How to unlink variables
Requirements
To unlink variables in a configuration, an instance of the TwinCAT System Manager must be created and the two variables to be unlinked from each other must be referenced by their pathnames
An alternative is to reference only to one variable and all linkages of that variable will be removed.
Procedure
The ProgId "TCatSysManager.TcSysManager" can be used to create an instance of the System Manager that implements the ITcSysManager interface. This interface has an UnlinkVariables method. To unlink the variable "TIPC^Project 1^Standard^Outputs^MyOutput" from "TIID^Device 1 (C220)^Box 1^Term 1^Channel 1^Output" the following vbscript code can be used:
Sample (vbscript):
dim tsm
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
call tsm.UnlinkVariables("TIPC^Project1^Standard^Outputs^MyOutput", "TIID^Device 1 (C220)^Box1^Term 1^Channel 1^Output")
call tsm.SaveConfiguration
If all linkages from "TIPC^Project 1^Standard^Outputs^MyOutput" should be removed, the following code can be used:
dim tsm
set tsm = CreateObject("TCatSysManager.TcSysManager")
call tsm.OpenConfiguration("c:\twincat\myConfig.wsm")
call tsm.UnlinkVariables("TIPC^Project1^Standard^Outputs^MyOutput")
call tsm.SaveConfiguration
See Also
How to... section, ITcSysManager, ITcSysManager::UnlinkVariables
Built on Tuesday, Mai 01, 2001