Code Red > VB(A)
how to make my line command work as expected
(1/1)
danmc:
i am having troubles making this simple lisp routine work. here is the code:
--- Code: ---(defun C:TDo2 ()
(setvar "osmode" 512)
(command "line" (getpoint "\n Pick Insertion Point")
(setvar "osmode" 128)(princ)
(getpoint "\n Pick Perp point")
"")
)
--- End code ---
It creates the first line ok, but i want it to end there. i thought that the "" would terminate the line command. what am i doing wrong?
ronjonp:
Give this a try. Welcome the TheSwamp :) .
--- Code - Auto/Visual Lisp: ---(defun c:tdo2 (/ *error* os p1 p2) (defun *error* (msg) ;; Reset snap setting on error (and os (setvar 'osmode os)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\nError: " msg)) ) (princ) ) ;; Save current snap settings (setq os (getvar 'osmode)) (setvar 'osmode 512) ;; Check that both points are picked (if (and (setq p1 (getpoint "\nPick Insertion Point: ")) (setvar 'osmode 128) (setq p2 (getpoint p1 "\nPick Perp Point: ")) ) (entmakex (list '(0 . "Line") '(8 . "Line") (cons 10 (trans p1 1 0)) (cons 11 (trans p2 1 0)))) ) ;; Reset snap setting (setvar 'osmode os) (princ))
danmc:
Thanks for the welcome!
Good to be back in the saddle after 25 years away from Autocad.
There is a lot of code in your example so maybe i did a cut and paste wrong or something but I am getting an error: "; error: syntax error".
Can you look at your code (i did the cut and paste a second time, no luck) and see if there is a syntax error?
just as a note, what I am trying to accomplish (the long goal) is to cut a section of a wall and create a simple door to place in the cut wall. i made a program like this back in the day but no longer have access to that code. so to help me re-learn autolisp i thought that i would do this project.
thanks for all your help.
Navigation
[0] Message Index
Go to full version