Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ilogic code to update sheet metal thickness parameter not working

1 REPLY 1
SOLVED
Reply
Message 1 of 2
pball
1206 Views, 1 Reply

Ilogic code to update sheet metal thickness parameter not working

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

 

1 REPLY 1
Message 2 of 2
pball
in reply to: pball

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)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report