본문 바로가기
  • 환영 합니다 ! Welcome!
VBA For Creo

Creo Dimension을 Regenerate 하는 코드

by ToolBOX01 2022. 9. 19.
반응형

■ IpfcRegenInstructions 기능

이 클래스는 솔리드 재생성을 위한 지침을 설명합니다. 재생성 기능을 사용하려면 "CCpfcRegenInstructions" 함수를  정의 해야 합니다.  "IpfcModel" 함수를 호출 하여  재생성을 실행 합니다,

 

▶ Function CCpfcRegenInstructions

Function CCpfcRegenInstructions.Create는 새로운  RegenInstructions 개체를 만듭니다.

- Parameters:

○ AllowFixUI As Boolean

이것이 "true"이면 오류가 있는 경우 모델 수정 인터페이스가 표시됩니다. false인 경우 Fix Model 인터페이스가 표시되지 않습니다. (null이 전달되면 false로 간주됩니다.)


○ ForceRegen As Boolean
현재 버전 사용 불가. Pass null.


○ FromFeat As Boolean
현재 버전 사용 불가. Pass null.

 

- Returns:
새로운 RegenInstructions 객체를 반환 합니다

 

Function CCpfcRegenInstructions 사용 코드 예)

'SET Regenerate
Dim RegenInstructions As New CCpfcRegenInstructions
Dim oInstrs As IpfcRegenInstructions: Set oInstrs = RegenInstructions.Create(True, True, Nothing)
Dim oSolid As IpfcSolid: Set oSolid = model

 

[ 실패 진단 대화상자 표시 ]

 

'SET Regenerate
Dim RegenInstructions As New CCpfcRegenInstructions
Dim oInstrs As IpfcRegenInstructions: Set oInstrs = RegenInstructions.Create(false, false, Nothing)
Dim oSolid As IpfcSolid: Set oSolid = model

 

[ 에러 표시]

 

- Creo 모델에서 "Regenerate" 상태가 성공인 상태 값 까지 변경 됩니다. 오류가 발생 하면 프로그램에서 에러 메세지 상자가 표시 됩니다. 

■ Regenerate 실행을 위한 소스 코드

 

        Dim asynconn As New pfcls.CCpfcAsyncConnection
        Dim conn As pfcls.IpfcAsyncConnection: Set conn = asynconn.Connect("", "", ".", 5)
        Dim session As pfcls.IpfcBaseSession: Set session = conn.session
        Dim model As IpfcModel: Set model = session.CurrentModel

 

        'SET Regenerate
        Dim RegenInstructions As New CCpfcRegenInstructions
        Dim oInstrs As IpfcRegenInstructions

        Set oInstrs = RegenInstructions.Create(false, false, Nothing)
        Dim oSolid As IpfcSolid: Set oSolid = model

 

        'Regenerate 실행

        Call oSolid.Regenerate(oInstrs)
        Call oSolid.Regenerate(oInstrs)

        

 

 

 

 

 

 

 

VBA property(속성), method(함수) 정리

1. property(속성) ・Selection : 선택된 개체를 반환한다. active~ 와 다른 점은 Selection 속성은 하나...

blog.naver.com