Rectangle Extend

Rectangle Extend

Anonymous
Not applicable
7,262 Views
43 Replies
Message 1 of 44

Rectangle Extend

Anonymous
Not applicable

Is there anyone with a command that can make a rectangle extend to a polyline/line?

0 Likes
7,263 Views
43 Replies
Replies (43)
Message 41 of 44

john.uhden
Mentor
Mentor

@Kent1Cooper 

Your image shows a square.  Though it is a rectangle, there is no implication of which way it should be extended.  My first thought was to extend it in the direction of its longer sides, but of course a square has all sides equal.

And then, what if the "sides" intersect a polyline arced (bulged) segment?  Should the rectangle be morphed to adopt the same shape between its intersection points?  Or is it preferred that the rectangle remain a rectangle?

Anyway, I guess the first step is to determine if the rectangle is rectangular.  Or maybe the OP accepts the definition of a rectangle in a loose format, like a rectangularish trapezoid.

John F. Uhden

0 Likes
Message 42 of 44

john.uhden
Mentor
Mentor

@hak_vz 

I was expecting you to shine through with your expertise.

Only thing is your midpoint function looks a little beginnerish.
I think this is what I use, but I didn't copy it...

(defun midpoint (p1 p2)
  (mapcar '* '(0.5 0.5 0.5)(mapcar '+ p1 p2))
)

 

 

John F. Uhden

0 Likes
Message 43 of 44

Kent1Cooper
Consultant
Consultant

@john.uhden wrote:

...

(defun midpoint (p1 p2)
  (mapcar '* '(0.5 0.5 0.5)(mapcar '+ p1 p2))
)

Save yourself a few code characters:

  (mapcar '/ (mapcar '+ p1 p2) '(2 2 2))

As long as p1 & p2 are point coordinate lists, coming from entity data or (getpoint) or (polar) or the like, their coordinates will always be real numbers, so the divisor 2's can be integers.

Kent Cooper, AIA
0 Likes
Message 44 of 44

john.uhden
Mentor
Mentor

@Kent1Cooper 

Excellent point!

I usually favor multiplying because it's faster than dividing, but unless you've got 10,000 midpoints to find you probably wouldn't discern a difference.

John F. Uhden

0 Likes