Beispielskripten

Aus CamBam Wiki
Wechseln zu: Navigation, Suche

MOP Automate VB and Python scripts

This script will automate the process of opening a source file, insert machining operations, set various properties and produce g-code.

These scripts demonstrate:

  • opening a CAD file (.dxf in this example)
  • drawing some extra shapes into the drawing
  • setting machining options
  • Call asynchronous CAD functions such as
  • Edit -> Join and Edit -> Convert to polyline
  • creating a machining operation from objects in a drawing layer
  • setting machining operation properties
  • saving a drawing and creating g-code

Python version:

mop.automate.py

VB-Script Version:

mop.automate.vbs


Tool Library Automation Python scripts

Maintaining large lists of tools in different libraries and across different applications can be a tedious business.

This script is intended to demonstrate various methods to aid tool library maintenance, including:

Finding tool libraries by name Adding new or removing existing tool libraries Enumerating tools within a library Copying tools from one library to another Finding tools in a library by tool number Removing and creating new tool definitions Writing tools to external files (such as a CSV text file)

Python version:

tool-library.py


Fehler beim Erstellen des Vorschaubildes: Datei fehlt
Eine Animation in CamBam

Gear Rotation Animation Python Script

This script takes a pre-drawn group of gear outlines (generated using the CamBam gear generator), then animates them using a series of relationship rules within the script.

This script requires CamBam 0.9.8N or later.

This script demonstrates:

Importing a helper Python module. Defining a Python class. Animating objects by changing their transformation property.

gear-animate-source.zip and Samplefiles


Sloped Lines VBScript

This script was created in response to query on how to generate a toolpath for a slot that slopes along the Z axis.

The script will generate a sequence of polylines that can be used as the source for an engraving operation.

The script was extended so that it can also produce a series of parallel sloped lines to machine a sloped surface.

The following parameters are used to control the script:

x1, y1 : The coordinates of the first control point. x2, y2 : The coordinates of the second control point. Target Depth : The deepest Z coordinate of the slot or surface. Depth Increment : The maximum depth per cut. Width : The width of the surface to cut. Use 0 to machine a slot. The tool diameter is not taken into account. Stepover : The distance between each parallel cut for a surface. Once the polylines are created, select them all, then insert an Engraving machine operation.

The engraving operation should have Target Depth set to 0 and Optimisation Mode set to None, so that the machining operation will follow the source polylines exactly, in the order they were created.