DxfInsert block reference entities update
![]() 9/5/2022 10:59 AM
|
---|
Hello, I have a block made from DfxLines and DfxArcs. I want to hide some of those lines, arcs for particular block references. I can change attribute values for each reference but I didn't find the way to change block reference entities. When I use blockReference.Block.Entities property changes are applied to parent block and all block references. C# Code: private void HideBlockPartsIfTextBigger( |
![]() 9/5/2022 11:21 AM
|
---|
Hi, First of all, please rename your block variable to insert, because inserts and blocks are fundamentally different things and contributes to the confusion and is part of your problem. So the block (not insert) is shared by multiple inserts. So setting the DxfEntity.Visible property on an entity inside a block, will affect all the inserts that insert that block. There is no way around that. The only way you can differentiate things by insert is putting an entity that's in a block on the 0 layer (zero layer). That way the entity's effective layer will be the insert's layer. This isn't helpful in your case though. Anyways, in your case, you don't want your blocks to be shared by multiple inserts. So you'll have insert copies of your blocks. You can use the Clone() method to copy any object. - Wout |
![]() 9/5/2022 1:57 PM
|
---|
Thanks for your replay. What should I copy (and what is the right way to do that). I've copied block: C# Code: blockInsert. |
![]() 9/5/2022 2:31 PM
|
---|
Please follow the example in the Clone documentation very precisely, or it won't work correctly. Also if you clone a block, you must give it a unique name and add it to DxfModel.Blocks. - Wout |