Easiest way to Extend/Join the Line Automatically

Easiest way to Extend/Join the Line Automatically

bogdan_marianJQ474
Participant Participant
1,490 Views
11 Replies
Message 1 of 12

Easiest way to Extend/Join the Line Automatically

bogdan_marianJQ474
Participant
Participant

Hello Forum!

 

I've been looking around and couldn't find a easy solution. If this one is a report, I'm terribly sorry.

 

I have a canvas with silhouettes, and some of them have notches (green polyline). I want to merge them together, so we don't have gaps between them.

 

Normally I would Extend easily, but it may happen to have multiple of them and I would be a tedious process. That's why I'm looking for a automatic process. 

Also I've tries PEDIT w/ Join & Fuzz but I was not able to join them correctly.

 

Silhouette.png

 

Any guidance from the ACAD gurus will be greately appreciated!

 

Note: We're rocking the ACAD LT 2024. Thank you!

0 Likes
1,491 Views
11 Replies
Replies (11)
Message 2 of 12

pendean
Community Legend
Community Legend

Are you asking for an automated EXTEND lisp that goes around your entire file?

Or just an instance like this that you manually select (or center on a display on screen)?

Or... ?

 
Message 3 of 12

bogdan_marianJQ474
Participant
Participant

Yup, any automated solution, not necesaarily via Extend.

 

But a way to connect & intersect both green lines to the white one on the entire file.

 

The canvas contains multiple example like this one, and going though each one indidvidually would take forever.

 

 

0 Likes
Message 4 of 12

devitg
Advisor
Advisor
@bogdan_marianJQ474
Please upload your sample dwg.
with a few canvas sample
0 Likes
Message 5 of 12

eusuntbogdyE7CEK
Explorer
Explorer

Of course! No idea why it wasn't uploaded in the first post.

 

A dwg as an example is added here. Thanks!

0 Likes
Message 6 of 12

Sea-Haven
Mentor
Mentor

Pretty sure this has been answered already, trying to find prior response.

 

1st step for me is that green lines are made as plines, then its pretty straight forward to extend to white pline using intersectwith to work out new end point. Yeah just found its all lines so need pline all objects 1st.

 

2nd method is offset white pline a small amount that your using as a test, can then use SSGET "F" to look for green lines and again intersectwith. I think that is what I did last time. Then lines or plines are ok. 

 

Use Pedit Multiple Join.

 

Will look for code or some one else will post prior solution based on a TRIM or EXTEND choice.

 

Intersect with pattern need 2nd and 4th points

SeaHaven_0-1710379644319.png

 

 

Message 7 of 12

devitg
Advisor
Advisor

@eusuntbogdyE7CEK please upload a TRUE and REAL Dwg, as I can see it is an array of the same figures all around.

 

For better LISp understanding , it will be better to set the 96 color pline at it's own layer , and white plines too .

 

Message 8 of 12

Kent1Cooper
Consultant
Consultant

Would the distance they need to extend always be within a similar small range?  It wouldn't be hard for a routine to find all the green Polylines, and search within a certain distance [3 drawing units should do it in your drawing] of each endpoint for a white Polyline, and if it finds one, Extend to it. [ That would also need to count on there being no white ones within that search distance from any green ends other than the ones you want Extended.]

 

[The same would work with just Lines.  It would be a memory saver if those Polylines were Lines instead, or if they were Joined together into collective Polylines, instead of being independent single-segment ones.]

Kent Cooper, AIA
0 Likes
Message 9 of 12

Sea-Haven
Mentor
Mentor

Try this, must pedit all objects do pedit M Join do twice, then make sure green plines are on another layer. The offset factor at moment is 0.4 may need a different value.

 

 

(defun c:PLEX ( / lay ss ss2 ent obj1 obj2 start end)
(setq lay (cdr (assoc 8 (entget (car (entsel "Pick pline to extend to for layer "))))))

(prompt "\nselect all plines ")
(setq ss (ssget (list (cons 0 "LWPOLYLINE")(cons 8 lay))))

(setq pt (getvar 'extmax))

(if (= ss nil)
  (alert "No plines selected ")
  (progn
  (repeat (setq x (sslength ss))
    (setq ent (ssname ss (setq x (1- x))))
    (setq obj1 (vlax-ename->vla-object ent))
    (command "offset" 0.4 ent pt "")
    (setq ent2 (entlast))
    (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) 
    (entget ent2))))
    (setq co-ord (cons (last co-ord) co-ord))
    (entdel ent2)

    (setq ss2 (ssget "F" co-ord))

    (setq obj2 (vlax-ename->vla-object (ssname ss2 0)))
    (setq start (vlax-curve-getstartPoint obj2))
    (setq end (vlax-curve-getEndPoint obj2))

    (command "extend" ent "" start end "")
  )
)
)
(princ)
)
(c:plex)

 

 

Message 10 of 12

bogdan_marianJQ474
Participant
Participant
Got it, will do. Thank you for the information!
0 Likes
Message 11 of 12

bogdan_marianJQ474
Participant
Participant
Hey Kent! Yes the distance will always have a small range. It will not be the same everytime.

I would agree with you that if the polylines were lines it would be a memory saver. In our use-case though, a application will export from svg to dxf and convert automatically the resulting lines as Polylines. That's why they are independent. To Join them toghether, I usuall make a PEDIT / M / Join.
0 Likes
Message 12 of 12

bogdan_marianJQ474
Participant
Participant
Hey Sea-Haven! This is a great idea!

I've tested the LIPS and it works in 70% of the time, even in the example DWG I've attached above.

Will try to tinker with the offset to see if it would make any difference.

Having this option, I'm thinking to implement a process that all notches are colored in a certain way. Given this, can we run this Lisp automatically on all the green (or any other color) items in the canvas?

Thank you for your patience and expertise. You guys rock!
0 Likes