Jump to content
Luis Ternou

Create/ draw a rectangle from 4 lines with fixed length

Recommended Posts

Luis Ternou

Hello everyone!

 

Can someone write a lisp that asks me for the length of four lines and then creates/draws a closed rectangle from that input?

Other id

 

Thanks in advance! :)

 

Kind regards,

Luis

Share this post


Link to post
Share on other sites
rkmcswain

If it's a rectangle, then you only need the length of 2 of the sides, and this is already built into the RECTANGLE command.

 

Run the RECTANGLE command, pick a start point, then enter "D" for dimensions, then enter the width and height.

Share this post


Link to post
Share on other sites
Luis Ternou

Thanks for your reply!

I solved it myself with the use of contrains (Paramatric) + two lines wich stay parallel (see image). It was difficult for me to explain what I needed but this is sufficient!

Sorry for the inconvenience! :thumbsup:

 

Kind regards,

Luis

Share this post


Link to post
Share on other sites
Luis Ternou

...sorry but no image. It asks me to enter a url(?). :huh:

Share this post


Link to post
Share on other sites
steven-g
...sorry but no image. It asks me to enter a url(?). :huh:

 

I've never worked that one out myself ! I use attach file, (you first need to select "go advanced" and click on the paperclip icon which lets you pick a file from your computer and at the bottom of that dialogue is an option to "insert inline" which is how I always do it.

Image 2.jpg

Share this post


Link to post
Share on other sites
tmelancon

No response from the OP? I agree with rkmcswain. The REC command literally does exactly what he wants. Since a rectangle will always have 2 sides that are identical.

 

rec·tan·gle

ˈrekˌtaNGɡəl/

noun

noun: rectangle; plural noun: rectangles

 

  • a plane figure with four straight sides and four right angles, especially one with unequal adjacent sides, in contrast to a square.
     
     
     
     

 

 

 

Run the REC command select first point. Type "D" for dimensions (this is your first length, and your second length). Once you specify your lengths hit then move your cursor and click when you have desired rotation.

 

The only thing I can think of that OP would want is a LISP that runs the rec command normally but chooses the "dimension" option automatically and then clicks and sets the rectangle automatically then exits so user doesnt have to interact much with the keyboard during running. IDK just my 2 cents. We will never know unless they come back and clarify. Thanks

Share this post


Link to post
Share on other sites
tmelancon

Possibly something like this.

 

(defun C:rectester(/ START LENGTH1 LENGTH2)
(setq start (getpoint "\nSpecify starting point of rectangle..."))
(setq length1 (getreal "\nSpecify first length..."))
(setq length2 (getreal "\nSpecify second length..."))
(command "_.rectang" start "D" length1 length2 start)
(princ))

Share this post


Link to post
Share on other sites
RobDraw
No response from the OP?

 

Please see post #3. A rectangle that behaves like a rectangle, not a polygon.

Share this post


Link to post
Share on other sites
Luis Ternou

Sorry for my late response but many thanks so far! Here is the attachment.

Contrains.jpg

Share this post


Link to post
Share on other sites
Luis Ternou

...and thanks steven-g for the how-to!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×