<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/10183452#M98294</link>
    <description>&lt;P&gt;buonasera a tutti, ho provato questa regola ilogic, e funziona solo se i file hanno la regola lamiera non fleggata, come nel mio caso che importo degli step, nel momento della conversione&amp;nbsp; la regola da errore&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mcremamarco_2-1616605438813.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/897800iEEB266FB31C30AB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mcremamarco_2-1616605438813.png" alt="mcremamarco_2-1616605438813.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in quanto da parte a lamiera, si trova la regola lamiera fleggata&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mcremamarco_1-1616605402615.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/897799i48E034330AF3A8B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mcremamarco_1-1616605402615.png" alt="mcremamarco_1-1616605402615.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;e possibile risolvere il problema????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Grazie mille&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 17:05:14 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2021-03-24T17:05:14Z</dc:date>
    <item>
      <title>iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354820#M98290</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've managed to put together an iLogic rule that when run, prompts the user to select a part file to convert to sheet metal, then measure the distance between two faces to determine the thickness, that value is then set as thickness in the part. Then the next part can be selected and the process repeated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works quite well but when the thickness is saved it does so with lots of trailing zeroes/decimals. I've tried rounding and "format" the parameter value but it still shows up like 10,0000000. Also I had to divide the Thickness value by 10 to get the correct value, my guess is this has to do with some unit setting?&lt;/P&gt;&lt;P&gt;So I'd be very grateful if someone with more knowledge could take a look at the code and improve it!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We work as a subcontractor for sheet metal products and often recieve STEP files where nothing is modeled as sheet metal, with this script it will save us quite some time instead of opening up each part, measure and input the thickness manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oADoc as AssemblyDocument
oADoc = ThisApplication.ActiveDocument

Dim comp As Object


While True
	'prompt user to select an occurrence
	comp = ThisApplication.CommandManager.Pick(
		SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, 
		"Select a component") 
		
    If comp Is Nothing Then
        MessageBox.Show ("Selection was cancelled","ilogic")
        Beep
        Exit While
    End If
		
	oPartDoc = comp.Definition.Document	
		
	oFace1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities,"Select Plane1")
	oFace2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities,"Select Plane2")
	
	Dim oAsmCompDef As AssemblyComponentDefinition
	oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
	Dim oTG As TransientGeometry
	oTG = ThisApplication.TransientGeometry
		Try
		oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane1").Delete
		oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane2").Delete
		Catch
		'Do nothing
		End Try
		
		oPlane1 = oAsmCompDef.WorkPlanes.AddFixed(oTG.CreatePoint(0,0,0),oTG.CreateUnitVector(1,0,0),oTG.CreateUnitVector(0,1,0),False)
		oPlane1.Name = "iLogic_Proxy_Plane1"
		oPlane2 = oAsmCompDef.WorkPlanes.AddFixed(oTG.CreatePoint(0,0,0),oTG.CreateUnitVector(1,0,0),oTG.CreateUnitVector(0,1,0),False)
		oPlane2.Name = "iLogic_Proxy_Plane2"
		oAsmCompDef.Constraints.AddFlushConstraint(oPlane1,oFace1,0)
		oAsmCompDef.Constraints.AddFlushConstraint(oPlane2,oFace2,0)
		oDistance = Measure.MinimumDistance(oPlane1.Name,oPlane2.Name)

		Try
			oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
			'Goto EditTHK
			Dim oSheetMetalCompDef As SheetMetalComponentDefinition
			oSheetMetalCompDef = oPartDoc.ComponentDefinition
		
			' Override the thickness for the document
				Dim oThicknessParam As Parameter
				oThicknessParam = oSheetMetalCompDef.Thickness
				
				oThicknessParam.Value = Round(oDistance/10, 1)
		Catch
				MessageBox.Show("Some error occurred, make sure the selected file is not read-only or a library item.","Error")
				
Exit While

		End Try		
	
	oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane1").Delete
	oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane2").Delete

End While&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should also mention that the code I've put together are from two other threads here on the forum and then I've just made some minor changes:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-forum/batch-convert-regular-parts-to-sheet-metal-parts/td-p/6477451" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-forum/batch-convert-regular-parts-to-sheet-metal-parts/td-p/6477451&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-forum/ilogic-measure-angle-between-selected-faces/td-p/5503912" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-forum/ilogic-measure-angle-between-selected-faces/td-p/5503912&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Happy for any advice!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/Fredrik&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 13:56:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354820#M98290</guid>
      <dc:creator>Wowbagger2</dc:creator>
      <dc:date>2017-09-05T13:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354850#M98291</link>
      <description>&lt;P&gt;1. Yes the 10 factor would be due to unit conversions assuming you are working in 'mm', as inventor's database units are in 'cm' so it returns the value in cm.&lt;/P&gt;
&lt;P&gt;2. Why does it matter that it has trailing zeros? It shouldn't show up anywhere...&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 14:02:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354850#M98291</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-09-05T14:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354910#M98292</link>
      <description>&lt;P&gt;1. Ok, that's what I thought, is there anyway to define the units as mm so I dont need to divide it?&lt;/P&gt;&lt;P&gt;2. We use the Thickness value for our BOM's so that could be a problem, although the script to put the Thickness value in the iProperties could round it off.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I admit both of these problems are quite minor but out of interest to learn more ilogic I'd still like to improve the script if possible.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 14:14:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7354910#M98292</guid>
      <dc:creator>Wowbagger2</dc:creator>
      <dc:date>2017-09-05T14:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7355137#M98293</link>
      <description>&lt;P&gt;1. No. The return values from the API calls are in database units, so you have to convert it one way or another.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. I hope you are making it an iProperty properly by using the "Exposed as property" setting. Within this, you can remove the trailing zeros by setting the "Custom Property Format" to exclude trailing zeroes. See my signature for links for resources that will help you with finding solutions for this. ie; namely the programming help and other posts in the forums.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2017 14:51:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/7355137#M98293</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2017-09-05T14:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/10183452#M98294</link>
      <description>&lt;P&gt;buonasera a tutti, ho provato questa regola ilogic, e funziona solo se i file hanno la regola lamiera non fleggata, come nel mio caso che importo degli step, nel momento della conversione&amp;nbsp; la regola da errore&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mcremamarco_2-1616605438813.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/897800iEEB266FB31C30AB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mcremamarco_2-1616605438813.png" alt="mcremamarco_2-1616605438813.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;in quanto da parte a lamiera, si trova la regola lamiera fleggata&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mcremamarco_1-1616605402615.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/897799i48E034330AF3A8B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mcremamarco_1-1616605402615.png" alt="mcremamarco_1-1616605402615.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;e possibile risolvere il problema????&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Grazie mille&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 17:05:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/10183452#M98294</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-03-24T17:05:14Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/10183658#M98295</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Italian to English translation&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;good evening everyone, I tried this ilogic rule, and it only works if the files have the sheet metal rule not flegged, as in my case what amount of steps, at the time of conversion the error rule&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The rule above sets the thickness of a &amp;nbsp;default sheetmetal style each time and does not follow the sheetmetal styles.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;In order to follow the sheetmetal style you need to activate the style by name using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-selector-tag"&gt;SheetMetal&lt;/SPAN&gt;&lt;SPAN class="hljs-selector-class"&gt;.SetActiveStyle&lt;/SPAN&gt;(“&lt;SPAN class="hljs-selector-tag"&gt;styleName&lt;/SPAN&gt;”)&lt;/PRE&gt;&lt;P&gt;A sample could be&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-selector-tag"&gt;If Thickness = “6” Then&lt;BR /&gt;SheetMetal&lt;/SPAN&gt;&lt;SPAN class="hljs-selector-class"&gt;.SetActiveStyle&lt;/SPAN&gt;(“SteelPlate-6”)&lt;BR /&gt;End If&lt;/PRE&gt;&lt;P&gt;&lt;A href="https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014/ENU/Inventor/files/GUID-42F118D3-1022-4A78-8495-BFD13A450EED-htm.html&amp;nbsp;" target="_blank" rel="noopener"&gt;https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014/ENU/Inventor/files/GUID-42F118D3-1022-4A78-8495-BFD13A450EED-htm.html&amp;nbsp;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If do not want to follow the style, you can switch off the follow style check box, how I do not know&lt;span class="lia-unicode-emoji" title=":crying_face:"&gt;😢&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Do you want the style on or off?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 18:01:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/10183658#M98295</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2021-03-24T18:01:19Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic Rule - Convert to Sheet metal part and measure/set thickness</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/14304660#M182025</link>
      <description>&lt;P&gt;Ciao, the checkbox A.Acheson mentioned is a property of the sheet metal definition: UseSheetMetalStyleThickness. While it's True the thickness comes from the sheet metal rule, and writing Thickness.Value fails: on a test plate your rule stopped in the Catch with "Catastrophic failure (0x8000FFFF (E_UNEXPECTED))" and the part kept the rule thickness. Set it to False right before the thickness and your value goes in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In italiano: aggiungi oSheetMetalCompDef.UseSheetMetalStyleThickness = False prima di impostare lo spessore, è la casella dello spessore dalla regola.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is Fredrik's rule with that line added. I also changed the Catch so it shows the real error text instead of the generic message. Both changes are marked NEW, nothing else touched.&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oADoc as AssemblyDocument
oADoc = ThisApplication.ActiveDocument
Dim comp As Object
While True
	'prompt user to select an occurrence
	comp = ThisApplication.CommandManager.Pick(
		SelectionFilterEnum.kAssemblyLeafOccurrenceFilter, 
		"Select a component") 
    If comp Is Nothing Then
        MessageBox.Show ("Selection was cancelled","ilogic")
        Beep
        Exit While
    End If
	oPartDoc = comp.Definition.Document	
	oFace1 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities,"Select Plane1")
	oFace2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities,"Select Plane2")
	Dim oAsmCompDef As AssemblyComponentDefinition
	oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
	Dim oTG As TransientGeometry
	oTG = ThisApplication.TransientGeometry
		Try
		oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane1").Delete
		oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane2").Delete
		Catch
		'Do nothing
		End Try
		oPlane1 = oAsmCompDef.WorkPlanes.AddFixed(oTG.CreatePoint(0,0,0),oTG.CreateUnitVector(1,0,0),oTG.CreateUnitVector(0,1,0),False)
		oPlane1.Name = "iLogic_Proxy_Plane1"
		oPlane2 = oAsmCompDef.WorkPlanes.AddFixed(oTG.CreatePoint(0,0,0),oTG.CreateUnitVector(1,0,0),oTG.CreateUnitVector(0,1,0),False)
		oPlane2.Name = "iLogic_Proxy_Plane2"
		oAsmCompDef.Constraints.AddFlushConstraint(oPlane1,oFace1,0)
		oAsmCompDef.Constraints.AddFlushConstraint(oPlane2,oFace2,0)
		oDistance = Measure.MinimumDistance(oPlane1.Name,oPlane2.Name)
		Try
			oPartDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
			'Goto EditTHK
			Dim oSheetMetalCompDef As SheetMetalComponentDefinition
			oSheetMetalCompDef = oPartDoc.ComponentDefinition
			' NEW: switch off "thickness from the sheet metal rule", otherwise the rule drives the thickness
			oSheetMetalCompDef.UseSheetMetalStyleThickness = False
			' Override the thickness for the document
				Dim oThicknessParam As Parameter
				oThicknessParam = oSheetMetalCompDef.Thickness
				oThicknessParam.Value = Round(oDistance/10, 1)
		Catch ex As Exception
				' NEW: show what Inventor actually says
				MessageBox.Show("Some error occurred, make sure the selected file is not read-only or a library item." &amp;amp; vbCrLf &amp;amp; ex.Message,"Error")
Exit While
		End Try		
	oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane1").Delete
	oAsmCompDef.WorkPlanes.Item("iLogic_Proxy_Plane2").Delete
End While&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As a side effect the part then stops following the rule thickness, the checkbox stays off. With STEP imports that's normally the point. One more thing in the original rule, Round(oDistance/10, 1) rounds to 0.1 cm, i.e. whole millimetres, so a 1.5 mm plate ended up as 2 mm in the test. If you have half-millimetre gauges, use Round(oDistance/10, 2), that gave 1.5 mm on the same test plate.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran your rule as above in Inventor 2025 on a 10 mm and a 1.5 mm test plate in an assembly, with the three Picks replaced by fixed picks so it could run in the background. Without the NEW line: the error above on both. With it: no error, 10 mm and 2 mm. The UseSheetMetalStyleThickness line is the one we use when converting STEP solids to sheet metal from code, always set before Thickness, value in cm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole STEP solid to sheet metal to flat pattern sequence, with this line in its place, is written up here: &lt;A href="https://steptocut.com/blog/inventor-sheet-metal-flat-pattern-step/" target="_blank"&gt;https://steptocut.com/blog/inventor-sheet-metal-flat-pattern-step/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're automating more of the STEP to sheet metal to DXF side, ask here, glad to help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Written with Claude (AI), tested in Inventor 2025 on our test plates.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Oct 2026 04:31:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-rule-convert-to-sheet-metal-part-and-measure-set/m-p/14304660#M182025</guid>
      <dc:creator>info28T45</dc:creator>
      <dc:date>2026-10-12T04:31:36Z</dc:date>
    </item>
  </channel>
</rss>

