Need Help creating LISP

Need Help creating LISP

rlong8U7K4
Explorer Explorer
312 Views
2 Replies
Message 1 of 3

Need Help creating LISP

rlong8U7K4
Explorer
Explorer

I have two different LISP routines I need help creating. First I would like to be able to create a 4" tall rectangle based off the point to point dimensions of another piece. So like a piece of back or side splash on a countertop. Second I would like to be able rotate a crooked object straight just by clicking the line I want to rotate it on.

0 Likes
313 Views
2 Replies
Replies (2)
Message 2 of 3

Sea-Haven
Mentor
Mentor

Good tasks to learn lisp.

 

1. Look into (setq pt1 (getpoint "\nPick 1st point ")) let you get pt2 

2 (setq ang (angle pt1 pt2))

3 use the polar function (setq pt4 (polar pt1 ....... your homework is look for missing bit and work out pt3, hint (+- (/ pi 2))

4 (command "line" pt1 pt2 pt3 pt4 "")

 

To rotate object/s you can use Align no need for code, when you have an existing object to ALIGN to. 

0 Likes
Message 3 of 3

Kent1Cooper
Consultant
Consultant

@Sea-Haven wrote:

....

4 (command "line" pt1 pt2 pt3 pt4 "")

.... 


@rlong8U7K4, I recommend this if you want to draw the complete rectangle, not just 3 sides:

(command "line" pt1 pt2 pt3 pt4 "_close")

and maybe for an end result you would prefer (command "_.pline" ....

But maybe you want only 3 sides, if the 4th is a countertop edge [and in some cases only 2 sides].

 

And if it's orthogonally oriented as seems likely in your description, of course you can use the RECTANG command, and don't need to compute quite as many points.

 

On the rotation, can you post an image or small sample drawing showing before and after?  In particular, it's not clear to me whether "the line I want to rotate it on" means a part of the object to be rotated [such as an edge of a rectangle] or a target object somehow.  And I assume "straight" means "orthogonal," but if so, there are multiple possible rotations for something that's not orthogonal.  Should it go to the closest orthogonal direction, or always horizontal, or ... ?

Kent Cooper, AIA
0 Likes