Jump to content

Xrecord doesn't create


MastroLube

Recommended Posts

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

 

3YVYA3F.png

 

Data should be consistent, right? Maybe entmake doesn't accept this type of sytax.. can someone give me an advice?

 

Thanks!

Dennis

Link to comment
Share on other sites

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 by MastroLube
Link to comment
Share on other sites

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

Link to comment
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
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...