Welcome, Guest. Please login or register.
Did you miss your activation email?
February 12, 2012, 03:24:31 AM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  Mach Screens
| | |-+  Works in progress
| | | |-+  Flash RU Screen
Pages: 1 2 3 4 5 6 7 »   Go Down
Print
Author Topic: Flash RU Screen  (Read 5175 times)
0 Members and 1 Guest are viewing this topic.
elpablito
Active Member

Offline Offline

Posts: 120


View Profile
« on: April 25, 2010, 10: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
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #1 on: April 26, 2010, 05: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:
typeof
and
Code:
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:
///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, 05:51:42 PM by zealous » Logged

Regards, Jason Blake

www.Fusioncnc.com
elpablito
Active Member

Offline Offline

Posts: 120


View Profile
« Reply #2 on: April 26, 2010, 06: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:
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
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #3 on: April 26, 2010, 09: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:
for (var Object_Name in _root) {
trace(Object_Name)
}

thanks,
Jason
Logged

Regards, Jason Blake

www.Fusioncnc.com
FXC
Active Member

Offline Offline

Posts: 45


View Profile
« Reply #4 on: April 28, 2010, 06: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?  Smiley

Anyway... per your instructions, I'm trying it and will report back.
Logged

Mach3 is a mess.
elpablito
Active Member

Offline Offline

Posts: 120


View Profile
« Reply #5 on: April 28, 2010, 08: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
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #6 on: April 29, 2010, 01:46:39 AM »

this is a great way to dynamically import stuff, for example Macros:

Code:
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");
Logged

Regards, Jason Blake

www.Fusioncnc.com
elpablito
Active Member

Offline Offline

Posts: 120


View Profile
« Reply #7 on: April 29, 2010, 11:31:23 AM »

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:
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);
}
Logged
zealous
Active Member

Offline Offline

Posts: 486



View Profile WWW
« Reply #8 on: April 29, 2010, 04:09:50 PM »

Nice!
Things seem to be working well, will run it on my machine and report back.
Logged

Regards, Jason Blake

www.Fusioncnc.com
Fab6657
Active Member

Offline Offline

Posts: 47


View Profile
« Reply #9 on: May 01, 2010, 12: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


* ScreenShot057.jpg (371.01 KB, 1023x569 - viewed 380 times.)
Logged
Pages: 1 2 3 4 5 6 7 »   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!