Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'catvba
'DrawingView.ReferenceView sample
Option Explicit
Sub CATMain()
Dim doc As DrawingDocument
Set doc = CATIA.ActiveDocument
Dim vis As DrawingViews
Set vis = doc.Sheets.ActiveSheet.views
Dim vis_info() As Variant
ReDim vis_info(vis.Count)
vis_info(0) = Join(Array("-- name -- ", "-- type -- ", "-- refrence --"), " : ")
Dim vi_info(2) As String
Dim i As Long
For i = 1 To vis.Count
vi_info(0) = vis.Item(i).Name
vi_info(1) = GetViewtype(vis.Item(i))
vi_info(2) = GetRefViewName(vis.Item(i))
vis_info(i) = Join(vi_info, " : ")
Next
MsgBox Join(vis_info, vbCrLf)
End Sub
Private Function GetRefViewName( _
ByVal vi As DrawingView) _
As String
On Error GoTo ref_nothing
GetRefViewName = "from_" & vi.ReferenceView.Name
Exit Function
ref_nothing:
GetRefViewName = "nothing"
End Function
Private Function GetViewtype( _
ByVal vi As DrawingView) _
As String
Dim res As String
Select Case vi.ViewType()
Case CatDrawingViewType.catViewBackground
res = "Background"
Case CatDrawingViewType.catViewFront
res = "Front"
Case CatDrawingViewType.catViewLeft
res = "Left"
Case CatDrawingViewType.catViewRight
res = "Right"
Case CatDrawingViewType.catViewTop
res = "Top"
Case CatDrawingViewType.catViewBottom
res = "Bottom"
Case CatDrawingViewType.catViewRear
res = "Rear"
Case CatDrawingViewType.catViewAuxiliary
res = "Auxiliary"
Case CatDrawingViewType.catViewIsom
res = "Isom"
Case CatDrawingViewType.catViewSection
res = "Section"
Case CatDrawingViewType.catViewSectionCut
res = "SectionCut"
Case CatDrawingViewType.catViewDetail
res = "Detail"
Case CatDrawingViewType.catViewUntyped
res = "Untyped"
Case CatDrawingViewType.catViewMain
res = "Main"
Case CatDrawingViewType.catViewPure_Sketch
res = "Pure_Sketch"
Case CatDrawingViewType.catViewUnfolded
res = "Unfolded"
Case Else
res = "unknown"
End Select
GetViewtype = res
End Function
Private Function GetRefViewName( _
ByVal vi As DrawingView) _
As String
On Error GoTo ref_nothing
GetRefViewName = "from_" & vi.ReferenceView.Name
Exit Function
ref_nothing:
Dim pv As DrawingView
Set pv = vi.GenerativeBehavior.ParentView 'Section & Detail
If pv Is Nothing Then GoTo parent_nothing
GetRefViewName = "from_" & pv.Name
Exit Function
parent_nothing:
GetRefViewName = "nothing"
End Function