Inventor General Discussion

Inventor General Discussion

Reply
Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 21 of 42 (1,796 Views)

Re: Changing C/C component Automation

03-20-2012 10:14 AM in reply to: cean_au

Cean,


 Here is a new version of the content center rule.  It has a new option to place a part with custom parameters as a Standard part.  The sample rule (AddContentCenterBar.txt) has a new line of code:
replacer.CreationMode = FileCreationMode.AsStandard

(Other options available are:
replacer.CreationMode = FileCreationMode.AsCustom

replacer.CreationMode = FileCreationMode.ByFunctionName  '  this is the default.  )

 I modified the sample code to work with the content center family that you are looking at.  This family uses a different custom parameter (B_L) to set the length (as compared to the pipe which uses PL).
 To see the parameter name, place a component manually and look at the Table View.  Hover the mouse over the column header to see the internal name of the column.  This is the parameter name that is required for the code.

ContentCenterColumnName.png



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

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 22 of 42 (1,782 Views)

Re: Changing C/C component Automation

03-20-2012 11:17 AM in reply to: MjDeck

Note that I changed the sample code to use a parameter named BarLength (it was previously PipeLength).



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

Distinguished Contributor
JimSteinmeyer
Posts: 326
Registered: ‎05-16-2011
Message 23 of 42 (1,766 Views)

Re: Changing C/C component Automation

03-20-2012 12:31 PM in reply to: josephcooley

Mike,

You asked Cean if he wanted the part as stancard or custom. Can you explane the differences and an example of use for each?

 

Thank you

 

Jim

Jim

Inventor Premium 2013 SP1.1
Vault 2013- plain vanilla version
HP G71 notebook
celeron cpu w\ 4gb RAM and 64 bit system
Win 7 home premium

Ya, my boss has me running my personal machine at work.
Valued Contributor
cean_au
Posts: 100
Registered: ‎07-11-2011
Message 24 of 42 (1,757 Views)

Re: Changing C/C component Automation

03-20-2012 05:22 PM in reply to: MjDeck

Hi Mike,

 

All good for custom part now. The flat bar is also good for standard, no matter I use "PL" or "B_L", or even omit it.

But the pipe still can't show correct length when placed as standard part.

 

Thanks

 

Cean

 

HI Jim, one difference is they are saved in different folders. Standard parts sit in content center. Custom ones sit in your project folder.

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 25 of 42 (1,755 Views)

Re: Changing C/C component Automation

03-20-2012 05:34 PM in reply to: cean_au

Cean,
 Can you post your complete rule that demostrates the failure to set the length of the pipe component?  Please attach it as a text file.  That makes it easy for me to work with it.



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

Valued Contributor
cean_au
Posts: 100
Registered: ‎07-11-2011
Message 26 of 42 (1,752 Views)

Re: Changing C/C component Automation

03-20-2012 07:19 PM in reply to: MjDeck

Here it is. Thx

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 27 of 42 (1,743 Views)

Re: Changing C/C component Automation

03-20-2012 07:44 PM in reply to: cean_au

Cean,
 Your rule works on my system.  It creates a pipe with length PL = 200 in.
 On your system, you might have to manually delete old pipe parts in your Content Center directory.  The old version of the rule probably created parts with the wrong length.  The new version won't overwrite these: it doesn't know that they are obsolete.  Once you delete them, the rule can generate new versions.

 I think an old part would also explain the behavior you saw with the bar part.  When you use "PL" instead of "B_L" for the bar part: if the part with that name already exists, it won't try to regenerate it.  If it did, you would see that "B_L" is required.  Please try deleting your existing bar parts (only delete the recently generated ones: don't delete any that are being used in other assemblies) and generate new ones.  I'm pretty sure that you will find that "B_L" is required to set the length of the bar part.



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

Valued Contributor
cean_au
Posts: 100
Registered: ‎07-11-2011
Message 28 of 42 (1,739 Views)

Re: Changing C/C component Automation

03-20-2012 08:16 PM in reply to: MjDeck

Hi Mike,

 

Cleaned the folders and all right now. The code is so cool now.

 

Thanks for all the help.

 

Cean

Distinguished Contributor
MarkESmith
Posts: 252
Registered: ‎12-14-2008
Message 29 of 42 (1,687 Views)

Re: Changing C/C component Automation

06-08-2012 01:04 AM in reply to: s.cupples

Hello

 

Could you please show a line of code which will swap content centre nuts?

 

also posted:

http://forums.autodesk.com/t5/Autodesk-Inventor/iLogic-Content-Center-Replace-Nuts/td-p/3489692

 

Many Thanks

 

MES

Employee
MjDeck
Posts: 959
Registered: ‎02-24-2009
Message 30 of 42 (1,668 Views)

Re: Changing C/C component Automation

06-15-2012 01:35 PM in reply to: MjDeck

Mark,

 See the sample rule in the attached file SwapNut.txt.  It will select a different member row within a family.  With modifications, it could select a different family.  To make it work in an assembly, you need to change the name of the nut component (the component name in the Model browser, not the file name) to "Ansi B18.2.4.2M Nut:1".  Also, create a Text parameter named NutType.  Make it a multi-value parameter, with possible values:
M3x0.5
M4x0.7
M5x0.8

 



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

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.