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: 

creating table on idw and importing file datas in it

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
srionde
612 Views, 6 Replies

creating table on idw and importing file datas in it

HEllo

 

I am just discovering the Ilogic feature, and i was wondering if we can create a table and importing some datas from other files in it.

 

This is for idw, as we are using 1 file per drawing i would like to make a summary of all my project's drawing into the first page.

 

I was looking for some information about creating a table and has not found any good thing.

 

I don'T want to use Excel at all for that.

If anyone could send me some link with ressources it would be really nice

 

Thank you

6 REPLIES 6
Message 2 of 7
salariua
in reply to: srionde

The only way I could do that was to add virtual parts to a parts list. Hide the default parts and add your info as virtual parts.

 

http://blog.ads-sol.com/2014/08/info-table-in-drawing.html

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 3 of 7
dkatz
in reply to: srionde

you could just make your own custom table (instead of a parts list) and pull parameters and iprops in programmatically. Here's the example from the Autodesk Programming help (I converted it over for iLogic use, as I'm sure many others have).

 

Public Sub CreateCustomTable()
    ' Set a reference to the drawing document.
    ' This assumes a drawing document is active.
    Dim oDrawDoc As DrawingDocument
    oDrawDoc = ThisApplication.ActiveDocument
    
    ' Set a reference to the active sheet.
    Dim oSheet As Sheet
    oSheet = oDrawDoc.ActiveSheet
    
    ' Set the column titles
    Dim oTitles(0 To 2) As String
    oTitles(0) = "Part Number"
    oTitles(1) = "Quantity"
    oTitles(2) = "Material"
    
    ' Set the contents of the custom table (contents are set row-wise)
    Dim oContents(0 To 8) As String
    oContents(0) = "1"
    oContents(1) = "1"
    oContents(2) = "Brass"
    oContents(3) = "2"
    oContents(4) = "2"
    oContents(5) = "Aluminium"
    oContents(6) = "3"
    oContents(7) = "1"
    oContents(8) = "Steel"
    
    ' Set the column widths (defaults to the column title width if not specified)
    Dim oColumnWidths(0 To 2) As Double
    oColumnWidths(0) = 2.5
    oColumnWidths(1) = 2.5
    oColumnWidths(2) = 4
      
    ' Create the custom table
    Dim oCustomTable As CustomTable
    oCustomTable = oSheet.CustomTables.Add("My Table", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), _
                                        3, 3, oTitles, oContents, oColumnWidths)
                                        

End Sub
 

 

So then you could fill out the contents with iproperties/paramters from the part using something like this: http://forums.autodesk.com/t5/inventor-general-discussion/using-ilogic-to-retrieve-iproperties-form-...

 

Hope that gets you somewhere closer.

Message 4 of 7
salariua
in reply to: dkatz

I have looked long and hard to create a custom table, I didn't wanted to touch the parts list but that's the only way I found.

 

The code seems fine except it creates a new table everytime. Need to check if table exists, update if yes, create if not.

 

Thanks.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!
Message 5 of 7
dkatz
in reply to: salariua

TableCount = 0
	numtables = oSheet.CustomTables.Count ' VB Code to count the number of custom tables on the page
	If numtables > 0 Then
		For	i = numtables To 1 Step -1 
			TableTitle = oSheet.CustomTables.Item(i).Title						
			If TableTitle = "My Table" Then
				TableCount = TableCount + 1
			End If
		Next
	End If

 

 

You'll find this snippet to be useful for determining if you have a table already. Ive used the title as the way of distinguishing one table from another.

Message 6 of 7
srionde
in reply to: dkatz

Thank you all of you for the information, I had no time yet to set some code lines, as soon as I will start it and I will all let you know.

 

I have also found some old code from inv 11 (I have relaese 2015) using commands like "set" or  some other commands that are not anymore in use.

 

 

Message 7 of 7
salariua
in reply to: dkatz

Thanks,

 

I didn't got your message; for some reason I don't get emails all the time.

 

I will need to check if a custom table has been placed allready, I am having as much as 3 custom tables on some drawings.

Adrian S.
blog.ads-sol.com 

AIP2012-2020 i7 6700k AMD R9 370
Did you find this reply helpful ?
If so please use the Accepted Solutions or Like button - Thank you!

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

Post to forums  

Autodesk Design & Make Report