Graph box Frame Reference gets 'lost' when adding a graphics Script.I am trying to draw a simple Wafermap which works fine with the following code.
However, when I substitute variables in for the numbers I get a missing reference error and can't for the life of me understand why this is happening. I need some JSL Expert Wisdom 
F_makeWaferMap = function({myScale, myWhiteSpace, myWaferDiameter},{},
myKeepOutZone = 2000;
myGraphBox = graphBox(
frameSize( (myWaferDiameter/2)/myScale, (myWaferDiameter/2)/myScale ),
xScale( -myWhiteSpace, myWaferDiameter + myWhiteSpace),
yScale( -myWhiteSpace, myWaferDiameter + myWhiteSpace)
);
frame = myGraphBox[FrameBox(1)];
frame << Add Graphics Script(penColor( "red" ); circle( {150000,150000}, 150000));
frame << Add Graphics Script(penColor( "red" ); circle( {150000,150000}, 150000-2000));
return(myGraphBox);
);
myWmDispObj = F_makeWaferMap(200, 20000, 300000); // Scale, Whitespace, Wafer Diameter
newWindow("Test", vListBox(myWmDispObj));
I am happily making references to the Frame Box as you can see from the log:</CODE></P><P><SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thickey_1-1647940813033.png" style="width: 400px;"><IMG src="https://us.v-cdn.net/6038925/uploads/images/41020iDC2927C13A39326F/thickey_1-1647940813033.png" role="button" title="thickey_1-1647940813033.png" alt="thickey_1-1647940813033.png" /></SPAN></P><P><CODE class=" language-jsl">
So, now lets substitute in some variables.
frame << Add Graphics Script(penColor( "red" ); circle( {myWaferDiameter/2, myWaferDiameter/2}, myWaferDiameter/2));
frame << Add Graphics Script(penColor( "red" ); circle( {myWaferDiameter/2, myWaferDiameter/2}, (myWaferDiameter/2) - myKeepOutZone));And I get the following Error, suggesting I have lost the reference to my passed in variables when I try to add them to the frame box.

I'm stumped 
ScriptingRe: Graph box Frame Reference gets 'lost' when adding a graphics Script.You might have to use some Eval(EvalExpr()) magic Insert one expression into another using Eval Insert, Eval Expr, Parse, and Substitute
Eval(EvalExpr(
frame << Add Graphics Script(
Pen Color("red");
Circle({Expr(myWaferDiameter) / 2, Expr(myWaferDiameter) / 2}, Expr(myWaferDiameter) / 2);
);
));Re: Graph box Frame Reference gets 'lost' when adding a graphics Script.Hi Jarmo, yes, I can simply do an eval(parse()), substituting my variable into the string to be converted to JSL but it's not the 'proper' way to go in my opinion.. Surely, there is a mechanism to this in a more ;direct' way.
eval(parse("frame << Add Graphics Script(penColor( \!"red\!" ); circle( {150000,150000}, " || char(myWaferDiameter/2) || "))"));Re: Graph box Frame Reference gets 'lost' when adding a graphics Script.I would never use Evil(Parse()) if it can be avoided (and in this case it can be) by using Eval(EvalExpr()) or substitute. At least I don't know of any other methods besides these (or if I do they are more complicated), how I could replace values in some platforms/jmp functions with values (like in Formulas). My preferred method is EvalExpr() as it is fairly easy to debug and it still gives you JSL highlighting in script editor (parse method wont).
Names Default To Here(1);
F_makeWaferMap = function({myScale, myWhiteSpace, myWaferDiameter},{},
myKeepOutZone = 2000;
myGraphBox = graphBox(
frameSize( (myWaferDiameter/2)/myScale, (myWaferDiameter/2)/myScale ),
xScale( -myWhiteSpace, myWaferDiameter + myWhiteSpace),
yScale( -myWhiteSpace, myWaferDiameter + myWhiteSpace)
);
frame = myGraphBox[FrameBox(1)];
expr_sub = Substitute(
Expr(frame << Add Graphics Script(
penColor("red");
circle({myWaferDiameter/2, myWaferDiameter/2}, myWaferDiameter/2)
)),
Expr(myWaferDiameter),
myWaferDiameter
);
expr_evalexpr = EvalExpr(
frame << Add Graphics Script(
penColor( "red" );
circle({Expr(myWaferDiameter)/2, Expr(myWaferDiameter)/2}, (Expr(myWaferDiameter)/2) - Expr(myKeepOutZone)));
);
show(expr_sub);
show(expr_evalexpr);
Eval(expr_sub);
Eval(expr_evalexpr);
return(myGraphBox);
);
myWmDispObj = F_makeWaferMap(200, 20000, 300000); // Scale, Whitespace, Wafer Diameter
newWindow("Test", vListBox(myWmDispObj));
Show(myWmDispObj << Get Graphics Script);Re: Graph box Frame Reference gets 'lost' when adding a graphics Script.The parameter WaferDiameter in the function MakeWaferMap only exists while the function is running. The formula supplied to <
I also like the eval(evalexpr( ... expr() ... expr() ... ) ) method for casting the transient variables into stone, mostly because the JSL editor will still do all of the syntax checking for ( and ).
Re: Graph box Frame Reference gets 'lost' when adding a graphics Script.Hello, I am not exactly sure why this works but would appreciate any insights. It seems that if you set another variable in your function (in this case just myWaferDiameter1) it seems to pass to the frame messages just fine?
Names Default to Here( 1 );
F_makeWaferMap = function({myScale, myWhiteSpace, myWaferDiameter},{},
myWaferDiameter1 = myWaferDiameter; //new variable here?
myKeepOutZone = 2000;
<BR /> //Use myWaferDiameter1 instead
myGraphBox = graphBox(
frameSize( (myWaferDiameter1/2)/myScale, (myWaferDiameter1/2)/myScale ),
xScale( -myWhiteSpace, myWaferDiameter1 + myWhiteSpace),
yScale( -myWhiteSpace, myWaferDiameter1 + myWhiteSpace)
);
frame = myGraphBox[FrameBox(1)];<BR />
frame << Add Graphics Script(penColor( "red" ); circle( {myWaferDiameter1/2, myWaferDiameter1/2}, myWaferDiameter1/2));
frame << Add Graphics Script(penColor( "red" ); circle( {myWaferDiameter1/2, myWaferDiameter1/2}, (myWaferDiameter1/2) - myKeepOutZone));
return(myGraphBox);
);
myWmDispObj = F_makeWaferMap( 200, 20000, 300000 ); // Scale, Whitespace, Wafer Diameter
newWindow("Test", vListBox( myWmDispObj ));Re: Graph box Frame Reference gets 'lost' when adding a graphics Script.Joseph, I noticed this also but like you I don't understand why a locally (to the function) generated variable works, whereas one passed in does not. V.Interesting.