Snap Vertex *line to nearest Block Base Point

Snap Vertex *line to nearest Block Base Point

jtm2020hyo
Collaborator Collaborator
3,024 Views
11 Replies
Message 1 of 12

Snap Vertex *line to nearest Block Base Point

jtm2020hyo
Collaborator
Collaborator

I need to move selected block to the nearest vertex of POLYLINE, LINE, ARC, LWPOLYLINE, SPLINE, ELLIPSE.

 

someone have a lisp for this?

 

 

0 Likes
Accepted solutions (1)
3,025 Views
11 Replies
Replies (11)
Message 2 of 12

jtm2020hyo
Collaborator
Collaborator

I need to snap a vertex of POLYLINE, LINE, ARC, LWPOLYLINE, SPLINE, ELLIPSE to one nearest block base point 

dynamic block, or regular block.

 

 

0 Likes
Message 3 of 12

Kent1Cooper
Consultant
Consultant

@jtm2020hyo wrote:

.... to move selected block to the nearest vertex of POLYLINE, LINE, ARC, LWPOLYLINE, SPLINE, ELLIPSE. ....


 

I don't have such a thing, but if one was to try to develop one, questions arise....  Polylines are clear enough about vertices, but for other things, what constitutes a "vertex"?  For a Line, would the midpoint count, or only the endpoints?  For an Arc, the center, and/or the midpoint, or only the ends?  A Spline, the Control points or the Fit points?  An Ellipse, the center, or only the quadrant points?  Should CIRCLE be added to the list?  Etc., etc.

 

A sample drawing or image specifying exactly what you would want to Move to, for the widest possible assortment of conditions, would be helpful.

Kent Cooper, AIA
Message 4 of 12

Kent1Cooper
Consultant
Consultant

@jtm2020hyo wrote:

.... to snap a vertex of POLYLINE, LINE, ARC, LWPOLYLINE, SPLINE, ELLIPSE to one nearest block base point  dynamic block, or regular block.


 

Does INSert Object-Snap not do what you need?  Explain the anticipated process in more detail.

 

[Also, this seems a very different request -- does it deserve a separate Topic?]

Kent Cooper, AIA
Message 5 of 12

Moshe-A
Mentor
Mentor

@jtm2020hyo  hi,

 

you can easily achieve  this on your own by modify the block and add Alignment parameter (make it dynamic)

 

moshe

 

Message 6 of 12

jtm2020hyo
Collaborator
Collaborator

i need to do something like this:

 

image.png

I need to active lisp
first, select selected blocks and later the *line (or vice-versa)

then lisp should move just the vertex of the nearest block
just one vertex per each block

 

 

 

 

 

0 Likes
Message 7 of 12

jtm2020hyo
Collaborator
Collaborator

I need to move each vertex, but not blocks.

 

0 Likes
Message 8 of 12

jtm2020hyo
Collaborator
Collaborator

I just move the vertex to the blocks

0 Likes
Message 9 of 12

eoconnor95662
Enthusiast
Enthusiast

@Kent1Cooper I have an idea for moving pline for all blocks. I am unfamiliar how to code stretching of the pickpoints of polyline. Take the insertion point of the blocks and change/round coordinates of polyline to nearest insertion point. Probably would want some constraints as well so they don't migrate to far away blocks.

 

@dlanorh You had helped me with modifying some code from Mel Franks to move block to nearest polyline, which could be a useful reference here. Seems like we just want the opposite result to happen.

 

 

My personal interest in this would be moving separate and/or multi-segment polylines to the insertion points of circle blocks, which I could then offset a distance from insertion point to snap it on tangent. If you could provide me a framework or full on attack plan 🙂 I could try making it as well.

 

Cheers,

Elliott

Message 10 of 12

dlanorh
Advisor
Advisor

 Instead of moving the pline vertices, i would be easier to modify the pline to pass through all the block insertion points. This would mitigate circumstances where there are more / less blocks than vertices.

I am not one of the robots you're looking for

Message 11 of 12

eoconnor95662
Enthusiast
Enthusiast

By adding a new Polyline Vertex at each insertion point? Not sure if I understand exactly what you mean.

Message 12 of 12

dlanorh
Advisor
Advisor
Accepted solution

Have a play with this. Draw a circle and copy it around. Load and run this lisp. It constructs a pline using the grread function. Pick a start point and ensure the line you construct passes through at least a part of each circle. When finished (right mouse click) it will make a polyline passing through the centre of each circle in the order you constructed the initial grread line. It does this by using the coords of the grread line and feeding them into a fence selection set. The circles are added in the order they were crossed. The selection set is the used to extract the coords of the centre of each circle and stored in a list. This list is then used to entmake a polyline. If a polyline already exist the coord list could also be fed into an existing polyline changing its vertices to conform to the new list. The existing polyline would retain all its other properties. Offset the line by the circle radius and you have a poly line that touches all the circles.

 

A simple filter change and it will work with blocks.

 

This removes the problems you have if the number of object is greater than or less than the number of pline vertices> The human eyes is far better at route planning than a computer algorithm.

 

I am not one of the robots you're looking for