- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
i try to solve the following stuff.
I open via VBA a Sketch Block template part from a new (other) part.
I copy this to the calling part (the part i call the function).
It's pasted into the sketched block definition fine 🙂
I think now about that it will be a smoother workflow when the user after the copy action get the new block on the cursor or in the smallest solution get a copy at 0.0 of the sketch
Is there a way to start the insert block command inside the part sketch enviroment via VBA ?
***************************
Private Sub Cmd_Insert_Block_Click()
Dim oCompDef As PartComponentDefinition
Set oCompDef = Block_Template.ComponentDefinition
' Set a reference to the definition named by selection
Dim oSketchBlockDef As SketchBlockDefinition
Set oSketchBlockDef = oCompDef.SketchBlockDefinitions.Item(CmB_Blocks.Text)
'Check if block exist
Dim targetdocoCompDef As PartComponentDefinition
Set targetdocoCompDef = targetdoc.ComponentDefinition
Dim targetdocoSketchBlockDef As SketchBlockDefinition
Dim Blockda As Integer
Blockda = 0
For Each targetdocoSketchBlockDef In targetdocoCompDef.SketchBlockDefinitions
If targetdocoSketchBlockDef.Name = CmB_Blocks.Text Then
Blockda = 1
End If
Next
If Blockda = 0 Then
Call oSketchBlockDef.CopyTo(targetdoc, True)
Me.LB_LastAction.Caption = "Last Action : " & "Block inserted = " & CmB_Blocks.Text
Else
Me.LB_LastAction.Caption = "Last Action : " & "Existing Block ignored"
End If
targetdoc.BrowserPanes.ActivePane.TopNode.BrowserNodes.Item(1).Expanded = True
If CB_Multi.Value = 0 Then
Me.Hide
End If
If Me.Visible = False Then Block_Template.Close True
End Sub
Solved! Go to Solution.