Jump to content

Recommended Posts

Posted (edited)

Hello everybody and sorry for my bad english!

This is a lisp routine that i created to insert a block with attributes. The first attribute is the current filename, without the file extension. I need the value of this attribute to be a field, not a text string, but I don't know how to modify the "fext" variable to do this.

The block name is Identifiant, and the attribute tag is PAEPCODE.

 

(defun c:ai ()
(vl-load-com)
   (setvar "luprec" 2)
   (setvar "clayer" "510_textes légendes")
   (if (= (setq txtcam (car (entsel "\n Nr camera: "))) nil)
       (setq nrcam "")
       (progn
           (setq nrcam (cdr (assoc 1 (entget txtcam))))
           (prompt (strcat "\n" " " nrcam))
       )
   )
   (if (= (setq txttipcam (car (entsel "\n Tip camera: "))) nil)
       (setq tipcam "")
       (progn
           (setq tipcam (cdr (assoc 1 (entget txttipcam))))
           (prompt (strcat "\n" " " tipcam))
       )
   )
   (if (= (setq txth (car (entsel "\n Inaltime camera: "))) nil)
       (setq hcam "")
       (progn
           (setq enth (entget txth))
           (setq npr (cdr (assoc 1 enth)))
           (setq pcar (substr npr 1 4))
           (if (= pcar "HSFP")
               (setq hcam (substr npr 6))
               (if (= pcar "HSP ")
                   (setq hcam (substr npr 5))
                   (setq hcam npr)
               )
           )
           (prompt (strcat "\n" " " hcam))
       )
       ;(setq hcam (cdr (assoc 1 (entget txth))))
   )
   (setq nddw (getvar "dwgname"))
   (setq fext (substr nddw 1 (- (strlen nddw) 4)))
   (setq plli (CAR (ENTSEL "\nPick polyline: ")))
   (setq arrea (VLA-GET-AREA (VLAX-ENAME->VLA-OBJECT plli)))
   (command "insert" "Identifiant" pause "" "" "" fext nrcam tipcam arrea hcam "chauffé") 
   (princ)
)

Edited by KataM
Posted

Welcome to CADTutor .

 

Firstly modify your codes to include the tag codes READ THIS

 

Back to your question , just replace the variable ftext with this "%%"

Posted

Thank you, that solved my problem. I only modify tc3 an fn7 with tc1 and fn2, like this:

(setq fext "%<\\AcVar Filename \\f \"%tc1%fn2\">%" )

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