AutoLISP: Break Line

If you’ve ever used the Express Tool BREAKLINE, you know how frustrating it is to get the darn thing to look correct. Here is a great lisp routine that makes the size of the break symbol proportional to the 2 points that you pick.

  • BRKL <enter> to start
  • pick 2 points for the overall length of the break line
  • (notice that I made multiple break lines at different sizes using this routine and each break line is proportional to the 2 points picked)






;;;===========================================

;;;      Single Line Break Symbol Creator

;;;===========================================

;;;

;|     Created by C. Alan Butler  2003

Yet another Break symbol creator

Uses PloyLine created on the current layer

Ortho Mode is up to you to pre set or not

Symbol is proportional to the length

and doesn't break anything

|;

;

(defun c:brkl (/ p1 p2 p3 p4 p5 p6 dist ang usercmd)

;

; error function & Routine Exit

(defun *error* (msg)

(if

(not

(member

msg

'("console break" "Function cancelled" "quit / exit abort" "")

)

)

(princ (strcat "\nError: " msg))

) ; if

(setvar "CMDECHO" usercmd)

(setvar "osmode" useros)

(princ)

) ;

;end error function

(setq oldcmd (getvar "CMDECHO"))

(setvar "CMDECHO" 0)

(setq useros (getvar "osmode"))

(setq usercmd (getvar "CMDECHO"))

(setvar "CMDECHO" 0)

(setvar "plinewid" 0)

(if (and (setq p1 (getpoint "Starting point of line : "))

(setq p6 (getpoint p1 "\nSelect second point: "))

)

(progn

(setq dist (distance p1 p6)

ang  (angle p1 p6)

p2   (polar p1 ang (* 0.4167 dist))

p5   (polar p1 ang (* 0.5833 dist))

p3   (polar p2 (+ 1.25664 ang) (* 0.1667 dist))

p4   (polar p5 (+ 4.39824 ang) (* 0.1667 dist))

) ;_ end of setq

(setvar "osmode" 0)

(command "pline" p1 p2 p3 p4 p5 p6 "") ; Draw the Z-Line

)

)

(*error* "")

(princ)

)

(prompt

"\nBreak Symbol Creator loaded.  Type BRKL to run it."

)

(princ)

About these ads

About AutoCAD Tips

As weird as it sounds, AutoCAD is a hobby for me. But I am fortunate enough to have a career doing my hobby. I work for a large engineering firm supporting CAD users in various disciplines. My dream job would be to work for a company like Autodesk or Disney's Imagineering where inspiring others and using innovative approaches and software are adding value to projects and bringing design in all areas up to a new level. This blog serves as a repository or knowledge base for myself 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 experience better.
This entry was posted in AutoLISP, TIPS. Bookmark the permalink.

5 Responses to AutoLISP: Break Line

  1. C. Alan Butler says:

    That’s an old one. My new one will allow you the scale the size after picking the two points. Also allows you to flip the shape. I have included 9 styles. Find it at http://www.theswamp.org

    • AutoCAD Tips says:

      Thank you Alan for this routine. I hope you don’t mind me posting it here. I try to give credit to whom ever created it. Though, some people don’t label their routines or say where they got them from.

  2. Kossiwa says:

    I’m in love with this one!!!!
    very useful!!!!
    Thanks Greg!

  3. rod says:

    hi, is this supported in autocad 2012? if so, how can i install it? thanks. newbie here…

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