Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 21 of 26 (163 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-15-2013 10:08 AM in reply to: alanjt_

Thanks, Alanjt_! You guys are awesome! I tested an earlier version and it didn't work. But the one on the link worked like a charm!  Thanks again, everyone!! LOL

Valued Mentor
alanjt_
Posts: 469
Registered: ‎08-25-2008
Message 22 of 26 (158 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-15-2013 10:22 AM in reply to: kameron1967

Glad you got what you needed. 

Happy CADing.

*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 23 of 26 (143 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-16-2013 05:23 AM in reply to: kameron1967

A mediocre code:

 

(defun c:bmcut (/ _pts d cutter e pts pts2 p1 p2)
  (defun _pts (ent)
    (mapcar 'cdr (vl-remove-if-not '(lambda (x)
		(member (car x) '(10 11))) ent)))                       
  (setq d (getdist "\nEnter Gap distance: "))
  (princ "\nSelect Cutter lines:")
  (setq cutter (ssget (setq fl '((-4 . "<OR")
                        (-4 . "<AND")
                        (0 . "LWPOLYLINE")
                        (90 . 2)
                        (-4 . "AND>")
                        (0 . "LINE")
                        (-4 . "OR>")
                       ))
               )
  )
  (repeat (setq i (sslength cutter))
    (setq e (ssname cutter (setq i (1- i))))
    (setq pts (_pts (entget e)))
    (if (and (setq cut-ee (ssget "_F" pts fl))
             (ssdel e cut-ee)
        )
      (repeat (setq n (sslength cut-ee))
        (Setq en (ssname cut-ee (setq n (1- n))))
        (setq pts2 (_pts (entget en)))
        (setq bpt (inters (Car pts) (cadr pts) (car pts2) (cadr pts2)))
        (setq p1 (polar bpt (angle (car pts2) (cadr pts2)) (* d 0.5)))
        (setq p2 (polar bpt (angle (cadr pts2) (car pts2)) (* d 0.5)))
        (command "_break" en "_non" p1 "_non" p2)
      )
    )
  )
)

 

 Only works for LINES and 1 segment polyline though.

 

Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 24 of 26 (132 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-16-2013 11:43 AM in reply to: pbejse

Pbejse - hi. Yes, this one trims horizontal lines around vertical ones. So it's got its usage for BREAKH command.

I then tried selecting only the horizontal lines and voila! - it now trims the vertical lines around the horizontal ones, thus meeting the BREAKV request.  Awesome.  Thank you very much, Pbejse! 

*Expert Elite*
pbejse
Posts: 2,406
Registered: ‎11-24-2009
Message 25 of 26 (114 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-16-2013 08:29 PM in reply to: kameron1967

kameron1967 wrote:

....Thank you very much, Pbejse! 


You are welcome. Glad you found a use for the code kameron1967.

 

Cheers

Distinguished Contributor
kameron1967
Posts: 156
Registered: ‎09-05-2008
Message 26 of 26 (104 Views)

Re: BREAK LINES HORIZONTALLY OR VERTICALLY

05-17-2013 08:00 AM in reply to: pbejse
There are 3 different solutions, each with its own merit. I chose yours because it did what I needed it to do. That, however, should not reflect badly on the other solutions because they too have their own function and will offer solution to the limitation that your routine has when dealing with other entities. So I'm greatful for all who stepped up on this. It's one big happy family! Cheers! :smileyhappy:

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community