This illustrates the method of implementation of the #EVAL() command in the tmp
file.

#EVAL() is implemented on top of the system evaluator.  The system evaluator is
used to evaluate expressions in macros, input fields, and the calculator. The
#EVAL() command looks at the right side of the expression it contains and
substitutes values for any tmp variables it finds.  It then passes this
modified expression on to the system evaluator to get a result.  If the
expression still contains macro variables, their current value is substituted
before calculating the result.  Thus, you have access to the current value of
the macro variables when you're coding.

===

For a simple example, if you have the following variables already set so that:
#myMacroVar=5  in the macro system and,
#myTmpVar=2  in the tmp system

Then for the command:
#EVAL(#myTmpResult=#myTmpVar+#myMacroVar)

#EVAL takes the right hand side of the expression

#myTmpVar+#myMacroVar

substitutes values for the tmp variables

2+#myMacroVar

and passes it on to the system evaluator.
The system evaluator then substitues values for macro variables

2+5

And calculates the result.

7

Which is passed back to the #EVAL command.

#myTmpResult=7

===

The trick is, you can't have a tmp variable with the same name as a macro
variable if you want to access the macro variable with #EVAL(), because the
#EVAL() command will find the tmp variable first and substitute its value in
the expression before passing it on to the system evaluator.

--gregg

[EMAIL PROTECTED] wrote:

> I dont know if this will work with standard variables
> in a tmp file. But here is how I use variables between
> a macro, tmp, and shape file.
> In the mcl file set your variables to a certains
> value  (see example below)
>
> F_OPEN[FN=c:\abtemp\Mikesk1.len, TY=R]
> //
> if(#total_prof_ele>=1)
>         #elelen1=0
>         #elepro1=0
>         F_read[FN=c:\abtemp\Mikesk1.len,FMT="%D3.4
> %D3.4~n",VR="elelen1,elepro1"]
>         #eltype1=TYP(GRP(1))
>         #elstrx1=STX(GRP(1))
>         #elstry1=STY(GRP(1))
>         #elendx1=ENX(GRP(1))
>         #elendy1=ENY(GRP(1))
>         if(#eltype1=3)
>                 #elcenx1=CEX(GRP(1))
>                 #elceny1=CEY(GRP(1))
>                 #elerad1=RAD(GRP(1))
>         else
>                 #elcenx1=0
>                 #elceny1=0
>                 #elerad1=0
>         endif
> else
>         #eltype1=0
>         #elelen1=0
>         #elstrx1=0
>         #elstry1=0
>         #elendx1=0
>         #elendy1=0
>         #elcenx1=0
>         #elceny1=0
>         #elerad1=0
>         #ellen1=0
>         #elpro1=0
> endif
> //
> IN the TMP file you need a @declare section. Define
> your variable type there (see example below)
> Then in the @start section set the variables you want to
> use in the tmp file to the variables in the mcl output
> file (Mikesk1.len from above
> exampe). (see example below for variable declaration in
> tmp file)
>
> @DECLARE
> #INT #gum
> #INT #s_on_off
> #INT #s_in_out
> #INT #x_sign
> //
> #DEC #pi
> #DEC #el1type
> #DEC #el1leng
> #DEC #el1prof
> #DEC #el1strx
> #DEC #el1stry
> #DEC #el1endx
> #DEC #el1endy
> #DEC #el1cenx
>
> @START
> EVAL(#el1type=#eltype1)
> #EVAL(#el1leng=#elelen1)
> #EVAL(#el1strx=#elstrx1)
> #EVAL(#el1stry=#elstry1)
> #EVAL(#el1endx=#elendx1)
> #EVAL(#el1endy=#elendy1)
> #EVAL(#el1cenx=#elcenx1)
> #EVAL(#el1ceny=#elceny1)
> #EVAL(#el1arad=#elerad1)
> #EVAL(#el1prof=#elepro1)
> > If I'm thinking what you're asking then maybe this might help...
> >
> > Template File:
> > @START
> > #EVAL(#U8=0)<FOR DEBUG HEADINGS SET U8 TO 1,SET TO 0 FOR NO DEBUG>
> > #IF(#U8=1)<**** START>
> > <#EVAL(#U2=0)>
> > % #FILE  <#S4>
> > % #DATE - #SYSTIME
> > %
> > % CHANGE V6 ON LINE N105 TO ACCOMODATE
> > % DIFFERENCE BETWEEN PRINT THICKNESS AND PART THICKNESS
> > %
> > #ONBLKG1G90G97F
> > V6D0
> > <#S1>
> > <#S2>
> > <#S3>
> > M0 T#TOOL #TLCMT
> > T#TOOL
> > G39D0.0
> > #IF(#TLDIA=0)<G1F#FEED>#ELSE<G1M3S#SPEEDF#FEED>
> > <#EVAL(#U9=0)>
> > <#EVAL(#V6=0)>
> > <#EVAL(#U7=1)>
> > #EVAL(#RFEED=R)
> > <#EVAL(#LOFF=(#SPEED+9)/10)>
> > <#EVAL(#LOFF=ABS(#LOFF))>
> > <#EVAL(#LOFF=INT(#LOFF))>
> > #IF(#LOFF<5)<#EVAL(#LOFF=5)>
> > #IF(#TLDIA=0)<>#ELSE<G4X#LOFF.>
> > G48R
> > #RESET(#MOV)
> > #EVAL(#V4=.03)
> > #EVAL(#C0=1)
> >
> > @TOOLCHG
> > #IF(#U8=1)<**** TOOLCHG>
> > #RESET(#MOV,#XPOS,#YPOS,#FXD)
> >  G1Z#ZHOMERM5M9
> > #IF(#U9=1)<G97F>
> > <#EVAL(#V9=0)>
> > <#EVAL(#V0=2)>
> > <#EVAL(#V7=0)>
> > <#EVAL(#V6=0)>
> > <#EVAL(#C1=0)>
> > <#EVAL(#PECK=0)>
> > G49R
> > G39D0.
> > <#S1>
> > <#S2>
> > <#S3>
> > M0 T#TOOL #TLCMT
> > T#TOOL
> > #IF(#U9=1)<G97F>
> > #IF(#TLOP=2,AND#U9=1)<#EVAL(#FEED=#FEED*.5)>
> > #IF(#TLOP=2,AND#U9=1)<G96F#FEEDD#FEED>
> > #IF(#TLOP=2,AND#U9=1)<#EVAL(#FEED=#FEED*2)>
> > #IF(#TLOP=2,AND#U9=1)<G96F#FEEDD#FEED>
> > G39D0.0
> > G1#IF(#TLDIA=0)<F#FEED>#ELSE<M3S#SPEEDF#FEED>
> > <#EVAL(#LOFF=(#SPEED+9)/10)>
> > <#EVAL(#LOFF=ABS(#LOFF))>
> > <#EVAL(#LOFF=INT(#LOFF))>
> > #IF(#LOFF<5)<#EVAL(#LOFF=5)>
> > #IF(#TLDIA=0)<>#ELSE<G4X#LOFF.>
> > G48R
> > #IF(#TLDIA=0)<>#ELSE<#EVAL(#C0=1)>
> > #RESET(#MOV)
> > #EVAL(#V4=.03)
> > #IF(#TLDIA<.065)<#EVAL(#V4=.05)>
> > #EVAL(#U7=1)
> > #EVAL(#C0=1)
> > #EVAL(#ZCHK=#ZHOME)
> > #EVAL(#ZPOS=#ZHOME)
> > #UPDATE(#XPOS,#YPOS,#ZPOS,#ZCHK)
> > #RESET(#XPOS,#YPOS,#ZCHK,#ZPOS,#C0)
> >
> > @END
> > #IF(#U8=1)<**** END>
> > G1Z#ZHOMERM5M9
> > G49R
> > X0.Y0.R
> > G39D0.
> > M30
> > #OFFBLK
> > %
> >
> >
> > Mcl File:
> > // Production_Milling 11.5 Windows 10/16/98 16:52:40 Macro File
> > // w:\mcl\1.mcl
> > // CREATED: 06/29/00
> > //
> > //  turns debug headings on for T5 & T1
> > ELMT_SEQ[BA=1, EL="1", ME=1]
> > UEVENT[XS=ENX(1), YS=ENY(1), LV=2, TX="#EVAL(#U8=1)"]
> > //
> > // turns debug headings for all remaining tools
> > ELMT_SEQ[BA=1, EL="28", ME=1]
> > UEVENT[XS=ENX(28), YS=ENY(28), LV=0, TX="#EVAL(#U8=0)"]
> >
> > Coded File:
> > % 1  CD245265-022 REV.AC OP.1
> > % 06/29/00 - 11:14AM
> > %
> > % CHANGE V6 ON LINE N105 TO ACCOMODATE
> > % DIFFERENCE BETWEEN PRINT THICKNESS AND PART THICKNESS
> > %
> > N100G1G90G97F
> > N105V6D0
> > N110M0 T5 5/8 X 90 SPOT DRILL L
> > N115T5
> > N120G39D0.0
> > N125G1M3S54F1.2
> > N130G4X6.
> > N135G48R
> > N140 G1Z2.0R
> > N145X-0.25Y-0.75R
> > N150**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N155V60D0.1005
> > N160V64D.1
> > N165V66D0.03
> > N170V67D12
> > N175X-0.25Y-0.75R
> > N180Z0.1R
> > N185M8
> > N190M2008
> > N195**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N200V60D0.2109
> > N205X-1.0Y-0.75R
> > N210M2008
> > N215**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N220X-2.25Y-3.0R
> > N225M2008
> > N230**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N235V60D0.25
> > N240X-3.75Y-0.75R
> > N245M2008
> > N250**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N255V60D0.2109
> > N260X-6.0Y-0.75R
> > N265M2008
> > N270**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N275V60D0.25
> > N280X-9.25Y-0.75R
> > N285M2008
> > N290**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N295V60D0.1005
> > N300X-9.75Y-0.75R
> > N305M2008
> > N310**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N315V60D0.2109
> > N320X-10.5Y-0.75R
> > N325M2008
> > N330**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N335X-11.5Y-5.25R
> > N340M2008
> > N345**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N350V60D0.1005
> > N355X-9.75Y-5.25R
> > N360M2008
> > N365**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N370V60D0.25
> > N375X-9.25Y-5.25R
> > N380M2008
> > N385**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N390V60D0.2109
> > N395X-6.0Y-5.25R
> > N400M2008
> > N465**** TOOLCHG
> > N470 G1Z2.0RM5M9
> > N475G49R
> > N480G39D0.
> > N485M0 T1 1/8 CENTER DRILL H
> > N490T1
> > N495G39D0.0
> > N500G1M3S68F1.0
> > N505G4X7.
> > N510G48R
> > N515**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N520V60D0.15
> > N525V64D.1
> > N530V66D0.03
> > N535V67D10
> > N540X-3.2585Y-3.0R
> > N545Z0.1R
> > N550M8
> > N555M2008
> > N560**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N565X-11.133Y-2.405R
> > N570M2008
> > N575**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N580X-4.631Y-2.83R
> > N585M2008
> > N695**** FXD2=Type Spot Drill=M2008 Bostomatic Drill Cycle with Dwell
> > N700X-11.133R
> > N705M2008
> > N710 G1Z2.0RM5M9
> > N715G49R
> > N720G39D0.
> > N725M0 T14 11/32 DRILL(.344) L
> > N730T14
> > N735G39D0.0
> > N740G1M3S98F1.3
> > N745G4X10.
> > N750G48R
> > N755V60DV6+1.7033
> > N760V63D0.25
> > N765V64D.1
> > N770V66D0.04
> > N775V67D13
> > N780X-3.2585Y-3.0R
> > N785Z0.1R
> > N790M8
> > N795M2000
> > N800X-11.133Y-2.405R
> > N805M2000
> > N810 G1Z2.0RM5M9
> > N815G49R
> > N820G39D0.
> > N825M0 T15 23/64 DRILL(.359) L
> > N830T15
> > N835G39D0.0
> > N840G1M3S94F1.3
> > N845G4X10.
> > N850G48R
> > N855V60D1.708
> > N860V64D.1
> > N865V66D0.04
> > N870V67D13
> > N875X-3.2585Y-3.0R
> > N880Z0.1R
> > N885M8
> > N890M2007
> > N895X-11.133Y-2.405R
> > N900M2007
> > N905 G1Z2.0RM5M9
> > N910G49R
> > N915G39D0.
> > N920M0 T16 15/32 DRILL(.469) L
> > N925T16
> > N930G39D0.0
> > N935G1M3S72F1.5
> > N940G4X8.
> > N945G48R
> > N950V60DV6+1.7408
> > N955V63D0.25
> > N960V64D.1
> > N965V66D0.04
> > N970V67D15
> > N975X-3.75Y-0.75R
> > N980Z0.1R
> > N985M8
> > N990M2000
> > N995X-9.25R
> >
> > In the .pm4 file I'm using user_cmd to eval #U8 to turn on and off debug
> > headings via a .mcl file.
> >
> >               -----Original Message-----
> >               From:   Joe Geraci [mailto:[EMAIL PROTECTED]]
> >               Sent:   Thursday, June 29, 2000 11:08 AM
> >               To:     'Michael Senack'; 'Smartcam' (E-mail)
> >               Subject:        RE: [mfg-smartcam] tmp variable initialized
> > from a macro
> >
> >
> >               Sorry,
> >
> >               User defined template variable, although in this case I
> > would be using
> >               #U0-#U19
> >               -----Original Message-----
> >               From:   Michael Senack [mailto:[EMAIL PROTECTED]]
> > <mailto:[mailto:[EMAIL PROTECTED]]>
> >               Sent:   Thursday, June 29, 2000 11:04 AM
> >               To:     'Joe Geraci'; 'Smartcam' (E-mail)
> >               Subject:        RE: [mfg-smartcam] tmp variable initialized
> > from a macro
> >
> >
> >               Exactly what is a " udtv variable"?
> >                       -----Original Message-----
> >                               From:   Joe Geraci
> > [mailto:[EMAIL PROTECTED]] <mailto:[mailto:[EMAIL PROTECTED]]>
> >                               Sent:   Thursday, June 29, 2000 10:37 AM
> >                               To:     'Smartcam' (E-mail)
> >                               Subject:        [mfg-smartcam] tmp variable
> > initialized
> >                       from
> >                       a macro
> >
> >               Hi Everyone,
> >               Can anyone show me a example of how to set a udtv
> >               variable
> >               from a macro,
> >               I'm looking to test (In the tmp file) for a given
> >               situation
> >               (macro
> >               created usr_cmd) in the shape file.
> >                               Thanks,
> >
> >                               J.G.
> >
> >
> > ======================================================================
> >               To find out more about this mailing list including how
> >               to
> >               unsubscribe,
> >               send the message "info mfg-smartcam" to
> >               [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> >
> >
> > ======================================================================
> > ======================================================================
> > To find out more about this mailing list including how to unsubscribe,
> > send the message "info mfg-smartcam" to [EMAIL PROTECTED]
> > ======================================================================
> ======================================================================
> To find out more about this mailing list including how to unsubscribe,
> send the message "info mfg-smartcam" to [EMAIL PROTECTED]
> ======================================================================

--

Gregg Olson
Development Manager
SDRC CAM Products


======================================================================
To find out more about this mailing list including how to unsubscribe,
send the message "info mfg-smartcam" to [EMAIL PROTECTED]
======================================================================

Reply via email to