Vismach is a simulator to show 3D previews of a physical machine. The function an screenshots are presented below, for a tutorial, look at the bottom of the page.
Vismach.py is a python library to draw objects in a simulation window. It is located in /usr/share/pyshare (can't find it on git - was it removed?). The simultion itself is a script, based on vismach.py. The scripts are located in /usr/bin (Hal components). The .hal file of your machine in your /home/user/linuxcnc/config/yourmachine loads this script with "loadusr" al a HAL component and connects the axis. Following important things are described in the script:
At the moment, these simulations are available:
Example for object "ram":
ram = Translate([ram], 0,0,150)
table = Collection([
crotary, # relation to previous object Box(-150,-50, 81, 150, 50, 100), Box(-150,-40, 75, 150, 40, 81), ])
Vismach can be used to verify motions that don't show up in AXIS preview, such as custom kinematics or m-codes. This screenshot shows a "virtual rotary table" using the C-axis. Another example on what one can do with LinuxCNC (ex Enhanced Machine Controller) and Vismach help.
Setting up a Simulation is basically done in following steps. To get familiar how it is done, you should start below to see how the scripting an d debugging works.
The Simulator is loaded as Hal Component. Open a terminal and type:
Then you will get the command line for HAL. Type:
A Window with the 5 axis simulation should appear (it is not connectetd to a controller, so you can't do anything with it now, than view it). Close the Window an Terminal. Now go to your /home/usr/linuxcnc/config/your_machine folder and edit the .hal file. Add at the bottom the line:
loadusr -W 5axisgui
The -W option tells Axis to wait for the simulator. Start AXIS your machine with configuration. This time the 5axisgui window will appear with ist (again it is not connectetd to a controller, so you can't do anything with it now, than view it).
sudo su cp /usr/bin/5axisgui /usr/bin/my_machine_gui chmod 755 /usr/bin/my_machine_gui
This will copy the 5axisgui script to a new file an makes it executable. Go to your /home/usr/linuxcnc/config/your_machine folder and edit the .hal file. Go to the bottom. Remove the line:
loadusr -W 5axisgui
Add the lines:
loadusr -W my_machine_gui
This will load your script. Using the "net" command, it will connect the Feedback Signal of your machine to the script for every joint. Save it and open Axis with your machine conig - the window should pop up again. This time, you should be able to move something in the Simulator, when controlling the machine with the key arrows. Of course - thats not your machine, and it might move anything. Close LinuxCNC.
Type in a Terminal: sudo gedit /usr/bin/my_machine_gui
The following shows a script with the basics:
You might test it from the terminal with:
halrun loadusr my_machine_gui
There seem to be further issues I don't understand right now: Although this works from terminal using halcmnd, I can't load this script from AXIS without crashing. Seems to be some details which might be found out from vismach.py. It has nothing to do with the connection from Axis to the script made in the . hal file of your machine. Feel free to improve our knowledge and document it here :) The good thing is that it works with following script, where 7 joints are defined (seem to be always 7 in the other scripts - I just don't know why):