MastroLube Posted August 13, 2015 Share Posted August 13, 2015 Hello guys, nice to see you again! I've a probleam creating this xrecord: (setq anXrec (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (300 . posizione) (301 . altezza) (302 . larghezza) (303 . colore_cordolo) (280 . n_superiore) (281 . phi_superiore) (282 . n_inferiore) (283 . phi_inferiore) (284 . phi_staffa) (285 . passo_staffa) (286 . n_legature) ) ) ) Data should be consistent, right? Maybe entmake doesn't accept this type of sytax.. can someone give me an advice? Thanks! Dennis Quote Link to comment Share on other sites More sharing options...
MastroLube Posted August 13, 2015 Author Share Posted August 13, 2015 (edited) i'm trying to use (cons .. ) to evalutate expression but i get an error bad argument: stringp nil This is the complete script: (defun c:cordoli/cordoli/aggiungi_cordolo#OnClicked (/) (dcl-ComboBox-AddString cordoli/cordoli/n_tipo_cordoli (dcl-Control-GetText cordoli/cordoli/nome)) (setq nome (dcl-Control-GetText cordoli/cordoli/nome) posizione (dcl-Control-GetText cordoli/cordoli/posizione) altezza (dcl-Control-GetText cordoli/cordoli/altezza) larghezza (dcl-Control-GetText cordoli/cordoli/larghezza) ;;COLORE colore_cordolo (dcl-Control-GetText cordoli/cordoli/colore_cordolo) estensione (dcl-Control-GetText cordoli/cordoli/estensione) n_superiore (atoi (dcl-Control-GetText cordoli/cordoli/n_superiore)) phi_superiore (atoi (dcl-Control-GetText cordoli/cordoli/phi_superiore)) n_inferiore (atoi (dcl-Control-GetText cordoli/cordoli/n_inferiore)) phi_inferiore (atoi (dcl-Control-GetText cordoli/cordoli/phi_inferiore)) phi_staffa (atoi (dcl-Control-GetText cordoli/cordoli/phi_staffa)) passo_staffa (atoi (dcl-Control-GetText cordoli/cordoli/passo_staffa)) n_legature (atoi (dcl-Control-GetText cordoli/cordoli/n_legature)) ) (get-or-make-Xrecord nome) );this sets the variables ;////////////////////////////// (defun get-or-create-Dict (/ adict) ;;test if "Cordoli" is already present in the main dictionary (if (not (setq adict (dictsearch (namedobjdict) "Cordoli"))) ;;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) "Cordoli" adict))) ) ;;if present then just return its entity name (setq adict (cdr (assoc -1 adict))) ) ) (defun get-or-make-Xrecord ( nome / adict anXrec nome) (cond ;;first get our dictionary. Notice that "Cordoli" will be ;;created here in case it doesn't exist ((setq adict (get-or-create-Dict)) (cond ;;if "Cordoli" is now valid then look for "Cordoli" Xrecord ((not (setq anXrec (dictsearch adict nome))) ;;if "Cordoli" was not found then create it (setq anXrec (entmakex '((0 . "XRECORD") (100 . "AcDbXrecord") (cons 300 posizione) (cons 301 altezza) (cons 302 larghezza) (cons 303 colore_cordolo) (cons 280 n_superiore) (cons 281 phi_superiore) (cons 282 n_inferiore) (cons 283 phi_inferiore) (cons 284 phi_staffa) (cons 285 passo_staffa) (cons 286 n_legature) ) ) ) ;;if creation succeeded then add it to our dictionary (if anXrec (setq anXrec (dictadd adict nome anXrec))) ) ;;if it's already present then just return its entity name (setq anXrec (cdr (assoc -1 (dictsearch adict nome))) ) ) ) ) ) Thanks Edited August 13, 2015 by MastroLube Quote Link to comment Share on other sites More sharing options...
ymg3 Posted August 13, 2015 Share Posted August 13, 2015 You need to cons the line containing a variable (setq anXrec (entmakex (list '(0 . "XRECORD") '(100 . "AcDbXrecord") (cons 300 posizione) (cons 301 altezza) (cons 302 larghezza) (cons 303 colore_cordolo) (cons 280 n_superiore) (cons 281 phi_superiore) (cons 282 n_inferiore) (cons 283 phi_inferiore) (cons 284 phi_staffa) (cons 285 passo_staffa) (cons 286 n_legature) ) ) ) Quote Link to comment Share on other sites More sharing options...
MastroLube Posted August 18, 2015 Author Share Posted August 18, 2015 Thank you very much! It works! How can I delete a xrecord? And to change values on it? Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.