Application Hierarchy
 
The rules of object orientation require a certain hierarchy of object creation when you start a VB application. The application must iterate down to the level of the object you want to access. For example, to list all the datum axes contained in the hole features in all models in session, do the following:
1. Use the method CCpfcAsyncConnection.Connect() to connect to an existing session of Creo Parametric.
Dim connection As IpfcAsyncConnection
Dim classAsyncConnection As New CCpfcAsyncConnection
connection = classAsyncConnection.Connect (DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value)
2. Get a handle to the session of Creo Parametricfor the current active connection:
Dim session As IpfcBaseSession
ession = connection.Session
3. Get the models that are loaded in the session:
Dim models As IpfcModels
models = session.ListModels()
4. Get the handle to the first model in the list:
Dim model As IpfcModel
model = models[0]
5. Get the feature model items in each model:
Dim items As IpfcModelItems
items = model.ListItems (EpfcModelItemType.EpfcITEM_FEATURE)
6. Filter out the features of type hole:
if (feature.FeatType = EpfcFeatureType.EpfcFEATTYPE_HOLE) then
7. Get the subitems in each feature that are axes:
Dim axes As IpfcModelItems
axes = feature.ListSubItems (EpfcModelItemType.EpfcITEM_AXIS)
Was this helpful?