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.
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
If Right(invDoc.FullFileName, 4) = ".ipt" Then
CountIPT = CountIPT + 1
UseModelIPT = IndexCounter
If Right(invDoc.FullFileName, 4) = ".iam" Then
CountIAM = CountIAM + 1
UseModelIAM = IndexCounter
IndexCounter = IndexCounter + 1
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.
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.
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.
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.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register