Set Rev table row to Static, add row

Set Rev table row to Static, add row

cbenner
Mentor Mentor
4,815 Views
13 Replies
Message 1 of 14

Set Rev table row to Static, add row

cbenner
Mentor
Mentor

Hey all,

 

I have never attempted any i-logic before and this may be running before I can walk, but I was wondering if this premise even sounded do-able.  I would like to create a rule to set the last row of my revision table to all static values, and then add a row.  I wouldn't even know where to start... si asking if it's even possible sounded like the right first question.

 

If so, then I'll pick some brains on how to get going.  I'm not going to ask anyone to write this for me, but I wouldn't mind some tutoring.

 

TIA

Accepted solutions (2)
4,816 Views
13 Replies
Replies (13)
Message 2 of 14

jdkriek
Advisor
Advisor
Accepted solution

Wrote this real quick

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument

' Get the revision table
Dim oRevTable As RevisionTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)

' Get last row
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)

' Make sure we have the active row
If oRow.IsActiveRow Then
	' Go through all columns in that row
	For i = 1 To oRevTable.RevisionTableColumns.Count
		Dim oCell As RevisionTableCell = oRow.Item(i)
		' Set all cells to static
		oCell.Text = oCell.Text
		' or static and blank
		'oCell.Text = ""
	Next
End If

' Add another row at the end
Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows
oRows.Add()
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 14

cbenner
Mentor
Mentor

Jonathon,

 

Wow,... thanks!  I wasn't expecting this much.  I am getting this error on row 8 though... can you advise?

 

Error on Line 8 : Comma, ')', or a valid expression continuation expected.

 

Is it missing a parenthese or something?  I remember playing with Autolisp a few (ok maybe 20) years ago, and that was always a killer.

Message 4 of 14

jdkriek
Advisor
Advisor
Accepted solution

Chris, you're welcome 🙂

 

I don't get any errors running the code under 2011, 2012, or 2013 - what version are you running?

 

Note sometimes you have to paste the code into notepad before pasting it into the iLogic rule to keep formatting.

 

Try downloading this text file and pasting from there:

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 5 of 14

cbenner
Mentor
Mentor

That did it!  Thanks a million, you just automated what was going to be a rather tedious procedure.  I owe ya one... maybe if we both go to AU, I can buy you a free beer at the AUGI party.

Message 6 of 14

jdkriek
Advisor
Advisor

Glad that worked for you - I'll definately take you up on the drink.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 7 of 14

Anonymous
Not applicable

Sorry I realize this thread is a little old, but is there any way to add a prompt in the code to ask for input to the revision table? I have an ECO column as well as a description column which I would like to fill out and make static using the above code.

 

Thank you

0 Likes
Message 8 of 14

MechMachineMan
Advisor
Advisor
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument

' Get the revision table
Dim oRevTable As RevisionTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)

' Get last row
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)

Dim oCell As RevisionTableCell
' Make sure we have the active row If oRow.IsActiveRow Then ' Go through all columns in that row For i = 1 To oRevTable.RevisionTableColumns.Count oCell = oRow.Item(i)
If i = 2 'indicates the 2nd column in revision table
oCell.Text = InputBox("What should the cell read?", "Rev Table Help", "DEFAULT TEXT") End if
oCell.Text = oCell.Text 'This sets all cells to static
Next End If ' Add another row at the end Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows oRows.Add()

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 9 of 14

Anonymous
Not applicable

So this seems to be working, but it enters the "default text" in the current revision and creates a new blank revision row when I run the rule.

0 Likes
Message 10 of 14

MechMachineMan
Advisor
Advisor
Have you tried typing something else instead of default text in the pop-up
window?

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
0 Likes
Message 11 of 14

Anonymous
Not applicable

Yes I did, here I modified the code to fit my process, and attached a screen of the outcome. It must be the order of the code just not sure how to modify it.

 

SyntaxEditor Code Snippet

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument

' Get the revision table
Dim oRevTable As RevisionTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)

' Get last row
Dim oRow As RevisionTableRow
oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)

Dim oCell As RevisionTableCell 

' Make sure we have the active row
If oRow.IsActiveRow Then
    ' Go through all columns in that row
    For i = 1 To oRevTable.RevisionTableColumns.Count
        oCell = oRow.Item(i)
                If i = 2 'indicates the 2nd column in revision table
                         oCell.Text = InputBox("Please Enter The ECO Number", "Revision Table", "INITDES-000XXX")
                 ElseIf i = 3 'indicates the 3nd column in revision table
                         oCell.Text = InputBox("Please Enter The Revision Description", "Revision Table", "INITIAL DESIGN")
        End If
                oCell.Text = oCell.Text   'This sets all cells to static

    Next
End If

' Add another row at the end
Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows
oRows.Add()

 

0 Likes
Message 12 of 14

MechMachineMan
Advisor
Advisor
I just rearraged the code so it adds a new row before modifying the old one.
Should have been easy enough to decifer... I mean the code is pretty easy to read if you just pick out key words. Like verbs and nouns....
@MechMachineMan wrote:
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument

' Get the revision table
Dim oRevTable As RevisionTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)

' Add another row at the end
Dim oRows As RevisionTableRows = oRevTable.RevisionTableRows
oRows.Add()
' Get last row Dim oRow As RevisionTableRow oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)
Dim oCell As RevisionTableCell
' Make sure we have the active row If oRow.IsActiveRow Then ' Go through all columns in that row For i = 1 To oRevTable.RevisionTableColumns.Count oCell = oRow.Item(i)
If i = 2 'indicates the 2nd column in revision table
oCell.Text = InputBox("What should the cell read?", "Rev Table Help", "DEFAULT TEXT") End if

oCell.Text = oCell.Text 'This sets all cells to static Next End If

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 13 of 14

Anonymous
Not applicable
Thank you
0 Likes
Message 14 of 14

schakradeo
Observer
Observer

Hello,

I want to change the revision on my sheet from A0,A1,A2... to B. I want to create an ilogic rule for that.

I'm trying to create an ilogic rule where you would delete all the revision rows except the first one, and rename the first column to "B"

I also want to automatically save the file after changing the rev table.

 

I tried creating an ilogic rule to change the Revision number property under iProperties>Project. But that doesn't update the revision in the title block correctly. Apparently the revision number iProperty and the one displayed on the title block is different.

Any help would be appreciated.

0 Likes