At the time it was mentioned in the comments that BlockReference.ExplodeToOwnerSpace() had some relative benefits, but it’s taken me some time to code up a simple sample to show how you might use it (Patrick’s recent comment reminded me I ought to, though). You will have to specify the starting point of the line by clicking the mouse then you will be prompted to specify the second point.
but then who has time to sit around and read those menus anyway? Select the block you wish to edit and then you will see the dialog box found in Figure 1. Some time ago I posted about how to use Entity.Explode() to do something similar to AutoCAD’s EXPLODE command.
This is the default option, the setting dialogue is not shown when this option is selected.
If some entities selected, you can select from one of the options below: Settings/ExplodeInterestingly enough, few of us have ever thought to use REFEDIT on blocks, and yet it's mentioned right there in the Modify pull-down menu. Select objects to explode: Select objects: You can include blocks, wipeouts and other entities in the selection. To follow along you need a previously inserted block that you're willing to make some minor modification to.įrom the Modify pull-down menu select In-place Xref and Block Edit. Most of us didn't think to try it out on blocks, even though technically blocks are referred to as references as well. As it turns out, it's a fantastic block editor as well. This awesome command came to us in AutoCAD® 2000 with the chief goal of permitting the editing of attached external references. to put everything on layer (0), By layer. explode all the nasted blocks and keep the first level block.
Select all the blocks with nested blocks in my drawing. Redefining an existing block is not a very exciting task, tedious at best.Įnter the REFEDIT command to save the day. I will be happy if you can help me to add the last item shown in the list into the routine you sent me. make sure you use the same insertion point or all of the previously inserted blocks will move, and so on. 139 block references already exist in the drawing. After hitting ok I get the message 'conv is already defined. So I go into the Block Definition box and I choose the particular block that Im working with and I go to the 'Allow exploding' check box and I check it. go back into the block command, redefine it. Im having trouble editing the block definition after the blocks are already drawn. You probably follow the same procedure we've all followed for years: Insert the block on the "0" layer.
SsBlocks.It's not uncommon for us to need to update our block definitions from time to time. import arrayįrom comtypes.client import CreateObject,GetModule, GetActiveObjectĪcad = GetActiveObject("AutoCAD.Application")Īcad = CreateObject("AutoCAD.Application",dynamic=True)īlockI = (insertionPnt, files, 1, 1, 1, 0) If somebody help me in how to correct the syntax to avoid this 'KeyError:9' will be appreciated. BlockReference.ExplodeToOwnerSpace () doesn’t return a list of created objects, so I opted to capture this using a Database.ObjectAppended event handler and then recursively call our custom ExplodeBlock () function for any nested blocks that get created. I made an exception when using the command 'entity.Explode()' and after, loop through the blocks in ModelSpace to get the inserted block again. (Optional) If you are finished using the Block Editor, click Close Block Editor. Click Block Editor tab Open/Save panel Save Block.
In the Properties palette, under Block, click Allow Exploding. In the Block Editor, make sure nothing is selected. It will give u entities present in BlockReferance. By: Open a block definition in the Block Editor. That would be an explanation, why you always get those coordinates. I found a solution to work around the 'KeyError:9'. Maybe you created a block and left the 'Select insertion point from screen' blank.