Script Editing - Tutorial 2 - Helix Pocket

In this tutorial we are going to create a simple machining operation.

1) This is the script function to copy :

public void Helix()
{
    //Get selected geometries in viewport
    var geometries = GetSelectedGeometries();

    //Create a pocket machining
    var pocket = AddMachineWork(WorkType.Mill_Pocket);

    //Define custom properties
    pocket.MillingParams.RoughingOp_HelixOnCircleGeometry = true;
    pocket.MillingParams.DepthMachining = 10;

    //Create the roughing operation
    pocket.AddSubOperation(SubOperationType.Roughing);

    //Link selected geometries with this operation
    LinkGeometryToWork(pocket, geometries);
}

2) Draw some circle on scene and select them

3) Call "helix" method

4) A pocket machining with a roughing operation will be created .

In this script example we have :

  • Picked current selected geometry
  • Create a pocket machining
  • Setted some machining parameter
  • Created the roughing sub operation
  • Linked the geometries with the pocket machining.

Search tool by diameter

Now i want associate a tool to the roughing operation . looking from existing tools.

The complete code will become :

public void Helix()
{
    //Get selected geometries in viewport
    var geometries = GetSelectedGeometries();

    //Create a pocket machining
    var pocket = AddMachineWork(WorkType.Mill_Pocket);

    //Define custom properties
    pocket.MillingParams.RoughingOp_HelixOnCircleGeometry = true;
    pocket.MillingParams.DepthMachining = 10;

    //Create the roughing operation
    var roughOp = pocket.AddSubOperation(SubOperationType.Roughing);

    //Search from rotary tool , filter for EndMill type, and with a diameter closest to 10mm
    roughOp.Tool = FindRotaryTool(ToolType.MillType_EndMill,10);

    //Link selected geometries with this operation
    LinkGeometryToWork(pocket, geometries);
}

I added these couple of lines.

    //Create the roughing operation
    var roughOp = pocket.AddSubOperation(SubOperationType.Roughing);

    //Search from rotary tool , filter for EndMill type, and with a diameter closest to 10mm
    roughOp.Tool = FindRotaryTool(ToolType.MillType_EndMill,10);

The FindRotaryTool is a function useful to search in tools library.

It search through rotary tools ( endmill, drill, tap , reamer , etc .. ) and filter them with ToolType.MillType_EndMill enum.

From filtered tools it return the endmill with a diameter closest to the passed parameter , 10mm in this case.

Additionally is possible filter the tool list, by tool description , for example:

roughOp.Tool = FindRotaryTool(ToolType.MillType_EndMill,10,"R390");

In this case it will return only the tool with string " _R390 " _in tool description.

results matching ""

    No results matching ""