Hello Guest it is November 22, 2019, 08:13:18 PM

Author Topic: Flash RU Screen  (Read 43848 times)

0 Members and 1 Guest are viewing this topic.

Flash RU Screen
« on: April 25, 2010, 11:14:34 PM »
This is my first release of the screenset I have been working on (download at the bottom).
Still many features are missing but I will be adding them in the future.

Im almost new to CNC, almost new to Mach, new to flash, new to actionscript and new to VBScript. so this has been a challenging job.

Im sure you will find many bugs and issues, I will try to fix them.

Please read the README.txt I have included before installing.

When you install it, please post so I know youre trying it.

Thanks
Pablo



DOWNLOAD:
www.gausstek.com/Ru Screen.rar

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Flash RU Screen
« Reply #1 on: April 26, 2010, 06:49:29 PM »
Looks great, will test things out and report back.

I am not sure if you are already doing this but I found it helps create screens faster and even more reduces resources.

You can get the current objects on the stage with
Code: [Select]
typeof and
Code: [Select]
Object_Name in _root
So you could grab all of the objects and there names and automaticaly create functions for them. You can also store up what was there before they moved to another frame and remove the "watch" function. This is important because since we are watching from the root they are always there and active even when you may not need them. This can cause a LED to fire off a function even if the code isnt on that frame.

This is what I do, and if you have a special function just put an indicator in the objects name.

Code: [Select]
///Create buttons and LED's Function
LED_Watch_function = function () {;

//remove any watch functions;
for (var w:Number = 0; w<_root.Stored_watch.length; w++) {;
_root.unwatch(_root.Stored_watch[w]);

};

///declare;
_root.Stored_watch = Array();
i = 0;

///Loop and find all objects named LED*********X EX:(LED_800);
for (var Object_Name in _root) {;

///Is it a movie object to nerrow it down;
if (typeof (this[Object_Name]) == "movieclip") {;

//-------------------------------------------------------------------------;

///does it have LED in the name;
if (Object_Name.indexOf("LED") == 0) {;

//What is the LED number;
LED_OEM_num = Object_Name.substr(3, Number(Object_Name.length-7));

//check current state of the LED;
if (_root["LED"+LED_OEM_num] == 1) {;
_root[Object_Name].gotoAndStop("on");
} else {;
_root[Object_Name].gotoAndStop("off");
};

///This function is create for each object with LED for its name<<<<<<<<<<<<<<<;
_root["LED"+LED_OEM_num+"_function"] = function (varName, oldVal, newVal) {;

//Call function (optinal);
_root[varName+"sub"](newVal);

//check cuurent state of the LED;
if (newVal == 1) {;
_root[varName+"_mov"].gotoAndStop("on");

} else {;
_root[varName+"_mov"].gotoAndStop("off");
};
return newVal;
};

//Watch the LED;
_root.watch("LED"+LED_OEM_num,_root["LED"+LED_OEM_num+"_function"]);

//Store it to remove later<<<<<<<<<<<<<<<<<<<<<<<<<;
_root.Stored_watch[i] = "LED"+LED_OEM_num;
i++;
};
};
};
};
//end function;
« Last Edit: April 26, 2010, 06:51:42 PM by zealous »
Re: Flash RU Screen
« Reply #2 on: April 26, 2010, 07:54:39 PM »
Hi zealous, thanks for your post.

Im a flash newbie and im not quite sure of the benefits of the code youre sharing.
My led movieclip code is quite simple

Code: [Select]
this.LedFunction = function(varName, ov, nv) {
if (nv == 0) {
gotoAndStop("off");
} else {
gotoAndStop("green");
}
newVal (nv);
return nv;
};
_root.watch(this._name,this.LedFunction);

if (_root[this._name] == 0) {
gotoAndStop("off");
} else {
gotoAndStop("green");
}

I declare the newVal function on the onClipEvent(load) of the led in case I need a special behavior.

Can you explain to me in more detail what would be the benefit of doing it the way you suggest?

Thanks

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Flash RU Screen
« Reply #3 on: April 26, 2010, 10:10:43 PM »
yeah that will work fine.
I had just come up with a way to just name your object and it would create the watch function dynamically depending on the name of the object by using that function.

What you have works well.

If you want to gather anything that Flash is using you can do a debugger check with this.
Code: [Select]
for (var Object_Name in _root) {
trace(Object_Name)
}

thanks,
Jason

Offline FXC

*
  •  45 45
    • View Profile
Re: Flash RU Screen
« Reply #4 on: April 28, 2010, 07:59:25 PM »
I was about to write a rant in your other thread and then I saw the last post linking to this download page. Why would you flaunt this thing in front of everybody and not let them try it? Just for show-off?  :)

Anyway... per your instructions, I'm trying it and will report back.
Mach3 is a mess.
Re: Flash RU Screen
« Reply #5 on: April 28, 2010, 09:23:41 PM »
Hi FXG,

I was changing the code to allow for external macros. It took me some time cause im very new to flash and each thing I want to achieve I first have to learn how.
Its better a rant for not sharing than a rant for damaging your cnc...

Thanks for trying it

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Flash RU Screen
« Reply #6 on: April 29, 2010, 02:46:39 AM »
this is a great way to dynamically import stuff, for example Macros:

Code: [Select]
vbdata = new LoadVars();
vbdata.onData = function(vbsrc) {
var myvb = vbsrc;
vbformated = myvb;//.split("\n");
sendvbcode.text = vbformated.split("\r").join("");
};
vbdata.load("C:\\Mach3\\Flash\\UserMacros\\usercode1.txt");
Re: Flash RU Screen
« Reply #7 on: April 29, 2010, 12:31:23 PM »
Right zealous, thats what I do.
Except that I read all the macros that are listed in the RUCONFIG.INI file and store them. Then I can call them by their name when i need them.

Code: [Select]
var inifile:LoadVars = new LoadVars();
var macrofile:LoadVars = new LoadVars();
var varname:String = "";
var gcodelines:Array;
var mindex:Number;
var timreadmacro:Number;

inifile.load("RUCONFIG.INI");

macrofile.onData = function(macrotext:String) {
_root[varname] = macrotext;
ReadNextIniLine();
};

function ReadNextIniLine() {
var readstarted:Boolean;
do {
readstarted = false;
if (mindex<gcodelines.length) {
var linea:String = gcodelines[mindex++].toUpperCase();
if (linea.substr(0, 2) != "//") {
var igualpos:Number = linea.indexOf("=");
if (igualpos>0) {
var thisvar = linea.substr(0, igualpos);
var vcontent:String = linea.substr(igualpos+1);
if (linea.substr(0, 5) == "MACRO") {
readstarted = true;
varname = thisvar;
macrofile.load(_root["PATHMACROS"]+vcontent);
}
else {
_root[thisvar] = vcontent;
}
}
}
} else {
readstarted = true;
}
} while (readstarted == false);
}

inifile.onData = function(gcodetext:String) {
gcodelines = gcodetext.split("\r\n");
mindex = 0;
ReadNextIniLine();
};


function CallMacro(macro:String) {
var mt:String = _root[macro.toUpperCase()];
macrocode.text = mt;
fscommand("VBMacro", mt);
}

Offline zealous

*
  •  492 492
  • HI!
    • View Profile
    • Artsoft Solutions
Re: Flash RU Screen
« Reply #8 on: April 29, 2010, 05:09:50 PM »
Nice!
Things seem to be working well, will run it on my machine and report back.
Re: Flash RU Screen
« Reply #9 on: May 01, 2010, 01:12:58 AM »
Hello,

i try also to test and run your new screen. Realy good, but i have some problems to run it.

- i use Mach3 last lockdown version licensed but in simulation mode on a laptop.
- i have installed Mach3 on d:\mach3.
- i also adapt the path in ruconfig.ini and copy the macros to the right path.

but i have when i load a gcode file no path to d:\, only to c:\ selection is possible,
double click on the change path icon (for drive) doesn't work.
Also when i load a gcode file thru the menu, i see the generation of the file in toolpath,
but not the gcode program list. Running is also impossible.

I attach a screenshot.

Thank's for sharing all this work.

Fabrice