Author Topic: Setbacks Creator  (Read 27671 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
Setbacks Creator
« Reply #30 on: October 01, 2003, 03:03:50 PM »
It's okay 7, my main point was to help Rug understand that something has to be supplied otherwise you get a too few arguments callback. Even nil is supplying something. I didn't think calling it a global variable was a problem. I just took it for what it's worth and went with it.

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Setbacks Creator
« Reply #31 on: October 01, 2003, 03:41:55 PM »
I know. I just didnt want anyone confused by my mistake. lmao!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Setbacks Creator
« Reply #32 on: October 01, 2003, 03:51:46 PM »
Thank you guys....I seemed to get a lot more help over here compared to cadalog for some reason...any ways. Now on to the second part of the program that I was wanting to do, the flowlines. Any ideas on where I should start with this?
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

JohnK

  • Administrator
  • Seagull
  • Posts: 10604
Setbacks Creator
« Reply #33 on: October 01, 2003, 03:57:58 PM »
Do you understand the code thusfar?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

t-bear

  • Guest
Setbacks Creator
« Reply #34 on: October 01, 2003, 04:20:00 PM »
I seemed to get a lot more help over here compared to cadalog for some reason

The reason you get more help here is that this is Mark & Se7en's home-base.  Kinda gittin' to be Daron's too.....
At CADalog, there is a lot more "How do I draw a line" & "My toolbar is gone?!?" stuff.....here the main focus is code.
Notice that, so far, my job on the "general CAD" forum is purty easy.  Hope it gets REAL busy one of these days......and I'm sure it will.

daron

  • Guest
Setbacks Creator
« Reply #35 on: October 01, 2003, 04:22:39 PM »
Quote from: rugaroo
Any ideas on where I should start with this?

Code: [Select]
(defun questions2answers (answer2-7)
   (if (or (= answer2-7 "") (= answer2-7 "Yes"))
      (prompt "PseudoCode")
      (prompt "Let's make sure you fully understand")
   )
)

daron

  • Guest
Setbacks Creator
« Reply #36 on: October 01, 2003, 04:34:05 PM »
Quote from: t-bear
here the main focus is code.
Notice that, so far, my job on the "general CAD" forum is purty easy.  Hope it gets REAL busy one of these days......and I'm sure it will.


I hope it does, Bear. We need to promote the site, without getting in everybody's face.

The thing that I find most difficult on Cadalog is that your superiors seemed to think that if they added a product support forum ILO a programming forum, we'd be happy. It just creates a mess. That's why I asked to start the suggestion box and started making suggestions to Mark. Being busy will be good, but if we're not organized at the starting gate, I think we'd fall into the same un-manageable mess we're in over there.

It's been slow for me over there the last couple of days. I haven't seen many questions I could answer.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Setbacks Creator
« Reply #37 on: October 01, 2003, 06:41:49 PM »
Ok...I think I figured out the error nil...This clears all of the users variable, which is why we do not have the restore user variables....after staring at this, and removing all of the comments, that is the only thing that could make sense. And I can prove it by just using the layer creation as an example...when you create layers through the prompt, it sets your 'current' layer to the layer you create, unless you set your layer to another....so either i am way off or at least part way there...which is it?
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

daron

  • Guest
Setbacks Creator
« Reply #38 on: October 01, 2003, 06:57:20 PM »
I think you've got it! So, I answered your question above. If you understand functions with arguments, what prompt should you get and what should you do. Think in the order in which things should be done, programatically. BTW, Stig's also really good with math and most likely can help you get the radii you were asking about with that.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Setbacks Creator
« Reply #39 on: October 03, 2003, 02:40:49 PM »
Quote from: Daron

Code: [Select]
(defun questions2answers (answer2-7)
   (if (or (= answer2-7 "") (= answer2-7 "Yes"))
      (prompt "PseudoCode")
      (prompt "Let's make sure you fully understand")
   )
)


This is what got me thinking....Just take what is given, and you have your 'pseudocode', but when you take the time to spell everything out, you are making sure that you fully understand. Geesh....my brain hurts now lol. Here is what I am attempting to add in to create my swales/flowlines. I am going to make this its own independent function which will be called from the end of the setbacks creation process.  Here is a rough 'skectch' to start and then some questions.


    1. Get side and rear lotlines from sset and add them to a new selection set called ssetswale.
    2. Once each item is selected, offset those a fix distance away. 2' from sides and 10' from rears.
    3. After offsetting the corresponding lines, changing layer to swale (Actually an easy part there), and filleting each of the objects within our ssetswale with a hard coded radius of 5'.[/list:u]

    Now I know this is a really rough idea, but we all need to start somewhere right? I don't believe anyone really said as to why Stig was using command as compared to vl-cmdf. I am going to take a guess here, and say that he is trying to eliminate the combination of VisLISP with regular old LISP. If that is the reason, I can understand keeping it all in one
'format', but other than that I wouldn't truly know. Anyone have any ideas here?

Rug
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

daron

  • Guest
Setbacks Creator
« Reply #40 on: October 03, 2003, 03:00:08 PM »
Because Stig IS "The Lisper's Apple" and as such he's entitled to program any way he see's fit. If you need help understanding that, go to www.vbdesign.net/expresso and look for his signature, then think about it for a little bit.

As far as the pseudo code goes, take each idea and try to create a function for it. If it seems like it can be broken down into more modular functions, work on it. Post code as you go.

To understand selection sets, go to http://www.afralisp.com and do a search on selection sets. Really good tutorials.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
Setbacks Creator
« Reply #41 on: October 03, 2003, 03:38:14 PM »
Looked at the selection set tutorials, but they show nothing on how to add ceratin entities to two entirely different ssets at the same time. As far as the rest of my idea goes, the layer changing and and offseting will be no problem. Like for the rear lot lnes, I could follow what Stig was doing for the other offsets.

Code: [Select]
(defun offsetrear (offpt side ss / ent lastent)
  (if (not ssrear)
    (setq ssrear (ssadd))
  )
  (setvar "ERRNO" 0)
  (while
    (setq lastent (entlast))
    (command ".OFFSET" "10" ent offpt "")
    (cond
      ((not (eq lastent (entlast)))
(ssadd (entlast) ssrear)
      )
    )
  )
  (if (< 0 (sslength ssrear))
    ssrear
  )
)


But I am unsure of how to get the items that were selected for the isdes and rears to add them to two other ssets along with the original sset that Stig had created.


EDIT: Formatting
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

SMadsen

  • Guest
Setbacks Creator
« Reply #42 on: October 03, 2003, 05:32:44 PM »
Quote from: rugaroo
I am going to take a guess here, and say that he is trying to eliminate the combination of VisLISP with regular old LISP
Not quite. I don't like to mix Lisp and ActiveX if it can be avoided (too many hickups when doing that, at least before r2004) but VL-CMDF is not an ActiveX command. It's a COMMAND function with an improved error handling.
I guess it's due to pure laziness when trying to debug a function where a command goes wrong. When there's an error in a COMMAND, it bombs and continue the command in AutoCAD, whereas VL-CMDF bombs out (depending on the situation, though) and terminates the command in AutoCAD. By going back to AutoCAD and see where COMMAND left you it's rather easy to get a hint of what went wrong.

Try make a faulty COMMAND sequence and check it out. Here's one

Code: [Select]
(defun C:ARCIRC_C ()
  (command "ARC" (setq pt (getpoint "\nArc start point: ")))
  (command "CIRCLE" pt 2.0)
)


Command: arcirc_c
Arc start point:
2D point or option keyword required.  <-- invokes VLIDE here
Function cancelled; reset after error   <-- resetting in VLIDE
Specify second point of arc or [Center/End]: <-- back to AutoCAD

When it errors, at least it's obvious that it didn't finish the ARC command and something went wrong after specifying the first point.

With VL-CMDF it can be a little more difficult.

Code: [Select]
(defun C:ARCIRC_F ()
  (vl-cmdf "ARC" (setq pt (getpoint "\nArc start point: ")))
  (vl-cmdf "CIRCLE" pt 2.0)
)


Command: arcirc_f
Arc start point:
2D point or option keyword required.
Invalid 2D point.
nil
Specify end point of arc: *Invalid*
Command:

That an error occurred is obvious, but where? It doesn't even jump back into VLIDE but continues in AutoCAD with a fresh Command prompt. A backtrace tells you nothing.
Of course, the error can easily be found by stepping through the stuff, but as said, I'm too lazy and want an instant bug to crawl out.

When the code is bug free and ready, I don't really care which command is used. That said, there ARE good uses where you deliberately want to proceed with a routine even though an error occurred - which is why VL-CMDF was written in the first place, I guess.

daron

  • Guest
Setbacks Creator
« Reply #43 on: October 03, 2003, 06:01:11 PM »
Quote from: SMadsen
there ARE good uses where you deliberately want to proceed with a routine even though an error occurred


THAT^ is why I've never used vl-cmdf in any routine. I have never realized the need to continue a function if somewhere in the middle it crashed out. Must be my low level of coding knowledge.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Setbacks Creator
« Reply #44 on: October 03, 2003, 06:52:09 PM »
Well I think it all boils down to proper error trapping/checking. It's not a matter of which one to use, COMMAND or CMDF, it's the amount of error checking you have before/after the function. I use both functions for apps that I write for myself because I know what is going on in the program, I do not use them for customers. I tend to use functions like the one below to make sure I can control all user input. Maybe it's overkill, but it's what I like to use.

Code: [Select]

(defun MST-GetString (msg / s)
  (if
    (and
      (= (type msg) 'STR)
      (not
        (vl-catch-all-error-p
          (setq s (vl-catch-all-apply 'getstring (list T msg)))
          )
        ); not
      )
    (strcase s)
    ); if
  ); defun


Check out these two functions Daron.
Code: [Select]

(defun dr2 (/ p1 p2 switch kwd)
  (if
    (not
      (vl-cmdf "line"
               (setq p1 (getpoint "\nPoint 1: "))
               (setq p2 (getpoint "\nPoint 2: "))
               "")
      ); not
     (progn
       (setq switch 1)
       (alert "cndf failed")
       )
    (vl-cmdf "circle" p1 p2)
     )

  (if switch
    (progn
      (initget 1 "Yes No")
      (setq kwd (getkword "\nContinue with program ? (Y/N): "))
      (cond
        ((= kwd "Yes")
         (alert "you said yes")
         )
        ((= kwd "No") (exit))
        )

      )
    )
  )

Code: [Select]

(defun dr3 (/ p1 p2 switch kwd)

    (if
      (not
        (command "line"
                 (setq p1 (getpoint "\nPoint 1: "))
                 (setq p2 (getpoint "\nPoint 2: "))
                 ""
                 )
        )
       (progn
         (setq switch 1)
         (alert "cndf failed")
         )
       (command "circle" p1 p2)
       )
    (if switch
      (progn
        (initget 1 "Yes No")
        (setq kwd (getkword "\nContinue with program ? (Y/N): "))
        (cond
          ((= kwd "Yes")
           (alert "you said yes")
           )
          ((= kwd "No") (exit))
          )

        )
      )
    )


P.S. I hope I'm not interrupting your lessons Stig! If so just tell me to buzz off. :D
TheSwamp.org  (serving the CAD community since 2003)