robierzo Posted October 21, 2022 Posted October 21, 2022 Hello. I need to get a list with the name of the entities that are part of a block. Thank you Quote
Jonathan Handojo Posted October 21, 2022 Posted October 21, 2022 (defun foo (your_vla_block / rtn) (vlax-for x your_vla_block (setq rtn (cons x rtn)) ) (reverse rtn) ) 1 Quote
robierzo Posted October 21, 2022 Author Posted October 21, 2022 Thanks Jonathan. How do I create the vla object from the ename? Quote
Jonathan Handojo Posted October 21, 2022 Posted October 21, 2022 (edited) 2 minutes ago, robierzo said: Thanks Jonathan. How do I create the vla object from the ename? (vlax-ename->vla-object your_ename) And similarly to revert back: (vlax-vla-object->ename your_vla_object) Edited October 21, 2022 by Jonathan Handojo Quote
robierzo Posted October 21, 2022 Author Posted October 21, 2022 (defun foo (your_vla_block / rtn) (vlax-for x your_vla_block (setq rtn (cons x rtn)) ) (reverse rtn) ) (defun c:listabloque () (setq ename (car (entsel "\nDesigna Bloque: "))) (setq obj_bloque (vlax-ename->vla-object ename)) (foo obj_bloque) ) It reports an error. Quote
Jonathan Handojo Posted October 21, 2022 Posted October 21, 2022 Oh sorry, my apologies... I forgot that wasn't how it works, whoops This was how it's supposed to be... (defun foo (your_vla_block / rtn) (vlax-for x (vla-item (vla-get-blocks (vla-get-document your_vla_block)) (vla-get-effectivename your_vla_block)) (setq rtn (cons x rtn)) ) (reverse rtn) ) 1 Quote
robierzo Posted October 21, 2022 Author Posted October 21, 2022 Now it works perfectly! Thanks a lot Jonathan.!!!! Quote
Lee Mac Posted October 22, 2022 Posted October 22, 2022 You may wish to consider this post, which also touches upon the entities constituting nested block references within the block definition. 1 Quote
robierzo Posted October 22, 2022 Author Posted October 22, 2022 O.K. Thank you very much Lee. In my case, I do not consider the possibility of nested blocks. But I really appreciate the advice. I'll keep it in mind. Thanks. Quote
j2lstaples Posted November 7, 2022 Posted November 7, 2022 On 10/22/2022 at 3:49 PM, Lee Mac said: You may wish to consider this post, which also touches upon the entities constituting nested block references within the block definition. Hey Lee, I appreciate your work. I constantly reference you in my LISP code that I do for work, and I've recently looked at this problem of nested blocks. I've used your Nested Block codes and Attribute Modification Suite on your website. I constantly have a problem of legibility for my drawings because some attributes are rotated along with my block. For example, an attribute named "ITEM_NO" is also visible along with the block but if the block is rotated, it is also rotated by let's say 180 degrees or 3.14 rad. I thought that this attribute would be nested within that block, and I've been trying to find where the rotation of the text option for that Attribute. I've tried using your "roAtt" function within Attribute Modification Suite but it doesn't seem to pick that attribute correctly. How would I identify this attribute within the list generated here? Quote
Lee Mac Posted November 7, 2022 Posted November 7, 2022 If you're trying to understand the structure of the block, I would suggest selecting the block and typing 'BEDIT' to view the block definition in the Block Editor; from there, you can check whether or not the attribute is nested within another block, or whether it is possibly a constant attribute. Quote
j2lstaples Posted November 8, 2022 Posted November 8, 2022 16 hours ago, Lee Mac said: If you're trying to understand the structure of the block, I would suggest selecting the block and typing 'BEDIT' to view the block definition in the Block Editor; from there, you can check whether or not the attribute is nested within another block, or whether it is possibly a constant attribute. I figured it out by just filtering out the attribute list for the block to select the attributes as vla-object that I needed to modify the rotation of. It went something like this. ;; Rotate Text to 0.0 - J2LSTAPLES ;; Rotates the Tag Text of a Block back to 0. ;; blk - [vla-object] ;; tag - [str] Tag String Name (defun J2:tagrot (blk tag / attlist rot) (foreach attlist (vlax-safearray->list (vlax-variant-value (vla-getAttributes blk))) (if (and (vlax-property-available-p attlist 'TagString) (= tag (vla-get-TagString attlist))) (setq rot (vlax-put-property attlist 'Rotation 0.0)) ) ) ) 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.