Jump to content

Getting a list of existing Dictionaries (collection)


Recommended Posts

Hi there

 

Does anyone know how to get the Name of a existing Dictionary? and secondly, how to print the values stored in them?

 

(defun c:dicttest (/ dictionaries DictName dictList)
  
  (vl-load-com)

  (setq dictionaries (vla-get-Dictionaries (vla-get-activedocument (vlax-get-acad-object))))
  (setq dictList '())

  (vlax-map-collection
    dictionaries
    '(lambda (theDict)
       (setq DictName (vlax-get-property theDict 'Name))

          (setq dictList (cons DictName dictList))
       
     )
  )					;vlax-map-collection
(foreach itm dictList (princ itm))
(princ)  
)					;defun

 

Thanks for the comments.

Link to post
Share on other sites

Maybe:

(mapcar 'print (dictsearch (NAMEDOBJDICT) "ACAD_LAYOUT"))

And maybe this:

(foreach x (entget (namedobjdict))
  (if (= 3 (car x))
    (print (cdr x))
  )
)

And this:

(defun c:dicttest (/ l)
  (vl-load-com)
  (vlax-for d (vla-get-dictionaries (vla-get-activedocument (vlax-get-acad-object)))
    (if	(vlax-property-available-p d 'name)
      (setq l (cons (list (vla-get-name d) d) l))
    )
  )
  (mapcar 'print l)
)

 

Edited by ronjonp
Link to post
Share on other sites

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
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...