Integer Variable for macro

Integer Variable for macro

Anonymous
Not applicable
764 Views
3 Replies
Message 1 of 4

Integer Variable for macro

Anonymous
Not applicable

Good Day All,

 

  I'm looking for an odd integer or macro language. I need to be able to take a user's number input, and alway make it the opposite integer - example - input number is "100", I want the macro to throw out "-100", if the input number is "-100", I want the macro to throw out "100"

 

REAL distance = INPUT "DISTANCE"

TRANSFORM MOVE "$distance"

 

What variable needs to link up with $distance to make it work?

0 Likes
Accepted solutions (1)
765 Views
3 Replies
Replies (3)
Message 2 of 4

TK.421
Advisor
Advisor

INT i = 100  // makes it 100

$i = $i * -1   // makes it -100

 

here's a line from a macro where i was shifting something in the z axis only:

MODE COORDINPUT COORDINATES 0 0 $zShift

 

What are you moving?

 

I would suggest recording a macro of you moving whatever it is you want to move to see what all the commands are,

then if you need help with entering variables, throw it back up here.


the numbers never lie
0 Likes
Message 3 of 4

Sean570
Advocate
Advocate
Accepted solution
this should work:

    REAL distance = INPUT "DISTANCE"
    REAL signValue = sign($distance)
    
    IF signValue == 1 {
        $distance = 0 - $distance
    } ELSEIF signValue == -1 {
        $distance = abs($distance)
    }

 

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

Beautiful , thank you sir!

0 Likes