Autodesk Inventor
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Does anyone know a way or a code to physically change the sheet metal defaults using iLogic code, I want to change parts in my assembly without opening each individual part and changing it there. Please help!
"Pushing the envelope, just to watch it bend"
Solved! Go to Solution.
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
Dim oDoc As Inventor.Document
'Add Input Box to retreive value here
Dim oTargetTHK As Double
oTargetTHK=25.4
'Check all referenced docs
For Each oDoc In oAssyDoc.AllReferencedDocuments
'verify document type (we are interested in metal sheets only)
If oDoc.ComponentDefinition.Type = 150995200 Then
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
oSheetMetalCompDef = oDoc.ComponentDefinition
' Override the thickness for the document
oSheetMetalCompDef.UseSheetMetalStyleThickness = False
' Get a reference to the parameter controlling the thickness.
Dim oThicknessParam As Parameter
oThicknessParam = oSheetMetalCompDef.Thickness
' Change the value of the parameter.
oThicknessParam.Value = oTargetTHK
Else
End If
Next
I was able to put the above code together after reviewing the example titled 'Sheet Metal Thickness Editing API Sample' from the Help pull down menu > Community Resources > Programming Help. Seems to work on the few simple examples I've tested.
Hope this helps.

Nathan Chandler
Product Support Specialist
Product Support Americas
Autodesk, Inc.
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I get an error when i copy this code into it's own rule that says "Error on Line 10 : 'For' must end with a matching 'Next'.
Am I doing something wrong or do I need to change anything in the code to personalize it?
Thank you
"Pushing the envelope, just to watch it bend"
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi rdiamond113,
Just a guess but did you happen to miss the last line when you copied the code?
The last line, Line 29, contains the missing Next statement.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I added it to my assembly and when I ran the rule I received a ton of errors. I'm using this to change the sheet metal type of a round column cover consisting of 4 quarter "skins". I'm not sure what type of parts you're using this code with but some of the errors I got had to do with basically rebuilding the skin and what not, like bend radius errors and sketch geometry errors
"Pushing the envelope, just to watch it bend"
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi rdiamond113,
It worked for me using an assembly with 3 sheet metal parts and 2 non-sheetmetal parts.
I made a couple of modifications, by adding an update statement and adding an input list, but other than that it's the same.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
Dim oDoc As Inventor.Document
'Add Input Box to retreive value here
Dim oTargetTHK As Double
'get user input
'oTargetTHK= InputBox("Enter Thickness", "iLogic", "0.2")
'create list of thicknesses
dList = new double(){0.1,0.2,0.3}
'get user input from list
oTargetTHK = InputListBox("Select a Thickness", dList, dList(0), "iLogic", "Thicknesses")
'Check all referenced docs
For Each oDoc In oAssyDoc.AllReferencedDocuments
'verify document type (we are interested in metal sheets only)
If oDoc.ComponentDefinition.Type = 150995200 Then
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
oSheetMetalCompDef = oDoc.ComponentDefinition
' Override the thickness for the document
oSheetMetalCompDef.UseSheetMetalStyleThickness = False
' Get a reference to the parameter controlling the thickness.
Dim oThicknessParam As Parameter
oThicknessParam = oSheetMetalCompDef.Thickness
' Change the value of the parameter.
oThicknessParam.Value = oTargetTHK
Else
End If
Next
InventorVb.DocumentUpdate()

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Okay I got it to work, the only issue I have now (LOL) is setting my specific sheet metal thickness, I changed where you had the thicknesses listed and found that it was setting the thickness to half what I ented in the list. how should I enter my standard sheet thicknesses?
"Pushing the envelope, just to watch it bend"
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I just realized the output from the code is metric, how can i change it to Inches?
"Pushing the envelope, just to watch it bend"
Re: Sheet Metal controlled through iLogic
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi rdiamond113,
Internally Inventor works with centimeters as the default unit, to adjust your input to inches can multiply your input by 2.54 as shown in this example.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Dim oAssyDoc As AssemblyDocument
oAssyDoc = ThisApplication.ActiveDocument
Dim oDoc As Inventor.Document
'Add Input Box to retreive value here
Dim oTargetTHK As Double
'get user input
oTargetTHK= InputBox("Enter Thickness", "iLogic", "0.2")*2.54
'Check all referenced docs
For Each oDoc In oAssyDoc.AllReferencedDocuments
'verify document type (we are interested in metal sheets only)
If oDoc.ComponentDefinition.Type = 150995200 Then
Dim oSheetMetalCompDef As SheetMetalComponentDefinition
oSheetMetalCompDef = oDoc.ComponentDefinition
' Override the thickness for the document
oSheetMetalCompDef.UseSheetMetalStyleThickness = False
' Get a reference to the parameter controlling the thickness.
Dim oThicknessParam As Parameter
oThicknessParam = oSheetMetalCompDef.Thickness
' Change the value of the parameter.
oThicknessParam.Value = oTargetTHK
Else
End If
Next
InventorVb.DocumentUpdate()

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

