How do I set a Block Reference to a known Block Name?

How do I set a Block Reference to a known Block Name?

Anonymous
Not applicable
370 Views
5 Replies
Message 1 of 6

How do I set a Block Reference to a known Block Name?

Anonymous
Not applicable
BlockName is the Block
oAcadApp is my AutoCad object

'Set the Block
Dim acoActiveBlock As AcadBlock
Set acoActiveBlock = oAcadApp.ActiveDocument.Blocks(BlockName)

'Set the Block Reference Object
Dim acoBlockRef As AcadBlockReference
Set acoBlockRef = acoActiveBlock

The above code keeps giving a type mismatch error. How do I set the block
reference to the know 'BlockName'

Chris
0 Likes
371 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Three ways:

1) Have the user manually select an insert
2) Loop through every objectin the database looking for inserts
3) Use a filtered selection set to acquire the inserts.

--
Good judgment comes from experience.
Experience comes from bad judgment.

http://www.acadx.com


"Veign" wrote in message
news:0003A30E758FF35A654D28FCB1B7699E@in.WebX.maYIadrTaRb...
> BlockName is the Block
> oAcadApp is my AutoCad object
>
> 'Set the Block
> Dim acoActiveBlock As AcadBlock
> Set acoActiveBlock = oAcadApp.ActiveDocument.Blocks(BlockName)
>
> 'Set the Block Reference Object
> Dim acoBlockRef As AcadBlockReference
> Set acoBlockRef = acoActiveBlock
>
> The above code keeps giving a type mismatch error. How do I set the block
> reference to the know 'BlockName'
>
> Chris
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
Block references can only be set from Inserts??


"Frank Oquendo" wrote in message
news:8F9C6BB8C22CDB9797D33929EE5F5F3B@in.WebX.maYIadrTaRb...
> Three ways:
>
> 1) Have the user manually select an insert
> 2) Loop through every objectin the database looking for inserts
> 3) Use a filtered selection set to acquire the inserts.
>
> --
> Good judgment comes from experience.
> Experience comes from bad judgment.
>
> http://www.acadx.com
>
>
> "Veign" wrote in message
> news:0003A30E758FF35A654D28FCB1B7699E@in.WebX.maYIadrTaRb...
> > BlockName is the Block
> > oAcadApp is my AutoCad object
> >
> > 'Set the Block
> > Dim acoActiveBlock As AcadBlock
> > Set acoActiveBlock = oAcadApp.ActiveDocument.Blocks(BlockName)
> >
> > 'Set the Block Reference Object
> > Dim acoBlockRef As AcadBlockReference
> > Set acoBlockRef = acoActiveBlock
> >
> > The above code keeps giving a type mismatch error. How do I set the
block
> > reference to the know 'BlockName'
> >
> > Chris
> >
> >
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
I guess the questions is then. With a known block, already inserted into a
drawing, how do I change one of its attributes?..


"Frank Oquendo" wrote in message
news:8F9C6BB8C22CDB9797D33929EE5F5F3B@in.WebX.maYIadrTaRb...
> Three ways:
>
> 1) Have the user manually select an insert
> 2) Loop through every objectin the database looking for inserts
> 3) Use a filtered selection set to acquire the inserts.
>
> --
> Good judgment comes from experience.
> Experience comes from bad judgment.
>
> http://www.acadx.com
>
>
> "Veign" wrote in message
> news:0003A30E758FF35A654D28FCB1B7699E@in.WebX.maYIadrTaRb...
> > BlockName is the Block
> > oAcadApp is my AutoCad object
> >
> > 'Set the Block
> > Dim acoActiveBlock As AcadBlock
> > Set acoActiveBlock = oAcadApp.ActiveDocument.Blocks(BlockName)
> >
> > 'Set the Block Reference Object
> > Dim acoBlockRef As AcadBlockReference
> > Set acoBlockRef = acoActiveBlock
> >
> > The above code keeps giving a type mismatch error. How do I set the
block
> > reference to the know 'BlockName'
> >
> > Chris
> >
> >
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
Yes, AcadblockReference = Insert.

--
Good judgment comes from experience.
Experience comes from bad judgment.

http://www.acadx.com


"Veign" wrote in message
news:F98297EC1D2D5ECFAB5E41C86BD4BFFE@in.WebX.maYIadrTaRb...
> Block references can only be set from Inserts??
>
>
> "Frank Oquendo" wrote in message
> news:8F9C6BB8C22CDB9797D33929EE5F5F3B@in.WebX.maYIadrTaRb...
> > Three ways:
> >
> > 1) Have the user manually select an insert
> > 2) Loop through every objectin the database looking for inserts
> > 3) Use a filtered selection set to acquire the inserts.
> >
> > --
> > Good judgment comes from experience.
> > Experience comes from bad judgment.
> >
> > http://www.acadx.com
> >
> >
> > "Veign" wrote in message
> > news:0003A30E758FF35A654D28FCB1B7699E@in.WebX.maYIadrTaRb...
> > > BlockName is the Block
> > > oAcadApp is my AutoCad object
> > >
> > > 'Set the Block
> > > Dim acoActiveBlock As AcadBlock
> > > Set acoActiveBlock = oAcadApp.ActiveDocument.Blocks(BlockName)
> > >
> > > 'Set the Block Reference Object
> > > Dim acoBlockRef As AcadBlockReference
> > > Set acoBlockRef = acoActiveBlock
> > >
> > > The above code keeps giving a type mismatch error. How do I set the
> block
> > > reference to the know 'BlockName'
> > >
> > > Chris
> > >
> > >
> >
> >
>
>
0 Likes
Message 6 of 6

Anonymous
Not applicable
Use the GetAttributes method. This will return a variant containing an array
AcadAttributeReferences. Use the TextString property to change the value.

--
Good judgment comes from experience.
Experience comes from bad judgment.

http://www.acadx.com


"Veign" wrote in message
news:35561CB525ED60BBC0CC69160A26675F@in.WebX.maYIadrTaRb...
> I guess the questions is then. With a known block, already inserted into
a
> drawing, how do I change one of its attributes?..
0 Likes