Jump to content

sxj1121

Dormant
  • Posts

    16
  • Joined

  • Last visited

  • Days Won

    2

sxj1121 last won the day on August 12 2019

sxj1121 had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

sxj1121's Achievements

4

Reputation

  1. For us, we just want to provide a way for users to learn G-Code and coordinate system by 3D printer.
  2. Refer to this post. It also works in PHP and python scripts.
  3. 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!
  4. you could download and install xampp, it would be easier for you to start programming. https://www.apachefriends.org/index.html
  5. 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.
  6. 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!
  7. Is there any way to show the G-Code that is running? I went to the API Documentation, but it looks like that it only shows whole G-Code command. Or is the printrun through USB the only solution? Any help would be appreciated!
  8. Just delete "&&" in PHP or "\n", then it would work.
  9. I figured out the reason. Just delete "&&" in PHP or delete"\n" and it would work.
  10. Is there any other way to send gcode to the 3d printer?
  11. 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()
  12. 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()
  13. Thank you very much! I solved this POST print_job problem. There are several syntax errors of PHP code.
  14. Finally solved it. It's just some PHP syntax error. 'file' => "@$filedata" doesn't work for PHP7. Besides, this file must be a local file. There is no need to set CURLOPT_HTTPHEADER. CURLOPT_HEADER must be set as 0
  15. I developed a web application by PHP. If I want to use POST print_job, do I need to generate new id and key every time? Because I found that a previous authorized id and key would be unauthorized next time. By the way, do I need to set api key? Thank you very much!
×
×
  • Create New...