
Discussion forum
![]() |
| ![]() |

Please abide by the rules of this forum.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
LISP define the position of a rectangle |
Post Reply ![]() |
Author | |
lumpy92 ![]() Newbie ![]() Joined: 02.Jun.2017 Location: Hungary Using: AutoCAD2013 Status: Offline Points: 8 |
![]() ![]() ![]() ![]() ![]() Posted: 29.Jun.2017 at 14:19 |
Hi all!
I try to write an autoLISP execution. I need to draw rectangles with it. After I define the first point, I send "d" ( My question is: is there any possible way, to do that WITHOUT the cursor? I want it to draw it into the right bottom position every time (and write it into my LISP code). Thank you for your suggestions!
![]() Edited by lumpy92 - 29.Jun.2017 at 15:07 |
|
![]() |
|
John Connor ![]() Senior Member ![]() Joined: 01.Feb.2011 Location: United States Using: AutoCAD 2018 Status: Offline Points: 6837 |
![]() ![]() ![]() ![]() ![]() |
Wouldn't that "D" be for "Dimensions? Why would you specify diameters if you are drawing rectangles? Makes no sense.
|
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>> |
|
![]() |
|
lumpy92 ![]() Newbie ![]() Joined: 02.Jun.2017 Location: Hungary Using: AutoCAD2013 Status: Offline Points: 8 |
![]() ![]() ![]() ![]() ![]() |
Sorry, my fault. It is stand for Dimensions.
|
|
![]() |
|
Kent Cooper ![]() Senior Member ![]() Joined: 12.Mar.2013 Location: United States Using: AutoCAD, Architectural Desktop Status: Offline Points: 414 |
![]() ![]() ![]() ![]() ![]() |
Simple example, lightly tested:
(defun C:TEST () (command "_.rectang" pause "_d" 15 10 (polar (getvar 'lastpoint) (* pi 1.75) 10))) The red part will feed in a point always in the right-bottom-ward direction. Adjust the blue parts to suit your needs, or use pauses for the first two, if you want to give it different sizes each time.
|
|
![]() |
|
lumpy92 ![]() Newbie ![]() Joined: 02.Jun.2017 Location: Hungary Using: AutoCAD2013 Status: Offline Points: 8 |
![]() ![]() ![]() ![]() ![]() |
Thank you very much, it is works
![]() |
|
![]() |
|
lumpy92 ![]() Newbie ![]() Joined: 02.Jun.2017 Location: Hungary Using: AutoCAD2013 Status: Offline Points: 8 |
![]() ![]() ![]() ![]() ![]() |
Could you explain me what is the difference between ._rectangle and _rectangle?
Why is the dot is necessary? Both of them works for me. Thanks!
|
|
![]() |
|
John Connor ![]() Senior Member ![]() Joined: 01.Feb.2011 Location: United States Using: AutoCAD 2018 Status: Offline Points: 6837 |
![]() ![]() ![]() ![]() ![]() |
Adding the "dot" before a command name ensures that the generic AutoCAD command will be used instead of one that might be substituted (or missing) by virtue of the command having been undefined.
|
|
"Humans have a strength that cannot be measured. This is John Connor. If you are reading this, you are the resistance."
<<AutoCAD 2015>> |
|
![]() |
|
Kent Cooper ![]() Senior Member ![]() Joined: 12.Mar.2013 Location: United States Using: AutoCAD, Architectural Desktop Status: Offline Points: 414 |
![]() ![]() ![]() ![]() ![]() |
Another way to do it, that uses the RECTANG command without the Dimensions option, but rather by calculating the opposite corner in the right-bottom-ward direction:
(defun C:RULS (/ UL xdim ydim); = Rectang from Upper Left by specifying Size (setq UL (getpoint "\nUpper Left corner: ") xdim (getdist "\nHorizontal size: ") ydim (getdist "\nVertical size: ") ) (command "_.rectang" UL (mapcar '+ UL (list xdim (- ydim)))) (princ) ) An advantage is that the prompts are clearer about what is being asked for. I can never remember which direction they mean for "length" and "width" in RECTANG's Dimension-option prompts, and I can easily get it wrong because I think of "width" as being horizontal, but they use "length" for the horizontal size and "width" for what I would prefer to call "height." Edited by Kent Cooper - 05.Jul.2017 at 18:52 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0,063 seconds.