Beispielskripten: Unterschied zwischen den Versionen
Ralfg (Diskussion | Beiträge) |
Ralfg (Diskussion | Beiträge) |
||
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
| + | Diese Beispielskripten zeigen in erster Linie Schnittstellen auf, mit denen CamBam und Objekte in CamBam in Skripten angesprochen werden können. Es geht dabei weniger über den Sinn der Skripten als um die Verwendeten Variablen. | ||
| + | |||
== MOP Automate VB and Python scripts == | == MOP Automate VB and Python scripts == | ||
| Zeile 78: | Zeile 80: | ||
<code>[http://www.google.com/search?client=safari&rls=en&q=cambam.pixelmaker.eu/pages/phocadownload/scripten/sloped-lines.vbs.zip sloped-lines.vbs.zip]</code> | <code>[http://www.google.com/search?client=safari&rls=en&q=cambam.pixelmaker.eu/pages/phocadownload/scripten/sloped-lines.vbs.zip sloped-lines.vbs.zip]</code> | ||
| + | ---- | ||
| + | == Invert3D VBScript == | ||
| + | 3D Meshes are built from many triangular faces. Each triangle has a 'normal', which is a direction vector perpendicular to the triangular face. The order of the points around the triangle will determine the normal direction. CamBam uses a 'Right Hand Rule', so that if the fingers of your right hand curl in the direction that the triangle points are ordered, your thumb will point in the direction of the normal. | ||
| + | |||
| + | Normal vectors are used to determine the outside facing direction of each face. When displaying meshes, faces pointing away from the viewer are often ignored by the display routines. If meshes are wound using a 'Left Hand Rule', this can result in the models appearing dark or hard to see in the CamBam drawing display. | ||
| + | |||
| + | The following script will reverse the winding direction of all selected mesh objects. | ||
| + | |||
| + | <code>[http://www.google.com/search?client=safari&rls=en&q=cambam.pixelmaker.eu/pages/phocadownload/scripten/invert-3d.vbs.zip invert-3d.vbs.zip]</code> | ||
| + | ---- | ||
Aktuelle Version vom 21. April 2013, 14:53 Uhr
Diese Beispielskripten zeigen in erster Linie Schnittstellen auf, mit denen CamBam und Objekte in CamBam in Skripten angesprochen werden können. Es geht dabei weniger über den Sinn der Skripten als um die Verwendeten Variablen.
Inhaltsverzeichnis
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:
VB-Script Version:
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:
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.
Invert3D VBScript
3D Meshes are built from many triangular faces. Each triangle has a 'normal', which is a direction vector perpendicular to the triangular face. The order of the points around the triangle will determine the normal direction. CamBam uses a 'Right Hand Rule', so that if the fingers of your right hand curl in the direction that the triangle points are ordered, your thumb will point in the direction of the normal.
Normal vectors are used to determine the outside facing direction of each face. When displaying meshes, faces pointing away from the viewer are often ignored by the display routines. If meshes are wound using a 'Left Hand Rule', this can result in the models appearing dark or hard to see in the CamBam drawing display.
The following script will reverse the winding direction of all selected mesh objects.