Inventor Customization

Reply
Member
e.wiggers
Posts: 3
Registered: ‎10-25-2007
Message 1 of 5 (417 Views)

Partslist export to DWG and PDF

417 Views, 4 Replies
07-03-2012 06:54 AM

Hello,

 

We are working with IV2012 and for a customer we have to generate about 1400 drawings. All these drawings we have to export to (Autocad) DWG and PDF format with the drawing number, revision, sheet size and name in the filename processed. All the parts and assemblies only have the part number as filename and this corresponds to the drawing file (idw) name. We dont want to change these basic filenames so i made a rule to export a assembly drawing and the part list, if present.

 

So far so good, the only problem I encounter is that I can't get the revision number outoff the iproperties from the right drawing. Say that if the assembly drawing has revision A, all the exported drawings from the part list get that revision number, even if they don't have a revision filled in. At first I export the main drawing, then test for a part list, if present, I loop through all the drawings in the part list, open them and export them to DWG and PDF. And that's the point where it is going wrong with the right revision number. It seems that the only iproperties I can approach are those from the main drawing, the file from where the rule is fired.

 

Can anybody help us with this problem, we have to export all these drawings at the end of this week.

 

Because the rule is pretty long I attached it.

 

Eelco Wiggers

Senior Engineer

 

Falcon engineers

The Netherlands

 

Contributor
zsc100
Posts: 18
Registered: ‎07-27-2012
Message 2 of 5 (328 Views)

Re: Partslist export to DWG and PDF

09-19-2012 08:58 AM in reply to: e.wiggers

Hey, I know it may be a little late, but I am doing something similar.  I have had no problem getting the revision # from any and all different parts and assemblies in the drawing.  My script is used to export partslists and other iProperty information from IDWs.  Here is the way I select what IPT or IAM iProperties I'm going use:

-----------------------------------------------------

' Get the Documents collection object
Set invDocs = ThisApplication.Documents
' Iterate through the contents of the Documents collection.
For Each invDoc In invDocs
' Display the full filename of the document
ListBox1.AddItem (invDoc.FullFileName)
If Right(invDoc.FullFileName, 4) = ".ipt" Then
CountIPT = CountIPT + 1
UseModelIPT = IndexCounter
End If

If Right(invDoc.FullFileName, 4) = ".iam" Then
CountIAM = CountIAM + 1
UseModelIAM = IndexCounter
End If

IndexCounter = IndexCounter + 1
Next

-----------------------------------------------------

 

Then to select which ever file you want you simply set the correct invDocs.Item like this:

Set invDoc = invDocs.Item(UseModelIAM)

 

Then access the the rev # like this:

Set invDocProperty = invDoc.PropertySets.Item("Inventor Summary Information").Item("Revision Number")

UserForm1.TextBox5.Text = invDocProperty.Value

 

 

 

I really appreciate your code to check if a parts list is present or not.  I had spent hours trying to find a method to see if a parts list existed until I saw your error handler idea.  I hate having to use an error handler, but I'm convinced that may be the only way.

 

Thanks,

Zach

ADN Support Specialist
xiaodong.liang
Posts: 1,263
Registered: ‎06-12-2011
Message 3 of 5 (302 Views)

Re: Partslist export to DWG and PDF

09-24-2012 08:11 PM in reply to: zsc100

Hi,

 

I am just interested in jumping to discuss how to  check if a parts list is present or not. Error handle is OK, but I am not clear why you did not use PartLists.Count. If it is 0, that means no part list exists.

 

Probably what you want to check is if a specific part list exists in PartLists? In general, to check one specific item exists or not within a collection, the first we could think of is to check its name. However PartsList has no name. PartsList.Attribute may be useful if you attach some attribute with it already.



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Contributor
zsc100
Posts: 18
Registered: ‎07-27-2012
Message 4 of 5 (287 Views)

Re: Partslist export to DWG and PDF

09-25-2012 02:40 PM in reply to: xiaodong.liang

Thank you Xiaodong, that worked.  How could I have been aware of that function.  When I type

"If (invDoc.ActiveSheet." I would like to see a dropdown of all possible options, but that doesn't happen after ActiveSheet, I guess because the IDE doesn't immediately know what the active sheet could be, so it doesn't give me any options.  It would be nice if there was an easy one-stop-shop reference for stuff like this; maybe there is and I've just missed it?

 

Thanks again,, that is a much cleaner way to check for partslists.

 

Zach

ADN Support Specialist
xiaodong.liang
Posts: 1,263
Registered: ‎06-12-2011
Message 5 of 5 (257 Views)

Re: Partslist export to DWG and PDF

10-10-2012 02:45 AM in reply to: zsc100

Hi,

 

you meant the dropdown list of the propeties & methods of ActiveSheet does not appear? Any object of Inventor? It works well in my Visual Studio. I have no experience on this, probably you will need to consult with MSDN why this happened.



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

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