fuqua Posted May 24, 2011 Author Posted May 24, 2011 If you want to change the attribute position relative to each block (i.e. not move all attributes to a single coordinate), the simplest method would probably be to use BEDIT (if available on your version) and change the position of the attribute in the block definition, then use ATTSYNC to apply the change to all other instances of the block (note that this will update all tags though). I can't at present think of another method without using code. oke ill make a screenshot to explain why i need to be able to roam around with those grips. Quote
dbroada Posted May 24, 2011 Posted May 24, 2011 just stepping back for a minute, I think Lee & I are interpreting your requirement slightly differently and each may have a different solution. Can you confirm..... you want it possible to move the "point" to a new location without moving the block (achieved). Do you want this location a set distance away from each instance of the block (say 5 units left, 2 units down)? Do you want this location to be the same global location for all the blocks (say location 100,100,0 )? If the first one then properties palette works, if the second you will need (LISP) code. Quote
fuqua Posted May 24, 2011 Author Posted May 24, 2011 ok here is a screenshot of 1 of my situations. Quote
Lee Mac Posted May 24, 2011 Posted May 24, 2011 If I have understood: (defun c:test ( / pt ss tag ) (vl-load-com) (if (and (ssget "_:L" '((0 . "INSERT") (66 . 1))) (setq tag (strcase (getstring "\nSpecify Tag to be Moved: "))) (setq pt (getpoint (strcat "\nSpecify Location for Tag " tag ": "))) (setq pt (vlax-3D-point (trans pt 1 0))) ) (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (foreach att (vlax-invoke obj 'getattributes) (if (and (eq tag (strcase (vla-get-tagstring att))) (eq :vlax-false (vla-get-lockposition att)) ) (vlax-put-property att (if (and (or (not (vlax-property-available-p att 'mtextattribute)) (eq :vlax-false (vla-get-mtextattribute att)) ) (not (eq acAlignmentLeft (vla-get-alignment att))) ) 'TextAlignmentPoint 'InsertionPoint ) pt ) ) ) ) (vla-delete ss) ) ) (princ) ) Quote
fuqua Posted May 24, 2011 Author Posted May 24, 2011 just stepping back for a minute, I think Lee & I are interpreting your requirement slightly differently and each may have a different solution. Can you confirm..... you want it possible to move the "point" to a new location without moving the block (achieved). yes Do you want this location a set distance away from each instance of the block (say 5 units left, 2 units down)? no, need to be able to free roam it around.Do you want this location to be the same global location for all the blocks (say location 100,100,0 )? no. If the first one then properties palette works, if the second you will need (LISP) code. what i need is like this select(ed) blocks=>run lisp=> click new location of the grips/points Quote
fuqua Posted May 24, 2011 Author Posted May 24, 2011 If I have understood: (defun c:test ( / pt ss tag ) (vl-load-com) (if (and (ssget "_:L" '((0 . "INSERT") (66 . 1))) (setq tag (strcase (getstring "\nSpecify Tag to be Moved: "))) (setq pt (getpoint (strcat "\nSpecify Location for Tag " tag ": "))) (setq pt (vlax-3D-point (trans pt 1 0))) ) (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (foreach att (vlax-invoke obj 'getattributes) (if (and (eq tag (strcase (vla-get-tagstring att))) (eq :vlax-false (vla-get-lockposition att)) ) (vlax-put-property att (if (and (or (not (vlax-property-available-p att 'mtextattribute)) (eq :vlax-false (vla-get-mtextattribute att)) ) (not (eq acAlignmentLeft (vla-get-alignment att))) ) 'TextAlignmentPoint 'InsertionPoint ) pt ) ) ) ) (vla-delete ss) ) ) (princ) ) does this work with my own block or the one dbroada adjusted ? edit: just tried both, but i aint able to click on anything when it says "specify tag to be moved"? Quote
Lee Mac Posted May 24, 2011 Posted May 24, 2011 does this work with my own block or the one dbroada adjusted ? The one you posted [ Any block with attributes which aren't locked ] Quote
fuqua Posted May 24, 2011 Author Posted May 24, 2011 The one you posted [ Any block with attributes which aren't locked ] sweet that worked ! i did had to specify which attribute though, could u make it so that it is auto set on the attribute "invoering" so only thing i have to do after is to specify the location ? btw your epic mate ! Quote
Lee Mac Posted May 24, 2011 Posted May 24, 2011 Thanks, you're welcome (defun c:test ( / pt ss tag ) (if (and (ssget "_:L" '((0 . "INSERT") (66 . 1))) (setq tag "INVOERING") (setq pt (getpoint (strcat "\nSpecify Location for Tag " tag ": "))) (setq pt (vlax-3D-point (trans pt 1 0))) ) (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (foreach att (vlax-invoke obj 'getattributes) (if (and (eq tag (strcase (vla-get-tagstring att))) (eq :vlax-false (vla-get-lockposition att)) ) (vlax-put-property att (if (and (or (not (vlax-property-available-p att 'mtextattribute)) (eq :vlax-false (vla-get-mtextattribute att)) ) (not (eq acAlignmentLeft (vla-get-alignment att))) ) 'TextAlignmentPoint 'InsertionPoint ) pt ) ) ) ) (vla-delete ss) ) ) (princ) ) Quote
fuqua Posted May 25, 2011 Author Posted May 25, 2011 Thanks, you're welcome (defun c:test ( / pt ss tag ) (if (and (ssget "_:L" '((0 . "INSERT") (66 . 1))) (setq tag "INVOERING") (setq pt (getpoint (strcat "\nSpecify Location for Tag " tag ": "))) (setq pt (vlax-3D-point (trans pt 1 0))) ) (progn (vlax-for obj (setq ss (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)) ) ) (foreach att (vlax-invoke obj 'getattributes) (if (and (eq tag (strcase (vla-get-tagstring att))) (eq :vlax-false (vla-get-lockposition att)) ) (vlax-put-property att (if (and (or (not (vlax-property-available-p att 'mtextattribute)) (eq :vlax-false (vla-get-mtextattribute att)) ) (not (eq acAlignmentLeft (vla-get-alignment att))) ) 'TextAlignmentPoint 'InsertionPoint ) pt ) ) ) ) (vla-delete ss) ) ) (princ) ) mate this one gives me a error Command: test Select objects: Specify opposite corner: 8 found Select objects: Specify Location for Tag INVOERING: ; error: no function definition: VLAX-3D-POINT Command: i havent changed anything to the code whatsoever. any ideas ? edit: nvm mate, i found the problem. needed to add "(vl-load-com)" at the first line working great ! thanks a million again Quote
Lee Mac Posted May 25, 2011 Posted May 25, 2011 nvm mate, i found the problem. needed to add "(vl-load-com)" at the first line working great ! thanks a million again Oh yeah, I sometimes forget that since I have it in my ACADDOC.lsp, so I don't notice when its not there. I would recommend you add: (vl-load-com) To the top of your ACADDOC.lsp, - its much easier than loading it from code and you won't have any trouble if a developer misses it from the code. Lee 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.