Benny_Ad Posted October 21, 2022 Posted October 21, 2022 (edited) I want to create a LISP command that will allow me to select a block and move the attributes (block descriptions) to the right (edit the x-coordinate of attribute location). It would be nice if the LISP command used "(setq ss (ssget '((0 . "INSERT"))))" to allow me to select multiple blocks at once and then have all their attributes shift to a specified X coordinate. I don't want to use Bedit, since some of the attributes to the block will be shifted to different locations. Here is the code I have so far. Currently, it will allow me to select multiple blocks and loop through all the attributes to each block. However, I don't know how to only change the X coordinate of each attribute. (defun c:shiftatt ( / i ss obj) (setq i 0) (if (and (setq ss (ssget '((0 . "INSERT")))) ) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss i))) (foreach x (vlax-invoke obj 'GetAttributes) ;code to change x-coordinate of each attribute ) (setq i (1+ i)) ) ) (princ) ) Edited October 21, 2022 by Benny_Ad Put code into correct notation Quote
Jonathan Handojo Posted October 21, 2022 Posted October 21, 2022 (edited) If some of the attributes would need to be in different locations as opposed to others, what you would need to do is use a dynamic point parameter and then link the attribute in question to the parameter. After that, you can get the dynamic properties using (vlax-invoke obj 'getdynamicblockproperties) and change the value from there. Edit: After further inspection, it's actually possible without. Further to your code above: (foreach x (vlax-invoke obj 'GetAttributes) (setq pt (vlax-get x 'InsertionPoint)) (vla-put-insertionpoint x (vlax-3d-point _your_x_value_ (cadr pt) (caddr pt))) ) Edited October 21, 2022 by Jonathan Handojo 1 1 Quote
BIGAL Posted October 22, 2022 Posted October 22, 2022 Another version (setq x 10) (setq pt2 (mapcar '+ (vlax-get obj 'insertionpoint ) (list X 0.0 0.0))) (foreach att (vlax-invoke obj 'GetAttributes) (vlax-put att 'insertionpoint pt2) ) 1 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.