Connect all the blocks without going over a polyline

Connect all the blocks without going over a polyline

jtm2020hyo
Collaborator Collaborator
3,986 Views
29 Replies
Message 1 of 30

Connect all the blocks without going over a polyline

jtm2020hyo
Collaborator
Collaborator

It's possible connect all selected blocks with a polyline but without going over a polyline.?

0 Likes
Accepted solutions (3)
3,987 Views
29 Replies
Replies (29)
Message 21 of 30

dlanorh
Advisor
Advisor
Accepted solution

Please see attached. I think this is what you are after. You need to select the start block, then all the blocks you want to connect.

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

Message 22 of 30

jtm2020hyo
Collaborator
Collaborator

@dlanorh wrote:

Please see attached. I think this is what you are after. You need to select the start block, then all the blocks you want to connect.


awesome. I did not think this might be solver with one polyline. I will test it in real-world problems. thanks for you help


image.png

0 Likes
Message 23 of 30

dlanorh
Advisor
Advisor
The returned polyline is normally closed bu I have included a start block selection where the polyline is broken to provide a start and end to the polyline. If you don't want this let me know.

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

Message 24 of 30

jtm2020hyo
Collaborator
Collaborator

@dlanorh wrote:
The returned polyline is normally closed bu I have included a start block selection where the polyline is broken to provide a start and end to the polyline. If you don't want this let me know.

can you give me that options in the same list-routine? 

I want to try to test it in my work.



0 Likes
Message 25 of 30

dlanorh
Advisor
Advisor
Should be relatively easy.

One think I forgot to mention. With large sets the routine is not infallible and may return a polyline with a single intersection. I am trying to rectify this, but the solution is a bit more problematic with large sets.

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

Message 26 of 30

dlanorh
Advisor
Advisor
Accepted solution

Attached is revised lisp to allow an open or closed polyline.

 

I have developed the lisp to include an local error routine. The routine also enables dynamic mode and the dynamic prompt. Choices will now be available at the cursor with selection by mouse enabled. These are all reset on exit.

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

Message 27 of 30

jtm2020hyo
Collaborator
Collaborator

thanks for your reply. this work for me.


...But I fix 2 errors. 


first, I tried to select one block (when lisp asks to select a point) and select the same block again (when lisp asks to selected blocks), then my AutoCAD crash or load something for ever.

second is the image here below. 

 

image.png


What I did was mark the block marked here below then select all block inside the circle.


I tried again but now work no errors. I don't know what happened but maybe help you in developing the code.

image.png

PD: attached file where i tested your last lisp version

0 Likes
Message 28 of 30

dlanorh
Advisor
Advisor

Sorry, I didn't check the Selection Set size. You must choose 2 different Blocks to connect otherwise it crashes because it cannot construct a zero length pline.

 

The minimum set size for the convex hull code from Lee Mac is 4 different Blocks, otherwise it just returns the input list .

 

I will insert additional checks and test tomorrow.

 

Still haven't got the intersection problem fixed, it is progressing, but work keeps getting in the way.

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

Message 29 of 30

dlanorh
Advisor
Advisor
Accepted solution

Attached is the updated Lisp, lightly tested.

 

This should now avoid endless loops, but I haven't got a fix for the intersection problem yet.

 

If you select the Open Polyline Option your will be asked to select a Start Block. This is the block from which the finished polyline will start. This block is automatically added to the selection set if it not selected as part of the other blocks selection set.

 

The main selection set prompt has now been changed and is related to the polyline option selected.

If "Open" it will read "Select Additional Blocks to Connect"

If "Closed" it will read "Select All Blocks to Connect".

 

For either option the selection set must contain a MINIMUM of two different blocks, this is calculated AFTER the start block is added (if the "Open" option is selected).

An alert box will popup informing you if there are insufficient blocks in the selection set. The selection set is then cleared and you will be asked to select again.

 

 

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

Message 30 of 30

jtm2020hyo
Collaborator
Collaborator

thanks for your updated version.

can be possible to connect block between nearest points?

0 Likes