Hello Guest it is April 25, 2024, 05:26:52 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dude1

711
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 04, 2015, 05:40:46 PM »
when you open poppabears file all the files you open and place them in the same place in mach4 so profile you put inside profile in M4 not the file named profile whats in the folder

so the folder plugins you open it and get the files out and put them in c\M4\plugins folder, same for the other 3 you don't place any code anywhere its all there already

712
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 04, 2015, 08:23:39 AM »
this is poppabears code from the lua panel
Code: [Select]
------------------------Header Section---------------------------------------
-- Name:        JoyStick Status Bitmap display
-- Author:      S Shafer
-- Modified by:
-- Created:     10/13/2014
-- Copyright:   (c) 2014 S S Systems, LLC, can be freely used, modified, or
-- derived from as long as this header section remains.
-- Licence:     BSD license
-- File Name: (luapanel embedded script, NO FRAME)
------------------------Header Section----------------------------------------

local panel = nil
local m_id = 0
local mInst = 0; --Mach4 instance number
local inst = mc.mcGetInstance(mInst);
local gtimer1 = 0;
local BitMapPanel = 0;
local picToUse = 0;
local KeyPressed = "";
local window = 0;

function GetNextID()
    m_id = m_id+1;
    return m_id;
end

function TimerTick()
    BitMapPanel:Refresh();
end

---the ID and its call to GetNextID has been moved to where the control is made.                          
function main()
    panel = mcLuaPanelParent;
    local window = panel:GetParent();
    window:SetBackgroundColour(wx.wxColour(230, 230, 230));
    --use the same color bg as the panel sits on in screen designer
    window:SetWindowStyleFlag(wx.wxBORDER_NONE);--removes sunken border of lua panel
    window:ClearBackground();
    window:Refresh();
    local wsize = window:GetSize();
    panel:SetSize(wsize);
    gtimer1 = wx.wxTimer(panel);--start a timer to poll IO changes
    panel:Connect(wx.wxEVT_TIMER, TimerTick);
    gtimer1:Start(200); -- set poll rate to 1/5th a second        
    panel:Connect(wx.wxEVT_CLOSE_WINDOW,
        function (event)        
            gtimer1:Stop();                
            event:Skip();
        end);
        
    mainSizer = wx.wxBoxSizer(wx.wxVERTICAL);
    GridSizer  = wx.wxFlexGridSizer( 2, 1, 0, 0 );--2 rows, 1 column, no x/y spacing between  

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory          
    local imagePathJoyCT =  Path .. "\\Wizards\\JoyStickResources\\JoyCenter.bmp";
local imagePathJoyDN =  Path .. "\\Wizards\\JoyStickResources\\JoyDown.bmp";
local imagePathJoyLT =  Path .. "\\Wizards\\JoyStickResources\\JoyLeft.bmp";
local imagePathJoyRT =  Path .. "\\Wizards\\JoyStickResources\\JoyRight.bmp";
local imagePathJoyUP =  Path .. "\\Wizards\\JoyStickResources\\JoyUp.bmp";

imageCT = wx.wxImage();
imageCT:LoadFile(imagePathJoyCT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpCT = wx.wxBitmap(imageCT);
wsizeCT = wx.wxSize(JoyBmpCT:GetWidth(), JoyBmpCT:GetHeight());

imageDN = wx.wxImage();
imageDN:LoadFile(imagePathJoyDN, wx.wxBITMAP_TYPE_BMP);
    JoyBmpDN = wx.wxBitmap(imageDN);
wsizeDN = wx.wxSize(JoyBmpDN:GetWidth(), JoyBmpDN:GetHeight());

imageLT = wx.wxImage();
imageLT:LoadFile(imagePathJoyLT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpLT = wx.wxBitmap(imageLT);
wsizeLT = wx.wxSize(JoyBmpLT:GetWidth(), JoyBmpLT:GetHeight());

imageRT = wx.wxImage();
imageRT:LoadFile(imagePathJoyRT, wx.wxBITMAP_TYPE_BMP);
    JoyBmpRT = wx.wxBitmap(imageRT);
wsizeRT = wx.wxSize(JoyBmpRT:GetWidth(), JoyBmpRT:GetHeight());
  
imageUP = wx.wxImage();
imageUP:LoadFile(imagePathJoyUP, wx.wxBITMAP_TYPE_BMP);
    JoyBmpUP = wx.wxBitmap(imageUP);
wsizeUP = wx.wxSize(JoyBmpUP:GetWidth(), JoyBmpUP:GetHeight());  

    BITMAPPANEL1_ID = GetNextID ();
    BitMapPanel = wx.wxPanel (  panel,
                                BITMAPPANEL1_ID,
                                wx.wxDefaultPosition,
                                panel:GetSize(),
                                wx.wxWANTS_CHARS,'');

    GridSizer:Add(BitMapPanel, 0, wx.wxALIGN_LEFT+wx.wxALL, 2);
    mainSizer:Add(GridSizer, 0, wx.wxALIGN_LEFT+wx.wxALL,2);
    panel:SetSizer(mainSizer);

    picToUse = JoyBmpCT;    
    BitMapPanel:SetFocus();    
    scr.SetProperty('DebugTB', 'Label', '');

    BitMapPanel:Connect(wx.wxEVT_PAINT,
                         function (event)
                            local mInst = 0;
                            local rc = 0; local X = 0; local Y = 1; local DirP = 1; DirN = -1;
                            local iSigVal1 = 0;local iSigVal2 = 0;local iSigVal3 = 0;local iSigVal4 = 0;
                            local hsig1 = 0;local hsig2 = 0;local hsig3 = 0;local hsig4 = 0;                            
                            local inst = mc.mcGetInstance(mInst);
                            hsig1, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT1);--LT X-
                            iSigVal1 = mc.mcSignalGetState(hsig1);
                            hsig2, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT2);--RT X+
                            iSigVal2 = mc.mcSignalGetState(hsig2);
                            hsig3, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT3);--UP Y+
                            iSigVal3 = mc.mcSignalGetState(hsig3);
                            hsig4, rc = mc.mcSignalGetHandle(inst, mc.ISIG_INPUT4);--DN Y-
                            iSigVal4 = mc.mcSignalGetState(hsig4);                            
                            if iSigVal1 == 1 then
                                picToUse = JoyBmpLT;--LT X-
                                mc.mcJogVelocityStart(inst, X, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input1 Active');
                                end
                            if iSigVal2 == 1 then
                                picToUse = JoyBmpRT;--RT X+
                                mc.mcJogVelocityStart(inst, X, DirP);
                                scr.SetProperty('DebugTB', 'Label', 'input2 Active');
                                end
                            if iSigVal3 == 1 then
                                picToUse = JoyBmpUP;
                                mc.mcJogVelocityStart(inst, Y, DirP); --UP Y+                            
                                scr.SetProperty('DebugTB', 'Label', 'input3 Active');
                            end  
                            if iSigVal4 == 1 then
                                picToUse = JoyBmpDN;--DN Y-
                                mc.mcJogVelocityStart(inst, Y, DirN);
                                scr.SetProperty('DebugTB', 'Label', 'input4 Active');
                            end
                            if iSigVal1 == 0 and iSigVal2 == 0 and iSigVal3 == 0 and iSigVal4 == 0 then
                                picToUse = JoyBmpCT;
                                local IsBtnJog = scr.GetProperty('btnJogLED', 'Value');
                                local val = tonumber(IsBtnJog);
                                if val == 0 then
                                    mc.mcJogVelocityStop(inst, X);
                                    mc.mcJogVelocityStop(inst, Y);
                                end
                                scr.SetProperty('DebugTB', 'Label', '');
                            end
                            local dc = wx.wxPaintDC(BitMapPanel);                            
                            dc:DrawBitmap(picToUse, 0,0, true);
                            dc:delete ();
                         end);
    panel:Fit();
    local window = panel:GetParent();
    window:Connect(wx.wxID_ANY, wx.wxEVT_SIZE,
                        function(event)
                            local wsize = event:GetSize();
                            panel:SetSize(wsize);
                            panel:FitInside();            
                        end);
end
main();
wx.wxGetApp():MainLoop();

 

713
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 04, 2015, 08:20:00 AM »
you have to put all bits in the correct spot the code is tyed into the screen set if you still cant get at the codes I will pull them out and send them to you and where i got them from

714
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 04, 2015, 08:08:49 AM »
tool box / joystick project example is done

715
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 04, 2015, 07:55:39 AM »
I got it working in wizards just had to change this bit local Path = "..\\Mach4Hobby" I stuck it in a lua panel in a screen set did not work but it would be good to use as a fly out tyed to a button like the one M3 has,

I think the first part has to be what place in the system the pics are

I put it in wizards what is in Mach4Hobby so I have it like this

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory
    local Path = "..\\Mach4Hobby"
    local imagepathBMP =  Path .. "\\Wizards\\images\\";--Path to your Picture with name and extension

also for fun I put it on desktop and the path is

local Path = mc.mcCntlGetCwd(inst); --Get Mach4's directory
    local Path = "..\\Wizards"
    local imagepathBMP =  Path .. "\\images\\";--Path to your Picture with name and extension


if you look at how poppabear did his joystick progect it will show you what to do to get it working in a screen set and how to tye it to inputs,  you have done a good job with it

716
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 11:54:22 PM »
It is the address for the images it is wrong it cant find them

local imagepathBMP =  Path .. "\\Wizards\\images\\";--Path to your Picture with name and extension

you put your script in wizards and double click on it will start with a error log showing it can`t find any of the images it does it anywhere in M4 file system

717
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 09:41:39 PM »
have you had a look at what poppabear did with the joystick progect this one http://www.machsupport.com/forum/index.php/topic,28149.0.html that may help

718
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 09:27:53 PM »
that looking relay good that thing with stopping things working when you don't wont them to work I think you may just have to play with the codes or add to whats there now at the moment I don't need to do stuff like that but I might play anyway since what I needed I have finished to a point where they work

719
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 08:11:53 PM »
you know the m3, 4, 5 macros are there as examples when you run a G code it courses the spindle to not turn on you can get ride of those one`s


720
Mach4 General Discussion / Re: No Script Engine Found for ...
« on: June 03, 2015, 07:55:20 PM »
wrong path name what it was looking for was not there as in the path to what ever script you where editing