AutoLISP: Spline Split

I don’t know how useful this routine is – but it is still pretty cool.

Someone requested it for a landscaping project and Lee-Mac came to the rescue.

What it does – Lets you draw a spline that intersects itself and then after placing the spline, offset the spline on both sides and trim out the intersections and erase the middle (original spline).

Here’s how:

  • SPLIT <enter> to start
  • Draw spline that intersects itself
  • Specify the offset distance

;LEE-MAC

(defun c:Split ( / d e ) (vl-load-com)

(setq e (entlast))

(command "_.spline")

(while (= 1 (boole 1 1 (getvar 'CMDACTIVE))) (command pause))

(if

(and

(not (equal e (setq e (entlast))))

(setq d (getdist "\nSpecify Offset: "))

)

(progn

(setq e (vlax-ename->vla-object e))

(vlax-invoke e 'offset d)

(vlax-invoke e 'offset (- d))

(vla-delete e)

)

)

(princ)

)
Advertisements

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Modifying, TIPS. Bookmark the permalink.

2 Responses to AutoLISP: Spline Split

  1. Julio says:

    Amazing, great routine, but I make a modificacion in the line _.spline, and modified it to _.pline and then we can make a polyline and when intersect with itself we can have the same result but with straight lines.
    Of course all this could not be possible without the genious of Lee Mac

  2. AutoCAD Tips says:

    Great suggestion Julio.
    And Yes, Lee is awesome!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s