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
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
Add PTN_Revision
I do have a ptn_revision.xml to import the style.
Add PTN_Revision
I do have a ptn_revision.xml to import the style.
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.
Blog: hjalte.nl - github.com
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.
Blog: hjalte.nl - github.com
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
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.