Hello again all,
So I've written two routines that when I run them seperatly I get the effect I want, but I want them to run one after the other. I just simply want to draw a pline and after I'm done drawing the pline I want it to automaticlly offset to the side I have picked. Here's what I have come up with so far and I can't figure out how to get the routines to run together. Please help.
(vl-load-com)
(defun c:ridge ()
(setq p1 (getpoint "\nSelect start of ridge: "))
(command "pline" p1)
); defun
(princ)
(vlr-command-reactor
nil '((:vlr-commandEnded . endCommand)))
(vlr-command-reactor
nil '((:vlr-commandCancelled . cancelCommand)))
(defun endCommand (calling-reactor endcommandInfo /
thecommandend)
(setq thecommandend (nth 0 endcommandInfo))
(if
(= thecommandend "PLINE")
(setq p2(getpoint "\nPick Which Side to Offset" ) )
)
(princ)
);defun
(defun cancelCommand (calling-reactor cancelcommandInfo /
thecommandcancel)
(setq thecommandcancel (nth 0 cancelcommandInfo))
(cond
((= thecommandcancel "PLINE") (prompt "\nRidge Aborted"))
(exit)
)
(princ)
);defun
(defun roffset()
(command "offset" "3'" p1 p2 "")
)
(princ)
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
First of all, LOOSE THOSE REACTORS. You do not need them.
Be familiar with LISP first before moving on to the VL* items.
For this type of program you do not need reactors.
One method:
(if (and
(setq p1 (getpoint "Specify first point: "))
(setq p2 (getpoint p1 "end point: "))
(setq p3 (getpoint p2 "Side of offset: ")) );and
(progn
[turn off osmode]
[draw the pline using p1 and p2]
[offset command using (ENTLAST) and p3]
[restore osmode]
);progn
(alert "Ridge aborted. ")
);if
;conceptual
Notice this program structure.
All user input is gathered (and tested) before the program executes.
This is key in successful program writing.
"Never underestimate the ingenuity of complete fools."
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Another method:
(defun c:test (/ las las1) (setq las (entlast)) (command "_.pline") (while (> (getvar 'cmdactive) 0) (command pause) ); end while (if (not (eq (setq las1 (entlast)) las)) (vl-cmdf "_.offset" "3" las1 pause "") ) (princ) )
HTH
Henrique