<?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: Generate derived part in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/4584119#M134461</link>
    <description>&lt;P&gt;wow and it thought i was a noob, see OP ^^^&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2013 12:40:26 GMT</pubDate>
    <dc:creator>DeerSpotter</dc:creator>
    <dc:date>2013-11-01T12:40:26Z</dc:date>
    <item>
      <title>iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3617902#M134452</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am hoping iLogic or some other method can help me solve this issue. This is not really an issue, but more a time consuming process that I would like to automate. I have created a very simple yet effective &amp;nbsp;tool for starting a new manifold assembly using iLogic. The rules and windows essentially fill out the size of the block, material type, description, project and part number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="Capture.JPG" border="0" align="center" alt="Capture.JPG" src="https://forums.autodesk.com/t5/image/serverpage/image-id/37356i2A39AED5092FFBD7/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below I have a hydraulic manifold I have designed and from that I created the final .ipt of the internals. The way I did this (which may not be the best method) was to create a second .ipt matching the LxWxH of the original manifold, next I inserted and aligned both into another .iam file, lastly I derived a third .ipt from a subtraction resulting in the third image below. This is a bit time consuming to create, but has been very helpful in error checking our designs. I would like to see if iLogic is capable of allowing me to automate this so we can easily create these internal flowpath .ipt's for every manifold we design. Is there a resource or something similar someone else has done that could point me in the right direction?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="manifold.jpg" border="0" align="center" alt="manifold.jpg" src="https://forums.autodesk.com/t5/image/serverpage/image-id/37352i24438E6D789EBA9E/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG title="manifold_internals.jpg" border="0" align="center" alt="manifold_internals.jpg" src="https://forums.autodesk.com/t5/image/serverpage/image-id/37354iBB3C448D42A5B217/image-size/original?v=mpbl-1&amp;amp;px=-1" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any help you may be able to furnish, I really appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darek Davis&lt;/P&gt;</description>
      <pubDate>Wed, 12 Sep 2012 22:59:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3617902#M134452</guid>
      <dc:creator>ddavis</dc:creator>
      <dc:date>2012-09-12T22:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3624546#M134453</link>
      <description>&lt;P&gt;Good case.&lt;/P&gt;
&lt;P&gt;iLogic “can” automate this procedure via direct calls to Inventor API objects.&amp;nbsp; My sample rule implements slightly modified method.&amp;nbsp; It wasn’t tested much (see screenshot).&lt;/P&gt;
&lt;P&gt;Please copy this code into the rule in your manifold &amp;nbsp;part and run the rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it will help you as a good start point for your own “magic” rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IMHO for this task it is better to use Inventor API and any .NET developing tool (VB, C#,…).&amp;nbsp; Really I developed and tested this code in the form of VB.NET EXE application (because Visual Studio has excellent debugger) and only then copied resulting code into iLogic rule with very little modifications.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/37760i9C93AB99026BEAE8/image-size/small?v=mpbl-1&amp;amp;px=-1" border="0" alt="1.png" title="1.png" align="center" /&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/37758i3C024F63E8600982/image-size/small?v=mpbl-1&amp;amp;px=-1" border="0" alt="2.PNG" title="2.PNG" width="202" height="167" align="center" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Sub Main

    'Step 0:  reference to active part
    Dim oSourcePartDoc As PartDocument _
          = CType(ThisApplication.ActiveDocument, PartDocument)
		  
'	Dim oSourcePartDoc As PartDocument = CType(ThisDoc.Document, PartDocument)

    'Step 1:  create outer body Body2 using shrinkwrap
    Dim oOuterPartDoc As PartDocument = ShrinkWrap(oSourcePartDoc)

    'Step 2:  create new part derived source and shrinkwrap bodies
    '         and subtract Body1 (source) from Body2 (outer)  
    Dim oResultDoc As PartDocument = SubtractPart(oSourcePartDoc, oOuterPartDoc)

    oResultDoc.Views.Add()

    ThisApplication.SilentOperation = True
    Call oOuterPartDoc.Save()
    Call oOuterPartDoc.Close()
    ThisApplication.SilentOperation = False

    Beep()
End Sub 'Main


  Function ShrinkWrap(ByVal oSourcePartDoc As PartDocument) As PartDocument

    Dim oTG As TransientGeometry = ThisApplication.TransientGeometry

    'active project workspace path
    Dim oProjectManager As DesignProjectManager = ThisApplication.DesignProjectManager
    Dim oActiveDesignProject As DesignProject = oProjectManager.ActiveDesignProject
    Dim WorkspacePath As String = oActiveDesignProject.WorkspacePath


    ' Create new assembly document
    Dim oAssyDoc As AssemblyDocument = CType(ThisApplication.Documents _
        .Add(DocumentTypeEnum.kAssemblyDocumentObject, , False),  _
             AssemblyDocument)
    'assembly definition
    Dim oAssyDef As AssemblyComponentDefinition = oAssyDoc.ComponentDefinition

    'Add the source component
    Dim oMatrix As Matrix = oTG.CreateMatrix
    Dim oOcc As ComponentOccurrence = oAssyDef.Occurrences _
          .AddByComponentDefinition(CType( _
            oSourcePartDoc.ComponentDefinition,  _
            ComponentDefinition), oMatrix)
    oOcc.Name = "Manifold"

    ' create filename for this assembly and save it
    Dim AssyFilename As String = WorkspacePath &amp;amp; "\TemporaryAssy.iam"
	
'	MsgBox(AssyFilename)
	
    ThisApplication.SilentOperation = True
    oAssyDoc.SaveAs(AssyFilename, False)
    ThisApplication.SilentOperation = False
	
'	MsgBox("Saved")

    ' Create a new part document that will be the shrinkwrap substitute
    Dim oPartDoc As PartDocument = CType(ThisApplication.Documents _
        .Add(DocumentTypeEnum.kPartDocumentObject, , False),  _
             PartDocument)

    Dim oPartDef As PartComponentDefinition = oPartDoc.ComponentDefinition
    Dim oDerivedAssemblyDef As DerivedAssemblyDefinition _
        = oPartDef.ReferenceComponents.DerivedAssemblyComponents _
            .CreateDefinition(oAssyDoc.FullDocumentName)

    ' Set various shrinkwrap related options
    oDerivedAssemblyDef.DeriveStyle _
        = DerivedComponentStyleEnum.kDeriveAsSingleBodyNoSeams
    oDerivedAssemblyDef.IncludeAllTopLeveliMateDefinitions _
        = DerivedComponentOptionEnum.kDerivedExcludeAll
    oDerivedAssemblyDef.IncludeAllTopLevelParameters _
        = DerivedComponentOptionEnum.kDerivedExcludeAll
    oDerivedAssemblyDef.ReducedMemoryMode = True

    Call oDerivedAssemblyDef.SetHolePatchingOptions( _
            DerivedHolePatchEnum.kDerivedPatchAll)


    ' Create the shrinkwrap component
    Dim oDerivedAssembly As DerivedAssemblyComponent _
      = oPartDef.ReferenceComponents.DerivedAssemblyComponents _
        .Add(oDerivedAssemblyDef)

    ' Save the part
    Dim PartFilename As String = WorkspacePath &amp;amp; "\OuterPart.ipt"
    ThisApplication.SilentOperation = True
    Call oPartDoc.SaveAs(PartFilename, False)
    ThisApplication.SilentOperation = False


    ' Create a substitute level of detail using the shrinkwrap part.
    Dim oSubstituteLOD As LevelOfDetailRepresentation = oAssyDef _
         .RepresentationsManager.LevelOfDetailRepresentations _
            .AddSubstitute(PartFilename)
    oSubstituteLOD.Name = "OuterBody"

    ThisApplication.SilentOperation = True
    Call oAssyDoc.Save()
    Call oAssyDoc.Close()
    ThisApplication.SilentOperation = False

    Return oPartDoc

  End Function 'ShrinkWrap
  
  
  

  Function SubtractPart(ByVal oSourcePartDoc As PartDocument, _
                        ByVal oOuterPartDoc As PartDocument) _
                      As PartDocument
    'create new part 
    Dim oDoc As PartDocument = CType(ThisApplication.Documents _
        .Add(DocumentTypeEnum.kPartDocumentObject, , False),  _
             PartDocument)
    Dim oDef As PartComponentDefinition = oDoc.ComponentDefinition

    ' Create the derived part 1 - Source body
    Dim oDerivedPartDef As DerivedPartUniformScaleDef _
          = oDef.ReferenceComponents.DerivedPartComponents _
            .CreateUniformScaleDef(oSourcePartDoc.FullFileName)
    Call oDef.ReferenceComponents.DerivedPartComponents _
          .Add(CType(oDerivedPartDef, DerivedPartDefinition))

    ' Create the derived part 2 - Outer body
    oDerivedPartDef = oDef.ReferenceComponents.DerivedPartComponents _
            .CreateUniformScaleDef(oOuterPartDoc.FullFileName)
    Call oDef.ReferenceComponents.DerivedPartComponents _
          .Add(CType(oDerivedPartDef, DerivedPartDefinition))


    'Subtract bodies
    Dim oColl As ObjectCollection = ThisApplication _
          .TransientObjects.CreateObjectCollection

    Dim oCombineFeatures As CombineFeatures = oDef.Features.CombineFeatures
    Dim oBody1 As SurfaceBody = oDef.SurfaceBodies.Item(1)
    Dim oBody2 As SurfaceBody = oDef.SurfaceBodies.Item(2)
    Call oColl.Add(oBody1)

    Dim oCF As CombineFeature = oCombineFeatures _
        .Add(oBody2, oColl, PartFeatureOperationEnum.kCutOperation, False)

    Return oDoc

  End Function 'SubtractPart
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 18:34:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3624546#M134453</guid>
      <dc:creator>Vladimir.Ananyev</dc:creator>
      <dc:date>2012-09-18T18:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3712064#M134454</link>
      <description>&lt;P&gt;Thank you for your help with this. Unfortunately I have not been successful getting this to work. I copy and paste this in to an iLogic rule, select "Straight VB Code" from the options and once I run the code I get the following&amp;nbsp;error. Is there something that I am doing incorrect?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/43464i73EFCEFBD78CB93D/image-size/original?v=mpbl-1&amp;amp;px=-1" title="Capture.JPG" alt="Capture.JPG" align="center" border="0" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2012 23:39:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3712064#M134454</guid>
      <dc:creator>ddavis</dc:creator>
      <dc:date>2012-11-26T23:39:44Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3712476#M134455</link>
      <description>&lt;P&gt;I used Inventor 2013.&amp;nbsp; The part file with my rule is attached.&amp;nbsp; &lt;BR /&gt;Please try it.&lt;/P&gt;
&lt;P&gt;Can you upload one of your models?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2012 11:36:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3712476#M134455</guid>
      <dc:creator>Vladimir.Ananyev</dc:creator>
      <dc:date>2012-11-27T11:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3718048#M134456</link>
      <description>&lt;P&gt;I figured out the issue. It turns out that Internet Explorer was adding or subtracting extra data. I installed Chrome and performed the coy and paste and it worked like a charm.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for your help with this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Fri, 30 Nov 2012 18:13:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3718048#M134456</guid>
      <dc:creator>ddavis</dc:creator>
      <dc:date>2012-11-30T18:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3876649#M134457</link>
      <description>&lt;P&gt;can you provide us a .txt file of the code?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2013 18:58:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3876649#M134457</guid>
      <dc:creator>DeerSpotter</dc:creator>
      <dc:date>2013-04-19T18:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3876702#M134458</link>
      <description>&lt;P&gt;Attached you will find the code in a text file as requested.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darek&lt;/P&gt;</description>
      <pubDate>Fri, 19 Apr 2013 19:56:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/3876702#M134458</guid>
      <dc:creator>ddavis</dc:creator>
      <dc:date>2013-04-19T19:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/4481563#M134460</link>
      <description>&lt;P&gt;i need to delete the derived part in Inventor using rules&amp;nbsp; , can you provide me the code ?&lt;/P&gt;</description>
      <pubDate>Wed, 02 Oct 2013 21:24:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/4481563#M134460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-10-02T21:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: iLogic: Generate derived part</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/4584119#M134461</link>
      <description>&lt;P&gt;wow and it thought i was a noob, see OP ^^^&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2013 12:40:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ilogic-generate-derived-part/m-p/4584119#M134461</guid>
      <dc:creator>DeerSpotter</dc:creator>
      <dc:date>2013-11-01T12:40:26Z</dc:date>
    </item>
  </channel>
</rss>

