@3arizona wrote:
.... I've been using this to offset rectangles. I just noticed that if i draw a rectangle using corner to corner (no dimension) the lines offset inward (that's what i want). If i draw a rectangle using coordinates (Rectangle;pick point;@30,20) it offsets outwards. ….
I think that may vary depending on in what order you pick the corners -- lower-left to upper-right may give a different result than lower-right to upper-left. But if they're always rectangles, maybe the easiest way to guarantee Offsetting inward is with a regular Offset command, using the halfway point between opposite corners as the to-which-side input.
If 'pl' is the Polyline rectangle's entity name, you can do it in various ways, for instance:
(command "_.offset" YourDistance pl
(polar
(setq v0 (vlax-curve-getStartPoint pl))
(angle v0 (setq v2 (vlax-curve-getPointAtParam pl 2.0)))
(/ (distance v0 v2) 2)
)
""
)
And to guarantee Offsetting outward, calculate a point guaranteed to be outside:
(command "_.offset" YourDistance pl
(polar
(setq v0 (vlax-curve-getStartPoint pl))
(angle v0 (setq v2 (vlax-curve-getPointAtParam pl 2.0)))
(* (distance v0 v2) 1.1)
)
""
)
But that would need to be modified if other shapes might sometimes be involved. There are routines out there that will, for example, use (vla-offset) and then compare the length or area of the result to the original, and if its not the right relationship, delete that one and do the (vla-offset) again with the opposite sign on the distance.
Kent Cooper, AIA