본문 바로가기
  • Welcome!
VBA For Creo

Feature ID 및 Feature 이름 검색 프로그램 # 2/3

by ToolBOX01 2021. 3. 22.
반응형

Feature Number and Feature Type Name List

 

 

 

IpfcModelItemOwner
연결된 모델 항목 (예 : 모델)이있는 개체의 기본 클래스입니다.

IpfcModelItemOwner.ListItems(Type as IpfcModelItemType [optional]) as IpfcModelItems [optional]

EpfcModelItemType.EpfcITEM_FEATURE


IpfcModelItem
이 클래스는 모델 항목을 정의합니다. 가능한 모델 항목 유형은 다음과 같습니다.

ITEM_FEATURE
ITEM_SURFACE
ITEM_EDGE
ITEM_COORD_SYS
ITEM_AXIS
ITEM_POINT
ITEM_QUILT
ITEM_CURVE
ITEM_LAYER
ITEM_NOTE
ITEM_DIMENSION
ITEM_REF_DIMENSION

IpfcFeature
이 클래스는 Feature을 정의합니다.


IpfcFeature.Pattern() as IpfcFeaturePattern
피쳐가 패턴의 멤버 인 경우 패턴입니다. 그렇지 않으면 null이됩니다.

 

 

 

Sub Feature_LIST2()
        Dim asynconn As New pfcls.CCpfcAsyncConnection
        Dim conn As pfcls.IpfcAsyncConnection
        Dim session As pfcls.IpfcBaseSession
    
'    On Error GoTo RunError
        Set conn = asynconn.Connect("", "", ".", 5)
        Set session = conn.session
    
        Dim model As IpfcModel
        Set model = session.CurrentModel
        
        'Model File location
        Cells(2, "c").Select
        Selection.ClearContents
        Cells(2, "c") = session.GetCurrentDirectory
        
        'Model File Name
        Cells(4, "c").Select
        Selection.ClearContents
        Cells(4, "c") = model.Filename
               
        'Cells 초기화
        Range(Cells(7, "A"), Cells(Rows.Count, "A")).EntireRow.Delete
        
        'Feature LIST
        Dim Modelowner As IpfcModelItemOwner
        Set Modelowner = model
        Dim FeatureItems As IpfcModelItems
        Set FeatureItems = Modelowner.ListItems(EpfcModelItemType.EpfcITEM_FEATURE)
        Dim Feature As IpfcFeature
        
        'Feature Pattern
        Dim Featurepattern As IpfcFeaturePattern
        Dim PatternListMembers As IpfcFeatures
        Dim Pattern As IpfcFeature
           
        'Excel Display
        For i = 0 To FeatureItems.Count - 1
                  Set Feature = FeatureItems(i)
                  
                  If Feature.IsVisible = True Then
                        Cells(i + 7, "b") = Feature.FeatTypeName
                        Cells(i + 7, "c") = Feature.Number
                        Cells(i + 7, "d") = Feature.FeatType
                                                
                        Set Featurepattern = Feature.Pattern
                        
                        If Not Featurepattern Is Nothing Then
                           Set PatternListMembers = Featurepattern.ListMembers
                            
                           For j = 0 To PatternListMembers.Count - 1
                                Set Pattern = PatternListMembers(j)
                                Cells(i + 7, "e") = "Pattern"
                           Next j
                         End If

                   End If
                   
        Next i

    Call BlankrowDelete
     
    conn.Disconnect (2)
    
    'Cleanup
    Set asynconn = Nothing
    Set conn = Nothing
    Set session = Nothing
    Set model = Nothing
    

'RunError:
'
'    If Err.Number <> 0 Then
'        MsgBox "Process Failed : Unknown error occurred." + Chr(13) + _
'                "Error No: " + CStr(Err.Number) + Chr(13) + _
'                "Error: " + Err.Description, vbCritical, "Error"
'
'        If Not conn Is Nothing Then
'            If conn.IsRunning Then
'                conn.Disconnect (2)
'            End If
'        End If
'    End If

End Sub

Sub BlankrowDelete()

    Columns("B").SpecialCells(4).EntireRow.Delete

End Sub

 

Feature Name List v2 .xlsm
0.03MB

 

 

 

 

 

 

Feature ID 및 Feature 이름 검색 프로그램 # 1/2

Feature ID and Feature Name Search Program 모델 프로그램 실행 왼쪽 모델 Tree는 Feature를 추가 하면 자동적으로 Feature 이름이 제공 됩니다. Feature의 이름에 공란이 있습니다. "extrude 1", "Roun..

tool-2020.tistory.com

 

 

Business inquiries : lionkk@idt21c.com