<?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 Using .AddCustomContentCenterPart or .AddContentCenterPart in Visual Studio in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addcustomcontentcenterpart-or-addcontentcenterpart-in/m-p/12454986#M15264</link>
    <description>&lt;P&gt;I’m trying to use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;.AddCustomContentCenterPart&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;method in Visual Studio with the following libraries:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.IO
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.Runtime.InteropServices
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.&lt;SPAN class=""&gt;Text&lt;/SPAN&gt;.RegularExpressions
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Autodesk.iLogic.Interfaces
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Inventor
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Autodesk.iLogic.Core&lt;/PRE&gt;&lt;P&gt;I’ve declared&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acomponents&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IManagedComponents, but I’m unsure how to assign a value to it.&lt;/P&gt;&lt;P&gt;Here’s the function I’m using to create a component:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Private&lt;/SPAN&gt; &lt;SPAN class=""&gt;Function&lt;/SPAN&gt; createComponent(&lt;SPAN class=""&gt;ByVal&lt;/SPAN&gt; name &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;String&lt;/SPAN&gt;, &lt;SPAN class=""&gt;ByVal&lt;/SPAN&gt; length &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;Integer&lt;/SPAN&gt;) &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;Object&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;Return&lt;/SPAN&gt; acomponents.AddCustomContentCenterPart(name,
    &lt;SPAN class=""&gt;"Structural Shapes"&lt;/SPAN&gt;,
    &lt;SPAN class=""&gt;"Frametek Tracks"&lt;/SPAN&gt;,
    {&lt;SPAN class=""&gt;"PARTNUMBER"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"PRC9019"&lt;/SPAN&gt;}, {&lt;SPAN class=""&gt;"Length"&lt;/SPAN&gt;, length},
    partFolder:=&lt;SPAN class=""&gt;""&lt;/SPAN&gt;,
    partFilename:=name + &lt;SPAN class=""&gt;".ipt"&lt;/SPAN&gt;,
    position:=&lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;, grounded:=&lt;SPAN class=""&gt;False&lt;/SPAN&gt;,
    visible:=&lt;SPAN class=""&gt;True&lt;/SPAN&gt;, appearance:=&lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;)
&lt;SPAN class=""&gt;End&lt;/SPAN&gt; &lt;SPAN class=""&gt;Function&lt;/SPAN&gt;

&lt;/PRE&gt;&lt;P&gt;In iLogic (within inventor), I can achieve this simply with:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Dim&lt;/SPAN&gt; componentA = Components.AddCustomContentCenterPart(&lt;SPAN class=""&gt;"Test123"&lt;/SPAN&gt;, 
    &lt;SPAN class=""&gt;"Structural Shapes"&lt;/SPAN&gt;, 
    &lt;SPAN class=""&gt;"Frametek Tracks"&lt;/SPAN&gt;,
    {&lt;SPAN class=""&gt;"PARTNUMBER"&lt;/SPAN&gt;,&lt;SPAN class=""&gt;"PRC9019"&lt;/SPAN&gt;},{&lt;SPAN class=""&gt;"Length"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;500&lt;/SPAN&gt;}, 
    partFolder := saveAsPath, 
    partFilename:= &lt;SPAN class=""&gt;"Test123.ipt"&lt;/SPAN&gt;, 
    position := &lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;, grounded := &lt;SPAN class=""&gt;False&lt;/SPAN&gt;, 
    visible := &lt;SPAN class=""&gt;True&lt;/SPAN&gt;, appearance := &lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;How can I correctly assign a value to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acomponents&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and use it in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;createComponent&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function in Visual Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Dec 2023 06:27:59 GMT</pubDate>
    <dc:creator>clive.w66LR9</dc:creator>
    <dc:date>2023-12-21T06:27:59Z</dc:date>
    <item>
      <title>Using .AddCustomContentCenterPart or .AddContentCenterPart in Visual Studio</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addcustomcontentcenterpart-or-addcontentcenterpart-in/m-p/12454986#M15264</link>
      <description>&lt;P&gt;I’m trying to use the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;.AddCustomContentCenterPart&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;method in Visual Studio with the following libraries:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.IO
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.Runtime.InteropServices
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; System.&lt;SPAN class=""&gt;Text&lt;/SPAN&gt;.RegularExpressions
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Autodesk.iLogic.Interfaces
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Inventor
&lt;SPAN class=""&gt;Imports&lt;/SPAN&gt; Autodesk.iLogic.Core&lt;/PRE&gt;&lt;P&gt;I’ve declared&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acomponents&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IManagedComponents, but I’m unsure how to assign a value to it.&lt;/P&gt;&lt;P&gt;Here’s the function I’m using to create a component:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Private&lt;/SPAN&gt; &lt;SPAN class=""&gt;Function&lt;/SPAN&gt; createComponent(&lt;SPAN class=""&gt;ByVal&lt;/SPAN&gt; name &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;String&lt;/SPAN&gt;, &lt;SPAN class=""&gt;ByVal&lt;/SPAN&gt; length &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;Integer&lt;/SPAN&gt;) &lt;SPAN class=""&gt;As&lt;/SPAN&gt; &lt;SPAN class=""&gt;Object&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;Return&lt;/SPAN&gt; acomponents.AddCustomContentCenterPart(name,
    &lt;SPAN class=""&gt;"Structural Shapes"&lt;/SPAN&gt;,
    &lt;SPAN class=""&gt;"Frametek Tracks"&lt;/SPAN&gt;,
    {&lt;SPAN class=""&gt;"PARTNUMBER"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;"PRC9019"&lt;/SPAN&gt;}, {&lt;SPAN class=""&gt;"Length"&lt;/SPAN&gt;, length},
    partFolder:=&lt;SPAN class=""&gt;""&lt;/SPAN&gt;,
    partFilename:=name + &lt;SPAN class=""&gt;".ipt"&lt;/SPAN&gt;,
    position:=&lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;, grounded:=&lt;SPAN class=""&gt;False&lt;/SPAN&gt;,
    visible:=&lt;SPAN class=""&gt;True&lt;/SPAN&gt;, appearance:=&lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;)
&lt;SPAN class=""&gt;End&lt;/SPAN&gt; &lt;SPAN class=""&gt;Function&lt;/SPAN&gt;

&lt;/PRE&gt;&lt;P&gt;In iLogic (within inventor), I can achieve this simply with:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;Dim&lt;/SPAN&gt; componentA = Components.AddCustomContentCenterPart(&lt;SPAN class=""&gt;"Test123"&lt;/SPAN&gt;, 
    &lt;SPAN class=""&gt;"Structural Shapes"&lt;/SPAN&gt;, 
    &lt;SPAN class=""&gt;"Frametek Tracks"&lt;/SPAN&gt;,
    {&lt;SPAN class=""&gt;"PARTNUMBER"&lt;/SPAN&gt;,&lt;SPAN class=""&gt;"PRC9019"&lt;/SPAN&gt;},{&lt;SPAN class=""&gt;"Length"&lt;/SPAN&gt;, &lt;SPAN class=""&gt;500&lt;/SPAN&gt;}, 
    partFolder := saveAsPath, 
    partFilename:= &lt;SPAN class=""&gt;"Test123.ipt"&lt;/SPAN&gt;, 
    position := &lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;, grounded := &lt;SPAN class=""&gt;False&lt;/SPAN&gt;, 
    visible := &lt;SPAN class=""&gt;True&lt;/SPAN&gt;, appearance := &lt;SPAN class=""&gt;Nothing&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;How can I correctly assign a value to&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;acomponents&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and use it in the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;createComponent&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;function in Visual Studio?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 06:27:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addcustomcontentcenterpart-or-addcontentcenterpart-in/m-p/12454986#M15264</guid>
      <dc:creator>clive.w66LR9</dc:creator>
      <dc:date>2023-12-21T06:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using .AddCustomContentCenterPart or .AddContentCenterPart in Visual Studio</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/using-addcustomcontentcenterpart-or-addcontentcenterpart-in/m-p/12456341#M15265</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10693606"&gt;@clive.w66LR9&lt;/a&gt;.&amp;nbsp; I do not have the answer you are looking for, but maybe I can offer some helpful advise/information instead.&amp;nbsp; It is usually not a good idea to attempt to use resources that are unique to the iLogic ApplicationAddIn within external tools, because we simply do not have access to all the needed resources.&amp;nbsp; When we create a new iLogic rule using the built-in rule editor dialog, there is a bunch of stuff done for us automatically in the background that we never see, to make our task simpler.&amp;nbsp; Part of what is done that we do not see if the automatic creation of the '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-32B66838-22E4-4A0A-B5BB-862350C76B36" target="_blank" rel="noopener"&gt;ThisRule&lt;/A&gt;' Class, multiple references added and inclusions made, and declarations of a bunch of variables, better known as '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=4ccb78b0-c35c-4d38-943a-854117da6ced" target="_blank" rel="noopener"&gt;Rule Objects&lt;/A&gt;', which represent Interfaces.&amp;nbsp; Since those Rule Objects get declared in the background, and we never see how they get declared, it is difficult to replicate those declarations outside of an iLogic rule.&amp;nbsp; And that is why we loose recognition of them within other custom Class blocks of code, such as when referencing another external rule with '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-32B66838-22E4-4A0A-B5BB-862350C76B36" target="_blank" rel="noopener"&gt;AddVbFile&lt;/A&gt;', in which the other rule must be set to 'Straight VB Code'.&amp;nbsp; We can sometimes 'pass' the rule object to an external resource as an input parameter when we initialize it, but it is complicated, if possible at all, to both declare and initialize these rule objects entirely within our external resources without passing them in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Those iLogic tools are often just a 'middle man' routine to take some of the complication out of the task, and allow different forms of 'input parameters', such as just the name of something, instead of supplying the object that the name refers to.&amp;nbsp; Pretty much all of it can be done with regular Inventor API code instead.&amp;nbsp; The API route just usually requires a bit more code and complication than the iLogic tools.&amp;nbsp; In this case, to use the API route, we need to first generate the CC model file from the CC table, then use the member model's full file name with the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ComponentOccurrences_Add" target="_blank" rel="noopener"&gt;Add&lt;/A&gt; method to add it to the assembly as a component.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is a link to the API Sample (in VBA, not vb.net) for adding a content center part to an assembly as a component.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=PlaceContentCenterPart_Sample" target="_blank" rel="noopener"&gt;https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=PlaceContentCenterPart_Sample&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That sample is referred to from the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=ComponentOccurrences_Add" target="_blank" rel="noopener"&gt;ComponentOccurrences.Add&lt;/A&gt;&amp;nbsp;method's online help page, because that is the primary Inventor API method for adding components to an assembly.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Dec 2023 17:15:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/using-addcustomcontentcenterpart-or-addcontentcenterpart-in/m-p/12456341#M15265</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-21T17:15:38Z</dc:date>
    </item>
  </channel>
</rss>

