Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi Everyone,
How do I create a diameter dimension using the free VB API (I'm using C#)? Additionally, the selection must be programmatic. I'm selecting an edge entity, using empty dimension senses, and no orientation hint. I know everything aside from orientation is working because it successfully creates a radius dimension (instead of diameter). See code snippet below.
Feels like I'm just missing something basic - any and all help greatly appreciated!
Thank you,
-Ben
IpfcView2D view = dwgModel2D.GetViewByName(viewName);
IpfcModel viewModel = view.GetModel();
IpfcModelItemOwner modelItemOwner = (IpfcModelItemOwner)viewModel;
IpfcModelItem entity1 = modelItemOwner.GetItemById((int)entityType1, entityID1);
CpfcSelections sels = new CpfcSelections();
IpfcSelection sel1 = new CMpfcSelect().CreateModelItemSelection(entity1, null);
sel1.set_SelView2D(view);
sels.Set(0, sel1);
CpfcDimensionSenses senses = new CpfcDimensionSenses();
senses.Set(0, sense1);
senses.Set(1, sense2);
CpfcVector2D vec = new CpfcVector2D();
vec.Set(0, xLoc);
vec.Set(1, yLoc);
IpfcDrawingDimCreateInstructions someDim = new CCpfcDrawingDimCreateInstructions().Create(sels, senses, vec, (int)hint);
IpfcDimension2D newDim = dwgModel2D.CreateDrawingDimension(someDim);
Solved! Go to Solution.
Hi Everyone,
Solved my own issue here - to create a diameter dimension instead of a radius dimension, you just need to select the same entity twice (along with a little bit of this: CCpfcEmptyDimensionSense().Create() and a little bit of that: EpfcOrientationHint.EpfcORIENTHINT_NONE).
Hope this helps someone else!
-Ben
Hi Everyone,
Solved my own issue here - to create a diameter dimension instead of a radius dimension, you just need to select the same entity twice (along with a little bit of this: CCpfcEmptyDimensionSense().Create() and a little bit of that: EpfcOrientationHint.EpfcORIENTHINT_NONE).
Hope this helps someone else!
-Ben