Restting text within an instance of a block

Discussion in 'AutoCAD' started by AlistairC, Nov 25, 2004.

  1. AlistairC

    AlistairC Guest

    Hi

    I have created a block with a given name (myBlock) that contains a rectangle and MText (.textString = "0"). When an instance of the Block is placed, I want to be able to reset the textString to another value (.textString = "1"), without exploding the Block. Each Block placed should have its own text string.
    Is this possible? I am working with VB6 and the AutoCAD 2004 type library

    Thanks
     
    AlistairC, Nov 25, 2004
    #1
  2. AlistairC

    HJohn Guest

    You can do this by setting a reference to the block, which is a collection of the entities. Then go through each entity, find the mtext and change the textstring. Remember that once you change it, all instances of the block on the drawing will be changed. You can use a block with an attribute, if you want to change one instance without affecting the rest. Good luck.
     
    HJohn, Nov 25, 2004
    #2
  3. Is there a reason you don't want to use attributes?
    --
    John Goodfellow
    irtfnm
    use john at goodfellowassoc dot com


    rectangle and MText (.textString = "0"). When an instance of the Block is
    placed, I want to be able to reset the textString to another value
    (.textString = "1"), without exploding the Block. Each Block placed should
    have its own text string.
     
    John Goodfellow, Nov 25, 2004
    #3
  4. AlistairC

    AlistairC Guest

    Hi
    Tthanks for the responses but to clarify myself...

    If I import a block containing one rectangle inside another rectangle and with text underneath, I would like to be able to move the inner rectangle and change the wording as I place the block or just after I have placed the block. This means the block definition will always be the same but each instance of the block could look different. In other words, can I find the text and the rectangle in the instance of the Block and modify them without exploding the block?"

    Hope this is clearer

    Cheers
     
    AlistairC, Nov 25, 2004
    #4
  5. You need to make a copy of the block first.
    Change it's name adding some counter value (e.g. copy 'myblock' as
    'myblock01')
    Change whatever you need and set the reference to this new block.
     
    Jorge Jimenez, Nov 25, 2004
    #5
  6. I don't think you can have a block reference that does not look exactly like
    its block definition. So..

    1. As Jorge suggested, copy the master block def. to a new block def., make
    your changes in the copy, and insert that.

    2. Insert a block ref. from the master block def., explode it, delete the
    block ref., make your changes, then and re-block or Group the changed
    entities.
    --
    John Goodfellow
    irtfnm
    use john at goodfellowassoc dot com


    with text underneath, I would like to be able to move the inner rectangle
    and change the wording as I place the block or just after I have placed the
    block. This means the block definition will always be the same but each
    instance of the block could look different. In other words, can I find the
    text and the rectangle in the instance of the Block and modify them without
    exploding the block?"
     
    John Goodfellow, Nov 26, 2004
    #6
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.