Jump to content

Lisp Help


bradb

Recommended Posts

I am not great with lisp I am still learning. But I have created some successful routines. This one works although I would like to add to it. It is a routine that draws 2 parallel lines at a given distance apart. What I would like and am having trouble with is.. I want it to remember the last distance I entered so when the command finishes and I hit enter to restart the command and my value is the same I don't have to retype I can just hit enter.(much like offset remembers the last distance) If any help with this would be appreciated>

 

Thanks in advance

 

fittest.lsp

Link to comment
Share on other sites

Something like:

 

(defun C:FIT1 (/ olddia sp ep ang uang dang lang rad p1 p2 p3 p4 osm lay)
(if(not fit1:dia)(setq fit1:dia 1.0))
(setq olddia fit1:dia
      fit1:dia (getdist(strcat "\nEnter DIA of FIT <" (rtos fit1:dia) ">: ")))
     (if(null fit1:dia)(setq fit1:dia olddia))
(setq sp (getpoint "\nEnter START of FIT: ")
     ep (getpoint sp "\nEnter END of FIT: ")
     ang (angle sp ep)
     uang (+ ang (/ pi 2))
     dang (+ ang (* pi 1.5))
     lang (+ ang pi)
     rad (/ fit1:dia 2)
     p1 (polar sp uang rad)
     p2 (polar ep uang rad)
     p3 (polar sp dang rad)
     p4 (polar ep dang rad)
)
   (setvar "cmdecho" 0)
   (setq osm (getvar "osmode")
         lay (getvar "clayer")
   )
    (setvar "osmode" 0)
    (command "line" p1 p2 "" "line" p3 p4 "")
    (setvar "osmode" osm)
    (setvar "cmdecho" 1)
(princ)
)

Link to comment
Share on other sites

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...