<?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: Assign Layers based on Custom iProperty in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5083800#M124357</link>
    <description>&lt;P&gt;Hi Adam,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We usually don't write code based on your requests, but we can provide guidance. What you are asking seems doable, it is rather straighforward to access iProperties and affect components to a specific layer in a drawing. You should be able to easily find VBA sample to achieve that by looking at the API Help Files or through our blogs and forums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can set the&amp;nbsp;&lt;STRONG&gt;DrawingCurveSegment.Layer Property&lt;/STRONG&gt;&amp;nbsp;&lt;EM&gt;&lt;/EM&gt;to the desired layer. You can use the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DrawingView.&lt;STRONG&gt;DrawingCurves&lt;/STRONG&gt;( [&lt;STRONG&gt;&lt;EM&gt;ModelObject&lt;/EM&gt;&lt;/STRONG&gt;] As Variant ) method to retrieve all the curves that represent a specific part or component from the model in your drawing. Also the&amp;nbsp;&lt;STRONG&gt;Sheet.ChangeLayer&amp;nbsp;&lt;/STRONG&gt;method allows to change layer for a set of curves at once and enhances performances comparing to changing layer curve by curve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have some more specific questions on how to achieve a precise task with the API, I'll be happy to point out how you can do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jun 2014 19:51:16 GMT</pubDate>
    <dc:creator>philippe.leefsma</dc:creator>
    <dc:date>2014-06-09T19:51:16Z</dc:date>
    <item>
      <title>Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5065906#M124356</link>
      <description>&lt;P&gt;I'm wondering if there is a way to assign parts to a drawing layer based on a layer name in a custom iProperty?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It would be a lot like the iLogic rule provided in this discussion ('Assign Materials to Layers')&amp;nbsp;&lt;A target="_self" href="https://forums.autodesk.com/t5/Inventor-Customization/Assign-Layers-to-Materials/td-p/2871324/page/5"&gt;http://forums.autodesk.com/t5/Inventor-Customization/Assign-Layers-to-Materials/td-p/2871324/page/5&lt;/A&gt;,&amp;nbsp;&lt;SPAN&gt;but rather than look at the material, it would look at a custom property named "Layer".&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have multiple parts which use the same material (I want the material spec to appear the same in the parts list), but I want to place them on different layers using iLogic rather than going through a large assembly, finding all individual parts, selecting as edge and then changing the layers manually.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 30 May 2014 18:20:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5065906#M124356</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-05-30T18:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5083800#M124357</link>
      <description>&lt;P&gt;Hi Adam,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We usually don't write code based on your requests, but we can provide guidance. What you are asking seems doable, it is rather straighforward to access iProperties and affect components to a specific layer in a drawing. You should be able to easily find VBA sample to achieve that by looking at the API Help Files or through our blogs and forums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can set the&amp;nbsp;&lt;STRONG&gt;DrawingCurveSegment.Layer Property&lt;/STRONG&gt;&amp;nbsp;&lt;EM&gt;&lt;/EM&gt;to the desired layer. You can use the&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DrawingView.&lt;STRONG&gt;DrawingCurves&lt;/STRONG&gt;( [&lt;STRONG&gt;&lt;EM&gt;ModelObject&lt;/EM&gt;&lt;/STRONG&gt;] As Variant ) method to retrieve all the curves that represent a specific part or component from the model in your drawing. Also the&amp;nbsp;&lt;STRONG&gt;Sheet.ChangeLayer&amp;nbsp;&lt;/STRONG&gt;method allows to change layer for a set of curves at once and enhances performances comparing to changing layer curve by curve.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have some more specific questions on how to achieve a precise task with the API, I'll be happy to point out how you can do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2014 19:51:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5083800#M124357</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-06-09T19:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5113668#M124358</link>
      <description>&lt;P&gt;Hey Philippe,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for getting back to me. I'm very new to programming and Inventors API so I'm afraid I'm&amp;nbsp;struggling a little with this one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been trying to modify routine from Mike Deck on the "Assign Layers to Materials" discussion (attached), but dont seem to be getting very far. I was thinking that it might be as simply as changing the:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;materialName = partDoc.ComponentDefinition.Material.Name&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;to reference the part custom iProperty called "Layer"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;iProperties.Value("Custom", "Layer")&lt;/PRE&gt;&lt;P&gt;But I'm not sure how to reference iProperties for individual parts, rather than the iproperties within the drawings. I cant seem to find any similar examples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is really appreciated.&amp;nbsp;&lt;SPAN&gt;Thanks again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Adam&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jun 2014 16:25:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5113668#M124358</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-24T16:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5115550#M124359</link>
      <description>&lt;P&gt;Internet should be your front line resource when getting started, googling the keyword combination &lt;EM&gt;"ilogic iproperty occurrence"&lt;/EM&gt; leads me on the first hit to that post that contains a sample:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/Inventor-General/iLogic-Assembly-Component-Occurrence-Definition/td-p/3639162" target="_self"&gt;http://forums.autodesk.com/t5/Inventor-General/iLogic-Assembly-Component-Occurrence-Definition/td-p/3639162&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;' set a reference to the assembly component definintion.
' This assumes an assembly document is open.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition

'Iterate through all of the occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
    Dim oName As String
    oName = oOccurrence.Name
  &lt;U&gt;&lt;STRONG&gt; iProperties.Value(oOccurrence.Name, "Project", "Part Number") = oName&lt;/STRONG&gt;&lt;/U&gt;
    MessageBox.Show(oOccurrence.Name, "iLogic")
Next&lt;/PRE&gt;
&lt;P&gt;Hope that helps,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2014 14:17:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5115550#M124359</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2014-06-25T14:17:20Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5115906#M124360</link>
      <description>&lt;P&gt;Philippe,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help. I guess with my limited knowledge of programming this is a little beyond my capabilities. I've only just started to try and teach my self in the last couple of months, and I can see I need to learn to walk before I can run.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully someone else can maybe take a look at this, because I think its got a lot of potential. I've never had much use for layers in Inventor until working in the structural design industry for the last 2 years (previously I was 7 years in Mechanical Design). In structural they are very useful to delineate scope, make complex drawings more easy to read, and when transferring details to work in AutoCAD.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Right now its a real pain to try and go down multiple separate sub assemblies to try and find the multiple steel parts that you want to put on a different layer, say for a example a layer called "By Others" where every other steel part is on another layer. If this was done at the part level with a layer reference, and then simply runing the iLogic routine in the drawing and having every part set to the correct layer, that would be fantastic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jun 2014 15:40:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5115906#M124360</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-06-25T15:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Assign Layers based on Custom iProperty</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5999716#M124361</link>
      <description>&lt;P&gt;I'd like to bump this old thread and see if there's anyone out there who has the knowledge to make this happen. Anyone out there at all?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 17:01:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/assign-layers-based-on-custom-iproperty/m-p/5999716#M124361</guid>
      <dc:creator>Kyle.Arnold</dc:creator>
      <dc:date>2016-01-21T17:01:59Z</dc:date>
    </item>
  </channel>
</rss>

