- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm making an automation wich generates and positions configurations of a parametric model in an assembly.
I'm want to try and use an excel file to store all made configurations and have the program check if a configuration already exists. if the configuration exists it has to replace it with the existing one.
At the moment i'm trying to do it with a for next loop but honestly i have no idea if this is the right approach.
Does anyone have an idea how i would go about doing this? Maybe excel is not the best way to do this?
I'm not looking for someone to fix my code but a little push in the right direction would be a great help.
I want to try and avoid using iParts and the content center for now.
Dim count2 As Double For count2 = oRowStart To oRowEnd If GoExcel.CellValue(ExcelFile, "Blad1", "B" & count2) = Parameter(bouwgoot.Name, "goot_soort") And GoExcel.CellValue(ExcelFile, "Blad1", "C" & count2) = Parameter(bouwgoot.Name, "goot_type") And GoExcel.CellValue(ExcelFile, "Blad1", "D" & count2) = Parameter(bouwgoot.Name, "goot_lengte") Then bouwreplace = GoExcel.CellValue("A" & count2) & ".iam" Component.Replace(bouwgoot.Name, bouwreplace, False) ThisApplication.FileManager.DeleteFile(bouwgootKopie) ElseIf GoExcel.CellValue(ExcelFile, "Blad1", "B" & count2) IsNot Parameter(bouwgoot.Name, "goot_soort") Or GoExcel.CellValue(ExcelFile, "Blad1", "C" & count2) IsNot Parameter(bouwgoot.Name, "goot_type") Or GoExcel.CellValue(ExcelFile, "Blad1", "D" & count2) IsNot Parameter(bouwgoot.Name, "goot_lengte") Then GoExcel.CellValue(ExcelFile, "Blad1", "A" & oEmptyRow) = System.IO.Path.GetFileNameWithoutExtension(bouwgootKopie) GoExcel.CellValue(ExcelFile, "Blad1", "B" & oEmptyRow) = Parameter(bouwgoot.Name, "goot_soort") GoExcel.CellValue(ExcelFile, "Blad1", "C" & oEmptyRow) = Parameter(bouwgoot.Name, "goot_type") GoExcel.CellValue(ExcelFile, "Blad1", "D" & oEmptyRow) = Parameter(bouwgoot.Name, "goot_lengte") GoExcel.Save Exit For End If Next
Note: i dont get any error messages but the program just writes new values in excel.
Sometimes the component will get replaced but not when all 3 parameters actually exist.
Regards,
Jeremy
Solved! Go to Solution.