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: 

Set Rev table row to Static, add row

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
cbenner
4172 Views, 13 Replies

Set Rev table row to Static, add row

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

13 REPLIES 13
Message 2 of 14
jdkriek
in reply to: cbenner

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
in reply to: jdkriek

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
in reply to: cbenner

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.


Message 5 of 14
cbenner
in reply to: jdkriek

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
in reply to: cbenner

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
Arrush80_
in reply to: jdkriek

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

Message 8 of 14
MechMachineMan
in reply to: Arrush80_

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
Arrush80_
in reply to: MechMachineMan

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.

Message 10 of 14
MechMachineMan
in reply to: Arrush80_

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
Message 11 of 14
Arrush80_
in reply to: MechMachineMan

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()

 

Message 12 of 14

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
Arrush80_
in reply to: MechMachineMan

Thank you
Message 14 of 14
schakradeo
in reply to: cbenner

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.

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

Post to forums  

Autodesk Design & Make Report