Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iLogic rule for assembly to generate a drawing list in excel

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
TorbjornRolfSallander
1573 Views, 3 Replies

iLogic rule for assembly to generate a drawing list in excel

I like to be abel to generate a drawing list from an Assembly. The result should be a list with PartNumber Title Date Revision ... for all the assemblys and parts in the structure that got a drawing.

 

I got a very well functioning iLogic rule that generates all the pdf´s in the structure, see attached file, so all I need is to add a few lines to create an excel document and then in the same loop as the pdf creation export the iProperties from the part/assy to the excel doc. It feels simple enough but it exceeds my knowledge in programming.

 

Please help!!

 

3 REPLIES 3
Message 2 of 4

Try the following rule to debug the export of your iProperties to the Excel workbook.
It assumes that the active document is an assembly.

'open the existing excel file
GoExcel.Open("c:\Temp\AAA\EXPORT.xlsx", "Sheet1")

'Print column titles in the row 2
Dim Names={"Display name", "Title", "Part Number", "Date", "Revision"}
GoExcel.CellValues("A2", "E2") = Names

Dim oAsmDoc As AssemblyDocument = TryCast(ThisApplication.ActiveDocument,AssemblyDocument)
If oAsmDoc Is Nothing Then
	MessageBox.Show("Activate assembly document first", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)
	Exit Sub
End If

Dim Data(4) As String	'string array for properties	
Dim row As Integer = 3	'start data row
Dim oPropSet As PropertySet
Dim oProp As Inventor.Property	

For Each oDoc As Inventor.Document In oAsmDoc.AllReferencedDocuments
	'full filename
	Data(0) = oDoc.FullFileName

    'Title
    oPropSet = oDoc.PropertySets.Item("Inventor Summary Information")
    oProp = oPropSet.Item("Title")
	Data(1) = oProp.Value
    
    'Part Number
    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")
    oProp = oPropSet.Item("Part Number")
	Data(2) = oProp.Value
    
    'Date
    oPropSet = oDoc.PropertySets.Item("Design Tracking Properties")
    oProp = oPropSet.Item("Creation Time")
	Data(3) = oProp.Value
    
    'Revision
    oPropSet = oDoc.PropertySets.Item("Inventor Summary Information")
    oProp = oPropSet.Item("Revision Number")
	Data(4) = oProp.Value
    
	GoExcel.CellValues("A" & CStr(row), "E" & CStr(row)) = Data
	row += 1
Next

GoExcel.Save
GoExcel.Close
    
MessageBox.Show("Done", "iLogic",MessageBoxButtons.OK,MessageBoxIcon.Information)

' === end of the rule ===

 

Good overview of how to access iProperties is published here:

http://modthemachine.typepad.com/my_weblog/2010/02/accessing-iproperties.html

 

Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

What are the relasionship between API and the iLogic interface? Are all the API syntax ok to use in iLogic?

I have tried to use some API code before but somtimes i get somting like "the "blabla" object does not have that "blabla".... and the iLogic interface does not give any clue to wat arguments I could use, just that what i just tried does not work...

 

Message 4 of 4

There is a good overview in the Inventor APi vs iLogic API presented by Wayne Brill:

http://au.autodesk.com/au-online/classes-on-demand/class-catalog/2011/autocad-inventor-suites/autode...

Hope it could help.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report