cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Create Diameter Dimension VB API

BD_9799497
12-Amethyst

Create Diameter Dimension VB API

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);

 

 

ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

1 REPLY 1

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

Announcements


Top Tags