ellen finkelstein logo

Ellen Finkelstein.com
AutoCAD PowerPoint About Links
       

Over 130 AutoCAD tips and tutorials!

AutoCAD Tips
AutoCAD Tips Blog

Get free tips!
Sign up for our monthly tips newsletter. Free, bonus e-booklet!


RSS: What is it? Why do I want it? How do I get it?

Add to My Yahoo!
Subscribe with Bloglines

Buy a Book

E-mail This Page 
to a Friend

Submit a tip! If you include your name and I post your tip, I'll give you credit.

AutoCAD Tips & Tutorials

Another Break Objects Quickly AutoLISP routine

In my earlier "Break objects quickly" tip, I have 4 routines that help you break objects more quickly than the standard AutoCAD command.

Febien Mosen sent me another routine, SCISSORS, that has 3 features:

  • You don't need to preselect the object; you just click the point where you want to break
  • Only if there are more than 1 object under the break point (that is, if you click on the intersection of objects), does the command as you to select which object you want to break

I tested it, and it worked fine for me.

You can download the AutoLISP file here.

Here's the code:

(defun C:SCISSORS( / pt1 bpt1 bpt2 ss1 dist1 ent1 centrecercle)
;;make it quiet
(setvar "cmdecho" 0)

;;first, get the breaking point
(setq pt1 (getpoint "Give me the break point... ")) ;;point where to break

;;now, check if there's more than one object under that point
(setq ss1 (selectfrompoint pt1))

;;if there's more than 1 object under point, ask to select, else use existing point
(if (> (sslength ss1) 1)
(progn ;;then
(princ "DISAMBIGUATION : pick the object to break...")
(setq ent1 (entsel))
(setq ent1n (car ent1)) ;; e-name of ent1
(setq bpt1 (cadr ent1)) ;; point on ent to break
)
(progn ;;else
(setq ent1n (ssname ss1 0));;store into an entity (can be useful further)
(setq bpt1 pt1) ;; point on ent to break
)
)

;;but if it's a circle (thus usually unbreakable)...
(if
(= (cdr (assoc 0 (entget ent1n))) "CIRCLE")
;;then replace the circle by 2 arcs joining at the break point
(progn
(princ "It's a circle !")
(setq centrecercle (cdr (assoc 10 (entget ent1n))))
(command "_arc" "_c" centrecercle pt1 "_a" "180")
(command "_arc" "_c" centrecercle pt1 "_a" "-180")
(entdel ent1n)
)
;;else perform a normal break
(progn
(command "_break" bpt1 "_f" pt1 pt1)
)
)

;;restore cmdecho
(setvar "cmdecho" 1)
;;end quietly
(princ)
)

;;--- this function makes a selection set of entities beneath a point
(defun selectfrompoint (bpt1 / dist1 ss1)
(setq dist1 (/ (getvar "viewsize") 200)) ;; set a distance equal to 1/200-th of view height
(setq ss1 ;;select by fence around point
(ssget "_F"
(list
(list (+ (car bpt1) dist1) (+ (cadr bpt1) dist1) 0)
(list (- (car bpt1) dist1) (- (cadr bpt1) dist1) 0)
)
)
);; setq ss1
ss1
)

 

 

 

 

 

Back to main tips menu for more tips

Page copy protected against web site content infringement by Copyscape


Books by Ellen

New!
AutoCAD 2009 and AutoCAD LT 2009 Bible

This is the 9th edition of this book! Completely updated to conform to the new interface and, of course, it covers all the new features, such as the ribbon, Quick View, ShowMotion, the View Cube, the SteeringWheel, and more.

AutoCAD 2008 and AutoCAD LT 2008 Bible
Learn the great new features with wide application to all disciplines. Get the most comprehensive book on AutoCAD! DVD contains a 30-day trial of AutoCAD and AutoCAD LT. Thorough exercises guide you through each feature.

AutoCAD 2007 and AutoCAD LT 2007 Bible 
Discover the 2007 features, especially the radically improved 3D tools. CD has AutoCAD 30-day trial, 3rd-party software, and drawings for exercises.

AutoCAD 2006 and AutoCAD LT 2006 Bible 
Understand and use the 2006 features, including dynamic blocks and the new method of customizing menus and toolbars. CD-ROM has AutoCAD trial, software, and drawings for all exercises.


AutoCAD 2005 and AutoCAD LT 2005 Bible
Fully explains latest 2005 features:  tables, fields, and sheet sets. For the first time, covers AutoCAD LT! CD-ROM comes with software and drawings for all exercises.


AutoCAD 2004 Bible

Covers all features in detail. Hands-on exercises. Over 1300 pages + CD-ROM with software and drawings for all exercises.

                                  Home  |  AutoCAD  |  PowerPoint  | E-StoreAbout  | Links | Contact | Site Map
Copyright Ellen Finkelstein, Inc.