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: 

Resort Hole Table

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
rob.j.ross
670 Views, 5 Replies

Resort Hole Table

How do you sort(Resort) a hole table via code?  The hole table does not appear to have a .Resort member.

 

I would think it would be oHoleTable.Resort.

 

Resort.png

____________________________
Inventor Professional 2014 64 Bit
Windows 7 Professional
NVIDIA Quadro FX 4600
Dual Intel Xeon E5540 CPUs
16GB DDR3 Ram
5 REPLIES 5
Message 2 of 6
ekinsb
in reply to: rob.j.ross

The functionalty to re-sort a table is missing from the API and if it was there it would be exactly where you were looking.  I did come up with a workaround that you can see if it will work in your case.  This executes teh re-sort command, just the same as if you run it from the user-interface.  Since it's a contextual command it relies on the table to sort being selected.

 

Public Sub ResortTable()
    Dim drawDoc As DrawingDocument
    Set drawDoc = ThisApplication.ActiveDocument
    
    Dim currentSheet As Sheet
    Set currentSheet = drawDoc.ActiveSheet
    
    ' Get the hole table to sort.
    Dim table As HoleTable
    Set table = currentSheet.HoleTables.Item(1)
    
    ' Add it to the select set.
    drawDoc.SelectSet.Clear
    Call drawDoc.SelectSet.Select(table)
    
    ' Get the re-sort command and execute it.
    ThisApplication.CommandManager.ControlDefinitions. _
               Item("DrawingHoleTableResortCtxCmd").Execute
End Sub

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 6
rob.j.ross
in reply to: ekinsb

Your code worked great.  Thanks Brian.

____________________________
Inventor Professional 2014 64 Bit
Windows 7 Professional
NVIDIA Quadro FX 4600
Dual Intel Xeon E5540 CPUs
16GB DDR3 Ram
Message 4 of 6
piwkorob
in reply to: ekinsb

Hi Brian,
I have the same issue with a lack of column sorting in the hole table, found your article, copied in your ilogic, but nothing happened.  I did not see any new opportunity to sort in any of the commands in the hole table.  We're running the 2014 version of Inventor.  Not sure if anything in your routine needs to be updated as your comments were posted back in 2013, but please let me know if you have any suggestions or updates to the code to make sorting available in the hole table data.

thanx
Rob

Message 5 of 6
ekinsb
in reply to: piwkorob

I just tested this again with Inventor 2015 and it works just the same as it did before.  The original samples was VBA and you mentioned iLogic.  Below is the code converted to an iLogic rule and that is also working.

 

Dim drawDoc As DrawingDocument
drawDoc = ThisApplication.ActiveDocument

Dim currentSheet As Sheet
currentSheet = drawDoc.ActiveSheet

' Get the hole table to sort.
Dim table As HoleTable
table = currentSheet.HoleTables.Item(1)

' Add it to the select set.
drawDoc.SelectSet.Clear
drawDoc.SelectSet.Select(table)

' Get the re-sort command and execute it.
ThisApplication.CommandManager.ControlDefinitions.Item("DrawingHoleTableResortCtxCmd").Execute

 


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 6
piwkorob
in reply to: ekinsb

thanx for your help

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

Post to forums  

Autodesk Design & Make Report