dober Posted June 26, 2017 Share Posted June 26, 2017 Please help I want to change my dynamic blocks on the layouts all the layouts at once. With a normal block, the Lisp goes well. I do not know how I have to adapt for Dynamic Bklöcke because with the synonymous with dynamic blocks works. Thank you (defun c:Test (/ taglist ss ent att tnme) (setq taglist '(("EBENE" . "TEST1") ("BAUTEIL" . "TEST2")) ; <--- List Tags and Values here. ) (if (setq ss (ssget "_X" '((0 . "INSERT") (2 . "Test-Block") (66 . 1) (410 . "~Model") ))) (foreach ent (mapcar 'cadr (ssnamex ss)) (setq att (entnext ent)) (while (not (eq "SEQEND" (cdadr (entget att)))) (setq tnme (cdr (assoc 2 (entget att)))) (if (assoc tnme taglist) (entmod (subst (cons 1 (cdr (assoc tnme taglist))) (assoc 1 (entget att)) (entget att)))) (setq att (entnext att)))) (command "_regenall")) (princ "\n<!> No Blocks Found <!>")) (princ)) Bitte um Hilfe Ich will meine Dynamischen Blöcke auf den Layouts ändern alle Layouts auf einmal. Mit einem normalen Block geht das Lisp gut. Leisder weiss ich nicht wie ich das für Dynamische Bklöcke anpassen muss da mit das auch mit Dynamischen Blöcken funktioniert. Danke Quote Link to comment Share on other sites More sharing options...
rlx Posted June 26, 2017 Share Posted June 26, 2017 Hi Dober, I think what you are looking for has to do with the effective name property. Plenty of stuf on this site. Havent had much time to test it or work any further on my block program and it might be a little over the top (so nothing new there ;-) but it also just might work for you : http://www.cadtutor.net/forum/showthread.php?100670-RlxBlk-Replace-Redefine-blocks-visibility-states-preview-and-link-attributes&highlight=rlxblk gr. Rlx Quote Link to comment Share on other sites More sharing options...
dober Posted June 26, 2017 Author Share Posted June 26, 2017 thanks for the link Unfortunately no that works with me not as I want. Thank you Quote Link to comment Share on other sites More sharing options...
rlx Posted June 26, 2017 Share Posted June 26, 2017 thanks for the linkUnfortunately no that works with me not as I want. Thank you pitty... Quote Link to comment Share on other sites More sharing options...
dober Posted June 26, 2017 Author Share Posted June 26, 2017 I have here the German version of Autocad about it is not with me I believe! It simply simply nothing at me kmmt also no error message. Thanks again. Quote Link to comment Share on other sites More sharing options...
rlx Posted June 26, 2017 Share Posted June 26, 2017 here's something on how to select dynamic block names https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/block-s-effective-name-conflicts-with-u/td-p/4941518 the important part is (cons 2 (strcat "`*U*," bname)) this will select all blocks with bname (your blockname) and also all blocks with name beginning with *u next you have to loop thru all of those blocks and get the effective name and if this name matches your own blockname you know you've got the right one. (progn (repeat (setq i (sslength ss)) (setq e (vlax-ename->vla-object (setq o (ssname ss (setq i (1- i)))))) (if (vlax-property-available-p e 'effectivename) (setq n (vla-get-effectivename e)) (setq n (vla-get-name e)) ) (if (wcmatch (strcase n) bnames) (ssadd o ss1) ) Gr. Rlx Quote Link to comment Share on other sites More sharing options...
dober Posted June 27, 2017 Author Share Posted June 27, 2017 Thanks for the tip, the unfortunately not so synonymous! Quote Link to comment Share on other sites More sharing options...
rlx Posted June 27, 2017 Share Posted June 27, 2017 Thanks for the tip, the unfortunately not so synonymous! Maybe a sample drawing would help? If I understand you code / language correctly , you want to update certain attributes for certain blocks? gr. Rlx Quote Link to comment Share on other sites More sharing options...
dober Posted June 27, 2017 Author Share Posted June 27, 2017 Can not upload the drawing the limit is 500 kb Quote Link to comment Share on other sites More sharing options...
dober Posted June 27, 2017 Author Share Posted June 27, 2017 Can not upload the drawing the limit is 500 kb So now it changes the text style. Testblock - Standard.zip Quote Link to comment Share on other sites More sharing options...
rlx Posted June 27, 2017 Share Posted June 27, 2017 unfortunately cannot open drawing here !#$%^& I was suppost to get a 'new' pc here at work but instead got secondhand and crippled pc so for now cannot go higher than acad 2012... Quote Link to comment Share on other sites More sharing options...
dober Posted June 27, 2017 Author Share Posted June 27, 2017 Hier die dwg auf 2010 Testblock - 2010.zip Quote Link to comment Share on other sites More sharing options...
rlx Posted June 27, 2017 Share Posted June 27, 2017 quickly written : ; Dober.lsp written for Dober on CadTutor - rlx 27-jun-2017 ; blockname = "Schriftkopf mit Rahmen" ; tag 1 = EBENE , tag 2 = BAUTEIL (defun C:Dober ( / bn att-list layout obj) (vl-load-com) (setq bn "Schriftkopf mit Rahmen" att-list '( ("EBENE" . "rlx1") ("BAUTEIL" . "rlx2"))) (vlax-for layout (vla-get-layouts (vla-get-ActiveDocument (vlax-get-acad-object))) (vlax-for obj (vla-get-block layout) (if (and (eq (vla-get-objectname obj) "AcDbBlockReference") (vlax-property-available-p obj 'effectivename) (eq (strcase (vla-Get-EffectiveName obj)) (strcase bn)) (eq (vla-get-hasattributes obj) :vlax-true)) (update_attributes obj) ) ) ) ) (defun update_attributes (%obj / ) (mapcar (function (lambda ( att / tag) (if (setq tag (assoc (vla-get-TagString att) att-list)) (vlax-put-property att 'TextString (cdr tag))))) (vlax-invoke %obj 'GetAttributes) ) ) gr. Rlx Quote Link to comment Share on other sites More sharing options...
dober Posted June 27, 2017 Author Share Posted June 27, 2017 Perfect 1000 times thank you :) Quote Link to comment Share on other sites More sharing options...
rlx Posted June 27, 2017 Share Posted June 27, 2017 Perfect 1000 times thank you:) Sie sind willkommen gr. Rlx Quote Link to comment Share on other sites More sharing options...
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.