Search the Community
Showing results for tags 'dictionary'.
-
Hello guys, I'm about to update my code in order to make it more efficient. A long time ago I wrote this function to save my custom values in an XRECORD inside a dictionary. Is it possible to have the number of parameters (300-301-302- and so on) depending on the length of the list? (DEFUN CP:salva_dati (name nomedizionario lst / dict_name anXrec) (SETQ dict_name (CP:get-or-create-Dict "C_plan")) ;(CDR (ASSOC -1 (DICTSEARCH (NAMEDOBJDICT) nomedizionario)))) (SETQ anXrec (ENTMAKEX (LIST '(0 . "XRECORD") '(100 . "AcDbXrecord") (CONS 300 (nth 0 lst)) ;percorso (CONS 301 (nth 1 lst)) ;unità (CONS 302 (nth 2 lst)) ;scala (CONS 303 (nth 3 lst)) ;scala colore (cons 304 (nth 4 lst)) ;moltiplicatore (cons 305 (nth 5 lst)) ;ang_rot ) ) ) (DICTADD dict_name name anXrec) ) (defun CP:get-or-create-Dict ( nome / adict) (if (not (setq adict (dictsearch (namedobjdict) nome))) (progn (setq adict (entmakex '((0 . "DICTIONARY")(100 . "AcDbDictionary")))) (if adict (setq adict (dictadd (namedobjdict) nome adict))) ) (setq adict (cdr (assoc -1 adict))) ) ) In this case, I can save 6 values. I want to use this function to save even only one value or 10 values without creating other dedicated functions. Is it possible? Any suggestion to accomplish that? Another question: to edit these xrecord I usually get values that don't modify and createa list of them plus values that I want to change. (setq lst (list (CP:leggi_dati "Costanti" "C_plan" 300) "M" "1" "1000" "0.01" (CP:leggi_dati "Costanti" "C_plan" 305) ) ) (dictremove (cdr (assoc -1 (dictsearch (namedobjdict) "C_plan"))) "Costanti") (CP:salva_dati "Costanti" "C_plan" lst) (DEFUN CP:leggi_dati (name nomedizionario valore / dict_name) (SETQ dict_name (CDR (ASSOC -1 (DICTSEARCH (NAMEDOBJDICT) nomedizionario)))) (CDR (ASSOC valore (DICTSEARCH dict_name name))) ) There is a better method? (modify only the element I want without collect the others) Thanks for your help! Dennis
- 12 replies
-
- xrecord
- dictionary
-
(and 1 more)
Tagged with:
-
Lisp Routine HELP! Can't append Xrecord dictionary to an Entity
akira2k1 posted a topic in AutoLISP, Visual LISP & DCL
Sorry I'm pretty new to Xdata, Xrecords & dictionaries and I got some code from "AfraLisp website and I'm trying to modify it to work for what i need. I'm going to store multiple "Part" dictionary information in Xrecords. Then I want to append these dictionaries to an entity (below only shows one dictionary, but in the future I will have "PartL1, PartL2, PartL3" that will all be applied to one entity). Then down the road I will make a lisp that will change the values for the "PartNum" "QTY" & "Spacing" for each. The problem is I can't get the Xrecord dictionary to append to the entity's dictionary. Everything works fine until I get to this line of code: (dictadd ent "PartL1" adict) I don't know if i have the formating correct or I'm referencing this incorrectly. Please help, i've done research and I can't get past this. (defun c:applyassem (/ vars varlist) ;;retrieve XRecord "PartL1" from dictionary "WSI_DICT" ;;which in turn calls both functions below (setq vars (get-or-make-Xrecord)) ;;get dictionary were "PartL1" is stored (setq adict (cdr (car (dictsearch (namedobjdict) "WSI_DICT")))) ;;get entity to app (setq ent (car (entsel))) (dictadd ent "PartL1" adict) (princ) ) (defun get-or-create-Dict (/ adict) ;;test if "WSI_DICT" is already present in the main dictionary (if (not (setq adict (dictsearch (namedobjdict) "WSI_DICT"))) ;;if not present then create a new one and set the main dictionary as owner (progn (setq adict (entmakex '((0 . "DICTIONARY")(100 . "AcDbDictionary")))) ;;if succesfully created, add it to the main dictionary (if adict (setq adict (dictadd (namedobjdict) "WSI_DICT" adict))) ) ;;if present then just return its entity name (setq adict (cdr (assoc -1 adict))) ) );defun (defun get-or-make-Xrecord(/ adict anXrec) (cond ;;first get our dictionary. make here in case it doesn't exit ((setq adict (get-or-create-Dict)) (cond ;;if "WSI_DICT" is now valid then look for "PartL1" Xrecord ((not (setq anXrec (dictsearch adict "PartL1"))) ;;if "PartL1" was not found then create it (setq anXrec (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (7 . "PART#") ;will be part number (90 . 1) ;will be default qty of part (91 . 16) ;will be spacing in inches ) );entmakex );setq anXrec ;;if creation succeeded then add it to our dictionary (if anXrec (setq anXrec (dictadd adict "PartL1" anXrec))) );not ;;if it's already present then just return its entity name (setq anXrec (cdr (assoc -1(dictsearch adict "PartL1"))) );setq anxrex );cond );setq adict );cond );defun- 1 reply
-
- xdata
- dictionary
-
(and 1 more)
Tagged with:
-
This is related to command LayerOrder or AecLayerOrder in AutoCAD Architecture 2015. This command lets user specify the order in which layers are displayed in the drawing. I'm trying to modify the order by program, but can't find where this list is stored. It has something to do with a dictionary AECDACH_VARS_UTIL within dictionary AEC_VARS, because when it's deleted, the layers go back to their original order. Any advice would be greatly appreciated.
-
- draw order
- dictionary
-
(and 3 more)
Tagged with:
-
Hi all, is it possible to: 1- Get properties of a table group (such as a layer, textstyle, dimstyle, ...) 2- Save the information inside drawing (via Dictadd, etc.) 3- Purge the processed table group. So it will be possible to restore the information when needed. If possible, any suggestion is greatly appreciated.
- 2 replies
-
- named object
- dictionary
-
(and 2 more)
Tagged with:
-
All, I am looking for a page that has an eplanation and example showing how to create different styles in dxf. Kind regards, Matthew Harrison
- 11 replies
-
- dxf
- dictsearch
-
(and 3 more)
Tagged with: