InterConnect - Break Link

In SolidWorks 2017 we have now the InterConnect functionality.

I have an Inventor part feature in my SLDPRT. I can break the link to the IPT reference manually by selecting the feature => RMB => Break Link.

How can i do this programatically ? What is the API command to break the link ?

Thanks for your help

SolidworksApi macros
Answers 7
RM
RM 2017-08-25 Best Answer

- Select the feature

- SolidWorksApplication.RunCommand(1030478, "")

SA
SA 2020-07-16

Is there a way to do this without prompting the user ("Warning, this operation cannot be undone...")?

Off topic: Sorry about the stupid question, but how did you find the command? It´s not listed here: 2019 SOLIDWORKS API Help - swCommands_e Enumeration

US
US 2020-07-16

Off topic: Sorry about the stupid question, but how did you find the command? It´s not listed here: 2019 SOLIDWORKS API Help - swCommands_e Enumeration

Create a macro with this module

'Attribute VB_Name = "GetCommand"<br>Option Explicit<br>Dim swEventHandler As ClassRC<br>Sub main()<br>    Set swEventHandler = New ClassRC<br>End Sub‍‍‍‍‍‍‍‍‍‍‍‍<span class="line-numbers-rows"><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span></span>

and this class

'VERSION 1.0 CLASS<br>'BEGIN<br>'  MultiUse = -1  'True<br>'END<br>'Attribute VB_Name = "ClassRC"<br>'Attribute VB_GlobalNameSpace = False<br>'Attribute VB_Creatable = False<br>'Attribute VB_PredeclaredId = False<br>'Attribute VB_Exposed = False<br>'Attribute swApp.VB_VarHelpID = -1<br><br>'http://help.solidworks.com/2018/English/api/swcommands/solidworks.interop.swcommands~solidworks.interop.swcommands.swcommands_e.html<br>Option Explicit<br><br>Public WithEvents swApp As SldWorks.SldWorks<br><br>Const header = "GetCommand"<br>Const showPreEvent = True<br>Const showPostEvent = False<br><br>Private Sub Class_Initialize()<br>    Set swApp = Application.SldWorks<br>End Sub<br><br>Private Function swApp_CommandOpenPreNotify&(ByVal command&, ByVal userCommand&)<br>    If showPreEvent Then Call MsgBox("Pre notifiy: " & command, vbInformation, header)<br>End Function<br><br>Private Function swApp_CommandCloseNotify&(ByVal command&, ByVal reason&)<br>    If showPostEvent Then Call MsgBox("Post notifiy: " & command, vbInformation, header)<br>End Function<span class="line-numbers-rows"><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span><span>‍</span></span>

and run the sub main in the module GetCommand.

BiI ERP-PDM 

SA
SA 2020-07-17

Thanks for the handy event/command monitor. Unfortunatly there doesn´t seem to be a hidden command to dissolve the feature without prompting the user

DE
DE 2020-08-04

, silly question. Once you activate this macro, which is BRILLIANT by the way, how do you turn it off?

SA
SA 2020-08-10

Try this and call the stopMonitoring subroutine

'Attribute VB_Name = "GetCommand"
Option Explicit
Dim swEventHandler As ClassRC

Sub stopMonitoring()
   Set swEventHandler = Nothing
End Sub

Sub main()
   Set swEventHandler = New ClassRC
End Sub

DE
DE 2020-08-11

Thank you ‌!