반응형
모데의 서피스 타입을 구분 하는 코드 입니다. 서피스 타입은 "숫자"로 표시 합니다
Type "0" | Type "1" | Type "2" |
Option Explicit
Sub Surfacetype()
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 ModelItemOwner As IpfcModelItemOwner
Dim ModelItems As IpfcModelItems
Dim ModelItem As IpfcModelItem
Dim Surface As IpfcSurface
Set conn = asynconn.Connect("", "", ".", 5)
Set BaseSession = conn.Session
Set model = BaseSession.CurrentModel
Set ModelItemOwner = model
'// Solid Model Surface List
Set ModelItems = ModelItemOwner.ListItems(EpfcModelItemType.EpfcITEM_SURFACE)
Dim i As Integer
For i = 0 To ModelItems.Count - 1
Set ModelItem = ModelItems.Item(i)
Set Surface = ModelItem
MsgBox Surface.GetSurfaceType
Next i
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
영업문의 : lionkk@idt21c.com
카카오 채널 : http://pf.kakao.com/_fItAxb
'VBA For Creo' 카테고리의 다른 글
#1 Creo 엑셀 VBA 코드 :: 개발 환경 설정 하기 (0) | 2023.12.21 |
---|---|
Geometry Evaluation (0) | 2023.10.12 |
Model Information - IpfcModel (0) | 2023.10.09 |
Model Operations (0) | 2023.10.06 |
Creo Template 프로그램 #2 (0) | 2023.09.12 |