Geometric Modeler

Topology

How to Thread a Rod

Combining sweep and boolean operations to create a threading operator
Use Case

Abstract

The CAAAdtThreadOpMain use case provides you with a way to create an operator that threads a rod. To achieve the threading, an appropriate profile is swept along an helix, then after being closed, the resulting body is removed from the rod to be threaded.  The operations illustrated in this use case are: the creation of a sweep, the closing of a surface and the union boolean operation. 


What You Will Learn With This Use Case

In this use case, you learn how to create a sweep, close it and remove the resulting body from the rod to be threaded. You also learn the basics about how to create a user operator.

[Top]

The CAAAdtThreadOpMain and CAAAdtThreadUtility Use Cases

CAAAdtThreadOpMain and CAAAdtThreadUtility are use cases of the CAAAdvancedTopologicalOperators.edu framework that illustrate the CAAAdvancedTopologicalOperators framework capabilities.

[Top]

What Do CAAAdtThreadOpMain and CAAAdtThreadUtility Do?

The CAAAdtThreadUtility use case defines the CAAAdtThread operator. Like any other operator, it must specify
  • a constructor as well as a destructor
  • a Run method
  • a GetResult method.

In addition, two global functions which are discussed later on are defined in the CAAAdtThreadUtility use case.

The CAAAdtThreadOpMain use case contains the main program that creates the cylinder to be threaded and call the CAAAdtThread operator.

This is the solid you obtain when you execute the CAAAdtThreadOpMain use case.

[Top]

How to Launch CAAAdtThreadOpMain

You must compile CAAAdtThreadUtility prior to launching CAAAdtThreadOpMain.  CAAAdtThreadOpMain requires CAAAdtThreadUtility as a module to be linked with in its Imakefile.mk file.

To launch CAAAdtThreadOpMain, you will need to set up the build time environment, then compile CAAAdtThreadOpMain.m, set up the run time environment, and then execute the use case [1].

If you simply type CAAAdtThreadOpMain with no argument, the use case executes, but doesn't save the result in an NCGM file. If you want to save this result, provide the full pathname of the NCGM file to create. For example:

With Windows CAAAdtThreadOpMain e:\thread.NCGM

With UNIX CAAAdtThreadOpMain /u/thread.NCGM

This NCGM file can be displayed using the CAAGemBrowser use case.

 

[Top]

Where to Find the CAAAdtThreadOpMain and CAAAdtThreadUtility Code

The CAAAdtThreadOpMain use case is made of a main named CAAAdtCreateThread .cpp located in the CAAAdtThreadOpMain.m module of the CAAAdvancedTopologicalOperators.edu framework:

Windows InstallRootDirectory\CAAAdvancedTopologicalOperators.edu\CAAAdtThreadOpMain .m\
Unix InstallRootDirectory/CAAAdvancedTopologicalOperators.edu/CAAAdtThreadOpMain .m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

This use case uses the CAAAdtThread class which is defined in the CAAAdtThreadUtility.m module.

[Top]

Step-by-Step

The CAAAdtThreadOpMain use case is divided into the following main steps:

[Top]

The Methodology

At first sight, the methodology to thread is rod would consist in removing a single triangular sweep from the cylindrical rod as indicated below:

Step 1
Creating a cylindrical rod
Step 2
Sweeping a triangular profile
along an helix
Step 3
Boolean remove

However, a usual source of problems when performing boolean operations is tangent or near-tangent surfaces. In the sequence of operations above, removing the sweep from the rod would result in a crash because the cylindrical surfaces of  both operands are coincident. This problem can be worked around by creating extensions so that the sweep to be substracted out has a diameter  slightly larger that the rod diameter. Another source of problem is when one operand auto-intersects. If we make the sweep jut out from the rod, unless the sweep auto-intersects, parasite cylindrical faces will be generated in place of the outer edge of the thread. This is not what we want to obtain.

To get over these two restrictions, we decided to proceed in two phases:

Phase 1: a first sweep is created. The profile for this first sweep is a rectangular triangle as described below. This sweep is removed from the rod.

Phase 1 (a)
Initial  rod
Phase 1 (b)
First sweep
Phase 1 (c)
First Boolean remove

Phase 2: a second sweep is created. A symetrical profile is used for this second sweep. This second sweep is removed from the solid resulting from the first boolean remove.

Phase 2 (a)
Intermediary solid
Phase 2 (b)
Second sweep
Phase 2 (c)
Second Boolean remove

Creating the Sweeps

The sweeps are created in the CAASweepCreate function. The CATFrFTopologicalSweep operator is created by the CATCreateFrFTopologicalSweep global function requires a guide and a profile as arguments.

// a - Create the sweep operator
//
CATFrFTopologicalSweep * pSweepOperator = CATCreateFrFTopologicalSweep(
        myFactory,
        myTopdata,
        iHelix,     //  guide
        iSection);  //  profile
  

Other parameters are tuned by using the Setxxx methods.

Specifying the Guide

The guide is an helix which is created by the CATCreateTopHelix global function.

// b - Helix creation
//
CATBody* piHelix = CATCreateTopHelix(
        _factory,
        _topData,
        piHelixAxis,                     // axis
        1,                               // orientation
        piBPOrigin,                      // origin
        CATAngle (0),                    // start angle
        CATAngle (helixAngleInt*CATPI),  // end angle 
        CATLength (pitch),               // pitch
        1);                              // orientation of the rotation about the axis
  

The helix parameters are:

Specifying the Profile

The profiles are defined in the CAASweepProfile function. They are originally created in the XOY plane but their positioning is moved to the beginning of the helix.

CATMathAxis Ref; // the canonical math axis
pSweepOperator->SetProfilePositionType(1);
pSweepOperator->SetProfilePosition(&Ref); // set profile axis system
  

[Top]

Specifying the reference element

In order to avoid a twisted sweep, the XOY plane must be specified as the reference element.

    [Top]


In Short

When writing an operator such as CAAAdtThread, the steps requiring attention are:

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[2] Overview of the Topological Operators
[Top]

History

Version: 1 [March 2002] Document created
[Top]

Copyright © 2002, Dassault Systèmes. All rights reserved.