01-16-2023
02:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
01-16-2023
02:03 AM
Hi, sorry for the late response - i've been caught up in learning iLogic, as i find it very fun to write.
The frustration i get from a non functioning code just gives me more drive to solve it, so i end up hyperfocusing on it and forget everything else around me, so i just now remembered that i made this post.
I ended up going away from the embedding/replace embedded file method and decided using goexcel. I've created a standard sheet layout which is locked, so the people using my tool wont be able to mess up the cells, then i set iLogic to read from the driving sheet cells. which reference a userfriendly sheet within the same excel file.
solved my issue by using the following code:
'Declare Iventor File Dialog Dim oFileDlg As Inventor.FileDialog Dim oDocFile As Document, oDocFileName As String 'Run File Selection Code InventorVb.Application.CreateFileDialog(oFileDlg) 'Allow Selection Of Excel Files oFileDlg.Filter = "Excel Spec Sheet (*.xls;*.xlsx;*xlsm)|*.xls;*.xlsx;*xlsm" 'Get File Path, setting the initial path to the same folder that the model is saved In. oFileDlg.InitialDirectory = ThisDoc.Path oFileDlg.CancelError = True On Error Resume Next 'Show Open File Dialog Window. oFileDlg.ShowOpen() If oFileDlg.FileName = "" MessageBox.Show("No File Selected", "Error") GoTo LAUNCH_FORM End If 'declares selected file name Dim xSpec As String = oFileDlg.FileName 'Set Filename parameter to the path. Parameter("Filename") = xSpec Parameter("Veneer:1", "VeneerDepth") = VeneerDepthBuild Parameter("Veneer:1", "VeneerWidth") = VeneerWidthBuild Parameter("Veneer:1", "VeneerHeight") = VeneerHeightBuild Parameter("CrossBar:1", "CrossH") = CrossHeightBuild Parameter("CrossBar:1", "CrossD") = CrossDepthBuild Parameter("CrossBar:1", "CrossW") = CrossWidthBuild Parameter("CrossBar:2", "CrossH") = CrossHeightBuild Parameter("CrossBar:2", "CrossD") = CrossDepthBuild Parameter("CrossBar:2", "CrossW") = CrossWidthBuild Parameter("CrossOffBot") = CrossOffBuild Parameter("CtopOffset") = CtopOffsetBuild GoExcel.Open(xSpec, "Driver") VeneerHeightBuild = GoExcel.CellValue(xSpec, "Driver", "B7") VeneerDepthBuild = GoExcel.CellValue(xSpec, "Driver", "C7") VeneerWidthBuild = GoExcel.CellValue(xSpec, "Driver", "D7") CrossHeightBuild = GoExcel.CellValue(xSpec, "Driver", "B6") CrossDepthBuild = GoExcel.CellValue(xSpec, "Driver", "C6") CrossWidthBuild = GoExcel.CellValue(xSpec, "Driver", "H12") CrossOffBuild = GoExcel.CellValue(xSpec, "Driver", "H7") CtopOffsetBuild = GoExcel.CellValue(xSpec, "Driver", "H8") FirstVeneerOffset = GoExcel.CellValue(xSpec, "Driver", "-H6") ModuleDim = GoExcel.CellValue(xSpec, "Driver", "D6") GoExcel.close 'ask if user wants to update dialog question = MessageBox.Show("Update model To spec sheet?", "xxx Gen v.3", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) If question = vbYes Then Parameter.UpdateAfterChange = True iLogicVb.UpdateWhenDone = True Parameter("Filename") = xSpec Parameter("Veneer:1", "VeneerDepth") = VeneerDepthBuild Parameter("Veneer:1", "VeneerWidth") = VeneerWidthBuild Parameter("Veneer:1", "VeneerHeight") = VeneerHeightBuild Parameter("CrossBar:1", "CrossH") = CrossHeightBuild Parameter("CrossBar:1", "CrossD") = CrossDepthBuild Parameter("CrossBar:1", "CrossW") = CrossWidthBuild Parameter("CrossBar:2", "CrossH") = CrossHeightBuild Parameter("CrossBar:2", "CrossD") = CrossDepthBuild Parameter("CrossBar:2", "CrossW") = CrossWidthBuild Parameter("CrossOffBot") = -CrossOffBuild Parameter("CtopOffset") = CtopOffsetBuild Else If question = vbNo Then Parameter.UpdateAfterChange = False iLogicVb.UpdateWhenDone = False Parameter("Veneer:1", "VeneerDepth") = DefaultVD Parameter("Veneer:1", "VeneerWidth") = DefaultVW Parameter("Veneer:1", "VeneerHeight") = DefaultVH Parameter("CrossBar:1", "CrossH") = DefaultCH Parameter("CrossBar:1", "CrossD") = DefaultCD Parameter("CrossBar:1", "CrossW") = DefaultCW Parameter("CrossBar:2", "CrossH") = DefaultCH Parameter("CrossBar:2", "CrossD") = DefaultCD Parameter("CrossBar:2", "CrossW") = DefaultCW End If LAUNCH_FORM: iLogicForm.Show("xxx Product Generator")