CADkitt Posted October 8, 2010 Posted October 8, 2010 (edited) It all works fine if you do it by hand, but if I run it all at once in a script it just deletes all attributes The stranged part is it deletes the attribute in the mspace template, and I only copy and not modify the attributes in mspace. Edit: it looks like catt and patt are not working in script when activated by selection. Some one any idea why? I didn't made that lisp and I am not really familiar in visuallisp. Edit2: Stitching catt and patt together gived the same results. (defun c:test8(/ blks) (command "mspace") (sssetfirst nil (ssget "_x" '((0 . "INSERT")(2 . "Template")))) ;(c:catt) (cattt) (setq blks (ssget "_x" '((0 . "INSERT")(2 . "Template")))) (command "zoom" "o" blks "") ;(command "erase" blks "") (command "pspace") (sssetfirst nil (ssget "_x" '((0 . "INSERT")(2 . "Template")))) ;(c:patt) (pattt) (command "zoom" "all") ) ;I didn't make this part!!! (defun cattt(/ sSet) ;(changeTags) (vl-load-com) (princ "\n<<< Select block to copy attributes >>>") (if (setq sSet(ssget "_:S" '((0 . "INSERT")(66 . 1)))) (progn (setq cBl(vlax-ename->vla-object(ssname sSet 0))) (vl-bb-set 'atLst(cons (vla-get-Name cBl) (mapcar '(lambda(x) (vla-get-TextString x)) (vlax-safearray->list (vlax-variant-value (vla-GetAttributes cBl)))))) (princ "\n<<< Attribute value(s) were copied >>>") ); end progn (princ "\n>>> This isn't block with attribute(s)! <<< ") ); end if (princ) ); end of c:catt (defun c:catt () (cattt)) ;**** Paste attributes values to multiple blocks **** (defun pattt(/ sDat dLst fLst blSet) (vl-load-com) (if (setq sDat(vl-bb-ref 'atLst)) (progn (setq fLst(list '(0 . "INSERT")(cons 2(car sDat)) '(66 . 1)) dLst(cdr sDat) ); end setq (princ(strcat "\n<<< Current block to paste is '" (car sDat) "' >>> ")) (if (setq blSet(ssget fLst)) (foreach bl (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex blSet)))) (mapcar 'vla-put-TextString (vlax-safearray->list (vlax-variant-value (vla-GetAttributes bl)))dLst) ); end foreach (princ "\n>>> Nothing selected! <<< ") ); end if ); end progn (princ "\n >>> There isn't attributes datas to paste! <<< ") ); end if (princ) ); end of c:patt (defun c:patt () (pattt)) Edited October 8, 2010 by CADkitt Quote
BlackBox Posted October 8, 2010 Posted October 8, 2010 How are you '[running] it all at once in a script'... Do you mean with an .SCR file? Or do you simply mean that you tried running one command (i.e., c:TEST8 ), which does all steps at once? Quote
CADkitt Posted October 8, 2010 Author Posted October 8, 2010 I just want to run it all at once with a cmd but I need to check if it went good, so using scr wouldn't work. It's gonna be part of a bigger lisp file. Quote
BlackBox Posted October 8, 2010 Posted October 8, 2010 Thanks for clarifying... your original discription was a bit confusing (to me). Quote
CADkitt Posted October 8, 2010 Author Posted October 8, 2010 I already updated the grammar I think it is going wrong at the selection sets, maybe I should change them in catt an patt. 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.