Connect all the blocks without going over a polyline

Connect all the blocks without going over a polyline

jtm2020hyo
Collaborator Collaborator
3,991 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,992 Views
29 Replies
Replies (29)
Message 2 of 30

3wood
Advisor
Advisor

Something like this?

LINKPOINTS.

 

Message 3 of 30

jtm2020hyo
Collaborator
Collaborator

@3wood wrote:

Something like this?

LINKPOINTS.

 


yes. something like that (in images). I can not make work that file, that vlx file just shows me next window:

image.png

 

 

...but I need something like that vlx try do.

I attached a lisp routine that works 50% how I need it. 

Here is an example of how it works:

image.png

 

...as you can you see some polylines are going over other polylines. What I need is fix that.

0 Likes
Message 4 of 30

jtm2020hyo
Collaborator
Collaborator

I attached 3 lisp-routines that could be useful to make a base

0 Likes
Message 5 of 30

3wood
Advisor
Advisor

Something like this?

I guess  the only 2 rules are:

Link all blocks.

No cross over. 

Capture1.JPG

Message 6 of 30

ВeekeeCZ
Consultant
Consultant

No big ideas in here...

 

(defun c:BConnectNoX (/ ss pts)
  
  (if (and (setq ss (ssget '((0 . "INSERT,CIRCLE,POINT"))))
	   (setq pts (mapcar '(lambda (e)
				(cdr (assoc 10 (entget e))))
			     (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
	   (setq pts (vl-sort pts (function (lambda (e1 e2) (< (cadr e1) (cadr e2))))))
	   (setq pts (vl-sort pts (function (lambda (e1 e2) (< (car e1) (car e2))))))
	   )
    (entmake (append (list (cons 0 "LWPOLYLINE")
			   (cons 100 "AcDbEntity")
			   (cons 100 "AcDbPolyline")
			   (cons 90 (length pts))
			   (cons 70 0))
		     (mapcar (function (lambda (p) (cons 10 p))) pts))))
  (princ)
  )
Message 7 of 30

jtm2020hyo
Collaborator
Collaborator

Interesting proposal.

apparently, work like Tcount.lsp:
image.png

 

0 Likes
Message 8 of 30

jtm2020hyo
Collaborator
Collaborator

there are more rules that I need add:


+the first rule, the blocks should be linked to the next nearest block no matter rotation or angle.

+the second rule, the LISP routine should work with dynamic blocks and regular blocks. (for some reason 20% of lisp routines that user does not work with dynamic block)

here an example using attached lisp routine (Connect_Blocks-all-option-by-dbhunia.lsp). red-polylines are what I need to fix.

image.png

 

 file, where I tested it, is attached.

0 Likes
Message 9 of 30

dlanorh
Advisor
Advisor

If you omit blocks and just consider their insertion points as points, it is a join the dots problem. The problem is Rule 1. It won't allow a solution in most random situations, if it must connect to the next nearest point.


Look at this thread. https://www.theswamp.org/index.php?topic=30434.0

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

Message 10 of 30

jtm2020hyo
Collaborator
Collaborator

 

the problem is with the next marked blocks...

 

 

image.png

 

if possible connect that blocks to their nearest block to their intersections, like this:


image.png

 

 

 

...final result should be like this. (connecting all point without going over other)

 

image.png

 

 

... final lisp should work with dynamic blocks and regular blocks.

 

0 Likes
Message 11 of 30

Kent1Cooper
Consultant
Consultant

@jtm2020hyo wrote: 

...final result should be like this. (connecting all point without going over other)

 

….

 

That image now violates the request in Message 1 to "connect all selected blocks with a polyline."  You need to pin down more precisely what you really want to happen.

Kent Cooper, AIA
Message 12 of 30

jtm2020hyo
Collaborator
Collaborator

@dlanorh wrote:

If you omit blocks and just consider their insertion points as points, it is a join the dots problem. The problem is Rule 1. It won't allow a solution in most random situations, if it must connect to the next nearest point.


Look at this thread. https://www.theswamp.org/index.php?topic=30434.0


 

I was reading that post and I found that they are trying creating geometric figures. that should be a lot more hard to be created. I just need to connect all block or points (base point) without going over other polylines. 


0 Likes
Message 13 of 30

jtm2020hyo
Collaborator
Collaborator

yes, you are right. 

I just need to connect all points without going over other. no matter how or what to use.

0 Likes
Message 14 of 30

jtm2020hyo
Collaborator
Collaborator

Here I leave an attached lisp created by @dbhunia, might be useful.

this lisp connect selected block with their nearest blocks and have options for limit length. 

0 Likes
Message 15 of 30

Kent1Cooper
Consultant
Consultant

@jtm2020hyo wrote:

yes, you are right. 
I just need to connect all points without going over other. no matter how or what to use.


 

Have you seen >this topic< ?

Kent Cooper, AIA
Message 16 of 30

jtm2020hyo
Collaborator
Collaborator

@Kent1Cooper wrote:

@jtm2020hyo wrote:

yes, you are right. 
I just need to connect all points without going over other. no matter how or what to use.


 

Have you seen >this topic< ?


 

Yes. I already tried but I need to create a link between the nearest blocks.

I tried to use the solution marked in that post but is not what I need, that gives me this:

image.png

 

edit: attached file where I tested your code.

 

0 Likes
Message 17 of 30

dlanorh
Advisor
Advisor
Post your drawing in 2010 format

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

Message 18 of 30

jtm2020hyo
Collaborator
Collaborator

@dlanorh wrote:
Post your drawing in 2010 format

here is attached my test drawing in 2010 version

0 Likes
Message 19 of 30

jtm2020hyo
Collaborator
Collaborator

Your LinkPoints look interesting, Can you fix your code? or maybe I'm doing something bad? I'm pretty interesting in try to test your code.

0 Likes
Message 20 of 30

jtm2020hyo
Collaborator
Collaborator

I found a lisp-routine that might help to solve this issue. (first attached)

"slbl2" auto-select blocks that are touching selected polylines. simply that.

exactly what we need. now we need to someone to combine it with "Connect_Blocks-all-option-by-dbhunia" lisp-routine. (attached below)

0 Likes