TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: iliekater on December 31, 2007, 05:24:27 PM

Title: Getting rid of the RECTANG command's messages
Post 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:
Title: Re: Getting rid of the RECTANG command's messages
Post by: Jeff_M on December 31, 2007, 05:36:59 PM
You could create the rectangle in code without the use of the RECTANG command....
Title: Re: Getting rid of the RECTANG command's messages
Post by: iliekater on December 31, 2007, 05:47:28 PM
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 !
Title: Re: Getting rid of the RECTANG command's messages
Post by: Jeff_M on December 31, 2007, 06:33:35 PM
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.
Title: Re: Getting rid of the RECTANG command's messages
Post by: CAB on December 31, 2007, 07:14:54 PM
Here is a rectangle function:
http://www.theswamp.org/index.php?topic=2404.msg30723#msg30723
Title: Re: Getting rid of the RECTANG command's messages
Post by: CAB on December 31, 2007, 07:24:22 PM
Here is one I just threw together.
Code: [Select]
(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)
        )
      )
    )
  )
)
Title: Re: Getting rid of the RECTANG command's messages
Post by: iliekater on January 01, 2008, 01:24:09 PM
Thanks guys . You are gold .  :wink: