Jump to content

Program for listing dependances... of nested blocks, text styles,...


Recommended Posts

Posted

Hello

Does anyone know a program, that can make a "map" of block hierarchy. Example:

 

House

...Doors

...Windows

......curtains

......glass mark

Doors

Windows

...curtains

...glass mark

curtains

glass mark

 

So program lists all the blocks and their nested blocks. And nested blocks of nested blocks,...

Same I would need to list wich textstyles, layers, dimstyles,... are used where.

 

I need this to do a purge my enormously large drawings.

Posted

I wrote this a little while ago, maybe it will help?

 

(defun c:BlockHierarchy ( / _blockhierarchy blocks ) (vl-load-com)
 ;; © Lee Mac 2011

 (defun _blockhierarchy ( block indent )
   
   (princ "\n") (repeat indent (princ "    ")) (princ "|--> ")
   (princ (vla-get-name block))

   (vlax-for obj block
     (if (eq "AcDbBlockReference" (vla-get-ObjectName obj))
       (_blockhierarchy (vla-item blocks (vla-get-name obj)) (1+ indent))
     )
   )
 )

 (setq blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))

 (vlax-for block blocks
   (if
     (and
       (eq :vlax-false (vla-get-isXref block))
       (eq :vlax-false (vla-get-isLayout block))
     )
     (_blockhierarchy block 1)
   )
 )
 (princ)
)

Posted

Generally it works for blocks. Thanks.

Problem is that my command line only has about 1000 lines, so I can not see all dependances.

Posted
Generally it works for blocks. Thanks.

Problem is that my command line only has about 1000 lines, so I can not see all dependances.

 

1000 lines not enough... how big are your drawings! :shock:

 

Maybe write the data to a file:

 

(defun c:BlockHierarchy ( / _blockhierarchy blocks fn fo ) (vl-load-com)
 ;; © Lee Mac 2011

 (defun _blockhierarchy ( block indent )
   
   (princ "\n" fo) (repeat indent (princ "    " fo)) (princ "|--> " fo)
   (princ (vla-get-name block) fo)

   (vlax-for obj block
     (if (eq "AcDbBlockReference" (vla-get-ObjectName obj))
       (_blockhierarchy (vla-item blocks (vla-get-name obj)) (1+ indent))
     )
   )
 )

 (setq blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))

 (if
   (and
     (setq fn (vl-filename-mktemp "Block" (vl-filename-directory (getvar 'DWGPREFIX)) ".txt"))
     (setq fo (open fn "w"))
   )
   (progn
     (vlax-for block blocks
       (if
         (and
           (eq :vlax-false (vla-get-isXref block))
           (eq :vlax-false (vla-get-isLayout block))
         )
         (_blockhierarchy block 0)
       )
     )
     (setq fo (close fo)) (startapp "notepad" fn)
   )
 )
 (princ)
)

Posted

Sounds like someone needs to purge their drawing.

Posted
Sounds like someone needs to purge their drawing.

:oops: jep ;)

I hate autodesk for making it so complicate!!! They could let you purge every item and only warn you that it is used! Development of autocad is dead since R12 if you ask me...

 

Thanks Lee Mac. It works greate now... but I'll improve it some more. I'll post it then here.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...