Back to index

salome-geom  6.5.0
Defines | Functions
GEOMImpl_IAdvancedOperations.cxx File Reference
#include <Standard_Stream.hxx>
#include "GEOMImpl_Types.hxx"
#include "GEOMImpl_IAdvancedOperations.hxx"
#include "GEOMImpl_IBasicOperations.hxx"
#include "GEOMImpl_IBooleanOperations.hxx"
#include "GEOMImpl_IShapesOperations.hxx"
#include "GEOMImpl_ITransformOperations.hxx"
#include "GEOMImpl_IBlocksOperations.hxx"
#include "GEOMImpl_I3DPrimOperations.hxx"
#include "GEOMImpl_ILocalOperations.hxx"
#include "GEOMImpl_IHealingOperations.hxx"
#include "GEOMImpl_Gen.hxx"
#include <Basics_OCCTVersion.hxx>
#include <utilities.h>
#include <OpUtil.hxx>
#include <Utils_ExceptHandlers.hxx>
#include "GEOM_Function.hxx"
#include "GEOM_PythonDump.hxx"
#include "GEOMImpl_PipeTShapeDriver.hxx"
#include "GEOMImpl_IPipeTShape.hxx"
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Ax3.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Tool.hxx>
#include <cmath>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>

Go to the source code of this file.

Defines

#define HALF_LENGTH_MAIN_PIPE   "Main pipe half length"
#define HALF_LENGTH_INCIDENT_PIPE   "Incident pipe half length"
#define CIRCULAR_QUARTER_PIPE   "Circular quarter of pipe"
#define THICKNESS   "Thickness"
#define FLANGE   "Flange"
#define CHAMFER_OR_FILLET   "Chamfer or fillet"
#define JUNCTION_FACE_1   "Junction 1"
#define JUNCTION_FACE_2   "Junction 2"
#define JUNCTION_FACE_3   "Junction 3"

Functions

 Handle (TColStd_HSequenceOfTransient) GEOMImpl_IAdvancedOperations
 MakePipeTShape.

Define Documentation

#define CHAMFER_OR_FILLET   "Chamfer or fillet"

Definition at line 75 of file GEOMImpl_IAdvancedOperations.cxx.

#define CIRCULAR_QUARTER_PIPE   "Circular quarter of pipe"

Definition at line 72 of file GEOMImpl_IAdvancedOperations.cxx.

#define FLANGE   "Flange"

Definition at line 74 of file GEOMImpl_IAdvancedOperations.cxx.

#define HALF_LENGTH_INCIDENT_PIPE   "Incident pipe half length"

Definition at line 71 of file GEOMImpl_IAdvancedOperations.cxx.

#define HALF_LENGTH_MAIN_PIPE   "Main pipe half length"

Definition at line 70 of file GEOMImpl_IAdvancedOperations.cxx.

#define JUNCTION_FACE_1   "Junction 1"

Definition at line 76 of file GEOMImpl_IAdvancedOperations.cxx.

#define JUNCTION_FACE_2   "Junction 2"

Definition at line 77 of file GEOMImpl_IAdvancedOperations.cxx.

#define JUNCTION_FACE_3   "Junction 3"

Definition at line 78 of file GEOMImpl_IAdvancedOperations.cxx.

#define THICKNESS   "Thickness"

Definition at line 73 of file GEOMImpl_IAdvancedOperations.cxx.


Function Documentation

Handle ( TColStd_HSequenceOfTransient  )

MakePipeTShape.

MakePipeTShapeFilletWithPosition.

MakePipeTShapeFillet Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length).

MakePipeTShapeChamferWithPosition Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length).

MakePipeTShapeChamfer Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length).

MakePipeTShapeWithPosition Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length).

Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length). Center of the shape is (0,0,0). The main plane of the T-shape is XOY.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theHexMeshBoolean indicating if shape is prepared for hex mesh
Returns:
List of GEOM_Objects, containing the created shape and propagation groups.

The extremities of the main pipe are located on junctions points P1 and P2. The extremity of the incident pipe is located on junction point P3.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theHexMeshBoolean indicating if shape is prepared for hex mesh
theP11st junction point of main pipe
theP22nd junction point of main pipe
theP3Junction point of incident pipe
Returns:
List of GEOM_Objects, containing the created shape and propagation groups..

A chamfer is created on the junction of the pipes. Center of the shape is (0,0,0). The main plane of the T-shape is XOY.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theHHeight of chamfer.
theWWidth of chamfer.
theHexMeshBoolean indicating if shape is prepared for hex mesh
Returns:
List of GEOM_Objects, containing the created shape and propagation groups.

A chamfer is created on the junction of the pipes. The extremities of the main pipe are located on junctions points P1 and P2. The extremity of the incident pipe is located on junction point P3.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theHHeight of chamfer.
theWWidth of chamfer.
theHexMeshBoolean indicating if shape is prepared for hex mesh
theP11st junction point of main pipe
theP22nd junction point of main pipe
theP3Junction point of incident pipe
Returns:
List of GEOM_Objects, containing the created shape and propagation groups.

A fillet is created on the junction of the pipes. Center of the shape is (0,0,0). The main plane of the T-shape is XOY.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theRFRadius of curvature of fillet.
theHexMeshBoolean indicating if shape is prepared for hex mesh
Returns:
List of GEOM_Objects, containing the created shape and propagation groups.

Create a T-shape object with specified caracteristics for the main and the incident pipes (radius, width, half-length). A fillet is created on the junction of the pipes. The extremities of the main pipe are located on junctions points P1 and P2. The extremity of the incident pipe is located on junction point P3.

Parameters:
theR1Internal radius of main pipe
theW1Width of main pipe
theL1Half-length of main pipe
theR2Internal radius of incident pipe (R2 < R1)
theW2Width of incident pipe (R2+W2 < R1+W1)
theL2Half-length of incident pipe
theRFRadius of curvature of fillet
theHexMeshBoolean indicating if shape is prepared for hex mesh
theP11st junction point of main pipe
theP22nd junction point of main pipe
theP3Junction point of incident pipe
Returns:
List of GEOM_Objects, containing the created shape and propagation groups.

Definition at line 1167 of file GEOMImpl_IAdvancedOperations.cxx.

{
  MESSAGE("GEOMImpl_IAdvancedOperations::MakePipeTShape");
  SetErrorCode(KO);
  //Add a new object
  Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);

  //Add a new shape function with parameters
  Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
  if (aFunction.IsNull()) return NULL;

  //Check if the function is set correctly
  if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;

  GEOMImpl_IPipeTShape aData(aFunction);

  aData.SetR1(theR1);
  aData.SetW1(theW1);
  aData.SetL1(theL1);
  aData.SetR2(theR2);
  aData.SetW2(theW2);
  aData.SetL2(theL2);
  aData.SetHexMesh(theHexMesh);

  //Compute the resulting value
  try {
#if OCC_VERSION_LARGE > 0x06010000
    OCC_CATCH_SIGNALS;
#endif
    if (!GetSolver()->ComputeFunction(aFunction)) {
      SetErrorCode("TShape driver failed");
      return NULL;
    }
    if (theHexMesh) {
      if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
        return NULL;
      if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
        return NULL;
    }
  } catch (Standard_Failure) {
    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
    SetErrorCode(aFail->GetMessageString());
    return NULL;
  }


  Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
  aSeq->Append(aShape);

  if (theHexMesh) {
    /*
     * Get the groups: BEGIN
     */
    try {
      if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf()))
        return NULL;
    }
    catch (Standard_Failure) {
      Handle(Standard_Failure) aFail = Standard_Failure::Caught();
      SetErrorCode(aFail->GetMessageString());
      return NULL;
    }

    TCollection_AsciiString aListRes, anEntry;
    // Iterate over the sequence aSeq
    Standard_Integer aNbGroups = aSeq->Length();
    Standard_Integer i = 2;
    for (; i <= aNbGroups; i++) {
      Handle(Standard_Transient) anItem = aSeq->Value(i);
      if (anItem.IsNull()) continue;
      Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(anItem);
      if (aGroup.IsNull()) continue;
      //Make a Python command
      TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
      aListRes += anEntry + ", ";
    }

    aListRes.Trunc(aListRes.Length() - 2);

    //Make a Python command
    GEOM::TPythonDump(aFunction)
      << "[" << aShape << ", " << aListRes.ToCString() << "] = geompy.MakePipeTShape("
      << theR1 << ", " << theW1 << ", " << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", "
      << theHexMesh << ")";
  }
  /*
   * Get the groups: END
   */
  else {
    //Make a Python command
    GEOM::TPythonDump(aFunction)
      << "[" << aShape << "] = geompy.MakePipeTShape(" << theR1 << ", " << theW1 << ", "
      << theL1 << ", " << theR2 << ", " << theW2 << ", " << theL2 << ", " << theHexMesh << ")";
  }

  SetErrorCode(OK);

  return aSeq;
}

Here is the call graph for this function: