Jump to content

entities that are part of a block


robierzo

Recommended Posts

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 by Jonathan Handojo
Link to comment
Share on other sites

(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.

Link to comment
Share on other sites

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)
)

 

 

  • Like 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 weeks later...
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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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))
    )
  )
)

 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...