Your Products have been synced, click here to refresh
'Assignment To look For varname = "WATCHER" ' Is it enabled? sstate = "" For cnt = 1 To PCDCommands.Count Set PCDCommand = PCDCommands.Item(cnt) If ((PCDCommand.Type = 195) And (varname = PCDCommand.GetText(DEST_EXPR, 0))) Then wvar = [B]PCDCommand.GetText(SRC_EXPR, 0)[/B] If wvar = """""" Then sstate = " started @ " retval = PCDCommand.PutText("""TRUE""", SRC_EXPR, 0) End If If wvar = """TRUE""" Then sstate = " ended @ " retval = PCDCommand.PutText("""""", SRC_EXPR, 0) End If
Can't see the tiny screenshot btw.
Have you checked you are catching the Type properly?
string ReturnValue="";
Variable tmpVarValue;
pcdPartProgram = pcdSession.ActivePartProgram;
tmpVarValue = pcdPartProgram.GetVariableValue(VarName);
if (tmpVarValue.VariableType == VARIABLE_TYPE_TYPES.VARIABLE_TYPE_STRING)
{
messagebox.show("String")
ReturnValue = tmpVarValue.StringValue;
}
else if (tmpVarValue.VariableType == VARIABLE_TYPE_TYPES.VARIABLE_TYPE_DOUBLE)
messagebox.show("Double")
{
ReturnValue = tmpVarValue.DoubleValue.ToString("F3");
}
else if (tmpVarValue.VariableType == VARIABLE_TYPE_TYPES.VARIABLE_TYPE_LONG)
messagebox.show("Long")
{
ReturnValue = tmpVarValue.LongValue.ToString("F3");
}
Have you tried it at runtime?
I use GetText for retrieving variable values, snippet from my program logger (full source somewhere in this forum):
'Assignment To look For varname = "WATCHER" ' Is it enabled? sstate = "" For cnt = 1 To PCDCommands.Count Set PCDCommand = PCDCommands.Item(cnt) If ((PCDCommand.Type = 195) And (varname = PCDCommand.GetText(DEST_EXPR, 0))) Then wvar = [B]PCDCommand.GetText(SRC_EXPR, 0)[/B] If wvar = """""" Then sstate = " started @ " retval = PCDCommand.PutText("""TRUE""", SRC_EXPR, 0) End If If wvar = """TRUE""" Then sstate = " ended @ " retval = PCDCommand.PutText("""""", SRC_EXPR, 0) End If
The code is looking for a variable (assignment) called "WATCHER", when this is found and the contents of the variable is null we set it to "TRUE". Is it already "TRUE" then we clear it (empty). Note that this actually changes the assignment command in the program.
© 2024 Hexagon AB and/or its subsidiaries. | Privacy Policy | Cloud Services Agreement |