63
6297
6283
后起之秀
使用道具 举报
218
699
483
顶梁支柱
(setq TEMPTARGETLAYERNAME "SG_TEMP")(setq TEMPTARGETLAYERCOLOR 5)(setq ISOLATED T)(setq ISOSET nil) ;_hold isolated layers data(setq ISOVIS 0) ;_set isolated to frozen or locked;;----------------=={ Isolate by type }==---------------------;;;; ;;;; Isolate all drawing's entityes by the choosen ;;;; target type. ;;;; ;;;;------------------------------------------------------------;;;; Author: Shay Gaghe, Copyright © 2014 ;;;;------------------------------------------------------------;;;;---Function Syntax : isotyp , unisotype(not active) ;;;;-- Current Version : 0.1 ;;;;-- Version History : 0.0 Date: 11.04.14 ;;;;------------------------------------------------------------;;;;----------------=={ SG:applyToSset }==----------------------;;;; ;;;; set all the givan selection set's members to a gien dxf ;;;; entry and value. ;;;;------------------------------------------------------------;;;; Author: Shay Gaghe, Copyright © 2014 ;;;;------------------------------------------------------------;;;; Arguments: ;;;; sset - a selection set ;;;; dxfe - dxf entry to substitue ;;;; dxfv - the new dxf value ;;;;------------------------------------------------------------;;(defun SG:applyToSset (sset dxfe dxfv / e i n) (setq i 0) (while (< i (sslength sset)) (setq e (entget (ssname sset i))) (setq n (entmod (subst (cons dxfe dxfv) (assoc dxfe e) e))) (setq i (1+ i)) ) T );;----------------=={ SG:createLayer }==----------------------;;;; ;;;; creates a new layer withe <name> name and <color> color. ;;;;------------------------------------------------------------;;;; Author: Shay Gaghe, Copyright © 2014 ;;;;------------------------------------------------------------;;;; Arguments: ;;;; name - a string representing the layer name ;;;; color - integer representing the layer color ;;;;------------------------------------------------------------;;;; Returned value: ;;;; entity name of the name created entity ;;;;------------------------------------------------------------;;(defun SG:createLayer (name color) (entmakex (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 62 color) ) ) );;----------------=={ SG:applyToAllLayers }==--------------------;;;; ;;;; apply a givan property and value to all drawing layers ;;;; expet the current current one. ;;;;------------------------------------------------------------;;;; Author: Shay Gaghe, Copyright © 2014 ;;;;------------------------------------------------------------;;;; Arguments: ;;;; dxfe - dxf entry to substitue ;;;; dxfv - the new dxf value to apply ;;;;------------------------------------------------------------;;(defun SG:applyToAllLayers (dxfe dxfv / la ob ladef) (setq ISOLATED T) (while (setq la (tblnext "LAYER" (null la))) ;_set all layers (except target) to froozen (if (not (equal (cdr (assoc 2 la)) (getvar "CLAYER") )) (progn(setq ob (tblobjname "LAYER" (cdr (assoc 2 la))))(setq ladef (entget ob))(setq ISOSET (cons ladef ISOSET))(if (assoc dxfe ladef) (entmod (subst (cons dxfe dxfv) (cons dxfe (cdr (assoc dxfe (setq ladef (entget ob))))) ladef ) ) (entmod (append la '((dxfe . dxfv)))) )) ) ) )(defun C:isotyp(/ ent sset i e cl f) (setvar "CMDECHO" 0) ;_turn off native command text (setvar "OSMODE" 0) ;_turn off osnap (command "undo" "m") ;_set undo mark (if (setq ent ;_ask user to select entity, if user miss it, program is terminated (car (entsel "\n Select the entity type you want to isolate \n")))