Jump to content

Create/ draw a rectangle from 4 lines with fixed length


Luis Ternou

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

...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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...