Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have iLogic which works perfect.
Is it possible?
1) add options, when I run iLogic, first open window with message "Please check ....." with two button. "Ok" and "Cancel". If I click "Ok" iLogic continiusly work, if I click "Cancel" iLogic aboort.
2) add image in this windows
Sub Main
Dim fileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(fileDlg)
fileDlg.Filter = "Spredsheet Files (*.xls) (*.xlsx) (*.xlsm) (*.xlsb)|*.xls; *.xlsx; *.xlsm; *.xlsb"
'Set open location using one of these 2 options below, "1)Hard coded" or "2)Project location":
'fileDlg.InitialDirectory = "D:\INVENTOR DATA\PROJEKTI\" 'Hard Coded path:
fileDlg.InitialDirectory = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
'Show File Open Dialogue
fileDlg.DialogTitle = "Browse for XLS File"
fileDlg.ShowOpen()
Dim xlFile As String = fileDlg.FileName
If xlFile = "" Then : Exit Sub: End If
'Open Excel file.
GoExcel.Open(xlFile, "Job Sheet")
Dim doc As Document = ThisDoc.Document
Dim trans As Transaction = ThisApplication.TransactionManager.StartTransaction(doc, "Custom Properties Import") 'Make this a single transaction
Dim filename As String = Nothing
processDocument(filename,xlFile)
If doc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
'Traverse all referenced documents.
For Each refDoc As Document In doc.AllReferencedDocuments
'Avoid readonly files like CC and Library.
If refDoc.IsModifiable Then
filename = IO.Path.GetFileName(refDoc.FullFileName)
processDocument(filename,xlFile)
End If
Next
End If
'Close Excel file.
GoExcel.Close
trans.End 'End the trasaction
MessageBox.Show("Job Sheet Successfully Imported", "iLogic")
End Sub
Sub processDocument(filename As String, xlFile As String)
'Read from Excel file
iProperties.Value(filename,"Custom", "Referenced Spreadsheet File Name") = xlFile
iProperties.Value(filename,"Custom", "AreaCode") = GoExcel.CellValue("H4")
iProperties.Value(filename,"Custom", "AreaName") = GoExcel.CellValue("C4")
iProperties.Value(filename,"Custom", "ComponentCode") = GoExcel.CellValue("H7")
iProperties.Value(filename,"Custom", "ComponentName") = GoExcel.CellValue("C7")
iProperties.Value(filename,"Custom", "Priority") = GoExcel.CellValue("P7")
iProperties.Value(filename,"Custom", "D365WoNumber") = GoExcel.CellValue("H8")
iProperties.Value(filename,"Custom", "DWGName") = GoExcel.CellValue("C6")
iProperties.Value(filename,"Custom", "DWGRef") = GoExcel.CellValue("H6")
iProperties.Value(filename,"Custom", "FSCReg") = GoExcel.CellValue("N20")
iProperties.Value(filename,"Custom", "HealthSafetySheets") = GoExcel.CellValue("H19")
iProperties.Value(filename,"Custom", "IssuedTo") = GoExcel.CellValue("P6")
iProperties.Value(filename,"Custom", "ItemCode") = GoExcel.CellValue("H5")
iProperties.Value(filename,"Custom", "ItemName") = GoExcel.CellValue("C5")
iProperties.Value(filename,"Custom", "JobDescription") = GoExcel.CellValue("A9")
iProperties.Value(filename,"Custom", "LoadList") = GoExcel.CellValue("C20")
iProperties.Value(filename,"Custom", "Notes01") = GoExcel.CellValue("A10")
iProperties.Value(filename,"Custom", "Notes02") = GoExcel.CellValue("A11")
iProperties.Value(filename,"Custom", "Notes03") = GoExcel.CellValue("A12")
iProperties.Value(filename,"Custom", "Notes04") = GoExcel.CellValue("A13")
iProperties.Value(filename,"Custom", "Notes05") = GoExcel.CellValue("A14")
iProperties.Value(filename,"Custom", "Notes06") = GoExcel.CellValue("A15")
iProperties.Value(filename,"Custom", "Notes07") = GoExcel.CellValue("A16")
iProperties.Value(filename,"Custom", "Notes08") = GoExcel.CellValue("A17")
iProperties.Value(filename,"Custom", "Notes09") = GoExcel.CellValue("A18")
iProperties.Value(filename,"Custom", "ProjectCode") = GoExcel.CellValue("H3")
iProperties.Value(filename,"Custom", "Project_Name") = GoExcel.CellValue("C3")
iProperties.Value(filename,"Custom", "RefDrawing") = GoExcel.CellValue("C6")
iProperties.Value(filename,"Custom", "TehnicalDataSheets") = GoExcel.CellValue("P19")
iProperties.Value(filename,"Custom", "LoadList") = GoExcel.CellValue("C20")
iProperties.Value(filename,"Custom", "UnitQty1") = GoExcel.CellValue("A22")
iProperties.Value(filename,"Custom", "UnitQty2") = GoExcel.CellValue("A23")
iProperties.Value(filename,"Custom", "UnitQty3") = GoExcel.CellValue("A24")
iProperties.Value(filename,"Custom", "UnitName1") = GoExcel.CellValue("B22")
iProperties.Value(filename,"Custom", "UnitName2") = GoExcel.CellValue("B23")
iProperties.Value(filename,"Custom", "UnitName3") = GoExcel.CellValue("B24")
iProperties.Value(filename,"Custom", "UnitEmpty1") = GoExcel.CellValue("C22")
iProperties.Value(filename,"Custom", "UnitEmpty2") = GoExcel.CellValue("C23")
iProperties.Value(filename,"Custom", "UnitEmpty3") = GoExcel.CellValue("C24")
iProperties.Value(filename,"Custom", "UnitDescription1") = GoExcel.CellValue("D22")
iProperties.Value(filename,"Custom", "UnitDescription2") = GoExcel.CellValue("D23")
iProperties.Value(filename,"Custom", "UnitDescription3") = GoExcel.CellValue("D24")
End Sub
Solved! Go to Solution.