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

How to get length unit of a model via VB API

Highlighted
Participant

How to get length unit of a model via VB API

Hi,

i have an IpfcModel object and i want to know, via vb api, its lenght unit (mm or inch).

Is possible to do it?

Thanks

Tags (2)
1 REPLY 1
Highlighted

Re: How to get length unit of a model via VB API

Just figured this out using VBA. You need to use ipfcSolid.GetPrincipalUnits:

 

Option 1:

Dim model As IpfcModel

Set model = session.CurrentModel

Dim SolidMdl As IpfcSolid

Set SolidMdl = model 'Convert to IpfcSolid to get units

Dim UnitSys As IpfcUnitSystem

Set UnitSys = SolidMdl.GetPrincipalUnits

MsgBox UnitSys.Name

MsgBox UnitSys.GetUnit(EpfcUNIT_LENGTH).Name

 

Option 2:

Dim model As IpfcModel

Set model = session.CurrentModel

Dim SolidMdl As IpfcSolid

Set SolidMdl = model 'Convert to IpfcSolid to get units

MsgBox SolidMdl.GetPrincipalUnits.GetUnit(EpfcUNIT_LENGTH).Name

 

Options for GetUnit:

• EpfcUNIT_LENGTH—Specifies length measurement units.
• EpfcUNIT_MASS—Specifies mass measurement units.
• EpfcUNIT_FORCE—Specifies force measurement units.
• EpfcUNIT_TIME—Specifies time measurement units.
• EpfcUNIT_TEMPERATURE—Specifies temperature measurement units.
• EpfcUNIT_ANGLE—Specifies angle measurement units.

Announcements