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

Model Information - IpfcModel

by ToolBOX01 2023. 10. 9.
반응형

□ IpfcModel.IsCommonNameModifiable()

모델 일반 이름(IpfcModel.CommonName)을 수정할 수 있는지 식별합니다.

Function	IsCommonNameModifiable () as Boolean

 

Option Explicit
Sub commonbool()

On Error GoTo RunError

    Dim asynconn As New pfcls.CCpfcAsyncConnection
    Dim conn As pfcls.IpfcAsyncConnection
    Dim BaseSession As pfcls.IpfcBaseSession
    Dim Session As IpfcSession
    Dim model As IpfcModel
    Dim commonbool As Boolean
    
    Set conn = asynconn.Connect("", "", ".", 5)
    Set BaseSession = conn.Session
    Set model = BaseSession.CurrentModel
    commonbool = model.IsCommonNameModifiable
    
    MsgBox commonbool
    
    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

 

IpfcModel.Descr

모델 설명자입니다.

Property	Descr as IpfcModelDescriptor

 

Option Explicit
Sub ModelDescriptor()

On Error GoTo RunError

    Dim asynconn As New pfcls.CCpfcAsyncConnection
    Dim conn As pfcls.IpfcAsyncConnection
    Dim BaseSession As pfcls.IpfcBaseSession
    Dim Session As IpfcSession
    Dim model As IpfcModel
    Dim ModelDescriptor As IpfcModelDescriptor
    
    Set conn = asynconn.Connect("", "", ".", 5)
    Set BaseSession = conn.Session
    Set model = BaseSession.CurrentModel
    Set ModelDescriptor = model.Descr
    
    MsgBox ModelDescriptor.GetExtension
    MsgBox ModelDescriptor.GetFileName
    MsgBox ModelDescriptor.GetFullName
    
    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

 

IpfcModel.IsModified

마지막 저장 이후 모델이 수정되었는지 여부를 지정하는 부울 플래그입니다.

Property	IsModified as Boolean

 

Option Explicit
Sub Modified()

On Error GoTo RunError

    Dim asynconn As New pfcls.CCpfcAsyncConnection
    Dim conn As pfcls.IpfcAsyncConnection
    Dim BaseSession As pfcls.IpfcBaseSession
    Dim Session As IpfcSession
    Dim model As IpfcModel
    Dim Modifiedboolean As Boolean
    
    Set conn = asynconn.Connect("", "", ".", 5)
    Set BaseSession = conn.Session
    Set model = BaseSession.CurrentModel
    Modifiedboolean = model.IsModified
    
    MsgBox Modifiedboolean
    
    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

 

□ IpfcModel.VersionStamp

버전 스탬프입니다. 버전 스탬프는 Creo Parametric 모델의 히스토리 및 변경 이력을 추적하기 위해 사용됩니다. 각각의 모델 변경 사항이나 버전 간의 비교를 가능하게 해줍니다. 버전 스탬프는 모델의 버전 관리와 협업 작업에서 중요한 역할을 합니다.

Property	VersionStamp as String

 

Option Explicit
Sub VersionStamp()

On Error GoTo RunError

    Dim asynconn As New pfcls.CCpfcAsyncConnection
    Dim conn As pfcls.IpfcAsyncConnection
    Dim BaseSession As pfcls.IpfcBaseSession
    Dim Session As IpfcSession
    Dim model As IpfcModel
    
    Set conn = asynconn.Connect("", "", ".", 5)
    Set BaseSession = conn.Session
    Set model = BaseSession.CurrentModel
    
    MsgBox model.VersionStamp
    
    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

 

□ IpfcModel.ListDependencies()

Creo Parametric 작업공간에서 모델에 대한 첫 번째 수준 종속성을 찾습니다.

Function	ListDependencies () as IpfcDependencies [optional]

 

□ IpfcModel.CleanupDependencies()

Creo Parametric 작업공간에서 객체의 종속성 데이터베이스를 강제로 정리합니다. 형상 생성, 정의 편집, 재구성과 같은 참조 변경 작업 중에는 이 함수를 호출하면 안 됩니다.

Sub	CleanupDependencies ()

 

□ IpfcModel.ListDeclaredModels()

모델에 대해 선언된 모든 첫 번째 수준 개체를 찾습니다. 레이아웃 A가 레이아웃 B에 선언되고 레이아웃 B가 파트 P에 선언된 경우 레이아웃 B만 반환됩니다.

Function	ListDeclaredModels () as IpfcModelDescriptors [optional]

 

□ IpfcModel.CheckIsModifiable()

해당 모델이 수정 가능한지 확인하여 하위 모델을 확인하지 않고 모델을 저장할 수 있음을 나타냅니다.
일반 모델의 경우 ShowUI가 true이면 모든 인스턴스도 확인됩니다.

Function	CheckIsModifiable (ShowUI as Boolean) as Boolean


□ IpfcModel.CheckIsSaveAllowed()

수정 상태 및 'save_objects' 구성 옵션에 따라 해당 모델을 함께 저장할 모든 하위 모델과 함께 저장할 수 있는지 확인합니다. 또한 현재 UI 컨텍스트를 확인하여 현재 모델을 저장하는 것이 안전한지 확인하므로 이 함수를 다른 시간에 호출하면 다른 결과가 반환될 수 있습니다.

Function	CheckIsSaveAllowed (ShowUI as Boolean) as Boolean

 


영업문의 : lionkk@idt21c.com
카카오 채널 : http://pf.kakao.com/_fItAxb

'VBA For Creo' 카테고리의 다른 글

Geometry Evaluation  (0) 2023.10.12
모델의 서피스 타입 구분 하기  (0) 2023.10.11
Model Operations  (0) 2023.10.06
Creo Template 프로그램 #2  (0) 2023.09.12
#1 IpfcAssembly  (0) 2023.08.20