You are on page 1of 2

Dim z(30) As String

Dim temp As Integer


Dim temp2 As Integer

Sub CATMain()
Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument
Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets
Dim f As String
f = Replace(drawingDocument1.Name, ".CATDrawing", "")
Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.Item(f)
f = f + ".CATProduct"
Dim documents1 As Documents
Set documents1 = CATIA.Documents
Dim oProdDoc As ProductDocument
Set oProdDoc = documents1.Item(f)
Dim oRootProd As Product
Set oRootProd = oProdDoc.Product
A = 0
Dim par As Parameters
Set par = oRootProd.UserRefProperties
Dim SinexRef As String
Dim DrwDoc As DrawingDocument
Set DrwDoc = CATIA.ActiveDocument
Call WalkDownTree(oRootProd, A)
Dim shActiveSheet As DrawingSheet
Set shActiveSheet = DrwDoc.Sheets.ActiveSheet
Dim vwActiveView As DrawingView
Set vwActiveView = shActiveSheet.Views.ActiveView
'------------------
' CREATE TABLE
'-----------------
' table position: 350, 150
' number of rows equal to 10
' number of columns: 4
' row height: 20
' column width: 50
Dim tblTable As DrawingTable
Set tblTable = vwActiveView.Tables.Add(300, 300, temp + 1, 5, 10, auto)

' set table caption


Dim i As Integer
i = 0
For h = 0 To temp

tblTable.SetCellString 1, 1, "SR.NO."
tblTable.SetCellString 2, 1, "01"
tblTable.SetCellString 3, 1, "02"
tblTable.SetCellString 4, 1, "03"
tblTable.SetCellString 5, 1, "04"
tblTable.SetCellString 6, 1, "05"
tblTable.SetCellString 7, 1, "06"
tblTable.SetCellString 3, 2, z(1)
i = i + 1

Next
MsgBox temp
End Sub
Sub WalkDownTree(oInProduct As Product, B)
Dim k As Integer
Dim oInstances As Products
Set oInstances = oInProduct.Products
If B <> 0 Then
z(B - 1) = oInProduct.ReferenceProduct.PartNumber
temp = B
End If
For k = 1 To oInstances.Count
Dim oInst As Product
Set oInst = oInstances.Item(k)
Call WalkDownTree(oInst, k)
Next
End Sub

You might also like