Community
Civil 3D Forum
Welcome to Autodesk’s Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select Dynamic Block across layouts and select the Layout where Dynamic Block is found

1 REPLY 1
Reply
Message 1 of 2
Anonymous
305 Views, 1 Reply

Select Dynamic Block across layouts and select the Layout where Dynamic Block is found

Hello guys,

I want to find a dynamic block by name in my DWG, across multi layouts (sometimes 15 layouts possible).

The goal is:

 1. find the DB

 2. goto the layout where the DB is found

 3. select the DB

 4. do the command UpdateField on the selection

 5. Done

Seems simpel to do, but It only works if:

- the DB is on the last layout

- or by manually setup when I select Layout20.

Thanks for your feedback.

 

 

(defun c:UpdateTB (/ laylist) 		
(vl-load-com)  
(setq laylist (layoutlist))
(foreach x laylist
(setvar "ctab" x)
(selblkbyname "Titleblock_template_v2_0")
;*** Update (command "updatefield") if DB found ***
);ForEach
;this part should be included somewhere above
(setvar "ctab" "Layout20")
(selblkbyname "Titleblock_template_v2_0")
(command "updatefield")
)

(defun selblkbyname (name / e n out ss x rjp-getblockname)
(vl-load-com)  
  (defun rjp-getblockname (obj)
    (if    (vlax-property-available-p obj 'effectivename)
      ;(progn ;True
	  (vla-get-effectivename obj) 
	  ;);progn
	  (vla-get-name obj) 
	);if
	);defun

  (if (setq ss     (ssget "_X" '((0 . "INSERT")))
            n     -1
            out     (ssadd))
    (while (setq e (ssname ss (setq n (1+ n))))
      (if (wcmatch (rjp-getblockname (vlax-ename->vla-object e)) name)
        (progn ;True
		(ssadd e out)
		(setq bn (rjp-getblockname (vlax-ename->vla-object e)))
		;(alert bn)
		);progn
		);if
	);while
	);if
    
  (sssetfirst nil out)
  (princ)
)

 

 

1 REPLY 1
Message 2 of 2
rl_jackson
in reply to: Anonymous

This sounds like something for the customization forum, but do you have fields to update automatically? I do that.


Rick Jackson
Survey CAD Technician VI

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report