Jump to content

Create 3 Center Curves for Polylines


Recommended Posts

Posted (edited)
13 hours ago, mhupp said:

Tho that is pretty cool way to set a bunch of variables with lambda

 

 

 

Just for fun, a slight different way to set variables, I like the dotted pair listing to tie in variable name and its short description.

 

Could be expanded as basic lists with the last item being the 'get' function (string, int, distance....) for different types using read and eval [ (list "ard" "Approach Radius" "getDist") ]

 

 

(defun c:setvariables ( / acount ard crd erd aof eof )
  (setq VariablesList (list
      (cons "ard" "Approach Radius")
      (cons "crd" "Center Radius")
      (cons "erd" "End Radius")
      (cons "aof" "Approach Offset")
      (cons "eof" "Tie In Offet")
  )) ; end list, end setq

  (foreach n VariablesList
    (setq MyX (getDist (strcat "\nSet " (cdr n) ": ")))
    (eval (read (strcat "(setq " (car n) " " (vl-princ-to-string MyX) ")" )))
  ) ; end foreach
)

 

 

(defun c:setvariables ( / acount ard crd erd aof eof )
  (setq VariablesList (list
      (list "ard" "Approach Radius" "getdist")
      (list "crd" "Center Radius" "getdist")
      (list "erd" "End Radius" "getdist")
      (list "aof" "Approach Offset" "getdist")
      (list "eof" "Tie In Offet" "getdist")
  )) ; end list, end setq

  (foreach n VariablesList
    (setq MyX ( (eval (read (last n))) (strcat "\nSet " (cadr n) ": ")))
    (eval (read (strcat "(setq " (car n) " " (vl-princ-to-string MyX) ")" )))
    (if (= (last n) "getstring") ; fix for strings
      (eval (read (strcat "(setq " (car n) " \"" (vl-princ-to-string MyX) "\")" )))
    )
  ) ; end foreach
)

 

 

Couple of edits for typos

Edited by Steven P
  • Like 1
Posted

Thank you for your help.

I managed to figure out where I was doing it wrong (I defined the values after the point where they were already used/called upon, didn't notice, so it was a simple matter or moving it higher, to the start of the code). 

The LISP does what I need it to do now, however I did encounter some issues with extreme cases, like a sharp angle (couple of degree) between the two lines/tangents - comment for future users :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...