본문 바로가기
  • Welcome!
VBA, VB.NET For Creo

IpfcModelItemOwner

by ToolBOX01 2024. 12. 15.
반응형

□ IpfcModelItemOwner

The IpfcModelItemOwner interface serves as a foundational class for objects that possess a collection of model items. This typically encompasses models, which are composed of various elements like features, surfaces, edges, points, and more.

Function GetItemById (Type as IpfcModelItemType, Id as Long) as IpfcModelItem [optional]

Returns the specified model item, given its identifier and type.

▷ Code :  Get Feature Type by feature id

Option Explicit
Public asynconn As New pfcls.CCpfcAsyncConnection
Public conn As pfcls.IpfcAsyncConnection
Public BaseSession As pfcls.IpfcBaseSession
Public Model As pfcls.IpfcModel
Public Sub CreoConnt01()
     
     '// connect creo model
     Set conn = asynconn.Connect(Null, Null, Null, Null)
     Set BaseSession = conn.Session
     Set Model = BaseSession.CurrentModel
     
    '// creo model connection check
     If Model Is Nothing Then
        MsgBox "There are No Active Creo Models", vbInformation, "korealionkk@gmail.com"
        Exit Sub
     End If
     
     Dim ModelItemOwner As IpfcModelItemOwner
     Dim ModelItem As IpfcModelItem
         
     set ModelItemOwner = Model
     set ModelItem = ModelItemOwner.GetItemById(EpfcModelItemType.EpfcITEM_FEATURE,43)  
     
     Msgbox ModelItem.Type
               
End Sub

Function GetItemByName (Type as IpfcModelItemType, Name as String) as IpfcModelItem [optional]

Returns a model item, given a string name and type, if it exists.

▷ Code :  Get Feature Type by feature name

  Dim ModelItemOwner As IpfcModelItemOwner
  Dim ModelItem As IpfcModelItem
         
  set ModelItemOwner = Model
  set ModelItem = ModelItemOwner.GetItemById(EpfcModelItemType.EpfcITEM_FEATURE,"KOREA")  
     
  Msgbox ModelItem.Type

Function ListItems (Type as IpfcModelItemType [optional]) as IpfcModelItems [optional]

Provides a list of model items of the specified type.

▷ Code :  Displays the quantity of all features that the model has

  Dim ModelItemOwner As IpfcModelItemOwner
  Dim ModelItems As IpfcModelItems
         
  set ModelItemOwner = Model
  set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_FEATURE)
       
  Msgbox ModelItems.Count

 

Supported Types:

  • For Solid Models: ITEM_FEATURE, ITEM_SURFACE, ITEM_COORD_SYS, ITEM_AXIS, ITEM_QUILT, ITEM_EDGE, ITEM_POINT, ITEM_CURVE, ITEM_LAYER, ITEM_SOLID_GEOMETRY, ITEM_NOTE, ITEM_DIMENSION, ITEM_REF_DIMENSION, ITEM_EXPLODED_STATE, ITEM_SIMPREP
  • For 2D Models: ITEM_TABLE, ITEM_DIMENSION, ITEM_REF_DIMENSION, ITEM_DTL_ENTITY, ITEM_DTL_GROUP, ITEM_DTL_SYM_DEFINITION, ITEM_DTL_SYM_INSTANCE, ITEM_DTL_OLE_OBJECT, ITEM_LAYER

 

 

by korealionkk@gmail.com


'VBA, VB.NET For Creo' 카테고리의 다른 글

Surface UV 포인트  (0) 2024.12.16
IpfcSurface  (1) 2024.12.16
Parent-Child Relationships between the VB API Objects  (1) 2024.12.12
Creo VB API 개념 - Related Classes  (0) 2024.12.12
Creo 모델 이름 표시하기 #2/2  (0) 2024.12.09