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, which is 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" als a HAL component and connects the axis. Following important things are described in the script:
- geometry is defined or loaded from a .stl or .obj file
- joints are defined an and connected to a HAL PIN
- colour is definded
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:
Example for object "ram":
ram = Translate([ram], 0,0,150)
- BoxCentred(x width,y width,z width); Box is centred on the origin
- BoxCentredXY(x width,y width,z width); Box is centred in x and y an is extruded from z = 0.
- Collection(objects); sum up geometry objects for one axis of the machine. Example of Syntax:
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
- Color(); apply colour for the specified part
- Hud(); head up display
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.
Set up your own Simulation
- 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 an [export] it as .obj or .stl.
- Create a *gui file for your machine in /usr/bin. Have a look at the existing scripts like scaragui.
- Read the geometry files with your script using the class AsciiOBJ or AsciiSTL. Define the axis (geometry, position, color, hal connection)
- Connect the script to your machine in .hal file with "loadusr" and the needed connections.