![]() ![]() ![]() The Setups collection provides access to all of the existing setups in a document. As seen in the previous object model, you can access a Setups collection object directly from the CAM object. Setups define a coordinate system and various other settings that all of the operations owned by the setup use. # Get the operation named "2D Adaptive1" within the folder. # Get the folder named "Folder1" within this setup.įolder = ('Folder1') # Get the Setups collection of all setups in the document. However, it can be very useful to use the itemByName method instead to get a specific setup, operation, or folder using its name, as illustrated below. The code above uses the item method to get a setup, operation, and folder and specifies an index of 0 to get the first item in each collection. # Get the first operation from the folder. # Get the Operations collection object from the folder. # Get the first folder in the collection. # Get the Folders collection object that contains all the folders in the setup. # Get the first operation in the collection. # Get the Operations collection object that contains all the operations in the setup. # Get the first Setup object in the CAM product. # Get the Setups collection object from the CAM object. Below is a Python code snippet that shows how to access the first setup, and the first operation and folder in the setup, assuming a document like that shown above is being used. Using the API, you navigate a similar structure to what you see in the browser to access a specific CAM object. This diagram illustrates the relationships between objects and how you traverse the object model to get a particular type of object. The diagram below illustrates a simplified view of the object model for the CAM object. Once you have a reference to the CAM object, you can traverse the object model to access the specific object you need. For example, if the Manufacture workspace has never been activated, the document will not have a CAM product. Products for data types other than Design only exist in a document if the user has explicitly created data of that type. Ui.messageBox('The Manufacturing workspace must be active') # Get the application and userInterfaceĬam = (app.activeProduct) The sample also shows how you can use this to determine if the Manfufacturing workspace is active. If the Manufacturing workspace is active, the CAM product will be the “active” product and can be obtained using the Application.activeProduct property, as shown below. Ui.messageBox('There is no CAM data in the active document') # From the Products collection on the active document, get the CAM Product.Ĭam: = ('CAMProductType') The example below demonstrates getting the CAM product, if it exists, from the active document. When you need to access data using the API, you first need to access the product that contains that data. For example, when you enter the CAM workspace in the user interface, a CAM product is added to the document, and all CAM-related data is contained within it. All documents always contain a Design product and may include other types of products depending on what has been created in the document. For example, a Design product contains all the design-related data. There are different types of products depending on the type of data they contain. The top-level containers are referred to as products. If you use the “Create” command from the Scripts and Addins Manager in Fusion 360 to create a new C++ script or add-in, the resulting cpp file contains the #include and using statements referencing the cam namespace and header file.Īccessing the CAM Product within a Fusion 360 DocumentĪ Fusion 360 document acts as a container of different types of data. Import re, adsk.fusion, adsk.cam, traceback If you use the “Create” command in the “Scripts and Addins” dialog to create a new Python script or add-in, you’ll see the line below where adsk.cam is already imported. ![]() Import adsk.cam into your script or add-in. The CAM functionality is defined in the adsk.cam library and is referenced into your program using the techniques shown below. If you’ve used the API to automate the Design portion of Fusion, you’ve used the re and asdk.fusion libraries. The CAM API functionality is provided through CAM-specific libraries. The Fusion 360 CAM API has been designed and developed to provide a high level of automation within the manufacture space. Introduction to the CAM API Introduction to the CAM API Introduction to the CAM API CAM Object Model Basics Understanding Setups Understanding Operations Introduction to the CAM API
0 Comments
Leave a Reply. |