Message 1 of 2
Exploding Dimensions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone;
I know exploding dimensions is a bad idea. BUT...let me explain.
I am creating a conversion program to convert solidworks drawings to autoCAD that has to meet a clients standard.
The design and drawing issues have all been done by this stage and the autoCAD file is just a deliverable at the end.
so NO blocks/Dims/Leaders etc allowed, this i can only see is to be totally translatable to all other clients.
Back to the how to.
Can anyone help me? I have created a filter and have the dimensions selected.
From then on its a bit of a mystery. I loop through the DimstyleTable but then I loose the ability to explode .
Any help would be appreciated.
public static void ExplodeDimensions()
{
try
{
//Start code here
//Gets the current document, editor and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Editor acDocEd = acDoc.Editor;
Database acDocDb = acDoc.Database;
//Sets up a filter for blocks only
var filter = new SelectionFilter(new[] { new TypedValue(0, "DIMENSION") });
var selection = acDocEd.SelectAll(filter);
//checks to see if selection set is good
if (selection.Status != PromptStatus.OK)
//if selection is no good returns
return;
//starts a transaction
using (var acTrans = acDocDb.TransactionManager.StartTransaction())
{
//loops through
foreach (var id in selection.Value.GetObjectIds())
{
//opens each object in for write
var acDr = (DimStyleTableRecord)acTrans.GetObject(id, OpenMode.ForWrite);
//explodes each object
acDr.e(); LOOSE THE ABILITY TO EXPLODE HERE
//erases each object
acDr.Erase();
}
//commits the transaction
acTrans.Commit();
}
}
catch (Autodesk.AutoCAD.Runtime.Exception ex)
{
Application.ShowAlertDialog("Error in Code\n" + ex.Message);
}
}