LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Showing revision 38
Difference (from revision 38 to revision 38) (minor diff, author diff)
(The revisions are identical or unavailable.)


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:

Classes defined in vismach.py

Details about functions can be found from vismach.py itself and the already existing examples. For first experiments one might just have a look at 5axisgui, where geometry is generated with simple boxes. Scaragui shows how to load .obj files. A short summary of the classes follows:

Transform/place Objects:

Example for object "ram":

ram = Translate([ram], 0,0,150)

Create Geometry

table = Collection([

	crotary,    # relation to previous object
	Box(-150,-50, 81, 150, 50, 100),
	Box(-150,-40, 75, 150, 40, 81),

Define joints as rotating/translating axis

further classes


upload:puma_vismach.png upload:hbm-vismach-ss1.png upload:hbm-vismach-ss2.png upload:scara_vismach.png upload:hexapod_sim3.png

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. upload:rotatekins.png Another example on what one can do with LinuxCNC (ex Enhanced Machine Controller) and Vismach help. upload:Dab_Tetrapod.png

Set up your own Simulation

get familiar with HAL

The Simulator is loaded as Hal Component. Open a terminal and type:


Then you will get the command line for HAL. Type:

loadusr 5axisgui

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. Then start your machine 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).

set up own script

Type in a Terminal (where "my_machine stands" for your deserved name):

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.

edit the script file

Type in a Terminal: sudo gedit /usr/bin/my_machine_gui

  1. Use a CAD and export .obj or .stl files for each axis consisting the geometry. The files can be produced using [FreeCAD]: Model the solid for each axis, create a mesh and [export] it as .obj or .stl.
  2. Create a *gui file for your machine in /usr/bin. Have a look at the existing scripts like scaragui.
  3. Read the geometry files with your script using the class AsciiOBJ or AsciiSTL. Define the axis (geometry, position, color, hal connection)
  4. Connect the script to your machine in .hal file with "loadusr" and the needed connections.

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
This page is read-only. Follow the BasicSteps to edit pages. | View other revisions | View current revision
Edited December 24, 2013 12:28 am by Felix (diff)
Published under a Creative Commons License