PDA

View Full Version : Get composition of a object block without exploding it



d.cakmur
2005-04-04, 09:05 AM
Hello,

To know what's in a block, I'm using

exploded=object.explode ' explode a block
explodedObjects = object.Explode
For i = 0 To UBound(explodedObjects)
Prompt explodedObjects(i).ObjectName

Select Case explodedObjects(i).ObjectName
Case "AcDb2dPolyline"
'...
end select
end for

Is there a possibility without exploding ?

Deniz

RobertAitken
2005-04-04, 10:16 AM
Hello,
.....
Is there a possibility without exploding ?

Deniz
Sorry for the this answer but it's been awhile.

Short answer Yes you can.

It's more to do with the block reference than the block object itself. This is where Ed and RRB correct me.

You can iterate through the block references and blocks and change them without exploding. I don't have any code to had that would show you. But it is possible.

You can for instance change the colours of entities with blockreferences and blocks programatically.

I know it's not much help but it might set you in the right direction.

Robert Aitken

RobertB
2005-04-04, 04:12 PM
Short answer Yes you can.

It's more to do with the block reference than the block object itself. This is where Ed and RRB correct me.

<snort>

To gat at the objects in the block, you simply need to iterate thru the Block object in the Blocks collection.


Dim myBlock as AcadBlock
Set myBlock = ThisDrawing.Blocks.Item("MySample")

Dim anEntity as AcadEntity
For Each anEntity in myBlock
'working code here
Next anEntity

RobertAitken
2005-04-04, 04:22 PM
<snort>

To gat at the objects in the block, you simply need to iterate thru the Block object in the Blocks collection.


Dim myBlock as AcadBlock
Set myBlock = ThisDrawing.Blocks.Item("MySample")

Dim anEntity as AcadEntity
For Each anEntity in myBlock
'working code here
Next anEntity

See, I knew it was something simple :roll:

Robert

Ed Jobe
2005-04-04, 05:01 PM
PS, once you have the AcadBlock object, it has an Items property that returns the block's objects.