ttray33y Posted June 10, 2017 Posted June 10, 2017 Attribute Object ID in Block. Hi guys its me again, I am trying to create a tagging system linking the attribute to a text field, I have this routine from @Tharwat that creates a text+field after clicking on the target block w/ attribute (it does work with default ent. properties like Block Unit, Color, Layer, Name etc.) but my problem is the attribute def. it has a different ObjectId and since the routine that Tharwat create uses (car (entsel) it will only return the block ObjectId and not the Attribute ObjID inside. Attribute ObjId 8796087888544 Others ObjId 8796087888528 Any Idea, is this feasible? Tharwats routine (vl-load-com) (defun c:TAG (/ space ss pt) (setq space (vla-get-modelspace (vla-get-ActiveDocument (vlax-get-acad-object)) ) ) (if (and (setq ss (car (entsel "\n Select a BLOCK : "))) (setq pt (getpoint "\n Specify TAG Location :")) ) (vla-addMText space (vlax-3d-point pt) 4. (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectID (vlax-ename->vla-object ss))) ">%).TextString \\f \"%tc1\">%" ) ) (princ) ) (princ) ) : Quote
Tharwat Posted June 10, 2017 Posted June 10, 2017 Hi, Replace the function entsel with nentsel and pick on the attribute itself when you are asked to select a Block. Quote
ttray33y Posted June 10, 2017 Author Posted June 10, 2017 its working now with a big BUT , so the attribute need to be visible right? thank you Tharwat Quote
Tharwat Posted June 10, 2017 Posted June 10, 2017 its working now with a big BUT , so the attribute need to be visible right? thank you Tharwat You are welcome. Sure it supposed to be visible since the user input function asks you to pick an object that is available / seen on the screen. Quote
BIGAL Posted June 11, 2017 Posted June 11, 2017 If the attribute is not visible you can get at the attribute via its creation order but that would rely on you knowing what number when created. Or use a "." for the attribute value its almost invisible, and then use Tharwat's method. Quote
ttray33y Posted June 13, 2017 Author Posted June 13, 2017 If the attribute is not visible you can get at the attribute via its creation order but that would rely on you knowing what number when created. Or use a "." for the attribute value its almost invisible, and then use Tharwat's method. any quicky snippets regarding to "If the attribute is not visible you can get at the attribute via its creation order but that would rely on you knowing what number when created. " Quote
BIGAL Posted June 13, 2017 Posted June 13, 2017 If you look at this then as it loops you get each attribute so you could change a attribute knowing how many times you need to go through the foreach use another if to change the attribute value and visibilty state. (setq y (getint "attribute counter")) (setq x 1) (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes) (if (= x y)(vla-put-textstring att newstr1)) (setq x (+ x 1)) ) Quote
ttray33y Posted June 15, 2017 Author Posted June 15, 2017 ok, consider this as solve. I found a workaround. instead of using attribute I created a custom property for Equipments and Valves. thank you again. 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.