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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

VBA obtaining tolerances from drawing

KM_10319639
4-Participant

VBA obtaining tolerances from drawing

Hello,

 

I'm currently working on Excel macro that connects to current session (drawing) and extracts data.

I managed to get it so far that it extracts dimensions (names and value) but i just can't get a correct procedure to get the dimensions upper and lower tolerance.

 

The only thing i was able to obtain is tolerance type with ipfcdimension2D.GetTolerance().

 

Is there a method to get upper and lower tolerance somehow?

 

Greatly appreciate the answer!

Klemen

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Just after 10 hours of search and after typing this post I realised what to do.

For anyone else searching for this, the solution is:

 

What i had:

Dim model as ipfcdrawing

      set model = session.currentmodel

Dim dimowner as ipfcmodelitemowner

      set dimowner = model

dim dimensions as ipfcmodelitems

      set dimensions = dimowner.listitems(epfcmodelitemtype.epfcITEM_DIMENSION)

dim dimension as ipfcdimension2D

      set dimension = dimensions.item(i)

dim tolerance as ipfcdimtolerance <------------- Here was the problem as having it defined like this only gives you option "type"

      set tolerance = dimension(i).gettolerance

 

What now gives me what i needed:

 

Dim model as ipfcdrawing

      set model = session.currentmodel

Dim dimowner as ipfcmodelitemowner

      set dimowner = model

dim dimensions as ipfcmodelitems

      set dimensions = dimowner.listitems(epfcmodelitemtype.epfcITEM_DIMENSION)

dim dimension as ipfcdimension2D

      set dimension = dimensions.item(i)

dim tolerance as ipfcdimtolplusminus <------------- Having it set like this now gives us options Minus and Plus

      set tolerance = dimension(i).gettolerance

 

View solution in original post

1 REPLY 1

Just after 10 hours of search and after typing this post I realised what to do.

For anyone else searching for this, the solution is:

 

What i had:

Dim model as ipfcdrawing

      set model = session.currentmodel

Dim dimowner as ipfcmodelitemowner

      set dimowner = model

dim dimensions as ipfcmodelitems

      set dimensions = dimowner.listitems(epfcmodelitemtype.epfcITEM_DIMENSION)

dim dimension as ipfcdimension2D

      set dimension = dimensions.item(i)

dim tolerance as ipfcdimtolerance <------------- Here was the problem as having it defined like this only gives you option "type"

      set tolerance = dimension(i).gettolerance

 

What now gives me what i needed:

 

Dim model as ipfcdrawing

      set model = session.currentmodel

Dim dimowner as ipfcmodelitemowner

      set dimowner = model

dim dimensions as ipfcmodelitems

      set dimensions = dimowner.listitems(epfcmodelitemtype.epfcITEM_DIMENSION)

dim dimension as ipfcdimension2D

      set dimension = dimensions.item(i)

dim tolerance as ipfcdimtolplusminus <------------- Having it set like this now gives us options Minus and Plus

      set tolerance = dimension(i).gettolerance

 

Top Tags