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: 

update drawings before checking them into Vault

3 REPLIES 3
Reply
Message 1 of 4
johan.degreef
326 Views, 3 Replies

update drawings before checking them into Vault

johan.degreef
Advisor
Advisor

I need to add a style to all my old drawings, in order to make the Vault revision table work on them. Would it be possible to get help here, to have a rule to do that for me? I will run the rule drawing per drawing.

 

Add PTN_Revision 

Set Revision Table/Tag to PTN_Revision

 

Many Thanks, Johan

 

Knipsel.JPG

 

Knipsel.JPG

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes

update drawings before checking them into Vault

I need to add a style to all my old drawings, in order to make the Vault revision table work on them. Would it be possible to get help here, to have a rule to do that for me? I will run the rule drawing per drawing.

 

Add PTN_Revision 

Set Revision Table/Tag to PTN_Revision

 

Many Thanks, Johan

 

Knipsel.JPG

 

Knipsel.JPG

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
3 REPLIES 3
Message 2 of 4

johan.degreef
Advisor
Advisor

Add PTN_Revision 

 

I do have a ptn_revision.xml to import the style.

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
0 Likes

Add PTN_Revision 

 

I do have a ptn_revision.xml to import the style.

Inventor 2025, Vault Professional 2025, Autocad Plant 3D 2025
Message 3 of 4
JelteDeJong
in reply to: johan.degreef

JelteDeJong
Mentor
Mentor

i assume that you have added your drawing syles to the global styles. In that case you could try this.

 

Dim doc As DrawingDocument = ThisDoc.Document
Dim revStyle
Try
	revStyle = doc.StylesManager.RevisionTableStyles.Item("PTN Revision")
Catch
	MsgBox("Could not get style with name: PTN Revision")
	return
End Try

If (revStyle.StyleLocation = StyleLocationEnum.kBothStyleLocation) Then
    revStyle.UpdateFromGlobal()
ElseIf (revStyle.StyleLocation = StyleLocationEnum.kLibraryStyleLocation) Then
    revStyle.ConvertToLocal()
End If

For Each sheet As Sheet In doc.Sheets
    For Each table As RevisionTable In Sheet.RevisionTables
        table.Style = revStyle
    Next
Next

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes

i assume that you have added your drawing syles to the global styles. In that case you could try this.

 

Dim doc As DrawingDocument = ThisDoc.Document
Dim revStyle
Try
	revStyle = doc.StylesManager.RevisionTableStyles.Item("PTN Revision")
Catch
	MsgBox("Could not get style with name: PTN Revision")
	return
End Try

If (revStyle.StyleLocation = StyleLocationEnum.kBothStyleLocation) Then
    revStyle.UpdateFromGlobal()
ElseIf (revStyle.StyleLocation = StyleLocationEnum.kLibraryStyleLocation) Then
    revStyle.ConvertToLocal()
End If

For Each sheet As Sheet In doc.Sheets
    For Each table As RevisionTable In Sheet.RevisionTables
        table.Style = revStyle
    Next
Next

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 4
Tony_Yates
in reply to: johan.degreef

Tony_Yates
Advocate
Advocate

Hi,

 

Try this,

 


Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet

 

'-----------------------------------Add Revision table--------------------------------------

Dim oTablePt As Point2d
oTablePt = ThisApplication.TransientGeometry.CreatePoint2d(53.3, 57.8)

If oSheet.RevisionTables.Count = 0 Then
Dim oRevTableStyle As RevisionTableStyle
oRevTableStyle = oDrawingDoc.StylesManager.RevisionTableStyles.Item("Revision Table (PTN Revision)")
Dim oRevTable As RevisionTable
oRevTable = oSheet.RevisionTables.Add2(oTablePt, True, True, True, "A", oRevTableStyle, )
Else
MessageBox.Show("Revision Table already exist", "Autodesk Inventor")
End If

Dim oRevTableItem As RevisionTable
oRevTableItem = oSheet.RevisionTables.Item(1)

Dim oWidthRevTable As Double
oWidthRevTable = oRevTableItem.RangeBox.MaxPoint.X - oRevTableItem.RangeBox.MinPoint.X

Dim oHeightRevTable As Double
oHeightRevTable = oRevTableItem.RangeBox.MaxPoint.Y - oRevTableItem.RangeBox.MinPoint.Y

0 Likes

Hi,

 

Try this,

 


Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDrawingDoc.ActiveSheet

 

'-----------------------------------Add Revision table--------------------------------------

Dim oTablePt As Point2d
oTablePt = ThisApplication.TransientGeometry.CreatePoint2d(53.3, 57.8)

If oSheet.RevisionTables.Count = 0 Then
Dim oRevTableStyle As RevisionTableStyle
oRevTableStyle = oDrawingDoc.StylesManager.RevisionTableStyles.Item("Revision Table (PTN Revision)")
Dim oRevTable As RevisionTable
oRevTable = oSheet.RevisionTables.Add2(oTablePt, True, True, True, "A", oRevTableStyle, )
Else
MessageBox.Show("Revision Table already exist", "Autodesk Inventor")
End If

Dim oRevTableItem As RevisionTable
oRevTableItem = oSheet.RevisionTables.Item(1)

Dim oWidthRevTable As Double
oWidthRevTable = oRevTableItem.RangeBox.MaxPoint.X - oRevTableItem.RangeBox.MinPoint.X

Dim oHeightRevTable As Double
oHeightRevTable = oRevTableItem.RangeBox.MaxPoint.Y - oRevTableItem.RangeBox.MinPoint.Y

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

Post to forums  

Autodesk Design & Make Report