LISP routine for a line

Anonymous

LISP routine for a line

Anonymous
Not applicable

Can somebody help me with the lisp routine where I could select multiple pairs of 2 points, but get lines shortened on both sides and then offseted by certain amount to the side I pick (like in the picture)? Thank you in advance.

0 Likes
Reply
Accepted solutions (1)
1,135 Views
5 Replies
Replies (5)

john.uhden
Mentor
Mentor

Sure.  Show us the lisp routine and if we understand it then maybe we can help you with it.

John F. Uhden

Kent1Cooper
Consultant
Consultant

Would it always be horizontal, and the offset always downward?  It would be pretty simple if that's the case, though certainly possible at any kind of angle.  But you would need some criterion for which way to offset it.

 

Never mind that -- "to the side I pick" is clear enough, and also [in the approach I imagine] makes it unimportant whether the direction of the Line is regular.  Do you have anything started already, as @john.uhden is apparently assuming?

Kent Cooper, AIA
0 Likes

Anonymous
Not applicable

Lines would be horizontal or vertical. For exampe: I would like to select points for all vertcal lines that need to be offseted to the right and click on the right to specify direction of the offset.

 

I don't have anything started, I don't know how to write it.

0 Likes

Kent1Cooper
Consultant
Consultant
Accepted solution

@Anonymous wrote:

Lines would be horizontal or vertical. For exampe: I would like to select points for all vertcal lines that need to be offseted to the right and click on the right to specify direction of the offset.....


For a single Line, this does it [and the angle doesn't matter at all], in simplest terms:

(defun C:I5O3 (/ p1 p2 lin); = Inset line ends 5 units, Offset 3 units
  (setq
    p1 (getpoint "\nFirst-end reference point: ")
    p2 (getpoint p1 "\nSecond-end reference point: ")
  ); setq
  (command "_.line"
    "_none" (polar p1 (angle p1 p2) 5)
    "_none" (polar p2 (angle p2 p1) 5)
    ""
  ); command
  (setq lin (entlast))
  (command "_.offset" 3 "@" pause "")
  (entdel lin)
  (princ)
); defun

[That's a capital letter I and a capital letter O in the command name, not numbers 1 or 0.]

 

If your wording means that you want to pick a bunch of points first, and then have the Lines drawn and the Offsetting done on all of them at once, that could also be done, but it would be more complicated.

Kent Cooper, AIA

Anonymous
Not applicable

Thank you very much, it works great!  Smiley Happy

0 Likes