harrison-matt Posted May 14, 2010 Posted May 14, 2010 Hello all, I am sorry if this is a repeat thread (although I did search first). With that said, I wanted to ask if it is possible to change an attibute just inserted without having to use ddedit, or attipedit. I know I can entget entlast, but I can't find the attribute in the return values or DXF reference. I am not quite sure if there is a better way to approach this, but regardless let me lay down the logistics. The block that is bieng inserted is a single attribute delta Symbol used for revisions or CA. The string that would be used as the value is prompted for prior to insertion and governs the layer for that block. Now am i off my rocker or could this be possible? Thanks ahead of time, Matt Quote
alanjt Posted May 14, 2010 Posted May 14, 2010 This should give you something to play with.. (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'GetAttributes) Quote
BIGAL Posted May 14, 2010 Posted May 14, 2010 You can go even further find all previous blocks "delta Symbol" and pull the attribute out and compare then return the last value say + 1 accept or change Quote
harrison-matt Posted May 14, 2010 Author Posted May 14, 2010 This should give you something to play with.. (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'GetAttributes) Ok, correct me if i am wrong, (acad not up) but this selects an entity translates its entity name to an object and invokes 'GetAttributes. right? Quote
alanjt Posted May 14, 2010 Posted May 14, 2010 I don't fully understand your query. However, if you post your block, I'll be more than happy to help you with this. Quote
alanjt Posted May 14, 2010 Posted May 14, 2010 Ok, correct me if i am wrong, (acad not up) but this selects an entity translates its entity name to an object and invokes 'GetAttributes. right? Correct. It extracts all attributes (vla-objects in a list), if any exist. I just used a single selection as an example. Quote
harrison-matt Posted May 14, 2010 Author Posted May 14, 2010 All i need is direction to what functions I can use to change the attibute as it is inserted. Here is a simplified version of my intent to clarify. (defun c:delta () (setq rev# (getstring "\nEnter you revision number: ")) (command "-insert" "G-ANNO-DELTA" pause 1 1 0) ;Here I am trying to get the rev# to apply to the value ;of the Attribute Block. Please though, i am asking for direction and help (to learn) not an entire solution. Thanks, G-ANNO-DELTA.dwg Quote
harrison-matt Posted May 14, 2010 Author Posted May 14, 2010 You can go even further find all previous blocks "delta Symbol" and pull the attribute out and compare then return the last value say + 1 accept or change Well, however convienent I deal with several different clients where some require odd ball revision nomenclature within their Delta, so increments could not apply in those conditions. Thank you though for your thoughtfulness. Quote
alanjt Posted May 14, 2010 Posted May 14, 2010 Command style: (defun c:Delta (/ block num pt att) (setq block "G-ANNO-DELTA") (initget 6) (if (and (or (tblsearch "block" block) (findfile (strcat block ".dwg")) (alert (strcat block " not found!")) ) (setq num (getint "\nRevision number: ")) (setq pt (getpoint "\nBlock insertion point: ")) ) (progn (setq att (getvar 'attreq)) (setvar 'attreq 1) (command "_.-insert" block "_non" pt 1. 1. 0. (itoa num)) (setvar 'attreq att) ) ) (princ) ) VLA style: (defun c:Delta (/ block num pt) (setq block "G-ANNO-DELTA") (initget 6) (if (and (or (tblsearch "block" block) (findfile (strcat block ".dwg")) (alert (strcat block " not found!")) ) (setq num (getint "\nRevision number: ")) (setq pt (getpoint "\nBlock insertion point: ")) ) (vla-put-textstring (car (vlax-invoke (vla-insertblock (if (or (eq acmodelspace (vla-get-activespace (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) ) ) ) (eq :vlax-true (vla-get-mspace *AcadDoc*)) ) (vla-get-modelspace *AcadDoc*) (vla-get-paperspace *AcadDoc*) ) (vlax-3d-point (trans pt 1 0)) block 1. 1. 1. 0. ) 'GetAttributes ) ) (itoa num) ) ) (princ) ) Quote
harrison-matt Posted May 14, 2010 Author Posted May 14, 2010 HA! Omg, I never even though about having the insertion within vla-put-textstring and vlax-invoke. That just opened me up to a whole new chapter on invoking methods. Thanks Alan! (p.s. Thank you for the example, I assure you I have learned from this) Matt Quote
alanjt Posted May 14, 2010 Posted May 14, 2010 HA! Omg, I never even though about having the insertion within vla-put-textstring and vlax-invoke. That just opened me up to a whole new chapter on invoking methods. Thanks Alan! (p.s. Thank you for the example, I assure you I have learned from this) Matt Normally I wouldn't approach it that way, but since you know the block will have the one attribute, there's no real harm. You're welcome. Enjoy and look closely at my checks and prompts. 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.