Using ListFeaturesByType in VBA
Hi, i've been trying to use ListFeaturesByType in VBA in Excel but didn't succeed.
Sub FixParts()
On Error GoTo Error
' put your code here
Dim model As IpfcModel
Set model = session.CurrentModel
'creating Fix Constraint
Dim constraint As IpfcComponentConstraint
Dim constructorOfConstraints As CCpfcComponentConstraint
Set constructorOfConstraints = New CCpfcComponentConstraint
Set constraint = constructorOfConstraints.Create(EpfcASM_CONSTRAINT_FIX)
'component path
Dim solid As IpfcSolid
Dim features As IpfcFeatures
solid = CType(model, IpfcSolid)
features = solid.ListFeaturesByType(True, EpfcFeatureType.EpfcFEATTYPE_COMPONENT)
'applying constraints
' end your code here
Done:
Exit Sub
Error:
Debug.Print Err.Description
conn.Disconnect (5)
Debug.Print "Disconnected"
End Sub
First thing. All examples that i've found using CType() function which is a converter from IpfcModel to IpfcSolid. But VBA doesn't have CType() functionality that's why it never succeeded.
How can i get IpfcSolid from IpfcModel and use ListFeaturesByType() function?
(whole purpose of this script is learing about functionaity of VBA API for Creo it has to apply fix constraint to each part in assembly)

