0 Members and 1 Guest are viewing this topic.
(setq sel (nentsel "\n Select item to copy property from: "))(setq sel2 (entsel "\n Select item to copy property to: "))(setq data (entget (car sel))); not sure linetype number anymore, so we shall assume 8(setq lt (cdr (assoc 8 data)))(if (setq pos (vl-string-position lt "|")) (setq lt (substr lt pos)))(setq data (entget (car sel2)))(entmod (subst (cons 8 lt) (assoc 8 data) data)); maybe an update is needed(entupd (cdr (assoc -1 data)))
.. very interesting solution ronjonp, thank you, but unfortunately not completedfunction change only colour of line acoording to colour of nested item, but linetype, layer name and other properties not changed yet"For example to change linetype and color of selected line same to line from xref.."
Try this :Code - Auto/Visual Lisp: [Select](defun c:a () (setq es (entsel "\n Select Object inside Block : ")) (setq s (car es)) (setq po (cadr es)) (setq en (entget s)) (setq typ (strcase (cdr (assoc 0 en)) t)) (cond ((= typ "insert") (command "ncopy" po "" "none" '(0 0 0) "none" '(0 0 0)) (setq s1 (entlast)) (defun *error* (msg) (entdel s1) (princ)) ;;(command "matchprop" (nentselp po)) (command "matchprop" s1) (while (> (getvar 'cmdactive) 0) (command "box" pause pause)) (entdel s) ) ) (princ))
Quote from: ahsattarian on July 26, 2022, 11:05:03 AMTry this :Code - Auto/Visual Lisp: [Select](defun c:a () (setq es (entsel "\n Select Object inside Block : ")) (setq s (car es)) (setq po (cadr es)) (setq en (entget s)) (setq typ (strcase (cdr (assoc 0 en)) t)) (cond ((= typ "insert") (command "ncopy" po "" "none" '(0 0 0) "none" '(0 0 0)) (setq s1 (entlast)) (defun *error* (msg) (entdel s1) (princ)) ;;(command "matchprop" (nentselp po)) (command "matchprop" s1) (while (> (getvar 'cmdactive) 0) (command "box" pause pause)) (entdel s) ) ) (princ))That will not select an item within a block you have to use NENTSEL.I've mentioned this to you multiple times, you should localize your variables ... especially the *error* function...Code - Auto/Visual Lisp: [Select](defun c:a (/ *error* en es po s s1 typ)
Also Localizing is not so necessary. It causes no problem.
Also Localizing is not so necessary. It causes no problem.Regards, Amir