Access Revision Number - But Not iProperty Revision Number

Access Revision Number - But Not iProperty Revision Number

Curtis_Waguespack
Consultant Consultant
1,547 Views
4 Replies
Message 1 of 5

Access Revision Number - But Not iProperty Revision Number

Curtis_Waguespack
Consultant
Consultant

Does anyone know how to access the document's internal revision number? Not the iProperty "Revision Number", but what ever Inventor uses to keep track of the revision number internally?

 

I'm really trying to determine when the iProperty "Revision Number" and the document's internal revision number are not the same, as this causes me issues when attempting to automate a revision roll.

 

Here is a quick video that demonstrates how the iProperty "Revision Number" and the document's internal revision number are not the same thing, in case it helps. Also attached is the example file (Inventor 2015) in case it helps.

 

Thanks in advance,
Curtis

 

EESignature

Accepted solutions (2)
1,548 Views
4 Replies
Replies (4)
Message 2 of 5

MechMachineMan
Advisor
Advisor
Accepted solution

I have looked into this before, and the only way I could find to access it was through the revision table, or if the <Sheet Revision> property was used on the page, I would have to iterate through the titleblock textboxes and find it.

 

Seems like a stupid workaround, and seems silly how they don't have a crucial peice of drafting infromation exposed.

 

And that being said, the only way to control it was to add/remove revision rows.


--------------------------------------
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 3 of 5

Curtis_Waguespack
Consultant
Consultant

Hi MechMachineMan,

 

I was afraid of that.  Unfortunately using the <Sheet Revision> property won't work for me, but adding and then removing a revision row gets the job done.

 

Here's an example iLogic rule for anyone else who might find this useful in the future.

 

Thank you!
Curtis

 

oApp = ThisApplication
oThisDoc = ThisDoc.Document
'create transaction
Call oApp.TransactionManager.StartTransaction(oThisDoc, "Get Next Rev")	
	Try
	' Get the revision table
		Dim oRevTable As RevisionTable
		oRevTable = oThisDoc.ActiveSheet.RevisionTables.Item(1)
		
		'add a row
		Dim oRows As RevisionTableRows 
		oRevRowCount = oRevTable.RevisionTableRows.Count		
		Dim oRow As RevisionTableRow
		oRows = oRevTable.RevisionTableRows
		oRows.Add()	
		
		' Get last row
		oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)	

		'get first entry in that row 
		Dim oCell_1 As RevisionTableCell = oRow.Item(1)	
		SharedVariable("NextRev") = oCell_1.Text 
	Catch
		MessageBox.Show("Revision Block Not Found.", "iLogic")
	End Try
oApp.TransactionManager.EndTransaction 'end transaction
oApp.TransactionManager.UndoTransaction() 'undo transaction

If SharedVariable("NextRev") <> iProperties.Value("Project", "Revision Number") Then
MessageBox.Show("Revision override found." &vbLf & vbLf & _
"Revision iProperty is : " & iProperties.Value("Project", "Revision Number")  & vbLf & _
"But the actual next revision will be: " & SharedVariable("NextRev"), "iLogic")
End If




EESignature

0 Likes
Message 4 of 5

Curtis_Waguespack
Consultant
Consultant
Accepted solution

 

Updated iLogic, the other version did not work as expected:

 

oApp = ThisApplication
oThisDoc = ThisDoc.Document

'[ create transaction
Call oApp.TransactionManager.StartTransaction(oThisDoc, "Get Next Rev")	

Try
' Get the revision table
	Dim oRevTable As RevisionTable
	oRevTable = oThisDoc.ActiveSheet.RevisionTables.Item(1)
	
	Dim oRows As RevisionTableRows 
	Dim oRow As RevisionTableRow

	'get last row
	oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)	
	Dim oCell As RevisionTableCell = oRow.Item(1)
	
	'add a row
	oRows = oRevTable.RevisionTableRows
	oRows.Add()	
	
	'get new last row
	oRow = oRevTable.RevisionTableRows.Item(oRevTable.RevisionTableRows.Count)	

	'get first entry in that row 
	Dim oCell_1 As RevisionTableCell = oRow.Item(1)	
	SharedVariable("NextRev") = oCell_1.Text
	'check is values are equal
	SharedVariable("RevOverride") = Chr(Asc(oCell.Text)+1) = oCell_1.Text
	'MessageBox.Show(Chr(Asc(oCell.Text)+1), oCell_1.Text)
Catch
	MessageBox.Show("Revision Block Not Found.", "iLogic")
End Try

oApp.TransactionManager.EndTransaction 'end transaction
oApp.TransactionManager.UndoTransaction() 'undo transaction
']

If SharedVariable("RevOverride") = False Then
MessageBox.Show("Revision override found." &vbLf & vbLf & _
"Revision iProperty is : " & iProperties.Value("Project", "Revision Number")  & vbLf & _
"But the actual next revision will be: " & SharedVariable("NextRev"), "iLogic")
End If

EESignature

Message 5 of 5

DRoam
Mentor
Mentor

Along the same vane, is there a way to access a Sheet's individual Revision number? I'm trying to write some iLogic that will overwrite the Revision for a range of sheets, and all I'm missing is a command that looks something like:

 

 

oSheet.Revision = "1"

But I haven't been able to find the proper code to access the current sheet's Revision property.

 

0 Likes