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

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to get length unit of a model via VB API

Gennaro
4-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

1 REPLY 1

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


Top Tags