I have something similar in my "Parameters" rule (see below), would it be better to incorporate as you have suggested?
If Parameter("Cassette_Width") > Parameter("Cassette_Height")
iProperties.Value("Custom", "Orientation") = "HORIZONTAL"
iProperties.Value("Custom", "ProgramHeight") = Parameter("Cassette_Height")
iProperties.Value("Custom", "ProgramWidth") = Parameter("Cassette_Width")
iProperties.Value("Custom", "Gauge") = Parameter("Thickness")
iProperties.Value("Custom", "Height") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Width") = Parameter("Cassette_Width")
iProperties.Value("Custom", "StiffLength") = Parameter("Cassette_Height")-10
Length = SheetMetal.FlatExtentsLength
Girth = SheetMetal.FlatExtentsWidth
iProperties.Value("Custom", "Length")= Round(Length,1)
iProperties.Value("Custom", "Girth") = Round(Girth, 1)
iProperties.Value("Custom", "Depth") = Parameter("Depth")
iProperties.Value("Custom", "Path") = ThisDoc.Path
ElseIf Parameter("Cassette_Height") > Parameter("Cassette_Width")
iProperties.Value("Custom", "Orientation") = "VERTICAL"
iProperties.Value("Custom", "ProgramHeight") = Parameter("Cassette_Width")
iProperties.Value("Custom", "ProgramWidth") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Gauge") = Parameter("Thickness")
iProperties.Value("Custom", "Height") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Width") = Parameter("Cassette_Width")
iProperties.Value("Custom", "StiffLength") = Parameter("Cassette_Width")-10
Length = SheetMetal.FlatExtentsLength
Girth = SheetMetal.FlatExtentsWidth
iProperties.Value("Custom", "Length")= Round(Length,1)
iProperties.Value("Custom", "Girth") = Round(Girth, 1)
iProperties.Value("Custom", "Depth") = Parameter("Depth")
iProperties.Value("Custom", "Path") = ThisDoc.Path
ElseIf Parameter("Cassette_Width") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Orientation") = "VERTICAL"
iProperties.Value("Custom", "ProgramHeight") = Parameter("Cassette_Width")
iProperties.Value("Custom", "ProgramWidth") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Gauge") = Parameter("Thickness")
iProperties.Value("Custom", "Height") = Parameter("Cassette_Height")
iProperties.Value("Custom", "Width") = Parameter("Cassette_Width")
iProperties.Value("Custom", "StiffLength") = Parameter("Cassette_Width")-10
Length = SheetMetal.FlatExtentsLength
Girth = SheetMetal.FlatExtentsWidth
iProperties.Value("Custom", "Length")= Round(Length,1)
iProperties.Value("Custom", "Girth") = Round(Girth, 1)
iProperties.Value("Custom", "Depth") = Parameter("Depth")
iProperties.Value("Custom", "Path") = ThisDoc.Path
End If
The above code is driven by this master code that reads an excel spreadsheet
'Dim exl As String
'exl = SharedVariable("exl")
xlspath = ThisDoc.Path & "/ORDER FORM.xlsx"
Dim oExcelRow As String
oExcelRow = iProperties.Value("Custom", "ExcelRow")
Dim oExcelRow2 As String
oExcelRow2 = oExcelRow + 1
iProperties.Value("Custom", "ExcelRow") = oExcelRow2
'GoExcel.Open(sharedvariable("exl"))
'A = CASSETTE ID
'B = CASSETTE QTY
'C = CASSETTE WIDTH
'D = CASSETTE HEIGHT
'E = CASSETTE LENGTH
'F = CASSETTE GIRTH
'G = FACADE TYPE
'H = CASSETTE JOINT TYPE
'I = LAY DIRECTION
'K = CASSETTE DEPTH
'K = TOP HOLE CENTRES (A)
'L = BOTTOM HOLE CENTRES (A)
'M = MACHINE ROUTE
'N = SAP NO.
'O = LINE NO.
'P = NOTES
'Q = STIFFENERS
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette ID
iProperties.Value("Project", "Part Number") = GoExcel.CellValue(xlspath, "Sheet1","A" & iProperties.Value("Custom", "ExcelRow"))
If GoExcel.CellValue("A" & iProperties.Value("Custom", "ExcelRow")) = Nothing
MessageBox.Show("CASSETTE NUMBER CELL BLANK", "Error")
iProperties.Value("Project", "Part Number") = "ERROR"
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Qty
iProperties.Value("Custom", "Qty") = GoExcel.CellValue(xlspath, "Sheet1","B" & iProperties.Value("Custom", "ExcelRow"))
If GoExcel.CellValue("B" & iProperties.Value("Custom", "ExcelRow")) = Nothing
MessageBox.Show("CASSETTE QTY CELL BLANK", "Error")
iProperties.Value("Custom", "Qty") = "ERROR"
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Height
Parameter("Cassette_Height") = GoExcel.CellValue(xlspath, "Sheet1","D" & iProperties.Value("Custom", "ExcelRow"))
If GoExcel.CellValue("D" & iProperties.Value("Custom", "ExcelRow")) = Nothing
MessageBox.Show("CASSETTE HEIGHT CELL BLANK", "Error")
Parameter("Cassette_Height") = 600
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Width
Parameter("Cassette_Width") = GoExcel.CellValue(xlspath, "Sheet1","C" & iProperties.Value("Custom", "ExcelRow"))
If GoExcel.CellValue("C" & iProperties.Value("Custom", "ExcelRow")) = Nothing
MessageBox.Show("CASSETTE WIDTH CELL BLANK", "Error")
Parameter("Cassette_Width") = 600
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Depth
iProperties.Value("Custom", "Depth") = GoExcel.CellValue(xlspath, "Sheet1","K" & iProperties.Value("Custom", "ExcelRow"))
Parameter("Depth2") = iProperties.Value("Custom", "Depth")+1
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Joint Type
iProperties.Value("Summary", "Title") = GoExcel.CellValue(xlspath, "Sheet1","H" & iProperties.Value("Custom", "ExcelRow"))
If iProperties.Value("Summary", "Title") = "Bottom Starter"
iProperties.Value("Custom", "Type") = "BOTTOM STARTER"
ElseIf iProperties.Value("Summary", "Title") = "Bottom Intermediate"
iProperties.Value("Custom", "Type") = "BOTTOM INTERMEDIATE"
ElseIf iProperties.Value("Summary", "Title") = "Bottom End"
iProperties.Value("Custom", "Type") = "BOTTOM END"
ElseIf iProperties.Value("Summary", "Title") = "Inter Starter"
iProperties.Value("Custom", "Type") = "INTERMEDIATE STARTER"
ElseIf iProperties.Value("Summary", "Title") = "Intermediate"
iProperties.Value("Custom", "Type") = "INTERMEDIATE"
ElseIf iProperties.Value("Summary", "Title") = "Inter End"
iProperties.Value("Custom", "Type") = "INTERMEDIATE END"
ElseIf iProperties.Value("Summary", "Title") = "Top Starter"
iProperties.Value("Custom", "Type") = "TOP STARTER"
ElseIf iProperties.Value("Summary", "Title") = "Top Intermediate"
iProperties.Value("Custom", "Type") = "TOP INTER"
ElseIf iProperties.Value("Summary", "Title") = "Top End"
iProperties.Value("Custom", "Type") = "TOP END"
ElseIf GoExcel.CellValue(xlspath, "Sheet1","G" & iProperties.Value("Custom", "ExcelRow")) = Nothing
MessageBox.Show("CASSETTE TYPE CELL BLANK", "Error")
iProperties.Value("Summary", "Title") = "ERROR"
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Cassette Lay Direction
iProperties.Value("Custom", "Lay") = GoExcel.CellValue(xlspath, "Sheet1","I" & iProperties.Value("Custom", "ExcelRow"))
'//Bottom Starter
If iProperties.Value("Summary", "Title") = "Bottom Starter"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("BS-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("BS-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Bottom Inter
ElseIf iProperties.Value("Summary", "Title") = "Bottom Intermediate"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("BI-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("BI-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Bottom End
ElseIf iProperties.Value("Summary", "Title") = "Bottom End"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("BE-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("BE-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Inter Starter
ElseIf iProperties.Value("Summary", "Title") = "Inter Starter"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("IS-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("IS-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Intermediate
ElseIf iProperties.Value("Summary", "Title") = "Intermediate"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("II-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("II-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Inter End
ElseIf iProperties.Value("Summary", "Title") = "Inter End"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("IE-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("IE-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Top Starter
ElseIf iProperties.Value("Summary", "Title") = "Top Starter"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("TS-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("TS-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'//Top Inter
ElseIf iProperties.Value("Summary", "Title") = "Top Intermediate"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("TI-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("TI-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'// Top End
ElseIf iProperties.Value("Summary", "Title") = "Top End"
If iProperties.Value("Custom", "Lay") = "L to R"
iLogicVb.RunRule("TE-LtoR")
ElseIf iProperties.Value("Custom", "Lay") = "R to L"
iLogicVb.RunRule("TE-RtoL")
ElseIf iProperties.Value("Custom", "Lay") = Nothing
MessageBox.Show("LAY DIRECTION CELL BLANK", "Error")
iProperties.Value("Custom", "Lay") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'// NO TYPE
ElseIf iProperties.Value("Summary", "Title") = "ERROR"
iLogicVb.RunRule("RESET")
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
''// Top Hole Centres
'Parameter("TopHoleGap") = GoExcel.CellValue(xlspath, "Sheet1","K" & iProperties.Value("Custom", "ExcelRow"))
''////////////////////////////////////////////////////////////////////////////////////////////////////////
''// Bottom Hole Centres
'Parameter("BottomHoleGap") = GoExcel.CellValue(xlspath, "Sheet1","K" & iProperties.Value("Custom", "ExcelRow"))
''////////////////////////////////////////////////////////////////////////////////////////////////////////
''// Left Hole Centres
'Parameter("LeftHoleGap") = GoExcel.CellValue(xlspath, "Sheet1","L" & iProperties.Value("Custom", "ExcelRow"))
''////////////////////////////////////////////////////////////////////////////////////////////////////////
''// Right Hole Centres
'Parameter("RightHoleGap") = GoExcel.CellValue(xlspath, "Sheet1","L" & iProperties.Value("Custom", "ExcelRow"))
'////////////////////////////////////////////////////////////////////////////////////////////////////////
InventorVb.DocumentUpdate()
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Flat Pattern Extents
'//Vertical Cassette
If Parameter("Cassette_Height") >= Parameter("Cassette_Width")
iProperties.Value("Custom", "Orientation") = "VERTICAL"
Length = SheetMetal.FlatExtentsLength
iProperties.Value("Custom", "Girth") = Round(Length, 1)
Girth = SheetMetal.FlatExtentsWidth
iProperties.Value("Custom", "Length") = Round(Girth, 1)
GoExcel.CellValue(xlspath, "Sheet1","E" & iProperties.Value("Custom", "ExcelRow")) = iProperties.Value("Custom", "Length")
GoExcel.CellValue(xlspath, "Sheet1","F" & iProperties.Value("Custom", "ExcelRow")) = iProperties.Value("Custom", "Girth")
'//Horizontal Cassette
Else
iProperties.Value("Custom", "Orientation") = "HORIZONTAL"
Length = SheetMetal.FlatExtentsLength
iProperties.Value("Custom", "Length") = Round(Length, 1)
Girth = SheetMetal.FlatExtentsWidth
iProperties.Value("Custom", "Girth") = Round(Girth, 1)
GoExcel.CellValue(xlspath, "Sheet1","E" & iProperties.Value("Custom", "ExcelRow")) = iProperties.Value("Custom", "Length")
GoExcel.CellValue(xlspath, "Sheet1","F" & iProperties.Value("Custom", "ExcelRow")) = iProperties.Value("Custom", "Girth")
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
'// Other Stuff
iProperties.Value("Custom", "Machine Route") = GoExcel.CellValue(xlspath, "Sheet1", "M" & iProperties.Value("Custom", "ExcelRow"))
iProperties.Value("Custom", "SAP Order No.") = GoExcel.CellValue(xlspath, "Sheet1", "N" & iProperties.Value("Custom", "ExcelRow"))
iProperties.Value("Custom", "LineNo.") = GoExcel.CellValue(xlspath, "Sheet1", "O" & iProperties.Value("Custom", "ExcelRow"))
iProperties.Value("Custom", "Stiffened") = GoExcel.CellValue(xlspath, "Sheet1", "T" & iProperties.Value("Custom", "ExcelRow"))
If iProperties.Value("Custom", "Stiffened") = "Stiffened"
iProperties.Value("Custom", "StiffQty") = GoExcel.CellValue(xlspath, "Sheet1", "U" & iProperties.Value("Custom", "ExcelRow")) * iProperties.Value("Custom", "Qty")
ElseIf iProperties.Value("Custom", "Stiffened") = "Un-Stiffened"
iProperties.Value("Custom", "StiffQty") = 0
End If
'////////////////////////////////////////////////////////////////////////////////////////////////////////
GoExcel.Save
iLogicForm.Show("NextCassette")