iLogic - delete revision marks

iLogic - delete revision marks

Anonymous
Not applicable
1,151 Views
8 Replies
Message 1 of 9

iLogic - delete revision marks

Anonymous
Not applicable

Hi,

 

I would like a code to delete all revision marks (only in active sheet).

 

Any suggestions? Thanks!

0 Likes
Accepted solutions (1)
1,152 Views
8 Replies
Replies (8)
Message 2 of 9

Stakin
Collaborator
Collaborator

Can you post one picture of this problem?

0 Likes
Message 3 of 9

Anonymous
Not applicable

As far as I know there is no way to do it.

You can only delete corresponding rows in your revision table.

Revision tag will disappear when it's row is deleted.

0 Likes
Message 4 of 9

JhoelForshav
Mentor
Mentor

Hi @Anonymous 

Here's kind of a workaround solution I found by @Curtis_Waguespack 

Dim oDrawDoc As Inventor.DrawingDocument = ThisApplication.ActiveEditDocument
Dim oRevTable As RevisionTable	

'get the current rev letter
oRev = iProperties.Value("Project", "Revision Number")

Try	'try to get the first rev table on the active sheet
	oRevTable = oDrawDoc.ActiveSheet.RevisionTables.Item(1)
Catch 'catch error when no rev table is found
	MessageBox.Show("Error: Most likely no revison table was found", "iLogic")
End Try
			
'define the rev table rows collection
Dim oRows As RevisionTableRows 
oRows = oRevTable.RevisionTableRows

'add new rev row, so that the old rows can be deleted	
oRows.Add() 

'look at all of the rows in the rev table
For Each oRow In oRows
	If oRow.IsActiveRow Then 
		'do nothing for the active row
	Else
		oRow.Delete 'deletes rev tags also
	End If
Next

'set rev number/letter back to what it was
iProperties.Value("Project", "Revision Number") = oRev

''Or set rev number/letter back to default

 The forum thread:

https://forums.autodesk.com/t5/inventor-forum/ilogic-rule-to-remove-all-revision-tags/td-p/5706327

 

0 Likes
Message 5 of 9

Stakin
Collaborator
Collaborator

try this:

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
	oSheet = oDrawingDoc.ActiveSheet
Dim oTG As TransientGeometry
	oTG = ThisApplication.TransientGeometry
If oSheet.RevisionTables.Count=0 Then
	oSheet.RevisionTables.Add(oTG.CreatePoint2d(-100, -100))
End If

Dim oRevisionTable As RevisionTable

Dim oRevisionTableRow As RevisionTableRow
For Each oRevisionTable In oSheet.RevisionTables
    oRevisionTable.RevisionTableRows.Add
	For Each oRevisionTableRow In oRevisionTable.RevisionTableRows
		If oRevisionTableRow.IsActiveRow = 0 Then
		   oRevisionTableRow.Delete
	   End If 
	Next
	oRevisionTable.Delete
Next

 Before run the rule:

 

2020211302242.JPG

after run the rule:

202011302243.JPG

0 Likes
Message 6 of 9

Anonymous
Not applicable

Stakin: Your code worked on one drawing but not an other.

 

The drawing it worked on this show up when I double-click the revision mark:

 

rev1.PNG

 

On the drawing it didn't work this show up when I double-click the revision mark:

 

rev2.PNG

 

 

Based on this, do you know why?

 

 

 

 

0 Likes
Message 7 of 9

WCrihfield
Mentor
Mentor

You could use something like this to get rid of all the 'SketchedSymbols' named "Revision Mark" from your active sheet.

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
For Each oSS As SketchedSymbol In oSheet.SketchedSymbols
	If oSS.Name = "Revision Mark" Then
		oSS.Delete
	End If
Next

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS 💡and Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 8 of 9

Stakin
Collaborator
Collaborator
Accepted solution

@WCrihfield I think maybe merge ours code,let them work together

 

@Anonymous ,try it

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument 
Dim oSheet As Sheet
	oSheet = oDrawingDoc.ActiveSheet
Dim oTG As TransientGeometry
	oTG = ThisApplication.TransientGeometry
If oSheet.RevisionTables.Count=0 Then
	oSheet.RevisionTables.Add(oTG.CreatePoint2d(-100, -100))
End If

Dim oRevisionTable As RevisionTable

Dim oRevisionTableRow As RevisionTableRow
For Each oRevisionTable In oSheet.RevisionTables
    oRevisionTable.RevisionTableRows.Add
	For Each oRevisionTableRow In oRevisionTable.RevisionTableRows
		If oRevisionTableRow.IsActiveRow = 0 Then
		   oRevisionTableRow.Delete
	   End If 
	Next
	oRevisionTable.Delete
Next

For Each oSS As SketchedSymbol In oSheet.SketchedSymbols
If oSS.Name = "Revision Mark" Then
oSS.Delete
End If
Next
Message 9 of 9

Anonymous
Not applicable

That merged version did the trick! Thank you both WCrihfield and Stakin!

0 Likes