## AutoLISP: Rectangle from the Midpoint of sides

Sidenote: there is a blog that has been stealing my content without any recognition of who actually made the content and then collecting \$ off its ads. Because of this, I am going to start adding watermarks in my pictures and a direct link into my posts so that if they want to modify my posts without permission, it will be very obvious that they are stealing from this blog. http://wp.me/p1aURt-jr

If you need create any type of lines (cable, wire, piping…) this may be a helpful routine. It simply lets you create a rectangle by picking to points that define the midpoints of the opposing sides and then define the length of those sides. the great thing is that it works at any angle. Here’s how:

• RECT3V <enter> to start
• Specify the midpoint of the 1st side
• Specify the midpoint of the 2nd side
• Specify the overall length of the side (which will apply to both sides) ```; David Bethel

; Creates a rectangle from the mid points of opposing sides and then specify the length of the sides

(defun c:rect3v (/ p1 p2 d1 c1 c2 c3 c4)

(initget 1)

(setq p1 (getpoint "\nCenter Of 1st Side: "))

(initget 1)

(setq p2 (getpoint p1 "\nCenter Of 2nd Side: "))

(grdraw p1 p2 2 1)

(initget 7)

(setq d1 (getdist "\nOpposing Width: "))

(setq c1 (polar p1 (+ (angle p1 p2) (* pi 0.5)) (* d1 0.5))

c2 (polar p1 (+ (angle p1 p2) (* pi -0.5)) (* d1 0.5))

c3 (polar p2 (+ (angle p2 p1) (* pi 0.5)) (* d1 0.5))

c4 (polar p2 (+ (angle p2 p1) (* pi -0.5)) (* d1 0.5)))

(entmake (list (cons 0 "POLYLINE")(cons 66 1)(cons 70 1)(list 10 0 0 0)))

(foreach v '(c1 c2 c3 c4)

(entmake (list (cons 0 "VERTEX")

(cons 10 (eval v)))))

(entmake (list (cons 0 "SEQEND")))

(prin1))``` 1. rafiq says:
2. sean says: