Inventor General Discussion

Reply
Active Contributor
s.cupples
Posts: 39
Registered: ‎07-15-2008
Message 1 of 42 (2,394 Views)

Changing C/C component Automation

2394 Views, 41 Replies
08-04-2010 04:32 PM

I'm looking at creating some Parametric models with Excel and ilogic

 

Anyone know if it’s possible to automate the changing of content centre components parts in a model using ilogic or some other method other than the traditional way of  manually selecting the components in the assembly followed by right mouse click to change

 

 As an example let say my model has some 1/2" hex bolts and I want to change them to 3/4" Hex Bolts is there a way to change these though a front end interface like and excel spreadsheet? or ilogic?

 

 Thanks

 

 N_M

Employee
MjDeck
Posts: 958
Registered: ‎02-24-2009
Message 2 of 42 (2,386 Views)

Re: Changing C/C component Automation

08-04-2010 05:10 PM in reply to: s.cupples

I think it is possible with iLogic, but it requires a lot of API code.  I will look at it and try to post a solution.

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Active Contributor
s.cupples
Posts: 39
Registered: ‎07-15-2008
Message 3 of 42 (2,386 Views)

Re: Changing C/C component Automation

08-04-2010 05:15 PM in reply to: MjDeck

Great

 

Thanks Mike

Active Contributor
s.cupples
Posts: 39
Registered: ‎07-15-2008
Message 4 of 42 (2,354 Views)

Re: Changing C/C component Automation

08-07-2010 04:00 AM in reply to: MjDeck

Hey Mike

 

Did you find the information I require?

 

Please dont forget me

 

N_M

Employee
MjDeck
Posts: 958
Registered: ‎02-24-2009
Message 5 of 42 (2,344 Views)

Re: Changing C/C component Automation

08-07-2010 09:27 AM in reply to: s.cupples

Are you using Inventor 2011?  I think there is a way in 2011, but I don't know about previous versions.



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Active Contributor
s.cupples
Posts: 39
Registered: ‎07-15-2008
Message 6 of 42 (2,340 Views)

Re: Changing C/C component Automation

08-07-2010 06:14 PM in reply to: s.cupples

I'm on subscription so I have the latest version 2011, please share with me what you have learnt ?

 

N_M

Employee
MjDeck
Posts: 958
Registered: ‎02-24-2009
Message 7 of 42 (2,335 Views)

Re: Changing C/C component Automation

08-08-2010 09:35 AM in reply to: s.cupples

Here is a way to do it using iLogic in Inventor 2011.  Most of the code is in an external rule, so that it can be re-used.  This code is provided "as is".

 

Save the attached file (ContentCenterReplace.iLogicVb) to a directory on your machine.  Add that directory to the list of External Rule Directories under Tools -> Options -> iLogic Configuration.

 

 To use this method, you have to rename the component occurrence in the assembly Model Browser (this way it has a constant name and iLogic can find it).  The attached screenshot (CCOccurrenceRename.PNG) shows how this looks in my sample model.  The disadvantage of this is that you don't see the component size information in the tree. You have to right-click on the component and look at the iProperties.

 

 Here's a sample rule:

 

AddVbFile "ContentCenterReplace.iLogicVb"
Dim replacer As New ContentCenterReplace(ThisDoc.Document, ThisApplication, "en-US")
Dim familyName As String = "Fasteners:Bolts:Hex Head:Hex Cap Screw - Metric"
compo = Component.InventorComponent("Hex Cap Screw:2")
replacer.Replace(compo, familyName, CapScrew2Name)

AddVbFile "ContentCenterReplace.iLogicVb"
Dim replacer As New ContentCenterReplace(ThisDoc.Document, ThisApplication, "en-US")
Dim familyName As String = "Fasteners:Bolts:Hex Head:Hex Cap Screw - Metric"
compo = Component.InventorComponent("Hex Cap Screw:2")

replacer.Replace(compo, familyName, CapScrew2Name)

Note the "en-US".  If you use a different language in Content Center, you will have to change this.  I haven't tested it with other languages. 

 

The familyName is the complete path to the part, using a colon as the separator.

 CapScrew2Name is a Text parameter in the assembly.  In this case it's a multivalue parameter, with values such as

ANSI B18.2.3.1M - M10 x 70 - 15

You can use either the Part Number or the File Name from the Table View of the Content Center family.

 

Here's another example with hard-coded part numbers:

If (ScrewLength = 55) Then

  replacer.Replace("Hex Cap Screw:1", familyName, "ANSI B18.2.3.1M - M10 x 1.5 x 55")

ElseIf  (ScrewLength = 65) Then

  replacer.Replace("Hex Cap Screw:1", familyName, "ANSI B18.2.3.1M - M10 x 1.5 x 65")

End If

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Contributor
josephcooley
Posts: 56
Registered: ‎09-25-2009
Message 8 of 42 (2,187 Views)

Re: Changing C/C component Automation

12-07-2010 09:12 AM in reply to: MjDeck

Mike,

Has there been any other solution developed for this problem?  Will this be a standard feature in 2012?  I think this is an extremely usefull feature for Inventor.

Employee
MjDeck
Posts: 958
Registered: ‎02-24-2009
Message 9 of 42 (2,183 Views)

Re: Changing C/C component Automation

12-07-2010 09:35 AM in reply to: josephcooley

I'm not sure if there's another solution.  Did you try the external rule and sample internal rule that I posted?  If so, are there any improvements or changes that you think it needs?

 



Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Valued Contributor
josephcooley
Posts: 56
Registered: ‎09-25-2009
Message 10 of 42 (2,177 Views)

Re: Changing C/C component Automation

12-07-2010 09:42 AM in reply to: MjDeck

The only thing I am worried about is that this file will be traveling...  So it will be used by many users on different computers.  Will that file always have to be available in the correct path on any computer that it is used on.  If its a one time thing then that will probably work if not I may need to find a different route.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
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 to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube