@DGRL wrote:
I just want 1 answer
Where can i find that list or HOW CAN I KNOW WHAT to fill in
Is there only 1 dictionary ? i.e
(dictsearch xdict "ACAD_FIELD")
Because i do not believe that there is only 1 dict called ACAD_FIELD
There must be more
Please attentively read the topic about dictionaries I linked in a previous message.
By definition, a dictionary cannot contain duplicated entry names so there can be only one ACAD_FIELD dictionary per extension dictionary.
If your goal is to get all ACAD_FIELD dictionaries in a drawing, you have to iterate through all enetities wich can have one in their extension dictionary (ATTRIB, ATTDEF, MTEXT, TEXT).
I do not know how should I try to explain this in an other way, so I purpose you to make some test with the following routines and understand by yourself the "Dictionary stuff".
These routines use the gc:GetExtDict and gc:GetDictEntries functions from the gc-Dictionary.lsp library (available here).
;; gc:GetExtDict (gile)
;; Returns the extension dictionary of the object (or nil)
;;
;; Argument : obj (ENAME)
(defun gc:GetExtDict (obj)
(cdadr (member '(102 . "{ACAD_XDICTIONARY") (entget obj)))
)
;; gc:GetDictEntries
;; Return the list of all entries in the dictionary as dotted pairs (name . ENAME)
;;
;; Argument : dict the dictionary (ENAME or DXF list)
(defun gc:GetDictEntries (dict / result)
(and (= (type dict) 'ENAME) (setq dict (entget dict)))
(while
(setq dict (vl-member-if (function (lambda (x) (= (car x) 3))) (cdr dict)))
(setq result (cons (cons (cdar dict) (cdadr dict)) result))
)
(reverse result)
)
This one prints the name of all named dictionaries contained by the root dictionary (Named Object Dictionary)
;; List all dictionaries in the named object dictionary
(defun listNamedObjDict ()
(foreach entry (gc:GetDictEntries (namedobjdict))
(princ (strcat "\n" (car entry)))
)
(princ)
)
This one prints the name of all layouts in the drawing. This is the AutoCAD stores the Layout objects of a drawing.
You can try with other dictionaries repalcing "ACAD_LAYOUT" by some othe name returned by the previous function.
;; list all entries in the ACAD_LAYOUT dictionary
(defun listLayoutDict (/)
(setq dictionaries (gc:GetDictEntries (namedobjdict))
layoutDict (cdr (assoc "ACAD_LAYOUT" dicts))
)
(foreach entry (gc:GetDictEntries layoutDict)
(princ (strcat "\n" (car entry)))
)
(princ)
)
This one list the entries of the object extension dictionary (if any).
;; list all entries in the object extension dictionary
(defun listExtensionDict (obj)
(if (setq xdict (gc:GetExtDict obj))
(foreach entry (gc:GetDictEntries xdict)
(princ (strcat "\n" (car entry)))
)
(princ "\nThe object do not have an extension dictionary")
)
(princ)
)
You can try this last one with a selected drawing entity (try with a MTEXT with field and a MTEXT without field)
(listExtensionDict (car entsel)))
You can also try with non graphic objects as the layer "0"
(listExtensionDict (tblobjname "Layer" "0"))
or the Model space BLOCK_RECORD.
(listExtensionDict (cdr (assoc 330 (entget (tblobjname "block" "*Model_space")))))
Remember that not all objects have an extension dictionary.
The next step can be creation and adding dictionaries and xrecords to the root dictionary or to an extension dictionary (and create it if not already exists).
See the dictadd function in the AutoLISP Reference, it contains an example.