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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Create Diameter Dimension VB API

BD_9799497
4-Participant

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
BD_9799497
4-Participant
(To:BD_9799497)

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
BD_9799497
4-Participant
(To:BD_9799497)

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

Top Tags