- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to save variables of the “first corner point” and “other corner point” when a user picks first point, then types in the length and width (with dynamic input on) when using the “Rectangle” command?
Example:
Command: RECTANGLE
Specify first corner point or [Chamfer/Elevation/Fillet/Thickness/Width]:
Specify other corner point or [Area/Dimensions/Rotation]: @Anonymous',15'
I want to replace what I have below with the “Rectangle” command so user can type in the length and width they need. The user will want the length and width to be whole numbers (Ex: 13, 15, 20, 23...etc) which can be done if using the rectangle command. Right now they have to draw a rectangle they want in whole numbers first. Then use the routine and snap to the corners. Hoping to combine all in one routine.
What I have now:
(setq firstpick (getpoint "\nEnter first corner: "))
(setq secondpick (getcorner firstpick "\nEnter cross corner: "))
; Get all four corners of user drawn rectangle
(setq pt1 firstpick)
(setq pt3 secondpick)
(setq pt2 (list (car pt1) (cadr pt3)))
(setq pt4 (list (car pt3) (cadr pt1)))
; Get the Area drawn and save in variable “myrecarea”
(setq mylength (distance pt1 pt2)); length
(setq mywidth (distance pt1 pt4)); width
(setq myrecarea (* mylength mywidth)); Get area of rectangle (length x width)
...more code
I want to replace above with using the “Rectangle” command (if possible) so user can type in length and width. Not sure how to extract those points (firstpick, secondpick) and save as variables...
(setq firstpick (command "rectangle"))(?)
(setq secondpick (?)
; Get all four corners of user drawn rectangle
(setq pt1 firstpick)
(setq pt3 secondpick)
(setq pt2 (list (car pt1) (cadr pt3)))
(setq pt4 (list (car pt3) (cadr pt1)))
; Get the Area drawn and save in variable “myrecarea”
(setq mylength (distance pt1 pt2)); length
(setq mywidth (distance pt1 pt4)); width
(setq myrecarea (* mylength mywidth)); Get area of rectangle (length x width)
...more code
If I can keep the variables pt1, pt2, pt3, pt4 as the four corners of my rectangle, I think the rest of my routine should keep working since those variables are needed later on as locations for drawing lines.
*The Area size determines what is drawn later in the routine…
One last question,
Is it possible to save everything drawn in a routine in a block? Not sure how the block naming would work if routine run several times in a single drawing without overwriting the original block.
Solved! Go to Solution.