Inventor Customization

Inventor Customization

Posts: 163
Registered: ‎02-10-2012
Message 1 of 3 (315 Views)

Automation: Replacing Content Center Parts Automation

315 Views, 2 Replies
11-20-2012 02:14 PM

Hi Mike, (And other users who can help)


***For any users joining, see this link for the original thread and starting code:


You're code is definitley a great starting point, and will most likely save me a ton of time!


I am currently diving into a small project which should save a lot of time for designers in the end if it pans out. 



Issue being resolved:


We use the Vault and have a ton of machines that get re-used from time to time through the Copy Design method. There's obviously some changes that are made from job to job, but the big issue is changing a machine from an Imperial to Metric one. This is the time (and mind) consuming process I'm looking to shorten.



What I have:


Currently I have a code (few tweaks needed but it works) that is run from an upper assembly. This code then cycles through each and every sub assembly and part that exists within it. As it cycles through, it checks for hole features which are tapped, and if it finds one of these instances, changes the thread from Imperial to Metric according to a Hard Coded set of values.



Current Dilema:


What's the point of changing the holes if the designer has to go through the assembly to change the bolts and fasteners anyways?





I've practiced a bit with your code and been able to replace items, the issue is everything must be hard coded in order to do so. My question is: 


Is there a way to get the Family from the Part Occurence / Document / Anything related?




I've looked through the API, but have only found that everything related to the Content Center.... is only accessable through the Content Center, and nothing else.


For Example, yes I am able to tell if a part has come from the content center (ie. PartComponentDefinition.IsContentMember), but that's as far as it goes, just a simple Boolean.


There MUST be a way to find out some sort of Content Center information from the direct Part / other related documents. I've looked at the "Replace Content Center Part Sample" provided in the API, but this example hard codes the ContentTreeViewPath as well.


In the end, I don't quite understand the point of hard coding this path with no way to access it through the Part Document. This only creates the need for constant manual change and / or MANY rules to compensate each and every family.


Is there an easy answer to my dilemma?



Thanks for the help in advance


Posts: 163
Registered: ‎02-10-2012
Message 2 of 3 (300 Views)

Re: Automation: Replacing Content Center Parts Automation

11-21-2012 08:48 AM in reply to: mehatfie

Does anyone have any ideas on how to get around this issue, if there is not a direct way available?




Posts: 163
Registered: ‎02-10-2012
Message 3 of 3 (276 Views)

Re: Automation: Replacing Content Center Parts Automation

11-27-2012 06:27 AM in reply to: mehatfie

Hi All,


I've used a work around method and the code is pretty much complete. There is one error that's occuring which I do not understand.


The code is successfully replacing bolts and various kinds, Flat Washers, Nuts... but for some reason, once it hits this LW it runs into an error (see attached photo).


The following piece of code is where the error occurs, I use the same line throughout the rest of my code and it works fine. This same piece of code is what is used to replace the Flat Washers as well. What could be the cause of this Lock Washer error?


The error line is between the messages:


*Note: I Use this line of code earlier on to create the Column Object


Dim NominalDiaColum As ContentTableColumn
NominalDiaColum = CurrCCFamily.TableColumns.Item("NND")



--------------------------------------------- Code ---------------------------------------


'If this is a Washer
Else If String.Compare(FastenerType, "Washers", True) = 0
     'Check Opposite Family For Part Size, Bolt Length, and a UNC Thread in the Imperial Part
     For Each oTableRow In OppCCFamily.TableRows

          Dim CurrentPartSize As Double
MessageBox.Show("Test 3", "Title")
          CurrentPartSize = oTableRow.GetCellValue(NominalDiaColum)
MessageBox.Show("Test 4", "Title")
          If (CurrentPartSize = OppPartSize) Then
                OppPartNum = oTableRow.GetCellValue(PartNumberColum)
                OppPartNumFound = True
               'MsgBox("Found Washer Replacement")
               Exit For
         End If
End If



---------------------------------------- End Code --------------------------------





Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.