VBA Command manager not excecuting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys
I'm trying to add automatically bend tables to the flat patterns of metal sheets following this code below.
I also want the right BEND ID's on the drawing view. To do that you need to select the table and the view which needs the ID's and then force trough the command manager to add the ID's to the drawing.
Got it from the following topic:
The function does everything correclty;
*it places the bend table, with the correct columns
*it also selects the table
*it also selects the right view to add the BEND ID to
But when I excecute the command "DrawingTableSelectBendViewCtxCmd" nothing happens.
I even checked the command with the EventWatcher program and it checks out.
Anyone have a clue what is going wrong? Working currently with INV2018.3
Many thanks!
Function Add_BendTable(ByRef oDrawingView As DrawingView, ByRef oModel As Document, ByRef oSheet As Sheet, ByRef oDrawingDoc As DrawingDocument)
Dim oPoint As Point2d
Dim oBendTable As CustomTable
Set oPoint = ThisApplication.TransientGeometry.CreatePoint2d(15, 15) ' ISO View (or current view)
If oModel.SubType <> "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
MsgBox ("A sheet metal document must be open.")
Exit Function
End If
Dim strColumns(1 To 4) As String
strColumns(1) = "BEND ID"
strColumns(2) = "BEND DIRECTION"
strColumns(3) = "BEND ANGLE"
strColumns(4) = "BEND RADIUS"
On Error GoTo ExitFunction
Set oBendTable = oSheet.CustomTables.AddBendTable(oModel.FullDocumentName, oPoint, "Bend Table", strColumns)
Dim oCtrlDef As ControlDefinition
oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("DrawingTableSelectBendViewCtxCmd")
oDrawingDoc.SelectSet.Clear
oDrawingDoc.SelectSet.Select oBendTable
oDrawingDoc.SelectSet.Select oDrawingView
oCtrlDef.Execute
ExitFunction:
End Function