Bend Tags to view (Add Tags to View)

Bend Tags to view (Add Tags to View)

Anonymous
Not applicable
921 Views
5 Replies
Message 1 of 6

Bend Tags to view (Add Tags to View)

Anonymous
Not applicable

Hi,

 

I have a macro to create drawings for all sheet-metal parts in an assembly.

Each drawing has a single view of the flat pattern and a bend table for the same view i.e.

 

 

'Create the view

objDrawingView = objDrawingSheet.DrawingViews.AddBaseView(objMyPartDocument, objMyPoint2D, dblMyViewScale, _ ViewOrientationTypeEnum.kFlatPivotLeftViewOrientation, _ DrawingViewStyleEnum.kHiddenLineDrawingViewStyle, , , objMyNameSpace)

 

 

 

'Create the bend table

objBendTable = objDrawingSheet.CustomTables.AddBendTable(oMyPartDocument.FullFileName, objMy2ndPoint2D, _ "Bend Table", strBendTableColumns, True, "BEND - ")

 

' where strBendTableColumns = {"BEND ID", "BEND DIRECTION", "BEND ANGLE"}

 

 

Now I want to add tags for the bends to the unfolded view of my part. Doing this manually is by right-clicking on the bend table and selecting the option "Add Tags to View" and then clicking on the view (of the flat pattern) But can I get some help to do this through the same macro??

 

Thanking you,

 

Wajih

0 Likes
Accepted solutions (1)
922 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Accepted solution
I got the following response from the Autodesk support team, so I thought I should post it here for reference; Dear Syed Wajih Hassan, Apologies for our late response. We have backlog in the queue. For some reasons, the original forum link is not available now. I investigated your question. It looks there is not an API for the ability, but the following workaround is working. Could you give it a try whether it helps? Public Sub CreateBendTable() ' Set a reference to the active drawing document Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument ' Set a reference to the active sheet Dim oActiveSheet As Sheet Set oActiveSheet = oDrawDoc.ActiveSheet ' Create the placement point for the table Dim oPoint As Point2d Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25) ' Specify the columns - this can be specified in any combination/order Dim strColumns(1 To 5) As String strColumns(1) = "BEND ID" strColumns(2) = "BEND RADIUS" strColumns(3) = "BEND ANGLE" strColumns(4) = "BEND KFACTOR" strColumns(5) = "BEND DIRECTION" ' Create the bend table by specifying the source sheet metal file Dim oBendTable As CustomTable Set oBendTable = oActiveSheet.CustomTables.AddBendTable("C:\temp\Part1.ipt", oPoint, "Bend Table", strColumns) oDrawDoc.SelectSet.Clear 'select the bend table for executing the command [Add Tag to View] oDrawDoc.SelectSet.Select oBendTable 'oDrawDoc.SelectSet.Select oDrawDoc.ActiveSheet.DrawingViews(1) 'select the drawingview to mimic the user selecting the view ThisApplication.CommandManager.ControlDefinitions("DrawingTableSelectBendViewCtxCmd").Execute End Sub Best Regards, Xiaodong Liang Developer Technical Services http://adn.autodesk.com
0 Likes
Message 3 of 6

Anonymous
Not applicable
Dear Syed Wajih Hassan, Apologies for our late response. We have backlog in the queue. For some reasons, the original forum link is not available now. I investigated your question. It looks there is not an API for the ability, but the following workaround is working. Could you give it a try whether it helps? Public Sub CreateBendTable() ' Set a reference to the active drawing document Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument ' Set a reference to the active sheet Dim oActiveSheet As Sheet Set oActiveSheet = oDrawDoc.ActiveSheet ' Create the placement point for the table Dim oPoint As Point2d Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(25, 25) ' Specify the columns - this can be specified in any combination/order Dim strColumns(1 To 5) As String strColumns(1) = "BEND ID" strColumns(2) = "BEND RADIUS" strColumns(3) = "BEND ANGLE" strColumns(4) = "BEND KFACTOR" strColumns(5) = "BEND DIRECTION" ' Create the bend table by specifying the source sheet metal file Dim oBendTable As CustomTable Set oBendTable = oActiveSheet.CustomTables.AddBendTable("C:\temp\Part1.ipt", oPoint, "Bend Table", strColumns) oDrawDoc.SelectSet.Clear 'select the bend table for executing the command [Add Tag to View] oDrawDoc.SelectSet.Select oBendTable 'oDrawDoc.SelectSet.Select oDrawDoc.ActiveSheet.DrawingViews(1) 'select the drawingview to mimic the user selecting the view ThisApplication.CommandManager.ControlDefinitions("DrawingTableSelectBendViewCtxCmd").Execute End Sub Best Regards, Xiaodong Liang Developer Technical Services http://adn.autodesk.com
Message 4 of 6

Anonymous
Not applicable

 

I was trying to do the same, and this post saved me hours.

 

FYI (and in a tidier format), the important bits of code are:

 

oDrawingDocument.SelectSet.Clear()

 

oDrawingDocument.SelectSet.Select(oBendTable)

 

 

oDrawingDocument.SelectSet.Select(oView1)

 

m_inventorApplication.CommandManager.ControlDefinitions("DrawingTableSelectBendViewCtxCmd").Execute()

 

where oBendTable is a custom table (bend table)

oView1 is the drawing view

m_inventorApplication is the running application

 

It might be a bit messy but it works

 

Thank you

 

Joe

Message 5 of 6

Maxim-CADman77
Advisor
Advisor

Dear @MjDeck 
whether a direct/real solution was added to API of actual Inventor releases?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Message 6 of 6

MjDeck
Autodesk
Autodesk

Hi @Maxim-CADman77 - yes, CustomTable.AddBendTagsToView was added in Inventor 2025. Here is sample code:

Dim drawDoc As DrawingDocument = ThisDrawing.Document
Dim sheetX = drawDoc.ActiveSheet
Dim tables = sheetX.CustomTables

Dim modelDoc = ThisDrawing.ModelDocument
Dim filename = modelDoc.FullFileName
Dim tablePt = ThisApplication.TransientGeometry.CreatePoint2d(30, 20)
Dim newTable = tables.AddBendTableWithOptions(filename, tablePt)

Dim view1 = sheetX.DrawingViews(1)
newTable.AddBendTagsToView(view1)

Mike Deck
Software Developer
Autodesk, Inc.