KataM Posted December 10, 2014 Posted December 10, 2014 (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 December 10, 2014 by KataM Quote
Tharwat Posted December 10, 2014 Posted December 10, 2014 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 "%%" Quote
KataM Posted December 10, 2014 Author Posted December 10, 2014 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\">%" ) Quote
Tharwat Posted December 10, 2014 Posted December 10, 2014 Thank you, that solved my problem. Excellent , you are welcome . Quote
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.