这是一个例程,我去掉了不必要的命令,然后我试图编辑它,但我的编辑似乎没有工作*我不是最好的,哈哈*。此例程允许您打断所有与选定对象相交的对象,效果很好,但我希望它打断这些对象,但以我可以选择的距离均匀偏移打断,而不是仅在点处打断。我正在使用autocad architectural desktop 2006。如果您还有什么需要知道的,请告诉我,我们将不胜感激
- ;;;====[ BreakObjects.lsp ]====
- ;;; Author: Copyright© 2006,2007 Charles Alan Butler
- ;;; Contact ***Had to delete in order to get past spam blocker
- ;;; Version: 1.3 April 9,2007
- ;;; Globalization by XANADU - ***Had to delete in order to get past spam
- ;;; Purpose: Break All selected objects
- ;;; permitted objects are lines, lwplines, plines, splines,
- ;;; ellipse, circles & arcs
- ;;;
- ;;; Function c:BreakTouching - Break objects touching the single Break object
- ;;;
- ;;; Sub_Routines:
- ;;; break_with
- ;;; ssget->vla-list
- ;;; list->3pair
- ;;; onlockedlayer
- ;;; get_interpts Return a list of intersect points
- ;;; break_obj Break entity at break points in list
- ;;; Requirements: objects must have the same z-value
- ;;; Restrictions: Does not Break objects on locked layers
- ;;; Returns: none
- ;;;
- ;;; THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED ;
- ;;; WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR ;
- ;;; PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED. ;
- ;;;
- ;;; You are hereby granted permission to use, copy and modify this
- ;;; software without charge, provided you do so exclusively for
- ;;; your own use or for use by others in your organization in the
- ;;; performance of their normal duties, and provided further that
- ;;; the above copyright notice appears in all copies and both that
- ;;; copyright notice and the limited warranty and restricted rights
- ;;; notice below appear in all supporting documentation.
- ;;;
- ;;+++++++++++++++++++++++
- ;; M A I N S U B R O U T I N E
- ;;+++++++++++++++++++++++
-
- (defun break_with (ss2brk ss2brkwith self / cmd intpts lst masterlist ss ssobjs
- onlockedlayer ssget->vla-list list->3pair
- get_interpts break_obj
- )
- ;; ss2brk selection set to break
- ;; ss2brkwith selection set to use as break points
- ;; self when true will allow an object to break itself
- ;; note that plined will break at each vertex
- (vl-load-com)
-
-
- ;;++++++++++++++++++++
- ;; S U B F U N C T I O N S
- ;;++++++++++++++++++++
-
- (defun onlockedlayer (ename / entlst)
- (setq entlst (tblsearch "LAYER" (cdr (assoc 8 (entget ename)))))
- (= 4 (logand 4 (cdr (assoc 70 entlst))))
- )
-
- (defun ssget->vla-list (ss / i ename lst)
- (setq i -1)
- (while (setq ename (ssname ss (setq i (1+ i))))
- (setq lst (cons (vlax-ename->vla-object ename) lst))
- )
- lst
- )
-
- (defun list->3pair (old / new)
- (while (setq new (cons (list (car old) (cadr old) (caddr old)) new)
- old (cdddr old))
- )
- (reverse new)
- )
-
- ;;===============
- ;; return a list of intersect points
- ;;===============
- (defun get_interpts (obj1 obj2 / iplist)
- (if (not (vl-catch-all-error-p
- (setq iplist (vl-catch-all-apply
- 'vlax-safearray->list
- (list
- (vlax-variant-value
- (vla-intersectwith obj1 obj2 acextendnone)
- ))))))
- iplist
- )
- )
-
-
- ;;================
- ;; Break entity at break points in list
- ;;================
- (defun break_obj (ent brkptlst / brkobjlst en enttype maxparam closedobj
- minparam obj obj2break p1param p2 p2param
- )
-
- (setq obj2break ent
- brkobjlst (list ent)
- enttype (cdr (assoc 0 (entget ent)))
- )
-
- (foreach brkpt brkptlst
- ;; get last entity created via break in case multiple breaks
- (if brkobjlst
- (progn
- ;; if pt not on object x, switch objects
- (if (not (numberp (vl-catch-all-apply 'vlax-curve-getdistatpoint (list obj2break brkpt)))
- )
- (foreach obj brkobjlst ; find the one that pt is on
- (if (numberp (vl-catch-all-apply 'vlax-curve-getdistatpoint (list obj brkpt)))
- (setq obj2break obj) ; switch objects
- )
- )
- )
- )
- )
-
|