Hi everyone,
I am looking for a lisp that will change the colors, linetypes, etc of the original file to match the colors, linetypes, etc of the file that it is xref into.
Thank
|
Hi everyone,
I am looking for a lisp that will change the colors, linetypes, etc of the original file to match the colors, linetypes, etc of the file that it is xref into.
Thank
Try this. It matches color, linetype, lineweight and plottable status.
Code:(defun c:setxlayer ( / xlayer ; ename of layer to be evaluate xl ; xlayer dxf lis xname ; Xref layer name cname ; current dwg layer name matching xname clayer ; cname's ename cl ; current dwg layer's dxf list ) (while (setq xlayer (tblnext "layer" (not xlayer))) (if (= 16 (logand 16 (cdr (assoc 70 (setq xl (entget (tblobjname "layer" (cdr (assoc 2 xlayer))))))))) (progn (setq xname (cdr (assoc 2 xl)) cname (substr xname (+ 2 (vl-string-position 124 xname)))) (if (setq clayer (tblsearch "layer" cname)) (progn (setq cl (entget (tblobjname "layer" (cdr (assoc 2 clayer))))) (entmod (mapcar (function (lambda (a) (cond ((= (car a) 62) (cons 62 (if (minusp (cdr a)) (- (abs (cdr (assoc 62 cl)))) (abs (cdr (assoc 62 cl))) ) )) ((member (car a) '(6 290 370)) (assoc (car a) cl)) (T a) ) ) ) xl ) ) ) ) ) ) ) (princ) )
Last edited by BlackBox; 2014-10-29 at 09:11 PM.
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Layer transparency? I saw it coming... Hoped OP doesn't need it.
Code:(defun c:setxlayer ( / xlayer ; ename of layer to be evaluate xl ; xlayer dxf lis xname ; Xref layer name cname ; current dwg layer name matching xname clayer ; cname's ename cl ; current dwg layer's dxf list layer_transparency ) (while (setq xlayer (tblnext "layer" (not xlayer))) (if (= 16 (logand 16 (cdr (assoc 70 (setq xl (entget (tblobjname "layer" (cdr (assoc 2 xlayer))))))))) (progn (setq xname (cdr (assoc 2 xl)) cname (substr xname (+ 2 (vl-string-position 124 xname)))) (if (setq clayer (tblsearch "layer" cname)) (progn (setq cl (entget (tblobjname "layer" (cdr (assoc 2 clayer))) '("AcCmTransparency"))) (if (setq layer_transparency (assoc -3 cl)) (entmod (append xl (list layer_transparency))) ) (entmod (mapcar (function (lambda (a) (cond ((= (car a) 62) (cons 62 (if (minusp (cdr a)) (- (abs (cdr (assoc 62 cl)))) (abs (cdr (assoc 62 cl))) ) )) ((member (car a) '(6 290 370)) (assoc (car a) cl)) (T a) ) ) ) xl ) ) ) ) ) ) ) (princ) )
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
Incorrect; to clarify, see the bottom of this post.
You've done well so far, add only what you're willing to.
Cheers
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000