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

VB API Fundamentals - Feature LIST

by ToolBOX01 2020. 12. 23.
반응형

Feature LIST VBA Excel Program

 

Part 파일의 모든 Feature들의 타입 이름을 List로 만들어 주는 프로그램. frature 번호, 타입, 상태를 알수 있다.

 

A program that makes the type names of all the features in the part file into a list.  The fracture number, type, and condition are known.

 

 

 

Source code

Sub feature_Nanme()

    Dim asynconn As New pfcls.CCpfcAsyncConnection
    Dim conn As pfcls.IpfcAsyncConnection
    Dim session As pfcls.IpfcBaseSession
    Dim oModel As pfcls.IpfcModel
    
    Set conn = asynconn.Connect("", "", ".", 5)
    Set session = conn.session
    Set oModel = session.CurrentModel
    Cells(2, 2) = oModel.Filename
    
    Dim oModelowner As IpfcModelItemOwner
    Set oModelowner = session.CurrentModel()

    
    Dim modelitems As IpfcModelItems
    Set modelitems = oModelowner.ListItems(EpfcModelItemType.EpfcITEM_FEATURE)
    Dim oFeature As IpfcFeature
    Dim i As Integer
    
    For i = 0 To modelitems.Count - 1
        Set oFeature = modelitems(i)
        Cells(i + 4, 2) = oFeature.FeatTypeName
        Cells(i + 4, 3) = oFeature.FeatType
        Cells(i + 4, 1) = i + 1
    Next
    
      
    'Disconnect with Creo
    conn.Disconnect (2)
    
End Sub

 

part feature list v1.xlsm
0.02MB

 

lionkk@idt21c.com