Creation of Custom Quality Control Actions

Предыдущая страницаВ началоСледующая страница

You can create custom quality control actions, using the example supplied with T-FLEX CAD. Open the ...T-FLEX Parametric CAD 17\API\QualityManagementSample\QualityManagementSample.sln solution in Microsoft Visual Studio and save it as a project template (Project > Export Template). Then create a new project from this template.

It is recommended to install the .NET desktop development workload for Microsoft Visual Studio, when working with projects of custom quality control actions.

The logic of the example action is defined in the SampleLogic.cs C# source file using T-FLEX CAD Open API. You can define logic of your action in the same file or add new one.

The example contains only one action, but you can include multiple action into the same source file. Each action is created as a derived class from the LogicBase class of the T-FLEX CAD Open API as shown below:

public class SampleLayerNamesLogic : LogicBase

You should specify following elements for a new action logic:

Unique identifier.
Generate a GUID via third-party tools and use it for overriding the get method of the Uid property as shown below:

public override Guid Uid => new System.Guid("07bc3705-0bc8-4833-b515-2cc8fb1eaa06");

Action information
Textual information to be displayed in T-FLEX CAD for the action is defined by overriding the ActionInfo GetActionInfo(GetActionInfoContext context) method as shown below. Here you can also add tags to be used for grouping actions in the quality control window. The 2D/3D tag is assigned to the example action. You can assign any other tag in the same way.

public override ActionInfo GetActionInfo(GetActionInfoContext context)

{

var res = new ActionInfo()

{

LogicUid = Uid,

Group = "Examples",

Name = "Custom Layer Names Check Action",

Description = "Example of a custom check stored in a separate library (dll)",

};

res.AddTag("2D/3D");

return res;

}

Action information may also be accessed in RunContext and FixContext classes.

Operations performed by the system, when running the check.
Check operations are defined by overriding the RunResult Run(RunContext context) method.

Operations performed by the system, when calling the Fix command for a check result, can be defined by overriding the FixResult Fix(FixContext context, FixTask task) method. If you don't override this method, the automatic fixing of detected errors won't be available for this action.

More information is available in the T-FLEX CAD Open API help system, which can be invoked from the Help section of the textual menu or from the help menu.

General information about project can be edited in the AssemblyInfo.cs source file, if necessary.

 

Upon finishing the work with the project, save it and build the solution. In result the dll-file of the custom library will appear within the folder specified when creating the project. Its exact location within the project folder depends on the selected configuration (default location is \bin\Debug). You can copy it to any other location, if necessary.

Then use Visual Studio or any text editor for editing the quality control script, where you want to include the created actions. Add the module of the created dll-library into the <Modules> group. Add the actions themselves into the <Actions> group. Add tags, attributes and customizable parameters, if necessary.

The detailed information on the structure of quality control scripts can be found in the Quality Control Scripts section.

Save the quality control script after editing.

Upon opening the script in T-FLEX CAD, new actions will be available in the Quality Control window.