Inventor General Discussion

Inventor General Discussion

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

Changing C/C component Automation

2675 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: 959
Registered: ‎02-24-2009
Message 2 of 42 (2,667 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,667 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,635 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: 959
Registered: ‎02-24-2009
Message 5 of 42 (2,625 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,621 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: 959
Registered: ‎02-24-2009
Message 7 of 42 (2,616 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,468 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: 959
Registered: ‎02-24-2009
Message 9 of 42 (2,464 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,458 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.

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.