CAM Object

Derived from: Product Object
Defined in namespace "adsk::cam" and the header file is <Cam/CAM/CAM.h>

Description

Object that represents the CAM environment of a Fusion document.

Methods

Name Description
checkAllToolpaths Checks if all the operations (includes those nested in sub-folders or patterns) in the document are valid and up to date.
checkToolpath Checks if the operations (including those nested in sub-folders or patterns) are valid and up to date.
checkValidity PreviewChecks whether the models used by the operations have changed in the mean time and invalidates the affected operations if needed. Should be used for cases where the automatic detection does not work yet, for instance when design changes are expected before a Manufacture API call. Also recommended at the beginning of a script or the beginning of an event handler.
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
clearAllToolpaths Clears all the toolpaths in the document, including those nested in sub-folders or patterns.
clearMissingReferences PreviewClears all missing references from the document, from all available operations.
clearToolpath Clears all the toolpaths for the specified objects, including those nested in sub-folders or patterns.
deleteEntities Deletes the specified set of entities that are associated with this product.
export3MFForDefaultAdditiveSetup **RETIRED** This method is only valid for an additive setup and exports the default additive setup's models as a 3MF file. The 3MF also contains machine and support information.
findAttributes Find attributes attached to objects in this product that match the group and or attribute name. This does not find attributes attached directly to the Product or Document objects but finds the attributes attached to entities within the product.

The search string for both the groupName and attributeName arguments can be either an absolute name value, or a regular expression. With an absolute name, the search string must match the entire groupName or attributeName, including case. An empty string will match everything. For example if you have an attribute group named "MyStuff" that contains the attribute "Length1", using the search string "MyStuff" as the group name and "Length1" as the attribute name will find the attributes with those names. Searching for "MyStuff" as the group name and "" as the attribute name will find all attributes that have "MyStuff" as the group name.

Regular expressions provide a more flexible way of searching. To use a regular expression, prefix the input string for the groupName or attributeName arguments with "re:". The regular expression much match the entire group or attribute name. For example if you have a group that contains attributes named "Length1", "Length2", "Width1", and "Width2" and want to find any of the length attributes you can use a regular expression using the string "re:Length.*". For more information on attributes see the Attributes topic in the user manual.
generateAllSetupSheets Generates all of the setup sheets for all of the operations in the document
generateAllToolpaths Generates or regenerates all the operations in the document, including those nested in sub-folders or patterns.
generateSetupSheet Generate the setup sheets for the specified objects
generateTemplateXML Generates a template for the specified Operations, Setups, or Folders and returns the template as an XML string.
generateToolpath Generates or regenerates all the specified objects, including those nested in sub-folders or patterns.
getMachiningTime Get the machining time for the specified objects.
postProcess Post all of the toolpaths (including those nested in sub-folders or patterns) for the specified objects. If post processing fails, an error message can be retrieved from the error log explaining the reason for the failure.
postProcessAll Post all of the toolpaths (includes those nested in sub-folders or patterns) in the document. If post processing fails, an error message can be retrieved from the error log explaining the reason for the failure.

Properties

Name Description
allMachines Gets an array containing all the machines in the document.
allOperations Gets a collection containing all of the operations in the document. This includes all operations nested in folders and patterns.
attributes Returns the collection of attributes associated with this product.
customGraphicsGroups Returns the customGraphicsGroups object associated with the CAM product.
designRootOccurrence The CAM product has its own root component which has a single occurrence that references the Design root occurrence. This property returns this occurrence.
documentToolLibrary Gets the document ToolLibrary. The ToolLibrary contains all tools used by any operation inside the document. Changes to the original ToolLibrary will not affect any operation because the document ToolLibrary is an independent copy.
exportManager Returns the Export Manager which provides access to the functionality to export in various formats.
genericPostFolder Gets the installed post folder.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
manufacturingModels Returns the collection of manufacturing models in the document.
namedViews Returns the NamedViews object associated with this product. The NamedViews collection provides access to the named views defined in this product and supports the creation of new named views.
ncPrograms Returns the collection of NC programs in the document.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
parentDocument Returns the parent Document object.
personalPostFolder Gets the personal post folder.
productType Returns the product type name of this product. A list of all of the possible product types can be obtained by using the Application.supportedProductTypes property.
selectionSets Returns the SelectionSets object associated with this product. If the product does not support selection sets, null is returned. The SelectionSets object is used to create and access existing selection sets.
setups Returns the Setups collection that provides access to existing setups.
temporaryFolder Gets the folder for temporary files.
unitsManager Returns the UnitsManager object associated with this product.
workspaces Returns the workspaces associated with this product.

Events

Name Description
setupActivated The SetupActivated event fires when a setup is activated.
setupActivating The SetupActivating event fires before a setup is activated.
setupChanged The SetupChanged event fires when a setup is modified.
setupCreated The SetupCreated event fires when a new setup is created.
setupDeactivated The SetupDeactivated event fires when a setup is deactivated.
setupDeactivating The SetupDeactivating event fires before a setup is deactivated.
setupDestroying The setupDestroying event fires before a setup is destroyed.

Samples

Name Description
Generate Setup Sheets API Sample Demonstrates generating the setup sheets for an existing toolpath..
Generate Toolpaths API Sample Demonstrates generating the toolpaths in the active document.
Manufacturing Workflow API Sample Manufacturing Workflow API Sample

This sample script starts by creating a simple component which is then used to describe a milling workflow. It creates a setup, a few operations, pick some tools from a Fusion sample tool library using loops and queries and ends up post-processing the operations out using an NC Program.

New CAM Operation API Sample Demonstrates adding a new toolpath into the document using an existing CAM template. You can get a sample template here. To use the sample, create a new design and add a block. Switch to the MANUFACTURE workspace and create a setup. Run the script and it will create a new facing operation in the setup.
Post Toolpaths API Sample Demonstrates posting toolpaths in the active document.

Version

Introduced in version January 2016