loudy000 Posted August 24, 2020 Posted August 24, 2020 Hi All, I have existing layers that i need to rename based from current layer property (line weight and color) example the new name would be: 0.50-alu-profile any help would be much appreciated. Thanks. Quote
Jonathan Handojo Posted August 24, 2020 Posted August 24, 2020 I don't see where the color fits in... (defun c:test ( / dmz ly lynm obj wgt) (setq dmz (getvar 'dimzin)) (setvar 'dimzin 0) (while (setq ly (tblnext "layer" (null ly))) (setq ly (cdr (assoc 2 ly)) obj (tblobjname "layer" ly) wgt (cdr (assoc 370 (entget obj))) lynm (strcat (rtos (* wgt 0.01) 2 2) "-" ly) ) (entmod (subst (cons 2 lynm) (assoc 2 (entget obj)) (entget obj) ) ) ) (setvar 'dimzin dmz) ) The above should do it (I think... because I don't know how in my computer the line weight reads 50 instead of 0.50, so I just divide by 100) 1 Quote
loudy000 Posted August 24, 2020 Author Posted August 24, 2020 38 minutes ago, Jonathan Handojo said: I don't see where the color fits in... (defun c:test ( / dmz ly lynm obj wgt) (setq dmz (getvar 'dimzin)) (setvar 'dimzin 0) (while (setq ly (tblnext "layer" (null ly))) (setq ly (cdr (assoc 2 ly)) obj (tblobjname "layer" ly) wgt (cdr (assoc 370 (entget obj))) lynm (strcat (rtos (* wgt 0.01) 2 2) "-" ly) ) (entmod (subst (cons 2 lynm) (assoc 2 (entget obj)) (entget obj) ) ) ) (setvar 'dimzin dmz) ) The above should do it (I think... because I don't know how in my computer the line weight reads 50 instead of 0.50, so I just divide by 100) Thank you very much! Quote
loudy000 Posted August 24, 2020 Author Posted August 24, 2020 Hi @Jonathan Handojo Sorry how do i modify this to get also the line pattern/ line style? Thanks. Quote
Jonathan Handojo Posted August 24, 2020 Posted August 24, 2020 @loudy000 Like this? (defun c:test ( / dmz ly lynm obj pat wgt) (setq dmz (getvar 'dimzin)) (setvar 'dimzin 0) (while (setq ly (tblnext "layer" (null ly))) (setq ly (cdr (assoc 2 ly)) obj (tblobjname "layer" ly) wgt (cdr (assoc 370 (entget obj))) pat (cdr (assoc 6 (entget obj))) lynm (strcat (rtos (* wgt 0.01) 2 2) "-" pat "-" ly) ) (entmod (subst (cons 2 lynm) (assoc 2 (entget obj)) (entget obj) ) ) ) (setvar 'dimzin dmz) ) 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.