Jump to content

sxj1121

Dormant
  • Posts

    16
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by sxj1121

  1. 28 minutes ago, CarloK said:

    Have you tried? The M142 command is still the same

     

    You still didn't mention why you want to use gcodes. The web API is the preferred interface method as that is officially documented and will have less potential problems interfering with the rest of the printer.

    For us, we just want to provide a way for users to learn G-Code and coordinate system by 3D printer.

  2. I have the same issue as yours. Do you also use the latest firmware? Right now, I could send G-Code as 'ultimaker'. But as 'root', the dbus part doesn't work. I searched by Google, it looks like dbus needs a correct interface, or some other problem leads to this. If you find out any solutions, please share. Thanks!

  3. 11 hours ago, zaaf77 said:

    @sxj1121... .. Many thanks for your help and is much much appreciated! Thanks for the piece of code just above as well as a reference to your PHP7, Would you be kind enough to share the link to this.... I mean PHP7 you just mentioned above.... 

    Much appreciated once again and thankyou so very much...

    Have a nice day!

    you could download and install xampp, it would be easier for you to start programming. https://www.apachefriends.org/index.html

    • Thanks 1
  4. 3 hours ago, zaaf77 said:

    @sxj1121

    any chance you got your printing done with PHP, would you like to share some more on it then? I am working on the same thingy, actually I want to authorize the user to print GCODE files from my website to directly to their 3DPrinter say ( ultimaker S5). I also want to restrict the number of prints as well but that's second step. More interested into the process of printing a GCODE directly from my website to the 3D printer, have you any thoughts on it? Waiting on you and thanking you in advance!

    I am sorry that I can't directly share my code with you due to the restrictions of our lab. You could try to start from posting a gcode file on windows cmd by curl.

    In my PHP code, I also use curl to send gcode file. You could refer to my previous post. 

    For PHP7, it is:

            $data_array =  array(

              'jobname' => 'file',

              "file" => new \CURLFile($filedata)

            );

    If you want develop a perfect website. You need to develop a PHP file for using Get, Put, Post to call the API. Then develop another PHP file to receive the file which is uploaded from the front-end. Next save the file to local (You don't really need this step, but I don't know how to skip it). Then upload this file from local to API by Post.

     

    For restricting the number of prints, you could use AJAX to get the real-time print process. If it's not Not Found, then disable the upload function. But I think if 3D printer starts printing, then keep uploading files won't make any changes.

    • Like 1
  5. For ultimaker 3 extended, I upgraded the firmware to the latest version and then set the ip address of it as static. Then I tried to use ssh to send G-Code.

    It works perfectly for: 

    ssh ultimaker@ip

    password ultimaker

    sendgcode G28.

    But if I login as root, and go to the /usr/share/griffin/command_util.py. Then all commands except "help" don't work and it returns error as the following pictures. How to fix this problem? Or is there any way to downgrade the firmware version to 4.3.2?

    Any help would be appreciated!

     

    1564701322(1).png

  6.  
     
    1
    20 hours ago, sxj1121 said:

    I tried to realize this by PHP or Python as the following code. But after running that py file, any command doesn't work. Do you have any idea about how to fix this? Thank you very much!

    <?php
    set_include_path('C:/xampp/htdocs/phpseclib1.0.15');
    include('Net/SSH2.php');
     
    $ssh = new Net_SSH2('ip');
    if (!$ssh->login('root', 'ultimaker')) {
    exit('Login Failed');
    }
    echo $ssh->exec('python3 /usr/share/griffin/command_util.py && help');
     
    ?>
     
    #
    import paramiko
    # realize transport
    trans = paramiko.Transport(('ip', 22))
    # connection
    trans.connect(username='root', password='ultimaker')
     
    # Specify the transport of the sshclient object as the above trans
    ssh = paramiko.SSHClient()
    ssh._transport = trans
    # execute command
    stdin, stdout, stderr = ssh.exec_command('python3 /usr/share/griffin/command_util.py \n sendgcode G28')
    print(stdout.read().decode())
     
    # close connection
    trans.close()

    Just delete "&&" in PHP or "\n", then it would work.

  7. I tried to send gcode to my 3d printer by PHP and Python. The following code could connect to it, but couldn't execute any command after running that py file. Any help would be appreciated!

    <?php
    set_include_path('C:/xampp/htdocs/phpseclib1.0.15');
    include('Net/SSH2.php');
    
    $ssh = new Net_SSH2('ip');
    if (!$ssh->login('root', 'ultimaker')) {
        exit('Login Failed');
    }
    echo $ssh->exec('python3 /usr/share/griffin/command_util.py && help');
    
    ?>
    # 
    import paramiko
    # realize transport
    trans = paramiko.Transport(('ip', 22))
    # connection
    trans.connect(username='root', password='ultimaker')
    
    # Specify the transport of the sshclient object as the above trans
    ssh = paramiko.SSHClient()
    ssh._transport = trans
    # execute command
    stdin, stdout, stderr = ssh.exec_command('python3 /usr/share/griffin/command_util.py \n sendgcode G28')
    print(stdout.read().decode())
    
    # close connection
    trans.close()

     

  8.  
     
     
     
     
     
     
     
     
     
     
     
    11
    On 2/8/2018 at 9:25 AM, gr5 said:

    Well the Um2 is simpler.  You can control it through USB (it's not officially supported but it works pretty well).  It has Marlin firmware which is on hundreds of different types of printers (most printers out there).  There is software called "octoprint" that allows you to control printers through USB or you can simply send gcodes with any software you want to write.

     

    The um3 indeed has a linux stack.  You can log in with ssh username and password is root/ultimaker.  You have to put the printer into developer mode first (it's a menu option on the printer).

     

    Everything is in python so the source code is all visible and commented on the printer itself.  Well some of it is in json files (javascript).

     

    Once in you can go to the /usr/share/griffin folder and do this:

    python3 command_util.py

     

    Then do "sendgcode" followed by the gcode you want to send.  This might be too slow (not real time enough for you) so you might want to create some kind of web service.  If you do *please* share. :)

     


     

    I tried to realize this by PHP or Python as the following code. But after running that py file, any command doesn't work. Do you have any idea about how to fix this? Thank you very much!

    <?php
    set_include_path('C:/xampp/htdocs/phpseclib1.0.15');
    include('Net/SSH2.php');
     
    $ssh = new Net_SSH2('ip');
    if (!$ssh->login('root', 'ultimaker')) {
    exit('Login Failed');
    }
    echo $ssh->exec('python3 /usr/share/griffin/command_util.py && help');
     
    ?>
     
    #
    import paramiko
    # realize transport
    trans = paramiko.Transport(('ip', 22))
    # connection
    trans.connect(username='root', password='ultimaker')
     
    # Specify the transport of the sshclient object as the above trans
    ssh = paramiko.SSHClient()
    ssh._transport = trans
    # execute command
    stdin, stdout, stderr = ssh.exec_command('python3 /usr/share/griffin/command_util.py \n sendgcode G28')
    print(stdout.read().decode())
     
    # close connection
    trans.close()
  9. On 5/18/2019 at 5:31 AM, Daid said:

    That shouldn't happen, a id+key should remain valid unless the machine is factory reset. So you only need it once. (On HTTP Digest level things do expire, but I would expect PHP to handle this for you seamlessly)

    Thank you very much! I solved this POST print_job problem. There are several syntax errors of PHP code.

  10. Our team is working on developing a web application for accessing The UM3E remotely in PHP, We tried implementing the POST print_job part using the multipart/form-data but it doesn't work. It shows no file received. Here is the code. Any help is appreciated!
     
    $curl = curl_init();
    $filedata = $_FILES["fileToUpload"]["tmp_name"];
      $data_array =  array(
        "jobname" => "test",
        "file" => "@$filedata"
      );
    $headers = array("Content-Type:multipart/form-data"); 
      $options = array(
       CURLOPT_URL => $url,
       CURLOPT_HTTPAUTH => CURLAUTH_DIGEST,
       CURLOPT_USERPWD => $username . ":" . $password,
       CURLOPT_HEADER => true,
       CURLOPT_POST => 1,
       CURLOPT_HTTPHEADER => $headers,
       CURLOPT_POSTFIELDS => $data,
       CURLOPT_RETURNTRANSFER => true
    ); 
    curl_setopt_array($curl, $options);
    $result = curl_exec($curl);
×
×
  • Create New...