CadFrank Posted August 14, 2014 Share Posted August 14, 2014 Now I have this code and It's not working. (defun _Modification (/ obj atts x lt Nombloc) (initget 1 "P T D V") (setq Mod (getkword "\n Quel élément voulez vous modifier? [Projet/Titre/Date/Verificateur] : ")) (if (= Mod "P") (progn (setq TProjet (strcase (getstring T "\n Quel est le nouveau nom du projet? "))) (setq TagPro "PROJET") (_getall->Layout (if (= Tag (vla-get-tagstring x)) (vla-put-textstring x Text) ) ) ) ) (defun _getall->Layout (Tag Text / adoc nombloc) (setq Nombloc '("LU CARTOUCHE" "Cartouche Aliance" "LC CARTOUCHE CHUM" "LC CARTOUCHE CHUM 2" "LC CARTOUCHE" "LU CARTOUCHE PANNEAU" "CARTOUCHE LU" "LC CARTOUCHE 2" ) ) (setq adoc (vla-get-activedocument (vlax-get-acad-object))) (vlax-for lt (vla-get-layouts adoc) (vlax-for obj (vla-get-block lt) (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (member (vla-get-effectivename obj) Nombloc) (= :vlax-true (vla-get-hasattributes obj)) ) (progn (setq atts (vlax-invoke obj 'getattributes)) (foreach x atts (if (= Tag (vla-get-tagstring x)) (vla-put-textstring x Text) ) ) ) ) ) ) ) it send's me the error ; error: bad argument type: VLA-OBJECT nil And i don't understand why.. since obj is the vla-object. Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted August 14, 2014 Share Posted August 14, 2014 (edited) VLA-OBJECT - layouts don't have VLA-OBJECT - block as subobject... Try to change last paragraph to this : (vlax-for obj (vla-get-blocks adoc) (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (member (vla-get-effectivename obj) Nombloc) (= :vlax-true (vla-get-hasattributes obj)) ) (progn (setq atts (vlax-invoke obj 'getattributes)) (foreach x atts (if (= Tag (vla-get-tagstring x)) (vla-put-textstring x Text) ) ) ) ) ) HTH [EDIT] : Just checked - you probably thought on VLA-OBJECT - ActiveLayout, so... : (vlax-for lt (vla-get-[color=red]activelayout[/color] adoc) (vlax-for obj (vla-get-block lt) (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (member (vla-get-effectivename obj) Nombloc) (= :vlax-true (vla-get-hasattributes obj)) ) (progn (setq atts (vlax-invoke obj 'getattributes)) (foreach x atts (if (= Tag (vla-get-tagstring x)) (vla-put-textstring x Text) ) ) ) ) ) ) Edited August 14, 2014 by marko_ribar 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.