26 May, 2019

## Deploying Automation

CATIA provides two methods to deploy automation written in EKL to end users; enabling organizations to streamline tools for maximum impact. Let’s take this EKl action as an example:

### Assign Color Based On Attribute Example

I previously posted on how to assign different colors to physical products. Today I’ll show a variant of that post.

The code below will look up all ProductOccurrences in an Editor, and assign a color to those whose V_description attribute is empty or filled, set by a boolean.

//get  the root
let root(ProductOccurrence)
root = GetEditorRootOccurrences("ProductOccurrence").GetItem(1)

//get the Occurrences whose type is Part and whose disciplines "AecWall"
let occs(List)
let predicate1(String)
predicate1= DescriptionFilled? "(x.Reference:VPMReference).V_description.Length()<>0"; "(x.Reference:VPMReference).V_description.Length()==0"

occs = root.Query("ProductOccurrence", predicate1)
//set the color
occs.Apply("ProductOccurrence", "x.SetAttributeString(\"Color\", \""+ColorName+"\")")



Running the action above will yield the following results:

##### Embedding Options In Actions

We can embed choices so that the end user may select from a dropdown menu.

### Deploying Through Catalogs

Catalogs are a type of a PLMEntity that can hold references to elements: Features, VPMReferences, Engineering Templates, etc. They allow for recalling elements from a single place. Note that this is different from CATIA V5’s Catalogs–called Component Families in 3DExperience.

##### Recalling A Catalog

Reusing the catalog is easily done by recalling it either by searching and opening it, or by adding it to the “My Favorites” list.

### Deploying Through Data Setup

The next method makes use of the Administrator role, and can be only done by accessing the Default collaborative space.

Add a knowledge resource table, then add the action, and finally bind the table to the space you want. The table you bind to a space will be available only to that space. Except if you bind it to the Corporate space, it willl be available to all other spaces on your tenant. Note that it is necessary to assign a command name to the action-resource.

##### Adding A Tool Command In The UI

Restart CATIA into a production workspace, for exampleCommon Space, and navigate to the Customize command and add a UI icon as shown below:

##### Deploying To Multiple Users

Once the action is added to DataSetup and a UI icon is created, you’ll notice that your CATSettings have been updated. The updated settings hold information about the toolbar changes you just made. To deploy to other users, you’ll need to push those CATSettings from your machine to users directories where their CATIA Environment files point to. This depends on your organization’s installation. Alternatively, you can push the settings files to a shared directory, and make sure that users Environment files point to it. The Environment variable that defines where CATIA’s settings are picked from is CATUserSettingPath. Note that changing these settings will cause users to lose their existing custom-shortcuts and settings.

### Source File

You can find the file containing the above script at the blog’s repo

Hits: 224

Tags: , ,

Maher Elkhaldi is a senior applications engineer at Tesla Motors. He founded the 3DXAutomation blog to help make knowledge of programming CATIA easier to find, and contribute to the open-source community.

This site uses Akismet to reduce spam. Learn how your comment data is processed.