I have a lisp routine that I would like to add to. Right now when running the macro the user is not prompted to "Pick Point On Line" in this example
(command "insert" blk "s" var1 pause pause))
I have added the line
(setq pt1 (entsel "Pick Point On Line "))
(command "insert" blk pt1 "s" var1 pause pause))
but the command doesn't seem to like my PT1 value
BLK and VAR1 are set in another lisp routine.
Solved! Go to Solution.
Solved by alanjt_. Go to Solution.
Command: asctest Pick Point On Line
X2D corner point, or option keyword.
error: Function cancelled
Still no luck
Tested and works (slight mod because I don't have your block or know the var1 variable.
(if (setq pt1 (getpoint "\nPick Point On Line ")) (command "_.-insert" "E-FLOW" "_non" pt1 "_S" 1. pause pause) )
Command: (if (setq pt1 (getpoint "\nPick Point On Line ")) (command "_.-insert" "h21" "_non" pt1 "_S" 1. pause pause) )
Pick Point On Line
X2D corner point, or option keyword.
error: Function cancelled
I changed your block to something I have in my drawings and the command still cancels out.
I'm concerned about your error message. What's "X2D corner point, or option keyword."
I'm not sure. That's what shows on the command line after I select my point on the line.
Ok, this works:
(setq pt1 (getpoint "\nPick Point On Line "))
(command "insert" blk "s" var1 "_non" pt1 pause)
But I would also like to add a prompt for "Direction or Rotation" of valve. Right now the prompt for "Pick point on Line" shows untill the command finishes.
(if (setq pt1 (getpoint "\nSpecify point on line: ")) (progn (princ "\nSpecify rotation: ") (command "_.insert" blk "_s" var1 "_non" pt1 pause) ) )
I have a new issue. All of my buttons are setup as individual custom commands so the buttons will repeat themselves with enter,right click,etc.
I use this to insert the block:
(defun c:ball_valve ()
(if (setq pt1 (getpoint "\nSpecify point on line: "))
(progn (princ "\nSpecify rotation: ")
(command "insert" blk "s" var1 "_non" pt1 pause)))
Then I have found this lisp routine to break the line the block is placed on.
(defun abbe ( / *error* enx sel )
(defun *error* ( msg )
(LM:endundo (LM:acdoc))
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(while
(progn
(setvar 'errno 0)
(initget "Rotation")
(princ (strcat "\nAutomatic Block Rotation: " (getenv "LMac\\ABBRotation")))
(setq sel (entsel "\nSelect Block to Trim [Rotation]: "))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, Try Again.")
)
( (= "Rotation" sel)
(initget "ON OFF")
(setenv "LMac\\ABBRotation"
(cond
( (getkword
(strcat "\nAutomatic Block Rotation [ON/OFF] <"
(getenv "LMac\\ABBRotation") ">: "
)
)
)
( (getenv "LMac\\ABBRotation") )
)
)
)
( (= 'ename (type (car sel)))
(cond
( (/= "INSERT" (cdr (assoc 0 (setq enx (entget (car sel))))))
(princ "\nObject must be a block.")
)
( (= 4 (logand 4 (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 enx)))))))
(princ "\nSelected block is on a locked layer.")
)
( t
(LM:startundo (LM:acdoc))
(LM:AutoBlockBreak (car sel) (= "ON" (getenv "LMac\\ABBRotation")))
(LM:endundo (LM:acdoc))
)
)
t
)
)
)
)
(princ)
)
The problem is on the button to run both commands I have:
ball_valve;\\abbe;last;;
This will work correctly but it will only repeat the "abbe" command and not insert the block again. Is there a way to combine these two lisp so I have both commands repeat?