Skip to main content
7-Bedrock
March 8, 2023
Solved

VBA obtaining tolerances from drawing

  • March 8, 2023
  • 1 reply
  • 1657 views

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

 

 

 

 

Best answer by KM_10319639

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

 

1 reply

KM_103196397-BedrockAuthorAnswer
7-Bedrock
March 8, 2023

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