TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: iliekater on December 31, 2007, 05:24:27 PM
-
I have created a lisp command that at some point prompts the user to specify the lower left corner of an about to be drawn rectangular . The width and length of the rectangular will be set automatically (by lisp code) , yet the user has to specify , by the previous point , where it likes to be created . Well , the command works fine , but I can't get rid of the AutoCAD's prompts for the dimensions of the rectangular . Although I am setting these dimensions by code , those messages still show up in the command line .
I have tried to modify the CMDECHO and the NOMUTT system variables , but those messages are still there ! :realmad:
-
You could create the rectangle in code without the use of the RECTANG command....
-
Aaaahh , yeah . You are right . I quess I am much more stupid than I thought ! :lol: I will draw it with four points and the PLINE command !
-
You could take it a step further and not use the (command) function at all....
check out the (entmake) thread in Show Your Stuff. And there's always the ActiveX method "AddLightweightPolyline" as well.
Edit-For some reason I couldn't locate the thread I was thinking of. But a search here for entmake & polyline should give you what you need.
-
Here is a rectangle function:
http://www.theswamp.org/index.php?topic=2404.msg30723#msg30723
-
Here is one I just threw together.
(defun c:getrectangle (/ p1 p2)
(if (and
(setq p1 (getpoint "\nPick the rectangle corner."))
(setq p2 (getcorner p1 "\nPick the corner."))
)
(progn
(setq pt_lst (list p1 (list (car p1)(cadr p2)) p2 (list (car p2)(cadr p1))))
;; Make LWpline by Gile
(setq zdir (trans '(0 0 1) 1 0 t)
elv (caddr (trans (car pt_lst) 1 zdir))
)
(entmakex
(append
(list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 90 (length pt_lst))
'(70 . 1) ; 1 for closed 0 overwise
(cons 38 elv)
(cons 210 zdir)
)
(mapcar '(lambda (pt) (cons 10 (trans pt 1 zdir))) pt_lst)
)
)
)
)
)
-
Thanks guys . You are gold . :wink: