Inventor General Discussion

Inventor General Discussion

Reply
Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 1 of 21 (492 Views)
Accepted Solution

parts lists in Inventor 2012

492 Views, 20 Replies
06-08-2012 09:48 AM

Hi,

I have created 2 parts list styles and need to be able to change just the parts list style for the active sheet in a multiple sheet document.  I read in posts on this forum that this was not possible in previous versions.  Is this now possible with the API for Inventor 2012 or 2013?  I know it can be done thru the UI, but have not been able to figure out how to or even if it can be done using the API for 2012. 

 

Thanks!

 

*Pro
sbixler
Posts: 1,881
Registered: ‎09-15-2003
Message 2 of 21 (461 Views)

Re: parts lists in Inventor 2012

06-11-2012 03:59 AM in reply to: cmines

PartsList.Style property should do the job.  Haven't tried it, just looking in the API Reference section of the Programming Help.

Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 3 of 21 (453 Views)

Re: parts lists in Inventor 2012

06-11-2012 06:34 AM in reply to: sbixler

That's what I thought, and tried, but I couldn't get it to work.  What would the code look like to set the name?  When selected the API Reference help for the Name property of the PartsListStyle from the Object Browser, it took me to the Style.Name property instead of the PartsListStyle.Name property I was expecting.   When I looked under the PartsListStyle in the API Reference, there is no Name property listed......but there is in the Object Browser.  Any help you could provide would be greatly appreciated.

Thanks!

*Pro
sbixler
Posts: 1,881
Registered: ‎09-15-2003
Message 4 of 21 (450 Views)

Re: parts lists in Inventor 2012

06-11-2012 07:18 AM in reply to: cmines

Looks as if once you have a particular parts list identified, you could use something like this: oMyPartsList.Style = "Parts List (ANSI)".  Again, I haven't tried this, just trying to interpret what I'm reading.

Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 5 of 21 (440 Views)

Re: parts lists in Inventor 2012

06-11-2012 08:17 AM in reply to: sbixler

Sam,

Here is what I tried:

Dim oPartsList As String

Set oPartsList.Style = "Parts List A"

 

I got a compile error "Invalid qualifier"

 

Thanks again for your help!

Chris

*Pro
sbixler
Posts: 1,881
Registered: ‎09-15-2003
Message 6 of 21 (438 Views)

Re: parts lists in Inventor 2012

06-11-2012 08:27 AM in reply to: cmines

Ah, the declaration is a problem (I hope it's the only problem)-- you need to declare the Parts List object as a PartsList object, not a string.  So "Dim oPartsList As PartsList"

Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 7 of 21 (432 Views)

Re: parts lists in Inventor 2012

06-11-2012 11:02 AM in reply to: sbixler

ok....I'm not getting any errors (YEA),  but it didn't change the parts list style.....(sigh).  Anything else I should try?

Thanks again,

Chris

*Pro
sbixler
Posts: 1,881
Registered: ‎09-15-2003
Message 8 of 21 (424 Views)

Re: parts lists in Inventor 2012

06-11-2012 12:03 PM in reply to: cmines

How are you getting oPartsList to be the actual list you're interested in?  How many parts lists are there in each drawing?  Only one, or could there be more?

Contributor
cmines
Posts: 21
Registered: ‎06-08-2012
Message 9 of 21 (418 Views)

Re: parts lists in Inventor 2012

06-11-2012 01:17 PM in reply to: sbixler

Sam,

Right before I add the first parts list, I'm setting the style.  I wrote a macro that essentially creates a parts list for the first part found, and then adds custom line (from a temp part list)  for each additional part found on the sheet.  It works great when I use my idw template that already has the parts list style that I want as default.   Now I need to run the macro in an idw that has a different parts list style as default and get the macro to change only the parts list style when it is run.  Here is how I'm trying to set the style for the first parts list created.

 

' Create the parts list and set a reference to it.    

Dim oPartsList As PartsList    

Set oPartsList.Style = "PARTS LIST PART"    

Set oPartsList = oSheet.PartsLists.Add(oDrawingView1, oPlacementPoint)    

Set oPartsList = oSheet.PartsLists.Item(1)

 

This creates the parts list, just not with the style I am trying to tell it to use.

Thanks for all your help!

Chris

*Expert Elite*
Curtis_Waguespack
Posts: 2,878
Registered: ‎03-08-2006
Message 10 of 21 (407 Views)

Re: parts lists in Inventor 2012

06-11-2012 01:49 PM in reply to: cmines

Hi cmines, 

 

I think you need to use the StylesManager as in this example. I didn't test this, but I think it might be the last missing piece.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

' Create the parts list and set a reference to it.    
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oPartsList As PartsList    
Set oPartsList.Style = oDoc.StylesManager.DimensionStyles.Item("PARTS LIST PART" )
Set oPartsList = oSheet.PartsLists.Add(oDrawingView1, oPlacementPoint)    
Set oPartsList = oSheet.PartsLists.Item(1)

 



  solution.png  Did you find this reply helpful ? If so please use the Accept as Solution or  Kudos button below.





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 or visit the Installation and Licensing Forum to get help installing your software.