<?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 Flatpattern in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6423334#M65302</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i have a Problem with the following code. If i change a sheetmetal part in an assembly, i get this message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fehler in Regel: Flaeche_Zuschnitt in Dokument: test1.ipt&lt;/P&gt;&lt;P&gt;Das COM-Objekt des Typs "Inventor._DocumentClass" kann nicht in den Schnittstellentyp "Inventor.PartDocument" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{29F0D463-C114-11D2-B77F-0060B0F159EF}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with that code?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area,4) 'use this one for cm^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.00107639104,4) 'use this one for ft^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 100,4) 'use this one for mm^2
    Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.0001,3) 'use this one for m^2
    iProperties.Value("Custom", "Flaeche_Zuchnitt") = dArea
	iProperties.Value("Custom", "Einheit") = "QM"
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 0,5")) Then &lt;/PRE&gt;</description>
    <pubDate>Thu, 07 Jul 2016 10:32:14 GMT</pubDate>
    <dc:creator>martinhoos</dc:creator>
    <dc:date>2016-07-07T10:32:14Z</dc:date>
    <item>
      <title>Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6423334#M65302</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i have a Problem with the following code. If i change a sheetmetal part in an assembly, i get this message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fehler in Regel: Flaeche_Zuschnitt in Dokument: test1.ipt&lt;/P&gt;&lt;P&gt;Das COM-Objekt des Typs "Inventor._DocumentClass" kann nicht in den Schnittstellentyp "Inventor.PartDocument" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID "{29F0D463-C114-11D2-B77F-0060B0F159EF}" aufgrund des folgenden Fehlers nicht durchgeführt werden konnte: Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is wrong with that code?&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area,4) 'use this one for cm^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.00107639104,4) 'use this one for ft^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 100,4) 'use this one for mm^2
    Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.0001,3) 'use this one for m^2
    iProperties.Value("Custom", "Flaeche_Zuchnitt") = dArea
	iProperties.Value("Custom", "Einheit") = "QM"
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 0,5")) Then &lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2016 10:32:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6423334#M65302</guid>
      <dc:creator>martinhoos</dc:creator>
      <dc:date>2016-07-07T10:32:14Z</dc:date>
    </item>
    <item>
      <title>Re: Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6425412#M65326</link>
      <description>&lt;P&gt;Looks like you might be missing the lower part of your code (If Then … Nothing!), but off the top of my head, it looks like you’re assigning ThisApplication.ActiveDocument to a oDoc. The problem with that, from the Assembly level, is that the Active Document would be of the AssemblyDocumentType, and not the PartDocumentType.&lt;BR /&gt;&lt;BR /&gt;The AssemblyDocument Type has subtype or SheetMetalComponentDefinition.&lt;BR /&gt;&lt;BR /&gt;If you have that rule set up in an individual part (meaning that it isn’t an external rule), you should try using ‘ThisDoc.Document’ instead of ThisApplication.ActiveDocument.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 11:22:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6425412#M65326</guid>
      <dc:creator>MegaJerk</dc:creator>
      <dc:date>2016-07-08T11:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6425426#M65327</link>
      <description>&lt;P&gt;Thank you very much.... great!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 11:33:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6425426#M65327</guid>
      <dc:creator>martinhoos</dc:creator>
      <dc:date>2016-07-08T11:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6451832#M65611</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;your solution works but only if i work with assemblies. If i work with a steelmetall plate i get a mistake that the Parameter Flaeche_Zuchnitt is missing.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 09:30:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6451832#M65611</guid>
      <dc:creator>martinhoos</dc:creator>
      <dc:date>2016-07-21T09:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6452141#M65616</link>
      <description>&lt;P&gt;You’re going to have to tell me more about how you’re using this rule.&lt;BR /&gt;&lt;BR /&gt;Is this an &lt;STRONG&gt;external&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;or internal&amp;nbsp;&lt;/STRONG&gt;rule that you are running from the top (&lt;STRONG&gt;Assembly&lt;/STRONG&gt;) level?&lt;BR /&gt;&lt;BR /&gt;Is this a rule that is being ran from the &lt;STRONG&gt;Part&lt;/STRONG&gt; level?&lt;BR /&gt;&lt;BR /&gt;Provide more information about how you are trying to use this, when it breaks, and when it doesn’t break.&lt;BR /&gt;&lt;BR /&gt;----&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 12:45:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6452141#M65616</guid>
      <dc:creator>MegaJerk</dc:creator>
      <dc:date>2016-07-21T12:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Flatpattern</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6452227#M65618</link>
      <description>&lt;P&gt;Thanks for answer megajerk,&lt;/P&gt;&lt;P&gt;the rule is external - it runs by "before save". If i open only a part, the rule runs ok. If i open a assembly and Change a part in the assembly - i get that message.&lt;/P&gt;&lt;P&gt;Below is the hole rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	Dim oDoc As PartDocument = ThisApplication.ActiveDocument
	If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
    Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
    If Not oDef.HasFlatPattern Then
        oDef.Unfold()
    End If
    Dim oFlatPattern As FlatPattern = oDef.FlatPattern
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area,4) 'use this one for cm^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.00107639104,4) 'use this one for ft^2
    'Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 100,4) 'use this one for mm^2
    Dim dArea As Double = Round(oFlatPattern.TopFace.Evaluator.Area * 0.0001,3) 'use this one for m^2
    iProperties.Value("Custom", "Flaeche_Zuchnitt") = dArea
	iProperties.Value("Custom", "Einheit") = "QM"
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 0,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "0,5mm"
	iProperties.Value("Custom", "Dicke") = "t=0,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-001"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 1,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "1,5mm"
	iProperties.Value("Custom", "Dicke") = "t=1,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-001"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 2,0")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "2,0mm"
	iProperties.Value("Custom", "Dicke") = "t=2,0"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-002"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("AL 3,0")) Then 
	iProperties.Value("Custom", "Benennung") = "Aluminium-Blech formatlos"
	iProperties.Value("Custom", "Abmessung") = "3,0mm"
	iProperties.Value("Custom", "Dicke") = "t=3,0"
	iProperties.Value("Custom", "Artikelnr") = "H50-001-008"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("St 1,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Stahl-Blech, S235JR"
	iProperties.Value("Custom", "Abmessung") = "2000x1000x1,5mm"
	iProperties.Value("Custom", "Dicke") = "t=1,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-043"
	End If
	currentStyle = SheetMetal.GetActiveStyle()
	If (currentStyle = ("St 2,5")) Then 
	iProperties.Value("Custom", "Benennung") = "Stahl-Blech, S235JR"
	iProperties.Value("Custom", "Abmessung") = "2000x1000x2,5mm"
	iProperties.Value("Custom", "Dicke") = "t=2,5"
	iProperties.Value("Custom", "Artikelnr") = "H50-000-041"
	End If

End If&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;P&gt;Regards Martin&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jul 2016 13:19:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/flatpattern/m-p/6452227#M65618</guid>
      <dc:creator>martinhoos</dc:creator>
      <dc:date>2016-07-21T13:19:34Z</dc:date>
    </item>
  </channel>
</rss>

