Using The Get... Commands

The commands described in this section are the ones you can access when using the Loop  Editor and right-clicking in the Editor window. 

When creating a loop containing the path of a feature contained in the specification tree, it is highly recommended to use the Get Feature command to retrieve the internal name of this feature.
 

The 'Get Axis' Command   

This task explains how to create a chamfer by using the Get Axis command. This command enables you to interactively capture the generic name of an axis and to insert it into the script instead of keying it in.
ascenari.gif (1364 bytes)
  1. Click the Loop icon () and enter 1 in the To field.

  2. In the Script Editor, enter the following script and click OK. A pad is created.

    myChamferDocument isa CATPart
    {
             myPart isa Part
             {
                        PartBody isa BodyFeature
                        {
                                 P isa Pad
                                 {
                                 }

                        }
             }
    }

  3. From the Window menu, select Cascade.

  4. Under the P isa Pad block, add F isa Chamfer(){}, position the cursor between the parenthesis, then right-click and select Get Axis, and select an edge in your geometrical surface. The script must be as follows: 

    myChamferDocument isa CATPart
    {
             myPart isa Part
             {
                        PartBody isa BodyFeature
                        {
                              P isa Pad
                              { 
                              }
                              F isa Chamfer("Edge:(Face:(Brp:(P;0:(Brp:(Sketch.1;2)));
                              None:());Face:(Brp:(P;0:(Brp:(Sketch.1;3)));None:());
                              None:(Limits1:();Limits2:()))"){}
                        }
              }

    }

  5. Click OK. The chamfer is created.

The "Get Edge" Command  

This task explains how to create a chamfer by using the Get Edge command. This command enables you to interactively capture the generic name of an edge and to insert it into the script instead of keying it in. 
ascenari.gif (1364 bytes)
  1. Click the Loop icon () and enter 1 in the To field.

  2. In the Script Editor, enter the following script and click OK. A pad is created.

    myChamferDocument isa CATPart
    {
             myPart isa Part
             {
                        PartBody isa BodyFeature
                        {
                                 P isa Pad
                                 {
                                 }

                        }
             }
    }
  3. Under the P isa Pad block, add F isa Chamfer(){}, position the cursor between the parenthesis, then right-click and select Get Edge, and select an edge in your geometrical surface. The script must be as follows: 

    myChamferDocument isa CATPart
    {
             myPart isa Part
             {
                        PartBody isa BodyFeature
                        {
                            P isa Pad
                            { }
                            F isa Chamfer("Edge:(Face:(Brp:(P;0:(Brp:(Sketch.1;2)));
                            None:());Face:(Brp:(P;2);None:());None:(Limits1:();Limits2:()))"){}
                        }
             }
    }
  4. Click Generate. The chamfer is created.

The "Get Surface" Command   

This task explains how to create a sketch on an existing face by using The Get Surface command. This command enables you to interactively capture the generic name of a surface and to insert it into the script instead of keying it in. 
ascenari.gif (1364 bytes)
  1. Open the KwrGetSurface.CATPart file.

  2. Access the Knowledge Advisor workbench, and click the Loop icon. Enter 1 in the To field

  3. Enter the following script:

    import "f:\cube.CATPart";
    myFaceDocument isa CATPart
    {
             myPart isa Part
             {
                     PartBody isa BodyFeature
                     {
                     P isa Pad{}
                     S isa Sketch.1()
  4. Position the cursor between the two parentheses of the last line of the above script, right-click and select Get Surface.

  5. Select the face whose name you want to capture. The full name is inserted at the cursor location. Enter the end of your script. In our example, the final script is as follows: 

    import "f:\PktGetSurface.CATPart";
    myFaceDocument isa CATPart
    {
             myPart isa Part
             {
                  PartBody isa BodyFeature
                  {
                  P isa Pad{}
                  S isa Sketch.1("Face:(Brp:(P;0:(Brp:(Sketch.1;2)));None:())")
                  {
                  }
                  }
             }
    }

The "Get Feature" Command    

This task explains how to use the Get Feature command. This command enables you to interactively capture the generic name of a surface and to insert it into the script instead of keying it in. In the task below, you are going to generate a line.
ascenari.gif (1364 bytes)
  1. Open the KwrGetFeature.CATPart file.

  2. Double-click the loop located below the Relations node and insert the following code into the editor:

    Line_Pt_Pt isa GSMLine
    {
    LineType = 0;
    TypeObject isa GSMLinePtPt
    {
    FirstPoint = object: // Using GetFeature to Select the FirstPoint (Point.10)
    SecondPoint = object: // Using GetFeature to Select the SecondPoint (Point.7)
    }
    }

     

  3. Position the cursor after FirstPoint = object:, right-click and select Get Feature.

  4. Click a point in the geometry (Point.10 for example) and add a semi-colon (;) at the end of the line.

  5. Position the cursor after SecondPoint = object: right-click and select Get Feature.

  6. Click another point in the geometry (Point.7 for example) and add a semi-colon (;) at the end of the line. Your script now looks like the one below:

  7. Click OK. A new line is generated.

  8.  

The 'Insert File Path' Command  

This task explains how to use the Insert File Path command. This command is one of the methods you can use to specify a path in a script. 

When writing a script, you have to specify a file path when you import a file, see the import keyword.

ascenari.gif (1364 bytes)
  1. Access the Script Editor and enter any instruction requiring a file path specification (import in the example below).

  2. Position the cursor where the path is to be specified.

  3. Right-click and select Insert File Path.

  4. In the dialog box which is displayed, select the appropriate file. Click Open to go back to the script editor.

  5. The full path is inserted at the cursor place.  Check that the statement is ended by a semi-colon.