I'm trying to make a new sheet metal template which will automatically update some parameters that will be used in the iproperties. I have two thirds of the stuff working but I'm getting an error when it tries to create the thickness parameter.
In the Ilogic code I have a few checks to see what thickness the material is and then I try to change or create the thickness parameter. I might just have something wrong since I'm trying to create a text parameter while the other ones are numeric. You can manually run the code or it'll run on save and pop up with an error. This isn't done yet as I don't have all the sheet metal thicknesses added yet and the iproperties set.
If I create the sheetmetalthickness text parameter I no longer receive the error, but I'm picky and like fixing code instead of using work arounds.
The code in question, full code is in the 2014 inventor part attached.
If (Thickness = .125) Then shtthickness = "11 GA" ElseIf (Thickness = .1875) Then shtthickness = "7 GA" Else shtthickness = "??" End If Try oUserParams("SheetMetalThickness").Value = shtthickness Catch ' assume error means not found and create it oUserParams.AddByValue("SheetMetalThickness", shtthickness, kTextPropertyType) End Try
Solved! Go to Solution.
Solved by pball. Go to Solution.
Found the answer searching some more. Just used the wrong unit type in the command.
WRONG
oUserParams.AddByValue("SheetMetalThickness", shtthickness, kTextPropertyType)
RIGHT
oUserParams.AddByValue("SheetMetalThickness", shtthickness, kTextUnits)