|
|  |
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
|
|
|
Books by Ellen
|
| |
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.
|
|