Overview

The AptAPI module has functions to build AP238 process descriptions with methods inspired by the APT tool path language. In addition, there are functions for reading RS274D/ISO 6983 files, and functions to import read STEP files with CAD geometries and tolerances for the workpiece, stock, fixtures and cutting tools.

The old APT language was incremental with much inferred state, while STEP-NC objects have a complete description of all important attributes (tool path curves, speeds and feeds, etc) explicitly attached to that object. This API builds the complete description as you make incremental APT-style calls to move, move, move. At any time you can ask for the current workpiece, workplan, workingstep, feed, speed and so on.

There is no need to create an instance of AptAPI, it is just a namespace that collects related functions in one place as class methods. For example, the following code creates a simple STEP-NC process that describes a tool moving along a straight line between two points.

#! python
# Create a simple STEP-NC process
from steptools import step
from steptools.step import AptAPI as apt

step.verbose(False)

apt.partno(test part)
apt.define_tool(0.25, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0)
apt.load_tool(1)

apt.rapid()
apt.goto_xyz(point001, 1.0, 12.0, 0.0)
apt.goto_xyz(point002, 1.0, 14.0, 0.0)

apt.save(test)

auto_workingstep_spindle/tool()

def auto_workingstep_spindle(cls) -> None:   # default
def auto_workingstep_tool(cls) -> None:

The auto-workingstep functions control how the API separates movement into workingsteps. By default it creates a new workingstep whenever the spindle speed or tool changes, which can be explicitly set by the auto_workingstep_spindle() function.

This behavior can be disabled by the auto_workingstep_tool() function to only create a new workingstep when the tool changes. The structure of the STEP-NC definitions require a new workingstep for a different tool.

The default, splitting at spindle speed changes, will tend to create more, shorter, workingsteps when parsing APT files. However, you may want to turn this behavior off and insert workingstep breaks explicitly by calling the workingstep function.

In the .NET API, the auto_workingstep_spindle() function was called CamModeOff() and auto_workingstep_tool() was called CamModeOn()

design()

@classmethod
def design(cls) -> Design:

The design() class method returns the Design object holding the data instances for the current project. This is the same as the return value of new_project()

end_workplan()

@classmethod
def end_workplan(cls) -> None:

The end_workplan() function closes the current workplan and pops it off of the stack of workplans. The parent of this will become the current workplan and the destination for any process additions. This is the opposite of nest_workplan() and similar functions, which create a sub-workplan and push it on the stack.

executable_workpiece_asis()

@classmethod
def executable_workpiece_asis(cls,
	executable: Object,
	filename: StrOrBytesPath
	) -> Object:

The executable_workpiece_asis() function defines the AS-IS shape of a workingstep or workplan from a STEP CAD model (AP203, AP214, or AP242 file). The model describes what the shape of the workpiece looks like before the executable is run. The function returns the new workpiece object.

The function assumes that all of the geometry in the file should be the as-is model. Any STEP file can be used, and may contain tolerances and dimensions. See the Tolerance API for more information.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the AS-IS shape.
filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to read.

executable_workpiece_removal()

@classmethod
def executable_workpiece_removal(cls,
	executable: Object,
	filename: StrOrBytesPath
	) -> Object:

The executable_workpiece_removal() function defines the REMOVAL shape of a workingstep or workplan from a STEP CAD model (AP203, AP214, or AP242 file). The model describes the difference in shape of the workpiece before and after the executable is run. The function returns the new workpiece object.

The function assumes that all of the geometry in the file should be the removal model. Any STEP file can be used, and may contain tolerances and dimensions. See the Tolerance API for more information.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the REMOVAL shape.
filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to read.

executable_workpiece_reuse_asis()

@classmethod
def executable_workpiece_reuse_asis(cls,
	executable: Object,
	workpiece: Object
	) -> None:

The executable_workpiece_reuse_asis() function defines the AS-IS shape of a workingstep or workplan by reusing an existing workpiece object.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the AS-IS shape.
workpiece: Object
The workpiece object that will be used for the AS-IS shape.

executable_workpiece_reuse_removal()

@classmethod
def executable_workpiece_reuse_removal(cls,
	executable: Object,
	other: Object
	) -> None:

The executable_workpiece_reuse_removal() function defines the REMOVAL shape of a workingstep or workplan by reusing an existing workpiece object.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the REMOVAL shape.
workpiece: Object
The workpiece object that will be used for the REMOVAL shape.

executable_workpiece_reuse_tobe()

@classmethod
def executable_workpiece_reuse_tobe(cls,
	executable: Object,
	other: Object
	) -> None:

The executable_workpiece_reuse_tobe() function defines the TO-BE shape of a workingstep or workplan by reusing an existing workpiece object.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the TO-BE shape.
workpiece: Object
The workpiece object that will be used for the TO-BE shape.

executable_workpiece_tobe()

@classmethod
def executable_workpiece_tobe(cls,
	executable: Object,
	filename: StrOrBytesPath
	) -> Object:

The executable_workpiece_tobe() function defines the TO-BE shape of a workingstep or workplan from a STEP CAD model (AP203, AP214, or AP242 file). The model describes what the shape of the workpiece looks like after the executable is run. The function returns the new workpiece object.

The function assumes that all of the geometry in the file should be the to-be model. Any STEP file can be used, and may contain tolerances and dimensions. See the Tolerance API for more information.

Keyword Parameters

executable: Object
The workingstep or workplan data object that will be assigned the TO-BE shape.
filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to read.

fixture()

@classmethod
def fixture(cls,
	filename: StrOrBytesPath,
	workplan: Object = None
	) -> Object:

The fixture() class method defines a fixture for the current workplan or the explicitly given workplan using a CAD file. If a workplan has no fixture defined then it may be inherited from the parent workplan. The fixture is an assembly will be imported from the STEP CAD file

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to import.
workplan: Object = None
Workplan that is to be given the fixture, or None for the current workplan.

geometry_for_tool_number()

@classmethod
def geometry_for_tool_number(cls,
	filename: StrOrBytesPath,
	toolnum: int
	) -> Object:

The geometry_for_tool_number() class method imports the given CAD file as the geometry of the tool. This function assumes that tool numbers are integers. Other functions allow the tool number to be any identifier. This function defines an identifier for the tool by prepending a T to the tool number. Therefore, tool 1 will be given the identifier T1.

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to import.
toolnum: int
Tool number as an integer.

generate_all_tool_geometry()

def generate_all_tool_geometry(cls) -> None:

The generate_all_tool_geometry() function creates product geometry from parametric description for any tool without it. This uses the diameter, length and corner radius values.

get_current_fixture()

@classmethod
def get_current_fixture(cls) -> Object:

The get_current_fixture() class method returns the data object that represents the fixture workpiece of a process. You can use the fixture() function to completely replace it with an imported a STEP CAD model. See get_current_workpiece() for more discussion about the workpieces associated with a process.

get_current_project()

@classmethod
def get_current_project(cls) -> Object:

The get_current_project() class method returns the data object that represents the project of the current file. Every STEP-NC program contains one project. This object is usually an instance of the product_definition EXPRESS type and has PROJECT ARM attributes. An example is shown below:

PROJ = apt.get_current_project()
print (Project: , PROJ)
pprint (dict(PROJ))

----------
Project:  <step.Object ARM PROJECT #10 product_definition>
{'description': '',
 'formation': <step.Object #12 product_definition_formation>,
 'frame_of_reference': <step.Object #16 product_definition_context>,
 'id': '',
 'its_id': 'imts_ashtray_v1',
 'its_manufacturer': None,
 'its_manufacturer_organization': None,
 'its_owner': None,
 'its_owner_organization': None,
 'its_release': None,
 'its_security_classification': <step.ArmCollection size 0>,
 'its_status': None,
 'its_workpieces': <step.ArmCollection size 1>,
 'main_workplan': <step.Object ARM WORKPLAN #19 machining_workplan>}
 

get_current_rawpiece()

@classmethod
def get_current_rawpiece(cls) -> Object:

The get_current_rawpiece() class method returns the data object that represents the AS-IS, or starting workpiece of a process. You can use the rawpiece() function to completely replace it with an imported a STEP CAD model. See get_current_workpiece() for more discussion about the workpieces associated with a process.

get_current_workingstep()

@classmethod
def get_current_workingstep(cls) -> Object:

The get_current_workingstep() class method the data object for the current working step, or None if there is no current workingstep. Some actions when creating process, like changing the tool, starting or ending a nested workplan, will create a new workingstep.

This object is usually an instance of the machining_workingstep EXPRESS type and has MACHINING_WORKINGSTEP ARM attributes. An example is shown below:

WS = apt.get_current_workingstep()
print (Workingstep: , WS)
pprint (dict(WS))

----------
Workingstep: <step.Object ARM MACHINING_WORKINGSTEP #905 machining_workingstep>
{'as_is_geometry': None,
 'consequence': '',
 'description': 'machining',
 'enabled': None,
 'final_features': <step.ArmCollection size 0>,
 'fixture_geometry': None,
 'its_feature': <step.Object ARM TOOLPATH_FEATURE #994 instanced_feature>,
 'its_id': '2D 90deg arcs and lines WS 2',
 'its_operation': <step.Object ARM FREEFORM_OPERATION #863 freeform_milling_operation>,
 'its_secplane': None,
 'its_secplane_rep': None,
 'its_security_classification': <step.ArmCollection size 0>,
 'machine_used': None,
 'name': '2D 90deg arcs and lines WS 2',
 'process_properties': <step.ArmCollection size 0>,
 'purpose': '',
 'removal_geometry': None,
 'to_be_geometry': None,
 'toolpath_orientation': None,
 'twin_end': None,
 'twin_exception': None,
 'twin_plan': None,
 'twin_source': None,
 'twin_start': None,
 'twin_worktime': None}
 

get_current_workpiece()

@classmethod
def get_current_workpiece(cls) -> Object:

The get_current_workpiece() class method returns the data object that represents the part being made. When a project is first defined it is given a workpiece with the default name unnamed workpiece, with no geometry associated with it. You can change this string with the partno() function, or can use the workpiece() function to completely replace it with an imported a STEP CAD model.

Workpiece is a general term in STEP-NC that refers to a STEP CAD model. A process many contain many workpieces for the starting "as-is" stock, fixture, cutting tools, and in-process shape. This function returns what is called the "to-be" workpiece.

This object is usually an instance of the product_definition EXPRESS type and has WORKPIECE ARM attributes. An example is shown below:

PIECE = apt.get_current_workpiece()
print (Workpiece: , PIECE)
pprint (dict(PIECE))

----------
Workpiece:  <step.Object ARM WORKPIECE #1648 product_definition>
{'clamping_positions': <step.ArmCollection size 0>,
 'description': '',
 'formation': <step.Object #1650 product_definition_formation>,
 'frame_of_reference': <step.Object #16 product_definition_context>,
 'global_tolerance': None,
 'id': '',
 'its_approvals': <step.ArmCollection size 0>,
 'its_bounding_geometry': None,
 'its_categories': <step.ArmCollection size 1>,
 'its_components': <step.ArmCollection size 1>,
 'its_constructive_models': <step.ArmCollection size 0>,
 'its_datestamps': <step.ArmCollection size 0>,
 'its_geometry': <step.Object #1654 shape_representation>,
 'its_id': '7AJS9999-0001A_FOR_NC -.1_fmt',
 'its_material': None,
 'its_orgs': <step.ArmCollection size 0>,
 'its_people': <step.ArmCollection size 0>,
 'its_rawpiece': None,
 'its_related_geometry': <step.ArmCollection size 0>,
 'its_security_classification': <step.ArmCollection size 0>,
 'its_styled_models': <step.ArmCollection size 0>,
 'its_timestamps': <step.ArmCollection size 0>,
 'product_approvals': <step.ArmCollection size 0>,
 'product_datestamps': <step.ArmCollection size 0>,
 'product_orgs': <step.ArmCollection size 0>,
 'product_people': <step.ArmCollection size 0>,
 'product_timestamps': <step.ArmCollection size 0>,
 'revision_approvals': <step.ArmCollection size 0>,
 'revision_datestamps': <step.ArmCollection size 0>,
 'revision_id': '',
 'revision_orgs': <step.ArmCollection size 0>,
 'revision_people': <step.ArmCollection size 0>,
 'revision_security_classification': <step.ArmCollection size 0>,
 'revision_timestamps': <step.ArmCollection size 0>,
 'security_classification': <step.ArmCollection size 0>,
 'shape_definition': <step.Object #1649 product_definition_shape>}
 

get_current_workplan()

@classmethod
def get_current_workplan(cls) -> Object:

The get_current_workplan() class method returns the data object that represents the current workplan, where new process will be added. When the active STEP file is changed by new_project() or open_project(), the current workplan is initialized to the main workplan of the project. Calling nest_workplan() or end_workplan changes the current workplan.

The main workplan is also available from the .main_workplan ARM attribute of the project.

This object is usually an instance of the machining_workplan EXPRESS type and has WORKPLAN ARM attributes. An example is shown below:

PLAN = apt.get_current_workplan()
print (Main Plan: , PLAN)
pprint (dict(PLAN))

----------
Main Plan:  <step.Object ARM WORKPLAN #19 machining_workplan>
{'as_is_geometry': <step.Object ARM WORKPIECE #2054 product_definition>,
 'consequence': '',
 'description': '',
 'enabled': None,
 'fixture_geometry': None,
 'its_channel': None,
 'its_elements': <step.ArmCollection size 1>,
 'its_id': 'Aerospace',
 'its_minimum_machine_params': None,
 'its_security_classification': <step.ArmCollection size 0>,
 'its_setup': <step.Object ARM SETUP #6267 product_definition_formation>,
 'machine_used': None,
 'name': 'Aerospace',
 'planning_operation': None,
 'process_properties': <step.ArmCollection size 0>,
 'purpose': '',
 'removal_geometry': None,
 'to_be_geometry': <step.Object ARM WORKPIECE #1648 product_definition>,
 'toolpath_orientation': None,
 'twin_end': None,
 'twin_exception': None,
 'twin_plan': None,
 'twin_source': None,
 'twin_start': None,
 'twin_worktime': None}
 

get_executable_workpiece_asis()

@classmethod
def get_executable_workpiece_asis(cls,
	executable: Object
	) -> Object:

The get_executable_workpiece_asis() function returns the AS-IS workpiece object of a workingstep or workplan.

Keyword Parameters

executable: Object
The workingstep or workplan data object with the AS-IS shape.

get_executable_workpiece_removal()

@classmethod
def get_executable_workpiece_removal(cls,
	executable: Object
	) -> Object:

The get_executable_workpiece_removal() function returns the REMOVAL workpiece object of a workingstep or workplan.

Keyword Parameters

executable: Object
The workingstep or workplan data object with the REMOVAL shape.

get_executable_workpiece_tobe()

@classmethod
def get_executable_workpiece_tobe(cls,
	executable: Object
	) -> Object:

The get_executable_workpiece_tobe() function returns the TO-BE workpiece object of a workingstep or workplan.

Keyword Parameters

executable: Object
The workingstep or workplan data object with the TO-BE shape.

get_id_from_uuid()

@classmethod
def get_id_from_uuid(cls,
	uuid: str
	) -> Object:

The get_id_from_uuid() function returns the data object associated with the given UUID string, or None if one is not found.

get_tool_product()

@classmethod
def get_tool_product(cls,
	toolnum: str
	) -> Object:

The get_tool_product() function returns the workpiece associated with the tool number, or None if one is not found.

inches()

@classmethod
def inches(cls) -> None:

The inches() class method sets the internal unit for subsequent length items to inches. Any tool path defined in an APT file or an ISO 6983 file will be given this unit until it is reset by another call.

Unlike the DefaultToInches function, the Inches function requires the units for subsequent items to be inches. The DefaultToInches function defines a default for the APT parsers when no other units have been defined.

Internally the system stores data in inch units or millimeter units. If an external file is found with other units then they are converted to one of these units.

millimeters()

@classmethod
def millimeters(cls) -> None:

The millimeters() class method sets the internal unit for subsequent length items to millimeters. Any tool path defined in an APT file or an ISO 6983 file will be given this unit until it is reset by another call. See inches()

nest_workplan/selective/parallel/non_sequential()

@classmethod
def nest_workplan(cls,
	name: str
	) -> Object:
	
@classmethod
def nest_selective(cls,
	name: str
	) -> Object:
	
@classmethod
def nest_non_sequential(cls,
	name: str
	) -> Object:
	
@classmethod
def nest_parallel(cls,
	name: str
	) -> Object:

The nest_workplan() function creates and returns a new workplan and makes it the current workplan for all subsequent operations.

The default is for the new workplan to be sequential. the nest_selective() function makes a workplan that selects one of its elements. The nest_parallel() function makes a concurrent workplan. The nest_non_sequential() function makes an unordered workplan.

The new plan is put into the old workplan, which is kept on a stack so that it can become the current workplan again when the new workplan is ended. See end_workplan() for details.

The workplan is the basic data structure of a STEP-NC program. A workplan describes a sequence of workingsteps, NC functions and other workplans that are to be executed in order. Every STEP-NC program has a special workplan called the main_workplan that defines the start of the program. The NestWorkplan function allows other workplans to be created.

Keyword Parameters

name: str
A meaningful name for the new workplan.

nest_workplan/selective/parallel/non_sequential_after()

@classmethod
def nest_workplan_after(cls,
	name: str,
	index: int,
	plan: Object
	) -> Object:
	
@classmethod
def nest_selective_after(cls,
	name: str,
	index: int,
	plan: Object
	) -> Object:
	
@classmethod
def nest_non_sequential_after(cls,
	name: str,
	index: int,
	plan: Object
	) -> Object:
	
@classmethod
def nest_parallel_after(cls,
	name: str,
	index: int,
	plan: Object
	) -> Object:

The nest_workplan_after() function operates in the same way as nest_workplan(), but allows the location of the new workplan to be selected by the user. The function creates and returns a new workplan and makes it the current workplan for all subsequent operations. The new workplan is inserted into plan after position index.

The nest_workplan_after() function makes a sequential workplan, nest_selective_after() makes a workplan that selects one of its elements, nest_parallel() function makes a concurrent workplan, and nest_non_sequential() function makes an unordered workplan.

Keyword Parameters

name: str
A meaningful name for the new workplan.
index: int
The new workplan will be inserted after this position. Use -1 to insert at the start and the current size of the workplan - 1 or more to append to the end.
plan: Object
The workplan, selective, etc that will contain the new workplan.

new_project()

@classmethod
def new_project(cls,
	name: str
	) -> Design:

The new_project() class method creates a new STEP-NC program with an empty workpiece and an empty main workplan. Returns the Design object holding the data instances for the new project. Use the other functions of the APT class to populate the empty project from STEP CAD files, APT files and other data sources.

The empty workplan is named main workplan and its workpiece is named unnamed workpiece. The default feeds and speeds for the new project will be zero. The default tool number for the first tool will be zero.

Keyword Parameters

name: str
Name for the new project, which is also the default file name when a the project is saved.

open_project()

@classmethod
def open_project(cls,
	filename: StrOrBytesPath
	) -> Design:

The open_project() class method reads a STEP or STEP-NC file and recognizes higher level ARM objects within it. Returns the Design object holding the data instances for the file.

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the file to be read.

partno()

@classmethod
def partno(cls,
	partname: str
	) -> None:

The partno() class method sets the name of the main workpiece in the STEP-NC project. It does not change any other attributes of the workpiece so if CAD geometry has been defined using workpiece() then that geometry will continue to be used but with the new workpiece name.

Keyword Parameters

partname: str
The new name for the workpiece.

put_workpiece_placement()

@classmethod
def put_workpiece_placement(cls,
	workpiece: Object,
	x: float, y: float, z: float,
	i: float = 0, j: float = 0, k: float = 1,
	a: float = 1, b: float = 0, c: float = 0
	) -> None:

The put_workpiece_placement() class method changes the location of a workpiece. CAD and CAM systems typically use different coordinate systems. In CAD a part is positioned and oriented in the coordinates it will be given in the final product. In CAM a part is often positioned and oriented in a convenient way for fixturing the part on the machine and so toolpaths start in a easily verifiable location, like the top center of the rawpiece.

In STEP, geometry is positioned and oriented using axis placements. To place the part, the user needs to describe the coordinates and orientations that must be given to the origin and axes (Z and X) of the workpiece in the coordinate system of the tool paths.

Keyword Parameters

workpiece: Object
The data object for the model whose placement is to be changed. The model can be any workpiece, rawpiece, fixture, in-process model or tool.
x: float
y: float
z: float
New X/Y/Z coordinates for the model origin.
i: float = 0
j: float = 0
k: float = 1
New direction components for the model Z axis
a: float = 1
b: float = 0
c: float = 0
New direction components for the model X axis

rapid()

def rapid(cls) -> None:

The rapid() function sets the feedrate to rapid for all subsequent tool path moves until changed with the feedrate() function. Note that this is different to the APT semantics which define the rapid for the next move only.

rawpiece()

@classmethod
def rawpiece(cls,
	filename: StrOrBytesPath
	) -> Object:

The rawpiece() class method imports a STEP CAD file as the "as-is" workpiece of the main workplan. If the STEP file has tolerances and dimensions, they will be included with the rawpiece. The Tolerance object has more information on how tolerances are processed in the API.

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to import.

read_catia_aptcl()

@classmethod
def read_catia_aptcl(cls,
	filename: StrOrBytesPath
	) -> None:

The read_catia_aptcl() function reads a binary APT CL file produced by CATIA and creates AP238 tool paths and operations from the APT description. The usage of APT varies between CAM systems. Similar functions are tailored for Siemens NX, Pro/Engineer, and others.

An application will typically create a new project and then read tool path data from one or more APT files. Each read adds data to the project. In order to keep the project well organized it can be a good idea to put the data from each file into its own workplan using the nest_workplan() function.

# Import process from CL file, keep in its own sub-workplan
apt.nest_workplan(Stage 1);
apt.read_catia_aptcl(Stage_1.clfile);
apt.end_workplan();

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the APT CL file to read.

read_makino_aptcl()

@classmethod
def read_makino_aptcl(cls,
	filename: StrOrBytesPath
	) -> None:

The read_makino_aptcl() function reads an APT CL file produced by Makino FFCAM and creates AP238 tool paths and operations. See read_catia_aptcl() for an example and discussion.

read_proe_aptcl()

@classmethod
def read_proe_aptcl(cls,
	filename: StrOrBytesPath
	) -> None:

The read_proe_aptcl() function reads an APT CL file produced by Pro/Engineer and creates AP238 tool paths and operations. See read_catia_aptcl() for an example and discussion.

read_ugs_aptcl()

@classmethod
def read_ugs_aptcl(cls,
	filename: StrOrBytesPath
	) -> None:

The read_ugs_aptcl() function reads an APT CL file produced by Siemens NX and creates AP238 tool paths and operations. See read_catia_aptcl() for an example and discussion.

retract_plane()

@classmethod
def retract_plane(cls,
    	z_value: float
	) -> None:

The retract_plane() function defines a safe distance from the surface being machined for rapid movements during an operation. If an application is generating its own tool paths for an operation then it can use the retract plane as the safe distance for rapid movement during the operation.

Keyword Parameters

z_value: float
The retract plane is defined to be at the given distance from the surface being machined. The direction of the distance depends on the current normal of the surface when the retract is executed.

save()

@classmethod
def save(cls,
	filename: StrOrBytesPath,
	modules: bool = True,
	xml: bool = False
	) -> None:

The save() class method writes the current project out to a STEP exchange file.

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the file to write. The extension of the file will be changed to .stp or .stpnc depending on whether the file contains just STEP CAD data or also contains STEP-NC process data.
modules: bool = True
If true, the instances in the file are grouped by the high-level concepts that they are used by. These groups are commented showing the structure of the data in greater detail. If false, the instances are written without any extra commenting.
xml: bool = False
If false, the file is writen in STEP Part 21 Exchange Format (ISO 10303-21) which is the most widely used encoding for STEP data. If true, the file is writen using ISO 10303-28, which is an alternative XML encoding that uses XML attributes.

set_make_display_messages()

@classmethod
def set_make_display_messages(cls,
	yn: bool
	) -> None:

The set_make_display_messages() function controls whether certain APT commands such as PPRINT and LOADTL are included in the process as message NC functions. When True they are included, when False they are not.

set_name()

@classmethod
def set_name(cls,
	obj: Object,
	name: str
	) -> None:

The set_name() function sets the name of a STEP-NC data object to the given string. Many objects in the API have names or identifiers.

Keyword Parameters

workplan: Object
An executable, project, feature, tolerance, workpiece or other STEP-NC data object that has a name attribute.
name: str
The new name.

set_name_in_plan()

@classmethod
def set_name_in_plan(cls,
	workplan: Object,
	index: int,
	name: str
	) -> None:

The set_name_in_plan() function sets the name of workingstep by position in a workplan. The function will set names in workplans and selectives and can be used to set the name of any executable. Use set_name() to set the name by data object rather than position in workplan.

Keyword Parameters

workplan: Object
The workplan or selective that contains the workingstep.
index: int
The position, starting with zero, of the executable within the workplan or selective that is to be given the new name.
name: str
The new name.

set_spindle_speed_for_feed_ccw/cw()

@classmethod
def set_spindle_speed_for_feed_ccw(cls,
	feed: float,
	speed: float
	) -> None:

@classmethod
def set_spindle_speed_for_feed_cw(cls,
	feed: float,
	speed: float
	) -> None:

The set_spindle_speed_for_feed_ccw() and set_spindle_speed_for_feed_cw() functions set the spindle speed for a given feed. The function can be used to fix the spindle speeds of process data that has been converted to STEP-NC when that data did not include sensible spindle speeds. Every instance of the given feed is given the spindle speed.

Keyword Parameters

feed: float
The value of the feed. All process data with this feed will be given the the spindle speed.
speed: float
Spindle speed setting, which must be greater than or equal to zero.

set_tool_diameter()

@classmethod
def set_tool_diameter(cls,
	toolnum: int,
	diameter: float
	) -> None:

The set_tool_diameter() function sets the diameter value in the parametric description of the given tool number.

set_tool_length()

@classmethod
def set_tool_length(cls,
	toolnum: int,
	length: float
	) -> None:

The set_tool_length() function sets the length value in the parametric description of the given tool number.

set_tool_radius()

@classmethod
def set_tool_radius(cls,
	toolnum: int,
	radius: float
	) -> None:

The set_tool_radius() function sets the corner radius value in the parametric description of the given tool number.

spindle_speed_ccw/cw()

@classmethod
def spindle_speed_ccw(cls,
	speed: float
	) -> None:

@classmethod
def spindle_speed_cw(cls,
	speed: float
	) -> None:

The spindle_speed_ccw() and spindle_speed_cw() functionsdefine the spindle speed to be used by all subsequent tool paths.

If a toolpath is currently being constructed then it is finished and a new one is started with the new spindle speed. If the API is in cam_mode_off(), then a new workingstep is also started because in APT files, spindle speed changes usually only happen at the start or end of an operation.

The unit of the spindle speed can be set using the spindle_speed_unit function.

Keyword Parameters

speed: float
Spindle speed setting, which must be greater than or equal to zero.

spindle_speed_unit()

@classmethod
def spindle_speed_unit(cls,
	unit: str
	) -> None:

The spindle_speed_unit() function defines the unit used for subsequent spindle speeds. The function should be followed by a call to spindle_speed_cw() or _ccw to set the new spindle speed value. The function sets the current spindle speed to zero and sets the technology object to None until a new one is needed for a new tool path.

Keyword Parameters

unit: str
The unit to be used for future spindle speeds as described by one of the following strings.
  • hertz cycles per second
  • rpm revolutions per minute

workpiece()

@classmethod
def workpiece(cls,
	filename: StrOrBytesPath
	) -> Object:

The workpiece() class method imports a STEP CAD file as the "to-be" workpiece of the main workplan. If the STEP file has tolerances and dimensions, they will be included with the workpiece. The Tolerance object has more information on how tolerances are processed in the API.

Keyword Parameters

filename: StrOrBytesPath
String, bytes, or PathLike object giving the location of the STEP CAD file to import.

workplan_setup()

@classmethod
def workplan_setup(cls,
	workplan: Object,
	x: float, y: float, z: float,
	i: float = 0, j: float = 0, k: float = 1,
	a: float = 1, b: float = 0, c: float = 0
	) -> None:

The workplan_setup() class method adds setup placement to a workplan. This defines a coordinate system for both the toolpaths in the workplan and the workpiece models of that workplan. Different workplans can have different setups so that for example one workplan mills the top face of a part and another workplan mills the bottom face.

Keyword Parameters

workplan: Object
The data object for the workplan that is to be given a setup placement.
x: float
y: float
z: float
New X/Y/Z coordinates for the setup origin.
i: float = 0
j: float = 0
k: float = 1
New direction components for the setup Z axis
a: float = 1
b: float = 0
c: float = 0
New direction components for the setup X axis