Forum Replies Created
as discussed , I started to retrieve information from a list of catparts,
using the code published in your book.
Now I would like to be able to run this script on every part and export the properties into the same Excel sheet. ( like I am showing in this code)
Any ideas how to add on to my code to accomplish this?
Remarks: The code opens the excel sheet but is not able to export the properties of the catparts.
Any ideas how to fix this issue?
Thanks and regards
Dim documents1 As Documents
Set documents1 = CATIA.Documents
MsgBox “The number of documents is ” & documents1.Count
Dim doc1 As String
Set doc1 = documents1.Item(1)
‘For Each doc1 in documents1
Dim partDoc1 as PartDocument
Set partDoc1 = doc1
Dim Excel As Object
Dim workbooks As workbooks
Dim workbook As workbook
Dim worksheet As Excel.worksheet
On Error Resume Next
Set Excel = GetObject(, “EXCEL.Application”)
If Err.Number <> 0 Then
Set Excel = CreateObject(“EXCEL.Application”)
MsgBox “Please note you have to close Excel”, vbCritical
Excel.Visible = True
‘load a sheet
Set workbooks = Excel.Application.workbooks
Set myworkbook = Excel.workbooks.Add
Set myworksheet = Excel.ActiveWorkbook.Add
Set myworksheet = Excel.Sheets.Add
‘download the properties
Excel.Cells(2, 2) = getThickness
Excel.Cells(2, 3) = getMaterial
Excel.Cells(2, 4) = getMass
thanks again for your nice reply.
The macro I want to create should do the steps described below
From a list of CAT Parts
1. Open a CATpart
2. Retrieve info from catpart (part number etc..)
3. Change viewpoint to iso and hide the specification tree.
4. Reframe part in window so that it is all visible.
5. Take picture and store it in required location with specific filename (probably the catpart filename and the current date / time and the fileextension for the picture type.)
6. Write info including hyperlink to open picture to an empty line in an excel file.
7. Close the catpart
8. Goto step 1.
Regarding step number 2 I didn’ t find info regarding this topic and also I dont know how to create the loop in order to save the list of images.
Thanks again and regards
PS: My current version is CATIA V5 R24