i need lisp, trim all short line at intersection

i need lisp, trim all short line at intersection

haryandi55
Explorer Explorer
703 Views
7 Replies
Message 1 of 8

i need lisp, trim all short line at intersection

haryandi55
Explorer
Explorer

i need lisp, trim all short line at intersection

 

need lisp.jpg

 

0 Likes
704 Views
7 Replies
Replies (7)
Message 2 of 8

hak_vz
Advisor
Advisor

You can use either TRIM or EXTEND commands very efficiently for this task. Start desired command, let say TRIM,

Select all entities, to trim entity pick at side, to extend press <SHIFT>. And that's it.

There has been similar lisps before so search true the forum's history.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 3 of 8

Kent1Cooper
Consultant
Consultant

What the image shows is not just Trimming.  A routine that Trimmed off the shortest part of a Line that crosses another would take off one or another of the red-wrapped ends here:

Kent1Cooper_0-1693483826554.png

or maybe both?  And would do nothing with the vertical Lines at the ends.  You need a more nuanced description of what you really want to do.

Kent Cooper, AIA
0 Likes
Message 4 of 8

ВeekeeCZ
Consultant
Consultant

This could help. It's just what I have, no adjustments to your imgs - feel free to make those if necessary.

Message 5 of 8

Udo_Huebner
Mentor
Mentor

Perhaps you could use "MAPCLEAN" from AutoCAD MAP to solve this task very quickly and without additional Lisp programming.

https://help.autodesk.com/view/MAP/2024/ENU/?guid=GUID-BA31C81D-C08E-4D92-A52E-FABB74B8DDA0

 

Gruß Udo Hübner (CAD-Huebner)
0 Likes
Message 6 of 8

calderg1000
Mentor
Mentor

Regards @haryandi55 

Try this code, to trim the shortest length of crossing lines, by selecting the cutting edge.

;;;___
(defun c:trm (/ s sn sp ep ssint pnt)
  (princ "\nSelect cutting edge/Lwpolyline object...")
  (if (setq s (ssget "_+.:E:S" '((0 . "*line")))
      )
    (progn
      (setq
        sn    (ssname s 0)
        sp    (vlax-curve-getstartpoint sn)
        ep    (vlax-curve-getendpoint sn)
        ssint (ssget "_f" (list sp ep))
      )
      (repeat (setq i (1- (sslength ssint)))
        (setq snl  (ssname ssint (setq i (1- i)))
              snld (entget snl)
              spl  (vlax-curve-getstartpoint snl)
              epl  (vlax-curve-getendpoint snl)
              ipl  (vlax-invoke (vlax-ename->vla-object sn)
                                'IntersectWith
                                (vlax-ename->vla-object snl)
                                acExtendboth
                   )
        )
        (if (< (distance spl ipl)
               (distance ipl epl)
            )
          (entmod (subst (cons 10 ipl) (cons 10 spl) snld))
          (entmod (subst (cons 11 ipl) (cons 11 epl) snld))
        )
      )
    )
  )
  (princ "\nInvalid Object Selected; Select Line/Lwpolyline...")
  (princ)
)

 

 

 

 


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Message 7 of 8

Sea-Haven
Mentor
Mentor

Try breakall.lsp by CAB then you do a ssget of the same area again and look for lines below a certain length then erase, Just did that for another task and worked well.

 

 

0 Likes
Message 8 of 8

Kent1Cooper
Consultant
Consultant

@Sea-Haven wrote:

Try breakall.lsp by CAB ....


According to its description [I haven't loaded and tried it], that will have the same issue I described in Message 3.  It will not make the corners at left and right in the "after" part of the image in Message 1.  I still think we need a more detailed explanation from the OP.

Kent Cooper, AIA
0 Likes