Modify block in paper space will in model space

Discussion in 'AutoCAD' started by Alan Henderson @ A'cad Solutions, Jun 24, 2004.

  1. I'm having a hard time thinking today and it's not even Friday.

    I have selected all occurrences of a block in the drawing - 2 in model space and 1 each in 2 layout tabs.
    I know how cycle through the blocks to update an attribute for all the blocks in model space, but I can't think of how to modify the blocks in paper space without having to change focus to the layout tabs.

    Thank in advance, I know this is an easy one...
     
    Alan Henderson @ A'cad Solutions, Jun 24, 2004
    #1
  2. Does (vla-get-block <layout object>) get you
    pointed in the correct direction?

    --
    Autodesk Discussion Group Facilitator


    message I'm having a hard time thinking today and it's not even Friday.

    I have selected all occurrences of a block in the drawing - 2 in model space
    and 1 each in 2 layout tabs.
    I know how cycle through the blocks to update an attribute for all the
    blocks in model space, but I can't think of how to modify the blocks in
    paper space without having to change focus to the layout tabs.

    Thank in advance, I know this is an easy one...
     
    Jason Piercey, Jun 24, 2004
    #2
  3. Alan Henderson @ A'cad Solutions

    Jeff Mishler Guest

    Something like this....
    (defun edit_att (blkname att_tag str)
    (vl-load-com)
    (ssget "x" (list '(0 . "INSERT")(cons 2 blkname)'(66 . 1)))
    (vlax-for item (vla-get-activeselectionset
    (vla-get-activedocument
    (vlax-get-acad-object)))
    (foreach att (vlax-safearray->list (vlax-variant-value
    (vla-getattributes item)))
    (if (= att_tag (vla-get-tagstring att))
    (vla-put-textstring att str)
    )
    )
    )
    )

    Usage: (edit_att "blockname" "tag of attribute to edit" "new text")
    Sample with my block name being "TDG" and an attribute with a defined Tag of
    "PROJECT":
    (edit_att "TDG" "PROJECT" "BIG TEST")

    HTH,
    Jeff

    message I'm having a hard time thinking today and it's not even Friday.

    I have selected all occurrences of a block in the drawing - 2 in model space
    and 1 each in 2 layout tabs.
    I know how cycle through the blocks to update an attribute for all the
    blocks in model space, but I can't think of how to modify the blocks in
    paper space without having to change focus to the layout tabs.

    Thank in advance, I know this is an easy one...
     
    Jeff Mishler, Jun 24, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.