SET(GEOM_CXXFLAGS -I${GEOM_ROOT_DIR}/include/salome)
+FIND_LIBRARY(AdvancedEngine AdvancedEngine ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(AdvancedGUI AdvancedGUI ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(BasicGUI BasicGUI ${GEOM_ROOT_DIR}/lib/salome)
FIND_LIBRARY(BlocksGUI BlocksGUI ${GEOM_ROOT_DIR}/lib/salome)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-import os
+import os, sys
from salome_utils import getTmpDir, generateFileName, uniteFiles
-from setenv import salome_subdir
+from setenv import add_path, get_lib_dir, salome_subdir
# -----------------------------------------------------------------------------
def set_env( args ):
"""Add to the PATH-variables modules specific paths"""
+ psep = os.pathsep
+ python_version="python%d.%d" % sys.version_info[0:2]
tmp_dir = getTmpDir()
env_dir = generateFileName( tmp_dir, prefix="env", with_port=True )
pass
pass
+ # find plugins
+ plugin_list = []
+ resource_path_list = []
+ for env_var in os.environ.keys():
+ value = os.environ[env_var]
+ if env_var[-9:] == "_ROOT_DIR" and value:
+ plugin_root = value
+ plugin = env_var[:-9] # plugin name may have wrong case
+
+ # look for NAMEOFPlugin.xml file among resource files
+ resource_dir = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
+ if not os.access( resource_dir, os.F_OK ): continue
+ for resource_file in os.listdir( resource_dir ):
+ if not resource_file.endswith( ".xml") or \
+ resource_file.lower() != plugin.lower() + ".xml":
+ continue
+ # use "name" attribute of "geom-plugin" as name of plugin in a right case
+ from xml.dom.minidom import parse
+ xml_doc = parse( os.path.join( resource_dir, resource_file ))
+ plugin_nodes = xml_doc.getElementsByTagName("geom-plugin")
+ if not plugin_nodes or not plugin_nodes[0].hasAttribute("name"): continue
+ plugin = plugin_nodes[0].getAttribute("name")
+ if plugin in plugin_list: continue
+
+ # add paths of plugin
+ plugin_list.append(plugin)
+ if not os.environ.has_key("SALOME_"+plugin+"Resources"):
+ resource_path = os.path.join(plugin_root,"share",salome_subdir,"resources",plugin.lower())
+ os.environ["SALOME_"+plugin+"Resources"] = resource_path
+ resource_path_list.append( resource_path )
+ add_path(os.path.join(plugin_root,get_lib_dir(),python_version, "site-packages",salome_subdir), "PYTHONPATH")
+ add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PYTHONPATH")
+
+ if sys.platform == "win32":
+ add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "PATH")
+ add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
+ else:
+ add_path(os.path.join(plugin_root,get_lib_dir(),salome_subdir), "LD_LIBRARY_PATH")
+ add_path(os.path.join(plugin_root,"bin",salome_subdir), "PYTHONPATH")
+ add_path(os.path.join(plugin_root,"bin",salome_subdir), "PATH")
+ pass
+ pass
+ break
+ plugin_list.append("GEOMActions")
+ os.environ["GEOM_PluginsList"] = ":".join(plugin_list)
+ os.environ["SalomeAppConfig"] = os.environ["SalomeAppConfig"] + psep + psep.join(resource_path_list)
doc/salome/tui/static/header.html \
src/Makefile \
src/AdvancedGUI/Makefile \
+ src/AdvancedEngine/Makefile \
src/ARCHIMEDE/Makefile \
src/BREPExport/Makefile \
src/BREPImport/Makefile \
in boolean theInheritFirstArg,
in boolean theAddPrefix);
- // # Methods to access interfaces for objects creation and transformation
-
+ // # Methods to access interfaces for objects creation and transformation
+
GEOM_IBasicOperations GetIBasicOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
GEOM_ITransformOperations GetITransformOperations(in long theStudyID) raises (SALOME::SALOME_Exception);
GEOM_I3DPrimOperations GetI3DPrimOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
GEOM_IMeasureOperations GetIMeasureOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
GEOM_IBlocksOperations GetIBlocksOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
GEOM_IGroupOperations GetIGroupOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
- GEOM_IAdvancedOperations GetIAdvancedOperations (in long theStudyID) raises (SALOME::SALOME_Exception);
- // # Objects Management
-
+ GEOM_IOperations GetPluginOperations (in long theStudyID,
+ in string theLibName) raises (SALOME::SALOME_Exception);
+
+ // # Objects Management
+
/*!
* \brief Removes the object from the GEOM component
--- /dev/null
+<?xml version='1.0' encoding='us-ascii'?>
+<!DOCTYPE meshers PUBLIC "" "desktop.dtd">
+<!--
+ Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+
+ Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+ CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+-->
+
+<!-- GUI customization for GEOM component -->
+
+<geom-plugins>
+
+ <geom-plugin name="AdvancedGUI"
+ server-lib="AdvancedEngine"
+ gui-lib="AdvancedGUI">
+ <actions>
+ <action label="TShape_Basic"
+ icon="pipetshape.png"
+ menu="NEW_ENTITY/PRIMITIVES/PIPETSHAPE"
+ tooltip="PRIMITIVES/PIPETSHAPE"
+ status-bar="Create new Pipe TShape object">
+ </action>
+ <action label="DividedDisk"
+ icon="divided_disk.png"
+ menu="NEW_ENTITY/BLOCKS/DIVIDEDDISK"
+ tooltip="BLOCKS/DIVIDEDDISK"
+ status-bar="Divided Disk">
+ </action>
+ <action label="DividedCylinder"
+ icon="dividedcylinder.png"
+ menu="NEW_ENTITY/BLOCKS/DIVIDEDCYLINDER"
+ tooltip="BLOCKS/DIVIDEDCYLINDER"
+ status-bar="Divided Cylinder">
+ </action>
+ <action label="SmoothingSurface"
+ icon="smoothingsurface.png"
+ menu="NEW_ENTITY/ADVANCED/SMOOTHINGSURFACE"
+ tooltip="ADVANCED/SMOOTHINGSURFACE"
+ status-bar="Smoothing Surface">
+ </action>
+ </actions>
+ </geom-plugin>
+
+</geom-plugins>
include $(top_srcdir)/adm_local/unix/make_common_starter.am
dist_salomeres_DATA = \
+GEOMActions.xml \
GEOM_en.xml \
GEOM_fr.xml \
GEOM.config \
<section name="resources">
<!-- Module resources -->
<parameter name="GEOM" value="%GEOM_ROOT_DIR%/share/salome/resources/geom"/>
+ <parameter name="AdvancedGUI" value="%GEOM_ROOT_DIR%/share/salome/resources/geom"/>
</section>
<section name="Geometry" >
<!-- Other module preferences -->
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "GEOM_AdvancedEngine.hxx"
+
+#include "AdvancedEngine_OperationsCreator.hh"
+
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+
+extern "C"
+{
+ADVANCEDENGINE_EXPORT
+ GEOM_GenericOperationsCreator* GetOperationsCreator()
+ {
+ //MESSAGE("GetOperationsCreator");
+
+ AdvancedEngine_OperationsCreator* aCreator = new AdvancedEngine_OperationsCreator();
+
+ return aCreator;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include "GEOM_AdvancedEngine.hxx"
+
+#include "AdvancedEngine_OperationsCreator.hh"
+
+#include "GEOM_IAdvancedOperations_i.hh"
+
+// Operations
+#include <GEOMImpl_PipeTShapeDriver.hxx>
+#include <GEOMImpl_DividedDiskDriver.hxx>
+// #include <GEOMImpl_DividedCylinderDriver.hxx>
+#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+
+#include <TFunction_Driver.hxx>
+#include <TFunction_DriverTable.hxx>
+
+#include "Utils_ExceptHandlers.hxx"
+#include "utilities.h"
+
+//============================================================================
+// function : Create
+// purpose :
+//============================================================================
+GEOM_IOperations_i* AdvancedEngine_OperationsCreator::Create (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_Gen* theGenImpl)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ MESSAGE( "AdvancedEngine_OperationsCreator::Create" );
+
+ if (_mapOfOperations.find(theStudyId) == _mapOfOperations.end()) {
+ _mapOfOperations[theStudyId] = new GEOMImpl_IAdvancedOperations (theGenImpl, theStudyId);
+
+ // Advanced operations
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(),
+ new GEOMImpl_PipeTShapeDriver());
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(),
+ new GEOMImpl_DividedDiskDriver());
+ //TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(),
+ // new GEOMImpl_DividedCylinderDriver());
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(),
+ new GEOMImpl_SmoothingSurfaceDriver());
+ /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+ }
+
+ GEOM_IAdvancedOperations_i* aServant =
+ new GEOM_IAdvancedOperations_i (thePOA, theEngine, _mapOfOperations[theStudyId]);
+
+ return aServant;
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOM_ADVANCEDENGINE_OPERATIONSCREATOR_HXX_
+#define _GEOM_ADVANCEDENGINE_OPERATIONSCREATOR_HXX_
+
+#include "GEOM_AdvancedEngine.hxx"
+
+#include "GEOM_Gen_i.hh"
+
+#include "GEOMImpl_IAdvancedOperations.hxx"
+
+#include <map>
+
+//=====================================================================
+// Operations creator
+//=====================================================================
+class ADVANCEDENGINE_EXPORT AdvancedEngine_OperationsCreator : public GEOM_GenericOperationsCreator
+{
+ public:
+ // Create operations
+ virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_Gen* theGenImpl);
+ // return the name of IDL module
+ //virtual std::string GetModuleName();
+
+ private:
+ std::map <int, GEOMImpl_IAdvancedOperations*> _mapOfOperations;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// Advanced functions (base = 200)
+#define ADVANCED_BASE 200 // NO OPERATION (advanced operations base)
+#define GEOM_TSHAPE 201
+#define GEOM_DIVIDEDDISK 202
+#define GEOM_DIVIDEDCYLINDER 203
+#define GEOM_SMOOTHINGSURFACE 204
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+// Advanced functions sub-operations codes
+#define TSHAPE_BASIC 1
+#define TSHAPE_CHAMFER 2
+#define TSHAPE_FILLET 3
+#define DIVIDEDDISK_R_RATIO 1
+#define DIVIDEDDISK_R_VECTOR_PNT 2
+#define DIVIDEDCYLINDER_R_H 1
+#define SMOOTHINGSURFACE_LPOINTS 1
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include <Standard_Stream.hxx>
+
+#include "AdvancedEngine_Types.hxx"
+
+#include <GEOMImpl_DividedDiskDriver.hxx>
+#include <GEOMImpl_IDividedDisk.hxx>
+#include <GEOMImpl_Types.hxx>
+#include <GEOM_Function.hxx>
+
+// OCCT includes
+#include <gp_Pnt.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Ax2.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+
+#include <Geom_Plane.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+#include <TopExp.hxx>
+
+#include <utilities.h>
+//@@ include required header files here @@//
+
+enum
+{
+ SQUARE,
+ HEXAGON
+};
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_DividedDiskDriver::GetID()
+{
+ static Standard_GUID aGUID("0b01da9a-c5da-11e1-8d80-78e7d1879630");
+ return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_DividedDiskDriver
+//purpose :
+//=======================================================================
+GEOMImpl_DividedDiskDriver::GEOMImpl_DividedDiskDriver()
+{
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IDividedDisk aData (aFunction);
+ Standard_Integer aType = aFunction->GetType();
+
+ TopoDS_Shape aShape;
+
+ // Getting data
+ double R = aData.GetR();
+ double Ratio = aData.GetRatio();
+ int Pattern = aData.GetType();
+
+ // Build reference disk (in the global coordinate system)
+ TopoDS_Shape aDisk;
+
+ if (Pattern == SQUARE)
+ aDisk = MakeDiskSquare( R, Ratio );
+ else if (Pattern == HEXAGON)
+ aDisk = MakeDiskHexagon( R, Ratio );
+
+ if (aType == DIVIDEDDISK_R_RATIO)
+ {
+ int theOrientation = aData.GetOrientation();
+ aShape = TransformShape(aDisk, theOrientation);
+ }
+ else if (aType == DIVIDEDDISK_R_VECTOR_PNT)
+ {
+ Handle(GEOM_Function) aRefPoint = aData.GetCenter();
+ Handle(GEOM_Function) aRefVector = aData.GetVector();
+ TopoDS_Shape aShapePnt = aRefPoint->GetValue();
+ TopoDS_Shape aShapeVec = aRefVector->GetValue();
+
+ if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
+ aShapeVec.ShapeType() == TopAbs_EDGE)
+ {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
+ TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anE, V1, V2, Standard_True);
+ if (!V1.IsNull() && !V2.IsNull())
+ {
+ gp_Vec aVec (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+ gp_Dir aDir(aVec);
+ aShape = TransformShape(aDisk, aPnt, aDir);
+ }
+ }
+ }
+
+ if (aShape.IsNull()) return 0;
+
+ aFunction->SetValue(aShape);
+
+ log.SetTouched(Label());
+
+ return 1;
+}
+
+
+//=======================================================================
+//function : MakeDiskHexagon
+//purpose :
+//=======================================================================
+TopoDS_Shell GEOMImpl_DividedDiskDriver::MakeDiskHexagon(double R, double Ratio) const
+{
+ // Geometry
+ gp_Dir ZDir(0,0,1);
+ gp_Dir XDir(1,0,0);
+ gp_Pnt Orig(0,0,0);
+
+ // Circle
+ gp_Ax1 Ax1(Orig,ZDir);
+ gp_Ax2 Ax(Orig,ZDir,XDir);
+ gp_Circ aCircle(Ax, R);
+
+ // Points
+// gp_Pnt P4(0.01*Ratio*R,0,0);
+// gp_Pnt P3(R,0,0);
+// gp_Pnt P2 = P3.Rotated(Ax1,-M_PI/6.0);
+// gp_Pnt P1(P4.X(),
+// P4.X()/sqrt(3.0),0);
+ gp_Pnt P1(0.01*Ratio*R*sqrt(3.0)/2,0,0);
+ gp_Pnt P2(R,0,0);
+ gp_Pnt P3 = P2.Rotated(Ax1,M_PI/6.0);
+ gp_Pnt P4(P1.X(),
+ P1.X()/sqrt(3.0),0);
+
+
+ //surfaces
+ gp_Ax2 anAx (gp::XOY());
+ Handle(Geom_Plane) aPlane = new Geom_Plane (anAx);
+
+ // Topology
+
+ // Vertices
+ TopoDS_Vertex O = BRepBuilderAPI_MakeVertex(Orig);
+ TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1);
+ TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2);
+ TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(P3);
+ TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(P4);
+
+ TopoDS_Vertex V1 = V1_init;
+ TopoDS_Vertex V2 = V2_init;
+
+ //Rotation
+ gp_Trsf myTrsf;
+ myTrsf.SetRotation(Ax1, M_PI/3.0);
+
+ BRepBuilderAPI_Transform xform(myTrsf);
+ xform.Perform(V1,Standard_True);
+ TopoDS_Vertex V1_60 = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2,Standard_True);
+ TopoDS_Vertex V2_60 = TopoDS::Vertex(xform.Shape());
+
+ // Declaration of shapes (used in the loop)
+ TopoDS_Edge E1, E2, E3, E4, E5, E6, E7, E8, E9;
+ TopoDS_Wire W1, W2, W3;
+ TopoDS_Face F1, F2, F3;
+ TopoDS_Shell S;
+
+ BRep_Builder aBuilder;
+ aBuilder.MakeShell(S);
+
+ // Initialisation of edges
+ TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed()));
+ E1 = E1_init;
+ TopoDS_Edge E8_init = BRepBuilderAPI_MakeEdge(O,TopoDS::Vertex(V1.Reversed()));
+ E8 = E8_init;
+
+ for (int i=1;i<=6;i++)
+ {
+ // Edges
+
+ // for Face1
+ E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V3.Reversed()));
+ E3 = BRepBuilderAPI_MakeEdge(V3,TopoDS::Vertex(V4.Reversed()));
+ E4 = BRepBuilderAPI_MakeEdge(V4,TopoDS::Vertex(V1.Reversed()));
+
+ // for Face2
+ if (i==6)
+ {
+ E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_init.Reversed()));
+ E7 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V4.Reversed()));
+ }
+ else
+ {
+ E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_60.Reversed()));
+ E7 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(V4.Reversed()));
+ }
+ E6 = BRepBuilderAPI_MakeEdge(V2_60,TopoDS::Vertex(V1_60.Reversed()));
+
+ // for Face3
+ E9 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(O.Reversed()));
+
+
+ // Wires
+
+ //Wire1
+ aBuilder.MakeWire(W1);
+ if (i==1)
+ aBuilder.Add(W1,E1);
+ else
+ aBuilder.Add(W1,TopoDS::Edge(E1.Reversed()));
+ aBuilder.Add(W1,E2);
+ aBuilder.Add(W1,E3);
+ aBuilder.Add(W1,E4);
+
+ // Wire 2
+ aBuilder.MakeWire(W2);
+ aBuilder.Add(W2,TopoDS::Edge(E3.Reversed()));
+ aBuilder.Add(W2,E5);
+ if (i==6)
+ aBuilder.Add(W2,TopoDS::Edge(E1_init.Reversed()));
+ else
+ aBuilder.Add(W2,E6);
+ aBuilder.Add(W2,E7);
+
+ // Wire3
+ aBuilder.MakeWire(W3);
+ if (i==1)
+ aBuilder.Add(W3,E8);
+ else
+ aBuilder.Add(W3,TopoDS::Edge(E8.Reversed()));
+ aBuilder.Add(W3,TopoDS::Edge(E4.Reversed()));
+ aBuilder.Add(W3,TopoDS::Edge(E7.Reversed()));
+ if (i==6)
+ aBuilder.Add(W3,TopoDS::Edge(E8_init.Reversed()));
+ else
+ aBuilder.Add(W3,E9);
+
+ // Faces creation
+ F1 = BRepBuilderAPI_MakeFace(aPlane,W1);
+ F2 = BRepBuilderAPI_MakeFace(aPlane,W2);
+ F3 = BRepBuilderAPI_MakeFace(aPlane,W3);
+
+ //Shell
+ aBuilder.Add(S, F1);
+ aBuilder.Add(S, F2);
+ aBuilder.Add(S, F3);
+
+ // rotation
+ V1=V1_60;
+ V2=V2_60;
+
+ xform.Perform(V1_60,Standard_True);
+ V1_60 = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2_60,Standard_True);
+ V2_60 = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V3,Standard_True);
+ V3 = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V4,Standard_True);
+ V4 = TopoDS::Vertex(xform.Shape());
+
+ // "Increment" of edges
+ E1=E6;
+ E8=E9;
+ }
+
+ return S;
+}
+
+//=======================================================================
+//function : MakeDiskSquare
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_DividedDiskDriver::MakeDiskSquare(double R, double Ratio) const
+{
+ // Geometry
+ gp_Dir ZDir(0,0,1);
+ gp_Dir XDir(1,0,0);
+ gp_Pnt Orig(0,0,0);
+
+ // Circle
+ gp_Ax1 Ax1(Orig,ZDir);
+ gp_Ax2 Ax(Orig,ZDir,XDir);
+ gp_Circ aCircle(Ax, R);
+
+ // Points
+ gp_Pnt P1(0.01*Ratio*R,0,0);
+ gp_Pnt P2(R,0,0);
+
+ //surfaces
+ gp_Ax2 anAx (gp::XOY());
+ Handle(Geom_Plane) aPlane = new Geom_Plane (anAx);
+
+ // Topology
+
+ // Vertices
+ TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1);
+ TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2);
+
+ TopoDS_Vertex V1 = V1_init;
+ TopoDS_Vertex V2 = V2_init;
+
+ //Rotation
+ gp_Trsf myTrsf;
+ myTrsf.SetRotation(Ax1, M_PI/2);
+
+ BRepBuilderAPI_Transform xform(myTrsf);
+ xform.Perform(V1,Standard_True);
+ TopoDS_Vertex V1_rotated = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2,Standard_True);
+ TopoDS_Vertex V2_rotated = TopoDS::Vertex(xform.Shape());
+
+ // Declaration of shapes (used in the loop)
+ TopoDS_Edge E1, E2, E3, E4;
+ TopoDS_Wire W1, W2;
+ TopoDS_Face F1, F2;
+ TopoDS_Shell S;
+
+ BRep_Builder aBuilder;
+ aBuilder.MakeWire(W2); // Central Wire
+ aBuilder.MakeShell(S); // Shell
+
+ // Initialisation of edges
+ TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed()));
+ E1 = E1_init;
+
+ for (int i=1;i<=4;i++)
+ {
+ // Edges
+ // for Face1
+
+ E3 = BRepBuilderAPI_MakeEdge(V2_rotated,TopoDS::Vertex(V1_rotated.Reversed()));
+ if (i == 4)
+ {
+ E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_init.Reversed()));
+ E4 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V1.Reversed()));
+ }
+ else
+ {
+ E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_rotated.Reversed()));
+ E4 = BRepBuilderAPI_MakeEdge(V1_rotated,TopoDS::Vertex(V1.Reversed()));
+ }
+
+ // Wires
+ //Wire1
+ aBuilder.MakeWire(W1);
+ if (i==1)
+ aBuilder.Add(W1,E1);
+ else
+ aBuilder.Add(W1,TopoDS::Edge(E1.Reversed()));
+ aBuilder.Add(W1,E2);
+ if (i==4)
+ aBuilder.Add(W1,TopoDS::Edge(E1_init.Reversed()));
+ else
+ aBuilder.Add(W1,E3);
+ aBuilder.Add(W1,E4);
+
+ // Wire central
+ aBuilder.Add(W2,TopoDS::Edge(E4.Reversed()));
+
+ // Faces creation
+ F1 = BRepBuilderAPI_MakeFace(aPlane,W1);
+
+ //Shell
+ aBuilder.Add(S, F1);
+
+ // rotation
+ V1=V1_rotated;
+ V2=V2_rotated;
+
+ xform.Perform(V1_rotated,Standard_True);
+ V1_rotated = TopoDS::Vertex(xform.Shape());
+ xform.Perform(V2_rotated,Standard_True);
+ V2_rotated = TopoDS::Vertex(xform.Shape());
+
+ // "Increment" of edges
+ E1=E3;
+ }
+ // Central square Face
+ F2 = BRepBuilderAPI_MakeFace(aPlane,W2);
+ aBuilder.Add(S, F2);
+
+ return S;
+}
+
+
+//=======================================================================
+//function : TrasformShape(TopoDS_Shape aShape,int theOrientation)
+//purpose : Perform shape transformation accordingly with specified
+// orientation
+//=======================================================================
+TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, int theOrientation) const
+{
+ gp_Dir N, Vx;
+ gp_Pnt theOrigin = gp::Origin();
+
+ switch(theOrientation)
+ {
+ case 1:
+ {
+ N = gp::DZ();
+ Vx = gp::DX();
+ break;
+ }
+ case 2:
+ {
+ N = gp::DX();
+ Vx = gp::DY();
+ break;
+ }
+ case 3:
+ {
+ N = gp::DY();
+ Vx = gp::DZ();
+ break;
+ }
+ }
+
+ gp_Ax3 aWPlane = gp_Ax3(theOrigin, N, Vx);
+
+ return WPlaneTransform(theShape, aWPlane);
+}
+
+//=======================================================================
+//function : TrasformShape(TopoDS_Shape aShape, gp_Dir V, gp_Pnt P)
+//purpose : Perform shape transformation accordingly with specified
+// pnt and direction
+//=======================================================================
+TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, gp_Pnt P, gp_Dir V) const
+{
+ gp_Ax3 aWPlane( P, V );
+ return WPlaneTransform(theShape, aWPlane);
+}
+
+//=======================================================================
+//function : WPlaneTransform
+//purpose : Perform shape transformation accordingly with the given
+// Working Plane
+//=======================================================================
+TopoDS_Shape GEOMImpl_DividedDiskDriver::WPlaneTransform(TopoDS_Shape theShape, gp_Ax3 theWPlane) const
+{
+ gp_Trsf aTrans;
+ aTrans.SetTransformation(theWPlane);
+ aTrans.Invert();
+ BRepBuilderAPI_Transform aTransformation (theShape, aTrans, Standard_False);
+ return aTransformation.Shape();
+}
+
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
+
+bool GEOMImpl_DividedDiskDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IDividedDisk aCI( function );
+ Standard_Integer aType = function->GetType();
+
+ theOperationName = "DIVIDEDDISK";
+
+ switch ( aType ) {
+ case DIVIDEDDISK_R_RATIO:
+ AddParam( theParams, "Radius", aCI.GetR() );
+ AddParam( theParams, "Ratio", aCI.GetRatio() );
+ AddParam( theParams, "Orientation", aCI.GetOrientation() );
+ AddParam( theParams, "Division pattern", aCI.GetType() );
+ break;
+ case DIVIDEDDISK_R_VECTOR_PNT:
+ AddParam( theParams, "Center Point", aCI.GetCenter() );
+ AddParam( theParams, "Vector", aCI.GetVector() );
+ AddParam( theParams, "Radius", aCI.GetR() );
+ AddParam( theParams, "Division pattern", aCI.GetType() );
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver);
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _GEOMImpl_DividedDiskDriver_HXX
+#define _GEOMImpl_DividedDiskDriver_HXX
+
+#include <TFunction_Driver.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_DividedDiskDriver;
+class TopoDS_Shape;
+class TopoDS_Shell;
+class gp_Pnt;
+class gp_Dir;
+class gp_Ax3;
+
+#include "GEOM_BaseDriver.hxx"
+
+DEFINE_STANDARD_HANDLE( GEOMImpl_DividedDiskDriver, GEOM_BaseDriver );
+
+class GEOMImpl_DividedDiskDriver : public GEOM_BaseDriver {
+public:
+ // Methods PUBLIC
+ //
+ Standard_EXPORT GEOMImpl_DividedDiskDriver();
+ Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+ Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
+ {
+ return Standard_True;
+ }
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {};
+
+ Standard_EXPORT virtual
+ bool GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& params);
+private:
+ TopoDS_Shape TransformShape (TopoDS_Shape aShape, int theOrientation) const;
+ TopoDS_Shape TransformShape (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const;
+ TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const;
+ TopoDS_Shell MakeDiskHexagon (double R, double Ratio) const;
+ TopoDS_Shape MakeDiskSquare (double R, double Ratio) const;
+
+ DEFINE_STANDARD_RTTI( GEOMImpl_DividedDiskDriver )
+};
+
+#endif // _GEOMImpl_DividedDiskDriver_HXX
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMImpl_IAdvancedOperations.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "GEOMImpl_IAdvancedOperations.hxx"
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
+
+#include "GEOM_Function.hxx"
+#include "GEOM_PythonDump.hxx"
+#include "GEOMUtils.hxx"
+#include "GEOMAlgo_Splitter.hxx"
+#include "GEOMAlgo_FinderShapeOn1.hxx"
+
+#include "GEOMImpl_Gen.hxx"
+#include "GEOMImpl_Types.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_IGroupOperations.hxx"
+
+#include "GEOMImpl_GlueDriver.hxx"
+#include "GEOMImpl_PipeTShapeDriver.hxx"
+#include "GEOMImpl_IPipeTShape.hxx"
+#include "GEOMImpl_DividedDiskDriver.hxx"
+#include "GEOMImpl_IDividedDisk.hxx"
+// #include "GEOMImpl_DividedCylinderDriver.hxx"
+// #include "GEOMImpl_IDividedCylinder.hxx"
+#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
+#include <GEOMImpl_ISmoothingSurface.hxx>
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+
+#include <TDF_Tool.hxx>
+#include <TFunction_DriverTable.hxx>
+#include <TFunction_Driver.hxx>
+#include <TFunction_Logbook.hxx>
+#include <TNaming_CopyShape.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+
+#include <BRepAdaptor_Surface.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepPrimAPI_MakeCone.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+
+#include <gp_Ax3.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <GC_MakeConicalSurface.hxx>
+#include <Geom_CylindricalSurface.hxx>
+
+#include <cmath>
+
+#include "AdvancedEngine_Types.hxx"
+
+#include <Standard_Stream.hxx>
+#include <Standard_Failure.hxx>
+#include <StdFail_NotDone.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+#define HALF_LENGTH_MAIN_PIPE "Main pipe half length" //"Tuyau principal - demi longueur"
+#define HALF_LENGTH_INCIDENT_PIPE "Incident pipe half length" //"Tuyau incident - demi longueur"
+#define CIRCULAR_QUARTER_PIPE "Circular quarter of pipe" //"Circulaire - quart de tuyau"
+#define THICKNESS "Thickness" //"Epaisseur"
+#define FLANGE "Flange" // "Collerette"
+#define CHAMFER_OR_FILLET "Chamfer or fillet" //"Chanfrein ou Raccord"
+#define JUNCTION_FACE_1 "Junction 1" //"Face de jonction 1"
+#define JUNCTION_FACE_2 "Junction 2" //"Face de jonction 2"
+#define JUNCTION_FACE_3 "Junction 3" //"Face de jonction 3"
+
+#define FIND_GROUPS_BY_POINTS 1
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID) :
+ GEOM_IOperations(theEngine, theDocID)
+{
+ MESSAGE("GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations");
+ myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
+ myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
+ myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
+ myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
+ myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
+ my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
+ myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
+ myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());
+ myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations()
+{
+ MESSAGE("GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations");
+ delete myBasicOperations;
+ delete myBooleanOperations;
+ delete myShapesOperations;
+ delete myTransformOperations;
+ delete myBlocksOperations;
+ delete my3DPrimOperations;
+ delete myLocalOperations;
+ delete myHealingOperations;
+ delete myGroupOperations;
+}
+
+//=============================================================================
+/*!
+ * SetPosition
+ */
+//=============================================================================
+gp_Trsf GEOMImpl_IAdvancedOperations::GetPositionTrsf(double theL1, double theL2,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3)
+{
+ // Old Local Coordinates System oldLCS
+ gp_Pnt P0(0, 0, 0);
+ gp_Pnt P1(-theL1, 0, 0);
+ gp_Pnt P2(theL1, 0, 0);
+ gp_Pnt P3(0, 0, theL2);
+
+ gp_Dir oldX(gp_Vec(P1, P2));
+ gp_Dir oldZ(gp_Vec(P0, P3));
+ gp_Ax3 oldLCS(P0, oldZ, oldX);
+
+ // New Local Coordinates System newLCS
+ double LocX, LocY, LocZ;
+ gp_Pnt newP1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
+ gp_Pnt newP2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
+ gp_Pnt newP3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
+ LocX = (newP1.X() + newP2.X()) / 2.;
+ LocY = (newP1.Y() + newP2.Y()) / 2.;
+ LocZ = (newP1.Z() + newP2.Z()) / 2.;
+ gp_Pnt newO(LocX, LocY, LocZ);
+
+ gp_Dir newX(gp_Vec(newP1, newP2)); // P1P2 Vector
+ gp_Dir newZ(gp_Vec(newO, newP3)); // OP3 Vector
+ gp_Ax3 newLCS = gp_Ax3(newO, newZ, newX);
+
+ gp_Trsf aTrsf;
+ aTrsf.SetDisplacement(oldLCS, newLCS);
+
+ return aTrsf;
+}
+
+//=============================================================================
+/*!
+ * CheckCompatiblePosition
+ *
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::CheckCompatiblePosition(double& theL1, double& theL2,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3,
+ double theTolerance)
+{
+ SetErrorCode(KO);
+ gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
+ gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
+ gp_Pnt P3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
+
+ double d12 = P1.Distance(P2);
+ double d13 = P1.Distance(P3);
+ double d23 = P2.Distance(P3);
+ // double d2 = newO.Distance(P3);
+
+ if (Abs(d12) <= Precision::Confusion()) {
+ SetErrorCode("Junctions points P1 and P2 are identical");
+ return false;
+ }
+ if (Abs(d13) <= Precision::Confusion()) {
+ SetErrorCode("Junctions points P1 and P3 are identical");
+ return false;
+ }
+ if (Abs(d23) <= Precision::Confusion()) {
+ SetErrorCode("Junctions points P2 and P3 are identical");
+ return false;
+ }
+
+
+ double newL1 = 0.5 * d12;
+ double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
+ //
+ // theL1*(1-theTolerance) <= newL1 <= theL1*(1+theTolerance)
+ //
+ if (fabs(newL1 - theL1) > Precision::Approximation()) {
+ if ( (newL1 * (1 - theTolerance) -theL1 <= Precision::Approximation()) &&
+ (newL1 * (1 + theTolerance) -theL1 >= Precision::Approximation()) ) {
+ // std::cerr << "theL1 = newL1" << std::endl;
+ theL1 = newL1;
+ } else {
+ theL1 = -1;
+ SetErrorCode("Dimension for main pipe (L1) is incompatible with new position");
+ return false;
+ }
+ }
+
+ //
+ // theL2*(1-theTolerance) <= newL2 <= theL2*(1+theTolerance)
+ //
+ if (fabs(newL2 - theL2) > Precision::Approximation()) {
+ if ( (newL2 * (1 - theTolerance) -theL2 <= Precision::Approximation()) &&
+ (newL2 * (1 + theTolerance) -theL2 >= Precision::Approximation()) ) {
+ theL2 = newL2;
+ } else {
+ theL2 = -1;
+ SetErrorCode("Dimension for incident pipe (L2) is incompatible with new position");
+ return false;
+ }
+ }
+
+ SetErrorCode(OK);
+ return true;
+
+}
+
+//=============================================================================
+/*!
+ * Generate the propagation groups of a Pipe T-Shape used for hexa mesh
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW, double theRF,
+ Handle(TColStd_HSequenceOfTransient) theSeq,
+ gp_Trsf aTrsf)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) return false;
+
+ TopoDS_Shape aShape = theShape->GetValue();
+ if (aShape.IsNull()) {
+ SetErrorCode("Shape is not defined");
+ return false;
+ }
+
+ gp_Trsf aTrsfInv = aTrsf.Inverted();
+
+// int expectedGroups = 0;
+// if (shapeType == TSHAPE_BASIC)
+// if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
+// expectedGroups = 10;
+// else
+// expectedGroups = 11;
+// else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET)
+// expectedGroups = 12;
+
+ double aR1Ext = theR1 + theW1;
+ double aR2Ext = theR2 + theW2;
+
+ /////////////////////////
+ //// Groups of Faces ////
+ /////////////////////////
+
+ //
+ // Comment the following lines when GetInPlace bug is solved
+ // == BEGIN
+ // Workaround of GetInPlace bug
+ // Create a bounding box that fits the shape
+ Handle(GEOM_Object) aBox = my3DPrimOperations->MakeBoxDXDYDZ(2*theL1, 2*aR1Ext, aR1Ext+theL2);
+ aBox->GetLastFunction()->SetDescription("");
+ myTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext);
+ aBox->GetLastFunction()->SetDescription("");
+ // Apply transformation to box
+ BRepBuilderAPI_Transform aTransformationBox(aBox->GetValue(), aTrsf, Standard_False);
+ TopoDS_Shape aBoxShapeTrsf = aTransformationBox.Shape();
+ aBox->GetLastFunction()->SetValue(aBoxShapeTrsf);
+
+ // Get the shell of the box
+ Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast
+ (myShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1));
+ aBox->GetLastFunction()->SetDescription("");
+ aShell->GetLastFunction()->SetDescription("");
+ // Get the common shapes between shell and shape
+ Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon
+ if (aCommonCompound.IsNull()) {
+ SetErrorCode(myBooleanOperations->GetErrorCode());
+ return false;
+ }
+ aCommonCompound->GetLastFunction()->SetDescription("");
+ // Explode the faces of common shapes => 3 faces
+ Handle(TColStd_HSequenceOfTransient) aCommonFaces =
+ myShapesOperations->MakeExplode(aCommonCompound, TopAbs_FACE, true);
+ aCommonCompound->GetLastFunction()->SetDescription("");
+ std::list<Handle(GEOM_Object)> aCompoundOfFacesList;
+
+ for (int i=0 ; i<= aCommonFaces->Length()-4 ; i+=4) {
+ std::list<Handle(GEOM_Object)> aFacesList;
+ for (int j = 1 ; j <= 4 ; j++) {
+ Handle(GEOM_Object) aFace = Handle(GEOM_Object)::DownCast(aCommonFaces->Value(i+j)); // Junction faces
+ if (!aFace.IsNull()) {
+ aFace->GetLastFunction()->SetDescription("");
+ aFacesList.push_back(aFace);
+ }
+ }
+ Handle(GEOM_Object) aCompoundOfFaces = myShapesOperations->MakeCompound(aFacesList);
+ if (!aCompoundOfFaces.IsNull()) {
+ aCompoundOfFaces->GetLastFunction()->SetDescription("");
+ aCompoundOfFacesList.push_back(aCompoundOfFaces);
+ }
+ }
+
+ if (aCompoundOfFacesList.size() == 3) {
+ Handle(GEOM_Object) aPln1 = aCompoundOfFacesList.front();
+ aCompoundOfFacesList.pop_front();
+ Handle(GEOM_Object) aPln2 = aCompoundOfFacesList.front();
+ aCompoundOfFacesList.pop_front();
+ Handle(GEOM_Object) aPln3 = aCompoundOfFacesList.front();
+ aCompoundOfFacesList.pop_front();
+ // == END
+ //
+
+
+ // Uncomment the following lines when GetInPlace bug is solved
+ // == BEGIN
+// Handle(GEOM_Object) aP1 = myBasicOperations->MakePointXYZ(-theL1, 0, 0);
+// Handle(GEOM_Object) aP2 = myBasicOperations->MakePointXYZ(-0, 0, theL2);
+// Handle(GEOM_Object) aP3 = myBasicOperations->MakePointXYZ(theL1, 0, 0);
+// aP1->GetLastFunction()->SetDescription("");
+// aP2->GetLastFunction()->SetDescription("");
+// aP3->GetLastFunction()->SetDescription("");
+// Handle(GEOM_Object) aV1 = myBasicOperations->MakeVectorDXDYDZ(-1, 0, 0);
+// Handle(GEOM_Object) aV2 = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+// Handle(GEOM_Object) aV3 = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
+// aV1->GetLastFunction()->SetDescription("");
+// aV2->GetLastFunction()->SetDescription("");
+// aV3->GetLastFunction()->SetDescription("");
+// Handle(GEOM_Object) aPln1 = myBasicOperations->MakePlanePntVec(aP1, aV1, 2*(aR1Ext+theL2));
+// Handle(GEOM_Object) aPln2 = myBasicOperations->MakePlanePntVec(aP2, aV2, 2*(aR2Ext));
+// Handle(GEOM_Object) aPln3 = myBasicOperations->MakePlanePntVec(aP3, aV3, 2*(aR1Ext+theL2));
+// aPln1->GetLastFunction()->SetDescription("");
+// aPln2->GetLastFunction()->SetDescription("");
+// aPln3->GetLastFunction()->SetDescription("");
+//
+// BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False);
+// TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape();
+// aPln1->GetLastFunction()->SetValue(aTrsf_Shape1);
+// BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False);
+// TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape();
+// aPln2->GetLastFunction()->SetValue(aTrsf_Shape2);
+// BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False);
+// TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape();
+// aPln3->GetLastFunction()->SetValue(aTrsf_Shape3);
+ // == END
+ //
+
+ Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1);
+ if (junctionFaces1.IsNull())
+ junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound
+ (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ if (!junctionFaces1.IsNull()) {
+ junctionFaces1->GetLastFunction()->SetDescription("");
+ junctionFaces1->SetName("JUNCTION_FACE_1");
+ theSeq->Append(junctionFaces1);
+ }
+ else {
+ SetErrorCode("Junction face 1 not found");
+ // theSeq->Append(aPln1);
+ // return false;
+ }
+ Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2);
+ if (junctionFaces2.IsNull())
+ junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound
+ (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ if (!junctionFaces2.IsNull()) {
+ junctionFaces2->GetLastFunction()->SetDescription("");
+ junctionFaces2->SetName("JUNCTION_FACE_2");
+ theSeq->Append(junctionFaces2);
+ }
+ else {
+ SetErrorCode("Junction face 2 not found");
+ // theSeq->Append(aPln2);
+ // return false;
+ }
+ Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3);
+ if (junctionFaces3.IsNull())
+ junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound
+ (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ if (!junctionFaces3.IsNull()) {
+ junctionFaces3->GetLastFunction()->SetDescription("");
+ junctionFaces3->SetName("JUNCTION_FACE_3");
+ theSeq->Append(junctionFaces3);
+ }
+ else {
+ SetErrorCode("Junction face 3 not found");
+ // theSeq->Append(aPln3);
+ // return false;
+ }
+ // Comment the following lines when GetInPlace bug is solved
+ // == BEGIN
+ }
+ // == END
+
+ /////////////////////////
+ //// Groups of Edges ////
+ /////////////////////////
+ // Result of propagate
+
+ Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+
+ TCollection_AsciiString theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) aSeqPropagate = myBlocksOperations->Propagate(theShape);
+ if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) {
+ SetErrorCode("Propagation groups not found");
+ return false;
+ }
+ Standard_Integer aNbGroups = aSeqPropagate->Length();
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+
+#ifdef FIND_GROUPS_BY_POINTS
+ // BEGIN: new groups search
+
+ // W2 R2
+ // .----.-----.----.
+ // e| | | | |
+ // | | | | |
+ // . | | | .
+ // g / ''..| | |..'' \
+ // f / ''''''' \
+ // .---.--'.. | | | ..'--.---.
+ // |a \ '''...........''' / |
+ // |-------\------' | '------/-------.
+ // | \ | / |
+ // c| \ | / |
+ // | R1 \ | / |
+ // | \ | / |
+ // ._________________|_________________.
+ // | L1 | |
+ // | | |
+ // | | |
+ // b| | |
+ // | | |
+ // |-----------------|-----------------|
+ // | W1 | |
+ // '-----------------'-----------------'
+ // d
+
+ // "Thickness" group (a)
+ gp_Pnt aPntA (-theL1, 0, theR1 + theW1/2.);
+ aPntA.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexA (aPntA);
+ TopoDS_Vertex aVertA = TopoDS::Vertex(mkVertexA.Shape());
+ TopoDS_Shape anEdgeA = GEOMUtils::GetEdgeNearPoint(aShape, aVertA);
+
+ // "Circular quarter of pipe" group (b)
+ gp_Pnt aPntB (-theL1, -aR1Ext * sin(M_PI/4.), -aR1Ext * sin(M_PI/4.));
+ aPntB.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexB (aPntB);
+ TopoDS_Vertex aVertB = TopoDS::Vertex(mkVertexB.Shape());
+ TopoDS_Shape anEdgeB = GEOMUtils::GetEdgeNearPoint(aShape, aVertB);
+
+ // "Circular quarter of pipe" group (c)
+ gp_Pnt aPntC (-theL1, -aR1Ext * sin(M_PI/4.), aR1Ext * sin(M_PI/4.));
+ aPntC.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexC (aPntC);
+ TopoDS_Vertex aVertC = TopoDS::Vertex(mkVertexC.Shape());
+ TopoDS_Shape anEdgeC = GEOMUtils::GetEdgeNearPoint(aShape, aVertC);
+
+ // "Main pipe half length" group (d)
+ gp_Pnt aPntD (-theL1/2., 0, -aR1Ext);
+ aPntD.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexD (aPntD);
+ TopoDS_Vertex aVertD = TopoDS::Vertex(mkVertexD.Shape());
+ TopoDS_Shape anEdgeD = GEOMUtils::GetEdgeNearPoint(aShape, aVertD);
+
+ // "Incident pipe half length" group (e)
+ double aTol10 = Precision::Confusion() * 10.;
+ gp_Pnt aPntE (-aR2Ext, 0, theL2 - aTol10);
+ aPntE.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexE (aPntE);
+ TopoDS_Vertex aVertE = TopoDS::Vertex(mkVertexE.Shape());
+ TopoDS_Shape anEdgeE = GEOMUtils::GetEdgeNearPoint(aShape, aVertE);
+
+ // "Flange" group (f)
+ double aFx = - aR2Ext - aTol10;
+ if (shapeType == TSHAPE_CHAMFER)
+ aFx -= theW;
+ else if (shapeType == TSHAPE_FILLET)
+ aFx -= theRF;
+ gp_Pnt aPntF (aFx, 0, aR1Ext);
+ aPntF.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexF (aPntF);
+ TopoDS_Vertex aVertF = TopoDS::Vertex(mkVertexF.Shape());
+ TopoDS_Shape anEdgeF = GEOMUtils::GetEdgeNearPoint(aShape, aVertF);
+
+ // "Chamfer or Fillet" group (g)
+ TopoDS_Shape anEdgeG;
+ if (shapeType == TSHAPE_CHAMFER) {
+ gp_Pnt aPntG (-aR2Ext - theW/2., 0, aR1Ext + theH/2.);
+ aPntG.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexG (aPntG);
+ TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape());
+ anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG);
+ }
+ else if (shapeType == TSHAPE_FILLET) {
+ gp_Pnt aPntG (-aR2Ext - theRF/2., 0, aR1Ext + theRF/2.);
+ aPntG.Transform(aTrsf);
+ BRepBuilderAPI_MakeVertex mkVertexG (aPntG);
+ TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape());
+ anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG);
+ }
+
+ for (int i = 1 ; i <= aNbGroups; i++) {
+ Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i));
+ if (aGroup.IsNull())
+ continue;
+
+ TopoDS_Shape aGroupShape = aGroup->GetValue();
+ TopTools_IndexedMapOfShape anEdgesMap;
+ TopExp::MapShapes(aGroupShape, TopAbs_EDGE, anEdgesMap);
+
+ if (anEdgesMap.Contains(anEdgeA)) { // a
+ aGroup->SetName("THICKNESS");
+ theSeq->Append(aGroup);
+ }
+ else if (anEdgesMap.Contains(anEdgeB)) { // b
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ theSeq->Append(aGroup);
+ }
+ else if (anEdgesMap.Contains(anEdgeC)) { // c
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ theSeq->Append(aGroup);
+ }
+ else if (anEdgesMap.Contains(anEdgeD)) { // d
+ aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+ theSeq->Append(aGroup);
+ }
+ else if (anEdgesMap.Contains(anEdgeE)) { // e
+ aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+ theSeq->Append(aGroup);
+ }
+ else if (anEdgesMap.Contains(anEdgeF)) { // f
+ aGroup->SetName("FLANGE");
+ theSeq->Append(aGroup);
+ }
+ else if (shapeType == TSHAPE_CHAMFER) { // g
+ if (anEdgesMap.Contains(anEdgeG)) {
+ aGroup->SetName("CHAMFER");
+ theSeq->Append(aGroup);
+ }
+ }
+ else if (shapeType == TSHAPE_FILLET) { // g
+ if (anEdgesMap.Contains(anEdgeG)) {
+ aGroup->SetName("FILLET");
+ theSeq->Append(aGroup);
+ }
+ }
+ else {
+ }
+ }
+ // END: new groups search
+#else
+ bool addGroup;
+ bool circularFoundAndAdded = false;
+ bool circularFound10 = false;
+ bool incidentPipeFound = false;
+ bool mainPipeFound = false;
+ bool mainPipeFoundAndAdded = false;
+ bool radialFound =false;
+ bool flangeFound = false;
+ bool flangeFoundAndAdded = false;
+ bool chamferOrFilletFound = false;
+
+ for (int i = 1 ; i <= aNbGroups; i++) {
+ addGroup = false;
+
+ Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i));
+ if (aGroup.IsNull())
+ continue;
+
+ TopoDS_Shape aGroupShape = aGroup->GetValue();
+ BRepBuilderAPI_Transform aTransformationShapeInv (aGroupShape, aTrsfInv, Standard_False);
+ TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape();
+
+ TopTools_IndexedMapOfShape anEdgesMap;
+ TopExp::MapShapes(aGroupShapeTrsfInv,TopAbs_EDGE, anEdgesMap);
+ Standard_Integer nbEdges = anEdgesMap.Extent();
+
+ if (shapeType == TSHAPE_BASIC) {
+ if ((nbEdges >= 21) || /*R1Ext = R2Ext*/(nbEdges == 17)) { // 17, 17+8*{1,2,3}, 21, 21+8*{1,2,3}
+ addGroup = true;
+ aGroup->SetName("THICKNESS");
+ }
+ else if (nbEdges == 6) {
+ if (!circularFoundAndAdded) {
+ circularFoundAndAdded = true;
+ addGroup = true;
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ }
+ }
+ else if (nbEdges == 8) {
+ incidentPipeFound = true;
+ mainPipeFound = false;
+ radialFound = false;
+ flangeFound = false;
+
+ TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX);
+ while (Ex.More()) {
+ gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ double x=aP.X(), y=aP.Y(), z=aP.Z();
+
+
+ if ((Abs(x) > aR2Ext + Precision::Confusion()) ||
+ (Abs(y) > aR2Ext + Precision::Confusion())) {
+ incidentPipeFound = false;
+ }
+
+ if ( z < -Precision::Confusion()) {
+ // length of main pipe
+ mainPipeFound = true;
+ if (!mainPipeFoundAndAdded) {
+ mainPipeFoundAndAdded = true;
+ addGroup = true;
+ aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+ }
+ }
+
+ else if (Abs(x) > (theL1-Precision::Confusion())) {
+ // discretisation circulaire
+ radialFound = true;
+ if (!circularFoundAndAdded) {
+ circularFoundAndAdded = true;
+ addGroup = true;
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ }
+ }
+ Ex.Next();
+ }
+ if (incidentPipeFound) {
+ addGroup = true;
+ aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+ }
+ if (!addGroup && (!incidentPipeFound &&
+ !radialFound &&
+ !mainPipeFound &&
+ !flangeFound)) {
+ // Flange (collerette)
+ flangeFound = true;
+ addGroup = true;
+ aGroup->SetName("FLANGE");
+ }
+ }
+ else
+ continue;
+ }
+ else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) {
+ if (nbEdges >= 25) { // 25, 25+8, 25+16, 25+24
+ addGroup = true;
+ aGroup->SetName("THICKNESS");
+ }
+ else if ((nbEdges == 10) || (nbEdges == 6)) {
+ if (!circularFoundAndAdded) {
+ addGroup = true;
+ circularFoundAndAdded = true;
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ if (nbEdges == 10) {
+ circularFound10 = true;
+ }
+ }
+ else if (!circularFound10 && nbEdges == 10) {
+ circularFound10 = true;
+ addGroup = true;
+ aGroup->SetName("CIRCULAR_QUARTER_PIPE");
+ }
+ }
+ else if (nbEdges == 8) {
+ incidentPipeFound = true;
+ mainPipeFound = true;
+ flangeFound = false;
+
+ bool isNearZ0 = false;
+ bool isBelowZ0 = false;
+
+ TopExp_Explorer Ex (aGroupShapeTrsfInv,TopAbs_VERTEX);
+ while (Ex.More()) {
+ gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ double x=aP.X(), y=aP.Y(), z=aP.Z();
+
+ // tuy_princ_long_avant & tuy_princ_long_apres
+ //bool isMain = (((z < Precision::Confusion()) || (x < Precision::Confusion())) &&
+ // ((y <= aR1Ext + Precision::Confusion()) ||
+ // (y <= -(aR1Ext + Precision::Confusion())) ||
+ // (y <= theR1 + Precision::Confusion()) ||
+ // (y == -(theR1 + Precision::Confusion()))));
+ bool isMain = ((z < Precision::Confusion() || x < Precision::Confusion()) &&
+ (fabs(y) > theR1 - Precision::Confusion() ||
+ fabs(y) < Precision::Confusion()));
+
+ if (!isMain) {
+ mainPipeFound = false;
+ }
+
+ // collerette
+ //if (z < Precision::Confusion() && !isMain) {
+ // flangeFound = true;
+ // if (!flangeFoundAndAdded) {
+ // flangeFoundAndAdded = true;
+ // addGroup = true;
+ // aGroup->SetName("FLANGE");
+ // }
+ //}
+ if (fabs(z) < Precision::Confusion()) isNearZ0 = true;
+ if (z < - Precision::Confusion()) isBelowZ0 = true;
+
+ // tuyau incident
+ if ((Abs(x) > aR2Ext + Precision::Confusion()) ||
+ (Abs(y) > aR2Ext + Precision::Confusion())) {
+ incidentPipeFound = false;
+ }
+ Ex.Next();
+ }
+ if (mainPipeFound) {
+ addGroup = true;
+ aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
+ }
+ if (incidentPipeFound) {
+ addGroup = true;
+ aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
+ }
+ if (isNearZ0 && !isBelowZ0) {
+ flangeFound = true;
+ if (!flangeFoundAndAdded) {
+ flangeFoundAndAdded = true;
+ addGroup = true;
+ aGroup->SetName("FLANGE");
+ }
+ }
+ if (!addGroup && (!incidentPipeFound &&
+ !mainPipeFound &&
+ !flangeFound &&
+ !chamferOrFilletFound)) {
+ addGroup = true;
+ chamferOrFilletFound = true;
+ if (shapeType == TSHAPE_CHAMFER)
+ aGroup->SetName("CHAMFER");
+ else
+ aGroup->SetName("FILLET");
+ }
+ }
+ else
+ continue;
+ }
+ // Add group to the list
+ if (addGroup)
+ theSeq->Append(aGroup);
+ }
+#endif
+
+ SetErrorCode(OK);
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Return faces that are laying on surface.
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::GetFacesOnSurf
+ (const TopoDS_Shape &theShape,
+ const Handle_Geom_Surface& theSurface,
+ const Standard_Real theTolerance,
+ TopTools_ListOfShape &theFaces)
+{
+ GEOMAlgo_FinderShapeOn1 aFinder;
+
+ aFinder.SetShape(theShape);
+ aFinder.SetTolerance(theTolerance);
+ aFinder.SetSurface(theSurface);
+ aFinder.SetShapeType(TopAbs_FACE);
+ aFinder.SetState(GEOMAlgo_ST_ON);
+
+ // Sets the minimal number of inner points for the faces that do not have own
+ // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
+ // Default value=3
+ aFinder.SetNbPntsMin(3);
+ // Sets the maximal number of inner points for edges or faces.
+ // It is usefull for the cases when this number is very big (e.g =2000) to improve
+ // the performance. If this value =0, all inner points will be taken into account.
+ // Default value=0
+ aFinder.SetNbPntsMax(100);
+ aFinder.Perform();
+
+ // Interprete results
+ Standard_Integer iErr = aFinder.ErrorStatus();
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iErr) {
+ MESSAGE(" iErr : " << iErr);
+ TCollection_AsciiString aMsg (" iErr : ");
+ aMsg += TCollection_AsciiString(iErr);
+ SetErrorCode(aMsg);
+ return false;
+ }
+ Standard_Integer iWrn = aFinder.WarningStatus();
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iWrn) {
+ MESSAGE(" *** iWrn : " << iWrn);
+ }
+
+ const TopTools_ListOfShape &aListRes = aFinder.Shapes(); // the result
+ TopTools_ListIteratorOfListOfShape anIter (aListRes);
+
+ for (; anIter.More(); anIter.Next()) {
+ theFaces.Append(anIter.Value());
+ }
+
+ return true;
+}
+
+//=============================================================================
+/*!
+ * Creates and returns conical face.
+ */
+//=============================================================================
+TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeConicalFace
+ (const gp_Ax2 &theAxis,
+ const double theRadius,
+ const double theRadiusThin,
+ const double theHeight,
+ const gp_Trsf &theTrsf)
+{
+ BRepPrimAPI_MakeCone aMkCone (theAxis, theRadius, theRadiusThin, theHeight);
+ TopoDS_Shape aResult;
+
+ aMkCone.Build();
+ if (aMkCone.IsDone()) {
+ TopExp_Explorer anExp(aMkCone.Shape(), TopAbs_FACE);
+
+ for (; anExp.More(); anExp.Next()) {
+ TopoDS_Face aFace = TopoDS::Face(anExp.Current());
+
+ if (aFace.IsNull() == Standard_False) {
+ BRepAdaptor_Surface anAdaptor(aFace, Standard_False);
+
+ if (anAdaptor.GetType() == GeomAbs_Cone) {
+ // This is a conical face. Transform and return it.
+ BRepBuilderAPI_Transform aTransf(aFace, theTrsf, Standard_False);
+
+ aResult = aTransf.Shape();
+ break;
+ }
+ }
+ }
+ }
+
+ return aResult;
+}
+
+//=============================================================================
+/*!
+ * Generate the internal group of a Pipe T-Shape
+ */
+//=============================================================================
+bool GEOMImpl_IAdvancedOperations::MakeInternalGroup
+ (const Handle(GEOM_Object) &theShape,
+ const double theR1, const double theLen1,
+ const double theR2, const double theLen2,
+ const double theRL, double theTransLenL,
+ const double theRR, double theTransLenR,
+ const double theRI, double theTransLenI,
+ const Handle(TColStd_HSequenceOfTransient) &theSeq,
+ const gp_Trsf &theTrsf)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) {
+ return false;
+ }
+
+ TopoDS_Shape aShape = theShape->GetValue();
+
+ if (aShape.IsNull()) {
+ SetErrorCode("Shape is not defined");
+ return false;
+ }
+
+ // Compute tolerance
+ Standard_Real aMaxTol = -RealLast();
+ TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
+
+ for (; anExp.More(); anExp.Next()) {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(anExp.Current());
+
+ if (aVertex.IsNull() == Standard_False) {
+ const Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+
+ if (aTol > aMaxTol) {
+ aMaxTol = aTol;
+ }
+ }
+ }
+
+ // Construct internal surfaces.
+ Standard_Integer i = 0;
+ const Standard_Integer aMaxNbSurf = 5;
+ Handle(Geom_Surface) aSurface[aMaxNbSurf];
+ TopTools_ListOfShape aConicalFaces;
+ Standard_Real aTolConf = Precision::Confusion();
+
+ // 1. Construct the internal surface of main pipe.
+ gp_Ax2 anAxis1 (gp::Origin(), gp::DX(), gp::DZ());
+ gp_Ax2 anAxis2 (gp::Origin(), gp::DZ(), gp::DX());
+
+ aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theR1);
+
+ // 2. Construct the internal surface of incident pipe.
+ aSurface[i++] = new Geom_CylindricalSurface(anAxis2, theR2);
+
+ // 3. Construct the internal surface of left reduction pipe.
+ if (theRL > aTolConf) {
+ aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theRL);
+
+ if (theTransLenL > aTolConf) {
+ // 3.1. Construct the internal surface of left transition pipe.
+ gp_Pnt aPLeft (-theLen1, 0., 0.);
+ gp_Ax2 anAxisLeft (aPLeft, -gp::DX(), gp::DZ());
+ TopoDS_Shape aConeLeft =
+ MakeConicalFace(anAxisLeft, theR1, theRL, theTransLenL, theTrsf);
+
+ if (aConeLeft.IsNull() == Standard_False) {
+ aConicalFaces.Append(aConeLeft);
+ }
+ }
+ }
+
+ // 4. Construct the internal surface of right reduction pipe.
+ if (theRR > aTolConf) {
+ // There is no need to construct another cylinder of the same radius. Skip it.
+ if (Abs(theRR - theRL) > aTolConf) {
+ aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theRR);
+ }
+
+ if (theTransLenL > aTolConf) {
+ // 4.1. Construct the internal surface of right transition pipe.
+ gp_Pnt aPRight (theLen1, 0., 0.);
+ gp_Ax2 anAxisRight (aPRight, gp::DX(), gp::DZ());
+ TopoDS_Shape aConeRight =
+ MakeConicalFace(anAxisRight, theR1, theRR, theTransLenR, theTrsf);
+
+ if (aConeRight.IsNull() == Standard_False) {
+ aConicalFaces.Append(aConeRight);
+ }
+ }
+ }
+
+ // 5. Construct the internal surface of incident reduction pipe.
+ if (theRI > aTolConf) {
+ aSurface[i++] = new Geom_CylindricalSurface(anAxis2, theRI);
+
+ if (theTransLenI > aTolConf) {
+ // 5.1. Construct the internal surface of incident transition pipe.
+ gp_Pnt aPInci (0., 0., theLen2);
+ gp_Ax2 anAxisInci (aPInci, gp::DZ(), gp::DX());
+ TopoDS_Shape aConeInci =
+ MakeConicalFace(anAxisInci, theR2, theRI, theTransLenI, theTrsf);
+
+ if (aConeInci.IsNull() == Standard_False) {
+ aConicalFaces.Append(aConeInci);
+ }
+ }
+ }
+
+ // Get faces that are laying on cylindrical surfaces.
+ TopTools_ListOfShape aFaces;
+ gp_Trsf anInvTrsf = theTrsf.Inverted();
+
+ for (i = 0; i < aMaxNbSurf; i++) {
+ if (aSurface[i].IsNull()) {
+ break;
+ }
+
+ aSurface[i]->Transform(theTrsf);
+
+ TopTools_ListOfShape aLocalFaces;
+
+ if (!GetFacesOnSurf(aShape, aSurface[i], aMaxTol, aLocalFaces)) {
+ return false;
+ }
+
+ if (i < 2) {
+ // Check if the result contains outer cylinders.
+ // It is required for main and incident pipes.
+ TopTools_ListIteratorOfListOfShape anIter(aLocalFaces);
+
+ while (anIter.More()) {
+ TopExp_Explorer anExp(anIter.Value(), TopAbs_VERTEX);
+ Standard_Boolean isInside = Standard_False;
+
+ // Get a vertex from this shape
+ if (anExp.More()) {
+ TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
+
+ if (aVtx.IsNull() == Standard_False) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(aVtx);
+
+ aPnt.Transform(anInvTrsf);
+
+ if (i == 0) {
+ // Check if the point is inside the main pipe.
+ isInside = (Abs(aPnt.X()) <= theLen1);
+ } else { // i == 1
+ // Check if the point is inside the incident pipe.
+ isInside = (aPnt.Z() <= theLen2);
+ }
+ }
+ }
+
+ if (isInside) {
+ // Keep this face.
+ anIter.Next();
+ } else {
+ // Remove this face.
+ aLocalFaces.Remove(anIter);
+ }
+ }
+ }
+
+ aFaces.Append(aLocalFaces);
+ }
+
+ // Get faces that are laying on conical faces.
+ if (aConicalFaces.IsEmpty() == Standard_False) {
+ Handle(GEOM_Object) aCone =
+ GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+ Handle(GEOM_Function) aFunction =
+ aCone->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
+ TopTools_ListIteratorOfListOfShape aFIter(aConicalFaces);
+ Handle(GEOM_Object) aConeFromShape;
+
+ for (; aFIter.More(); aFIter.Next()) {
+ aFunction->SetValue(aFIter.Value());
+ aConeFromShape = myShapesOperations->GetInPlace(theShape, aCone);
+
+ if (aConeFromShape.IsNull() == Standard_False) {
+ aConeFromShape->GetLastFunction()->SetDescription("");
+ TopoDS_Shape aConeFaces = aConeFromShape->GetValue();
+ TopExp_Explorer anExp(aConeFaces, TopAbs_FACE);
+
+ for (; anExp.More(); anExp.Next()) {
+ TopoDS_Face aConeFace = TopoDS::Face(anExp.Current());
+
+ if (aConeFace.IsNull() == Standard_False) {
+ aFaces.Append(aConeFace);
+ }
+ }
+ }
+ }
+ }
+
+ // Create a group of internal faces.
+ if (aFaces.IsEmpty() == Standard_False) {
+ Handle(GEOM_Object) aGroup = myGroupOperations->CreateGroup(theShape, TopAbs_FACE);
+
+ if (aGroup.IsNull() == Standard_False) {
+ aGroup->GetLastFunction()->SetDescription("");
+ aGroup->SetName("INTERNAL_FACES");
+
+ TopTools_IndexedMapOfShape anIndices;
+ Handle(TColStd_HSequenceOfInteger) aSeqIDs = new TColStd_HSequenceOfInteger;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ TopTools_ListIteratorOfListOfShape anIter(aFaces);
+
+ for (; anIter.More(); anIter.Next()) {
+ const TopoDS_Shape &aFace = anIter.Value();
+ const Standard_Integer anIndex = anIndices.FindIndex(aFace);
+
+ if (anIndex > 0) {
+ aSeqIDs->Append(anIndex);
+ }
+ }
+
+ myGroupOperations->UnionIDs(aGroup, aSeqIDs);
+ aGroup->GetLastFunction()->SetDescription("");
+ theSeq->Append(aGroup);
+ }
+ }
+
+ SetErrorCode(OK);
+
+ return true;
+}
+
+bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) theShape,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW,
+ double theRF, bool isNormal)
+{
+ SetErrorCode(KO);
+
+ // Build tools for partition operation:
+ // 1 face and 2 planes
+ // Face
+ Handle(GEOM_Object) arete_intersect_int;
+ Handle(GEOM_Object) wire_t, wire_t2, face_t, face_t2;
+ Handle(GEOM_Object) chan_racc;
+ Handle(GEOM_Object) vi1, vi2;
+ Handle(GEOM_Object) Te3;
+
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ Handle(GEOM_Object) Vector_Z = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+ Vector_Z->GetLastFunction()->SetDescription("");
+
+ // Useful values
+ double aSize = 2*(theL1 + theL2);
+ double aR1Ext = theR1 + theW1;
+ double aR2Ext = theR2 + theW2;
+ double theVertCylinderRadius = aR2Ext + theW + theRF;
+ double theHoriCylinderRadius = aR1Ext + theH + theRF;
+
+ // Common edges on internal cylinder
+ Handle(GEOM_Object) box_i = my3DPrimOperations->MakeBoxDXDYDZ(theR2, theR2, theR1);
+ box_i->GetLastFunction()->SetDescription("");
+ box_i = myTransformOperations->TranslateDXDYDZ(box_i, -theR2, -theR2, 0);
+ box_i->GetLastFunction()->SetDescription("");
+
+ Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ TCollection_AsciiString theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) edges_i =
+ myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+ if (edges_i.IsNull() || edges_i->Length() == 0) {
+ SetErrorCode("Internal edges not found");
+ return false;
+ }
+ for (int i=1; i<=edges_i->Length();i++) {
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_i->Value(i));
+ anObj->GetLastFunction()->SetDescription("");
+ }
+ arete_intersect_int = Handle(GEOM_Object)::DownCast(edges_i->Value(1));
+
+ // search for vertices located on both internal pipes
+ aFunction = theShape->GetLastFunction();
+ theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) vertices_i =
+ myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+ if (vertices_i.IsNull() || vertices_i->Length() == 0) {
+ SetErrorCode("Internal vertices not found");
+ return false;
+ }
+
+ for (int i = 1; i <= vertices_i->Length(); i++) {
+ Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_i->Value(i));
+ v->GetLastFunction()->SetDescription("");
+ TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
+ gp_Pnt aP = BRep_Tool::Pnt(aVertex);
+// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
+ if (Abs(aP.X()) <= Precision::Confusion()) {
+ if (Abs(aP.Y()) - theR1 <= Precision::Confusion()) {
+ vi1 = v;
+ }
+ } else if (Abs(aP.Y()) <= Precision::Confusion()) {
+ if (Abs(aP.X()) - theR1 <= Precision::Confusion()) {
+ vi2 = v;
+ }
+ }
+ }
+
+ std::list<Handle(GEOM_Object)> theShapes;
+
+ if (isNormal) {
+ Handle(GEOM_Object) ve1, ve2;
+
+ Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ(aR2Ext, aR2Ext, aR1Ext);
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ(box_e, -aR2Ext, -aR2Ext, 0);
+ box_e->GetLastFunction()->SetDescription("");
+ // Common edges on external cylinder
+ aFunction = theShape->GetLastFunction();
+ theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) edges_e =
+ myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return false;
+ }
+ for (int i=1; i<=edges_e->Length();i++) {
+ Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
+ anObj->GetLastFunction()->SetDescription("");
+ }
+
+ // search for vertices located on both external pipes
+ aFunction = theShape->GetLastFunction();
+ theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) vertices_e =
+ myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+ if (vertices_e.IsNull() || vertices_e->Length() == 0) {
+ SetErrorCode("External vertices not found");
+ return false;
+ }
+
+ for (int i = 1; i <= vertices_e->Length(); i++) {
+ Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_e->Value(i));
+ v->GetLastFunction()->SetDescription("");
+ TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
+ gp_Pnt aP = BRep_Tool::Pnt(aVertex);
+// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
+ if (Abs(aP.X()) <= Precision::Confusion()) {
+ if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
+ ve1 = v;
+ }
+ } else if (Abs(aP.Y()) <= Precision::Confusion()) {
+ if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
+ ve2 = v;
+ }
+ }
+ if ( !ve1.IsNull() && !ve2.IsNull())
+ break;
+ }
+ Handle(GEOM_Object) edge_e1, edge_e2;
+
+ edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1);
+ if (edge_e1.IsNull()) {
+ SetErrorCode("Edge 1 could not be built");
+ return false;
+ }
+
+ edge_e2 = myBasicOperations->MakeLineTwoPnt(ve2, vi2);
+ if (edge_e2.IsNull()) {
+ SetErrorCode("Edge 2 could not be built");
+ return false;
+ }
+
+ edge_e1->GetLastFunction()->SetDescription("");
+ edge_e2->GetLastFunction()->SetDescription("");
+
+ std::list<Handle(GEOM_Object)> edge_e_elist;
+ edge_e_elist.push_back(arete_intersect_int);
+ edge_e_elist.push_back(edge_e1);
+ edge_e_elist.push_back(Handle(GEOM_Object)::DownCast(edges_e->Value(1)));
+ edge_e_elist.push_back(edge_e2);
+ wire_t = myShapesOperations->MakeWire(edge_e_elist, 1e-7);
+ if (wire_t.IsNull()) {
+ SetErrorCode("Impossible to build wire");
+ return false;
+ }
+ wire_t->GetLastFunction()->SetDescription("");
+ face_t = myShapesOperations->MakeFace(wire_t, false);
+ if (face_t.IsNull()) {
+ SetErrorCode("Impossible to build face");
+ return false;
+ }
+ face_t->GetLastFunction()->SetDescription("");
+
+ theShapes.push_back(theShape);
+ theShapes.push_back(vi1);
+ theShapes.push_back(vi2);
+ theShapes.push_back(ve1);
+ theShapes.push_back(ve2);
+ theShapes.push_back(edge_e1);
+ theShapes.push_back(edge_e2);
+ theShapes.push_back(wire_t);
+ theShapes.push_back(face_t);
+ }
+ else {
+ Handle(GEOM_Object) P1, P2, P3, P4, P5, P6;
+ int idP1, idP2, idP3, idP4;
+ int PZX, PZY;
+ double ZX=0, ZY=0;
+ std::vector<int> LX;
+ std::vector<int> LY;
+ Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ
+ (theVertCylinderRadius, theVertCylinderRadius, theHoriCylinderRadius);
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ
+ (box_e, -theVertCylinderRadius, -theVertCylinderRadius, 0);
+ box_e->GetLastFunction()->SetDescription("");
+
+ aFunction = theShape->GetLastFunction();
+ theDesc = aFunction->GetDescription();
+ Handle(TColStd_HSequenceOfTransient) extremVertices =
+ myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
+ // Recover previous description to get rid of Propagate dump
+ aFunction->SetDescription(theDesc);
+
+ if (extremVertices.IsNull() || extremVertices->Length() == 0) {
+ if (theRF == 0)
+ SetErrorCode("Vertices on chamfer not found");
+ else
+ SetErrorCode("Vertices on fillet not found");
+ return false;
+ }
+
+ theShapes.push_back(theShape);
+ theShapes.push_back(box_e);
+ if (extremVertices->Length() != 6) {
+ // for (int i=1; i<=extremVertices->Length(); i++){
+ // theShapes.push_back(Handle(GEOM_Object)::DownCast(extremVertices->Value(i)));
+ // }
+ // Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes);
+ // TopoDS_Shape aCompoundShape = aCompound->GetValue();
+ // theShape->GetLastFunction()->SetValue(aCompoundShape);
+ SetErrorCode("Bad number of vertices on chamfer found");
+ return false;
+ }
+
+ for (int i=1; i<=extremVertices->Length(); i++){
+ Handle(GEOM_Object) aV = Handle(GEOM_Object)::DownCast(extremVertices->Value(i));
+ aV->GetLastFunction()->SetDescription("");
+ gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aV->GetValue()));
+
+ if (Abs(aP.X()) <= Precision::Confusion()) {
+ if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
+ LX.push_back(i);
+ if (aP.Z()-ZX > Precision::Confusion()) {
+ ZX = aP.Z();
+ PZX = i;
+ }
+ }
+ }
+ else {
+ if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
+ LY.push_back(i);
+ if (aP.Z() - ZY > Precision::Confusion()) {
+ ZY = aP.Z();
+ PZY = i;
+ }
+ }
+ }
+ }
+
+ idP2 = PZX;
+ idP4 = PZY;
+ idP1 = LX.at(0);
+ if (LX.at(0) == PZX)
+ idP1 = LX.at(1);
+ idP3 = LY.at(0);
+ if (LY.at(0) == PZY)
+ idP3 = LY.at(1);
+
+ P1 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP1));
+ P2 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP2));
+ P3 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP3));
+ P4 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP4));
+
+ Handle(GEOM_Object) Cote_1 = myBasicOperations->MakeLineTwoPnt(P1, vi1);
+ if (Cote_1.IsNull()) {
+ SetErrorCode("Impossible to build edge in thickness");
+ return false;
+ }
+ Cote_1->GetLastFunction()->SetDescription("");
+
+ Handle(GEOM_Object) Cote_2 = myBasicOperations->MakeLineTwoPnt(vi2, P3);
+ if (Cote_2.IsNull()) {
+ SetErrorCode("Impossible to build edge in thickness");
+ return false;
+ }
+ Cote_2->GetLastFunction()->SetDescription("");
+
+ // edge_chan_princ = arete du chanfrein (ou raccord) sur le tuyau principal
+ // edge_chan_inc = arete du chanfrein (ou raccord) sur le tuyau incident
+ // std::cerr << "Getting chamfer edge on main pipe" << std::endl;
+ Handle(GEOM_Object) edge_chan_princ = myBlocksOperations->GetEdge(theShape, P1, P3);
+ if (edge_chan_princ.IsNull()) {
+ SetErrorCode("Impossible to find edge on main pipe");
+ return false;
+ }
+ edge_chan_princ->GetLastFunction()->SetDescription("");
+
+ Handle(GEOM_Object) edge_chan_inc = myBlocksOperations->GetEdge(theShape, P2, P4);
+ if (edge_chan_inc.IsNull()) {
+ SetErrorCode("Impossible to find edge on incident pipe");
+ return false;
+ }
+ edge_chan_inc->GetLastFunction()->SetDescription("");
+
+ std::list<Handle(GEOM_Object)> edgeList1;
+ edgeList1.push_back(edge_chan_princ);
+ edgeList1.push_back(Cote_1);
+ edgeList1.push_back(arete_intersect_int);
+ edgeList1.push_back(Cote_2);
+
+ // std::cerr << "Creating wire 1" << std::endl;
+ wire_t = myShapesOperations->MakeWire(edgeList1, 1e-7);
+ if (wire_t.IsNull()) {
+ SetErrorCode("Impossible to build wire");
+ return false;
+ }
+ wire_t->GetLastFunction()->SetDescription("");
+
+ // std::cerr << "Creating face 1" << std::endl;
+ face_t = myShapesOperations->MakeFace(wire_t, false);
+ if (face_t.IsNull()) {
+ SetErrorCode("Impossible to build face");
+ return false;
+ }
+ face_t->GetLastFunction()->SetDescription("");
+ theShapes.push_back(face_t);
+
+ gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue()));
+ gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue()));
+ double deltaZ = aP2.Z() - aP5.Z();
+ // std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl;
+ Handle(GEOM_Object) P5bis = myTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ);
+ if (P5bis.IsNull()) {
+ SetErrorCode("Impossible to translate vertex");
+ return false;
+ }
+ P5bis->GetLastFunction()->SetDescription("");
+
+ gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue()));
+ gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue()));
+ deltaZ = aP4.Z() - aP6.Z();
+ // std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl;
+ Handle(GEOM_Object) P6bis = myTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ);
+ if (P6bis.IsNull()) {
+ SetErrorCode("Impossible to translate vertex");
+ return false;
+ }
+ P6bis->GetLastFunction()->SetDescription("");
+
+ // std::cerr << "Creating new line 1 from 2 previous points" << std::endl;
+ Handle(GEOM_Object) Cote_3 = myBasicOperations->MakeLineTwoPnt(P5bis, P2);
+ if (Cote_3.IsNull()) {
+ SetErrorCode("Impossible to build edge in thickness");
+ return false;
+ }
+ Cote_3->GetLastFunction()->SetDescription("");
+
+ // std::cerr << "Creating new line 2 from 2 previous points" << std::endl;
+ Handle(GEOM_Object) Cote_4 = myBasicOperations->MakeLineTwoPnt(P6bis, P4);
+ if (Cote_4.IsNull()) {
+ SetErrorCode("Impossible to build edge in thickness");
+ return false;
+ }
+ Cote_4->GetLastFunction()->SetDescription("");
+
+ // std::cerr << "Creating new line 3 from 2 previous points" << std::endl;
+ Handle(GEOM_Object) Cote_5 = myBasicOperations->MakeLineTwoPnt(P5bis, P6bis);
+ if (Cote_4.IsNull()) {
+ SetErrorCode("Impossible to build edge in thickness");
+ return false;
+ }
+ Cote_5->GetLastFunction()->SetDescription("");
+
+ //std::list<Handle(GEOM_Object)> edgeList2;
+ //edgeList2.push_back(edge_chan_inc);
+ //edgeList2.push_back(Cote_3);
+ //edgeList2.push_back(Cote_5);
+ //edgeList2.push_back(Cote_4);
+ // std::cerr << "Creating wire 2" << std::endl;
+ //wire_t2 = myShapesOperations->MakeWire(edgeList2, 1e-7);
+ //if (wire_t2.IsNull()) {
+ // SetErrorCode("Impossible to build wire");
+ // return false;
+ //}
+ //wire_t2->GetLastFunction()->SetDescription("");
+ // std::cerr << "Creating face 2" << std::endl;
+ //face_t2 = myShapesOperations->MakeFace(wire_t2, false);
+
+ // Mantis issue 0021682
+ face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - (theR2 + theW2));
+ //face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - 2.0*theR2);
+ if (face_t2.IsNull()) {
+ SetErrorCode("Impossible to build face");
+ return false;
+ }
+ face_t2->GetLastFunction()->SetDescription("");
+ theShapes.push_back(face_t2);
+ }
+
+ // Planes
+ Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0);
+ Handle(GEOM_Object) aVZ = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
+ Handle(GEOM_Object) aVXZ = myBasicOperations->MakeVectorDXDYDZ(aR1Ext, 0, 0.5*(theL1+theVertCylinderRadius));
+ Handle(GEOM_Object) aPlnOZ = myBasicOperations->MakePlanePntVec(aP0, aVZ, aSize);
+ Handle(GEOM_Object) aPlnOXZ = myBasicOperations->MakePlanePntVec(aP0, aVXZ, aSize);
+ aP0->GetLastFunction()->SetDescription("");
+ aVZ->GetLastFunction()->SetDescription("");
+ aVXZ->GetLastFunction()->SetDescription("");
+ aPlnOZ->GetLastFunction()->SetDescription("");
+ aPlnOXZ->GetLastFunction()->SetDescription("");
+ theShapes.push_back(aPlnOZ);
+ theShapes.push_back(aPlnOXZ);
+
+ // Partition
+ Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient;
+ Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient;
+ Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient;
+ Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient;
+ Handle(TColStd_HArray1OfInteger) theMaterials;
+
+ partitionShapes->Append(theShape);
+ theTools->Append(aPlnOZ);
+ if (Abs(aR1Ext - aR2Ext) > Precision::Confusion())
+ theTools->Append(aPlnOXZ);
+ theTools->Append(face_t);
+ if (!isNormal)
+ theTools->Append(face_t2);
+
+ Te3 = myBooleanOperations->MakePartition
+ (partitionShapes, theTools, theKeepInside, theRemoveInside,
+ TopAbs_SOLID, false, theMaterials, 0, false);
+ if (Te3.IsNull()) {
+ SetErrorCode("Impossible to build partition of TShape");
+ return false;
+ }
+ Te3->GetLastFunction()->SetDescription("");
+
+ // Last verification: result should be a block
+ std::list<GEOMImpl_IBlocksOperations::BCError> errList;
+ if (!myBlocksOperations->CheckCompoundOfBlocks(Te3,errList)) {
+ SetErrorCode("TShape is not a compound of block");
+ return false;
+ }
+
+// // BEGIN Compound of created shapes - Only for debug purpose
+// theShapes.clear();
+// theShapes.push_back(theShape);
+// theShapes.push_back(aPlnOZ);
+// if (Abs(aR1Ext - aR2Ext) > Precision::Confusion() )
+// theShapes.push_back(aPlnOXZ);
+// theShapes.push_back(face_t);
+// if (!isNormal)
+// theShapes.push_back(face_t2);
+//
+// Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes);
+// TopoDS_Shape aCompoundShape = aCompound->GetValue();
+// theShape->GetLastFunction()->SetValue(aCompoundShape);
+// // END Compound of created shapes - Only for debug purpose
+
+ TopoDS_Shape aShape = Te3->GetValue();
+ theShape->GetLastFunction()->SetValue(aShape);
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return false;
+ }
+
+ SetErrorCode(OK);
+ return true;
+}
+
+// Mirror and glue faces
+bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2)
+{
+ SetErrorCode(KO);
+
+ // Useful values
+ double aSize = 2*(theL1 + theL2);
+ double aR1Ext = theR1 + theW1;
+
+ // Planes
+ Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0);
+ aP0->GetLastFunction()->SetDescription("");
+ Handle(GEOM_Object) aVX = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
+ Handle(GEOM_Object) aVY = myBasicOperations->MakeVectorDXDYDZ(0, 1, 0);
+ aVX->GetLastFunction()->SetDescription("");
+ aVY->GetLastFunction()->SetDescription("");
+ Handle(GEOM_Object) aPlane_OX = myBasicOperations->MakePlanePntVec(aP0, aVX, 2*(aR1Ext + theL2));
+ Handle(GEOM_Object) aPlane_OY = myBasicOperations->MakePlanePntVec(aP0, aVY, aSize);
+ aPlane_OX->GetLastFunction()->SetDescription("");
+ aPlane_OY->GetLastFunction()->SetDescription("");
+
+ Handle(GEOM_Object) Te4 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OX);
+ if (Te4.IsNull()) {
+ SetErrorCode("Impossible to build mirror of quarter TShape");
+ return false;
+ }
+
+ Handle(GEOM_Object) Te5 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OY);
+ if (Te5.IsNull()) {
+ SetErrorCode("Impossible to build mirror of half TShape");
+ return false;
+ }
+
+ Handle(GEOM_Object) Te6 = myTransformOperations->MirrorPlaneCopy(Te4, aPlane_OY);
+ if (Te6.IsNull()) {
+ SetErrorCode("Impossible to build mirror of half TShape");
+ return false;
+ }
+
+ std::list<Handle(GEOM_Object)> aShapesList;
+ aShapesList.push_back(theShape);
+ aShapesList.push_back(Te4);
+ aShapesList.push_back(Te5);
+ aShapesList.push_back(Te6);
+ Handle(GEOM_Object) Te7 = myShapesOperations->MakeCompound(aShapesList);
+ if (Te7.IsNull()) {
+ SetErrorCode("Impossible to build compound");
+ return false;
+ }
+
+ // Copy source shape
+ TopoDS_Shape aShapeCopy;
+ TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
+ TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
+
+ Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
+ if (Te8.IsNull()) {
+ SetErrorCode("Impossible to glue faces of TShape");
+ return false;
+ }
+
+ TopoDS_Shape aShape = Te8->GetValue();
+ BRepCheck_Analyzer anAna (aShape, Standard_True);
+
+ if (!anAna.IsValid()) {
+ // Try to do gluing with the tolerance equal to maximal
+ // tolerance of vertices of the source shape.
+ Standard_Real aTolMax = -RealLast();
+
+ for (TopExp_Explorer ExV (aShapeCopy, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(ExV.Current());
+ Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+
+ if (aTol > aTolMax) {
+ aTolMax = aTol;
+ }
+ }
+
+ // Perform gluing
+ Te7->GetLastFunction()->SetValue(aShapeCopy);
+ Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
+
+ if (Te8.IsNull()) {
+ SetErrorCode("Impossible to glue faces of TShape");
+ return false;
+ }
+
+ aShape = Te8->GetValue();
+ }
+
+
+ theShape->GetLastFunction()->SetValue(aShape);
+
+ Te4->GetLastFunction()->SetDescription("");
+ Te5->GetLastFunction()->SetDescription("");
+ Te6->GetLastFunction()->SetDescription("");
+ Te7->GetLastFunction()->SetDescription("");
+ Te8->GetLastFunction()->SetDescription("");
+
+ SetErrorCode(OK);
+ return true;
+}
+
+//=======================================================================
+//function : MakePipeTShapeThicknessReduction
+//purpose : Static method. Add thiskness reduction elements at the three
+// open ends of the T-Shape.
+//=======================================================================
+TopoDS_Shape GEOMImpl_IAdvancedOperations::MakePipeTShapeThicknessReduction
+ (TopoDS_Shape theShape,
+ double r1, double w1, double l1,
+ double r2, double w2, double l2,
+ double rL, double wL, double ltransL, double lthinL,
+ double rR, double wR, double ltransR, double lthinR,
+ double rI, double wI, double ltransI, double lthinI,
+ bool fuseReductions)
+{
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ //
+ // ---------------------.
+ // W \
+ // ---------------------. \
+ // ^ \ '-----------------.
+ // |R \ Wthin |
+ // | '-----------------'
+ // v Rthin
+ // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--
+ // Ltrans Lthin
+
+ TopoDS_Shape aResult = theShape;
+ double aTol = Precision::Confusion();
+
+ gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
+
+ // Left reduction (rL, wL, ltransL, lthinL)
+ if (rL > aTol && wL > aTol && ltransL > aTol) {
+ gp_Pnt aPLeft (-l1, 0, 0);
+ gp_Ax2 anAxesLeft (aPLeft, -aVX, aVZ);
+ TopoDS_Shape aReductionLeft = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
+ (anAxesLeft, r1, w1, rL, wL, ltransL, lthinL, fuseReductions);
+
+ if (fuseReductions) {
+ BRepAlgoAPI_Fuse fuseL (aResult, aReductionLeft);
+ if (!fuseL.IsDone())
+ StdFail_NotDone::Raise("Cannot fuse Te with left reduction");
+ aResult = fuseL.Shape();
+ }
+ else {
+ BRep_Builder B;
+ TopoDS_Compound C;
+ B.MakeCompound(C);
+ B.Add(C, aResult);
+ B.Add(C, aReductionLeft);
+ aResult = C;
+ }
+ }
+
+ // Right reduction
+ if (rR > aTol && wR > aTol && ltransR > aTol) {
+ gp_Pnt aPRight (l1, 0, 0);
+ gp_Ax2 anAxesRight (aPRight, aVX, aVZ);
+ TopoDS_Shape aReductionRight = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
+ (anAxesRight, r1, w1, rR, wR, ltransR, lthinR, fuseReductions);
+
+ if (fuseReductions) {
+ BRepAlgoAPI_Fuse fuseR (aResult, aReductionRight);
+ if (!fuseR.IsDone())
+ StdFail_NotDone::Raise("Cannot fuse Te with right reduction");
+ aResult = fuseR.Shape();
+ }
+ else {
+ BRep_Builder B;
+ TopoDS_Compound C;
+ B.MakeCompound(C);
+ B.Add(C, aResult);
+ B.Add(C, aReductionRight);
+ aResult = C;
+ }
+ }
+
+ // Incident reduction
+ if (rI > aTol && wI > aTol && ltransI > aTol) {
+ gp_Pnt aPInci (0, 0, l2);
+ gp_Ax2 anAxesInci (aPInci, aVZ, aVX);
+ TopoDS_Shape aReductionInci = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
+ (anAxesInci, r2, w2, rI, wI, ltransI, lthinI, fuseReductions);
+
+ if (fuseReductions) {
+ BRepAlgoAPI_Fuse fuseInci (aResult, aReductionInci);
+ if (!fuseInci.IsDone())
+ StdFail_NotDone::Raise("Cannot fuse Te with incident reduction");
+ aResult = fuseInci.Shape();
+ }
+ else {
+ BRep_Builder B;
+ TopoDS_Compound C;
+ B.MakeCompound(C);
+ B.Add(C, aResult);
+ B.Add(C, aReductionInci);
+ aResult = C;
+ }
+ }
+
+ // Get rid of extra compounds
+ TopTools_ListOfShape listShapeRes;
+ GEOMUtils::AddSimpleShapes(aResult, listShapeRes);
+ aResult = listShapeRes.First(); // useful for the case "fuseReductions == true"
+
+ if (!fuseReductions && listShapeRes.Extent() > 1) {
+ // Simplify T-Shape compound (get rid of sub-compounds) and glue duplicated faces
+ BRep_Builder B;
+ TopoDS_Compound C;
+ B.MakeCompound(C);
+
+ TopTools_ListIteratorOfListOfShape itSub (listShapeRes);
+ for (; itSub.More(); itSub.Next())
+ B.Add(C, itSub.Value());
+
+ // GlueFaces
+ aResult = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
+ }
+
+ return aResult;
+}
+
+//=======================================================================
+//function : MakeThicknessReduction
+//purpose : Static method. Create one thickness reduction element.
+//=======================================================================
+TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeThicknessReduction (gp_Ax2 theAxes,
+ const double R, const double W,
+ const double Rthin, const double Wthin,
+ const double Ltrans, const double Lthin,
+ bool fuse)
+{
+ double aTol = Precision::Confusion();
+ if (Rthin < aTol || Wthin < aTol || Ltrans < aTol) {
+ StdFail_NotDone::Raise("Cannot build thickness reduction: too small values");
+ }
+ bool isThinPart = (Lthin > aTol);
+
+ // .
+ // W |\
+ // . \
+ // ^ \ '-----------------.
+ // |R \| | Wthin
+ // | '-----------------'
+ // v Rthin
+ // --.--.--.--.--.--.--.--.--.--.--.--.--> theAxes.Direction()
+ // Ltrans Lthin
+
+ double RExt = R + W;
+ double RthinExt = Rthin + Wthin;
+
+ gp_Dir aNormal = theAxes.Direction();
+ gp_Dir anXDir = theAxes.XDirection();
+ gp_Pnt aPntCyl (theAxes.Location().XYZ() + aNormal.XYZ()*Ltrans);
+ gp_Ax2 anAxesCyl (aPntCyl, aNormal, anXDir);
+
+ // Build the transition part
+ BRepPrimAPI_MakeCone ConeExt (theAxes, RExt, RthinExt, Ltrans);
+ BRepPrimAPI_MakeCone ConeInt (theAxes, R, Rthin, Ltrans);
+ ConeExt.Build();
+ ConeInt.Build();
+ if (!ConeExt.IsDone() || !ConeInt.IsDone())
+ StdFail_NotDone::Raise("Cannot build cones of thickness reduction");
+ BRepAlgoAPI_Cut cut1 (ConeExt.Shape(), ConeInt.Shape());
+ if (!cut1.IsDone())
+ StdFail_NotDone::Raise("Coudn't build transition part of thickness reduction");
+ TopoDS_Shape aReduction = cut1.Shape();
+
+ // Build the thin part, if required
+ TopoDS_Shape aThinPart;
+ if (isThinPart) {
+ BRepPrimAPI_MakeCylinder CExt (anAxesCyl, RthinExt, Lthin);
+ BRepPrimAPI_MakeCylinder CInt (anAxesCyl, Rthin, Lthin);
+ CExt.Build();
+ CInt.Build();
+ if (!CExt.IsDone() || !CInt.IsDone())
+ StdFail_NotDone::Raise("Cannot build cylinders of thickness reduction");
+ BRepAlgoAPI_Cut cut2 (CExt.Shape(), CInt.Shape());
+ if (!cut2.IsDone())
+ StdFail_NotDone::Raise("Coudn't build thin part of thickness reduction");
+ aThinPart = cut2.Shape();
+ }
+
+ // Join parts
+ if (fuse) {
+ if (isThinPart) {
+ BRepAlgoAPI_Fuse fuse1 (aReduction, aThinPart);
+ if (!fuse1.IsDone())
+ StdFail_NotDone::Raise("Cannot fuse parts of thickness reduction");
+ aReduction = fuse1.Shape();
+ }
+ }
+ else {
+ // Partition the reduction on blocks
+ gp_Ax3 anAxesPln1 (aPntCyl, theAxes.XDirection(), aNormal);
+ gp_Ax3 anAxesPln2 (aPntCyl, theAxes.YDirection(), aNormal);
+ gp_Pln aPln1 (anAxesPln1);
+ gp_Pln aPln2 (anAxesPln2);
+ double aSize = Ltrans + Lthin + R + Rthin + Wthin; // to guarantee enough size in all directions
+ TopoDS_Shape aTool1 = BRepBuilderAPI_MakeFace(aPln1, -aSize, +aSize, -aSize, +aSize).Shape();
+ TopoDS_Shape aTool2 = BRepBuilderAPI_MakeFace(aPln2, -aSize, +aSize, -aSize, +aSize).Shape();
+
+ GEOMAlgo_Splitter PS;
+ PS.AddShape(aReduction);
+ if (isThinPart)
+ PS.AddShape(aThinPart);
+ PS.AddTool(aTool1);
+ PS.AddTool(aTool2);
+ PS.SetLimit(TopAbs_SOLID);
+ PS.Perform();
+
+ aReduction = PS.Shape();
+ }
+
+ return aReduction;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShape
+ * \brief 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh)
+{
+ 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);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //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;
+ }
+
+ if (isTRL || isTRR || isTRI) {
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ 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);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., aSeq, gp_Trsf()))
+ return NULL;
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, gp_Trsf())) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShape("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theHexMesh;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length).
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups..
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition
+ (double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3)
+{
+ SetErrorCode(KO);
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
+ /////////////////
+ // TSHAPE CODE
+ /////////////////
+ //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;
+
+ // Check new position
+ if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+ 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);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //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;
+ }
+
+ if (isTRL || isTRR || isTRI) {
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ TopoDS_Shape Te = aShape->GetValue();
+
+ // Set Position
+ gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+ BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False);
+ TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+ aFunction->SetValue(aTrsf_Shape);
+
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ aSeq->Append(aShape);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., aSeq, aTrsf)) {
+ return NULL;
+ }
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, aTrsf)) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShape("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeChamfer
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of chamfer.
+ * \param theW Width of chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer
+ (double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theH, double theW,
+ bool theHexMesh)
+{
+ 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_CHAMFER);
+ 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.SetH(theH);
+ aData.SetW(theW);
+ aData.SetHexMesh(theHexMesh);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //Compute the resulting value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("TShape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // BEGIN of chamfer
+ TopoDS_Shape aShapeShape = aShape->GetValue();
+ TopTools_IndexedMapOfShape anEdgesIndices;
+ TopExp::MapShapes(aShapeShape, anEdgesIndices);
+ // Common edges on external cylinders
+ Handle(GEOM_Object) box_e;
+ if (theHexMesh) {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+ }
+ else {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+ }
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+ box_e->GetLastFunction()->SetDescription("");
+
+ Handle(TColStd_HSequenceOfInteger) edges_e =
+ myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ box_e->GetLastFunction()->SetDescription("");
+
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return NULL;
+ }
+ int nbEdgesInChamfer = 0;
+ std::list<int> theEdges;
+ for (int i=1; i<=edges_e->Length();i++) {
+ int edgeID = edges_e->Value(i);
+ TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+ TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+ int iv=0;
+ while (Ex.More()) {
+ iv ++;
+ gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+ nbEdgesInChamfer ++;
+ theEdges.push_back(edgeID);
+ }
+ Ex.Next();
+ }
+ if (theHexMesh && nbEdgesInChamfer == 1)
+ break;
+ }
+ Handle(GEOM_Object) aChamfer;
+ try {
+ aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+ if (aChamfer.IsNull()) {
+ SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
+ return NULL;
+ }
+ aChamfer->GetLastFunction()->SetDescription("");
+
+ TopoDS_Shape aChamferShape = aChamfer->GetValue();
+ aFunction->SetValue(aChamferShape);
+ // END of chamfer
+
+ if (theHexMesh) {
+ if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false))
+ return NULL;
+ if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+ return NULL;
+ }
+
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (isTRL || isTRR || isTRI) {
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ 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);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2,
+ theH, theW, 0., aSeq, gp_Trsf()))
+ return NULL;
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, gp_Trsf())) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theH << ", " << theW << ", " << theHexMesh;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeChamferWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of chamfer.
+ * \param theW Width of chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition
+ (double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theH, double theW,
+ bool theHexMesh,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3)
+{
+ 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_CHAMFER);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+ // Check new position
+ if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+ 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.SetH(theH);
+ aData.SetW(theW);
+ aData.SetHexMesh(theHexMesh);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //Compute the resulting value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("TShape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // BEGIN of chamfer
+ TopoDS_Shape aShapeShape = aShape->GetValue();
+ TopTools_IndexedMapOfShape anEdgesIndices;
+ TopExp::MapShapes(aShapeShape, anEdgesIndices);
+ // Common edges on external cylinders
+ Handle(GEOM_Object) box_e;
+ if (theHexMesh) {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+ }
+ else {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+ }
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+ box_e->GetLastFunction()->SetDescription("");
+
+ Handle(TColStd_HSequenceOfInteger) edges_e =
+ myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ box_e->GetLastFunction()->SetDescription("");
+
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return NULL;
+ }
+ int nbEdgesInChamfer = 0;
+ std::list<int> theEdges;
+ for (int i=1; i<=edges_e->Length();i++) {
+ int edgeID = edges_e->Value(i);
+ TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+ TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+ while (Ex.More()) {
+ gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+ nbEdgesInChamfer ++;
+ theEdges.push_back(edgeID);
+ }
+ Ex.Next();
+ }
+ if (theHexMesh && nbEdgesInChamfer == 1)
+ break;
+ }
+ Handle(GEOM_Object) aChamfer;
+ try {
+ aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+ if (aChamfer.IsNull()) {
+ SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
+ return NULL;
+ }
+ aChamfer->GetLastFunction()->SetDescription("");
+
+ TopoDS_Shape aChamferShape = aChamfer->GetValue();
+ aFunction->SetValue(aChamferShape);
+ // END of chamfer
+
+ if (theHexMesh) {
+ if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false))
+ return NULL;
+ if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+ return NULL;
+ }
+
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (isTRL || isTRR || isTRI) {
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // Set Position
+ gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+ BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), aTrsf, Standard_False);
+ TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+ aFunction->SetValue(aTrsf_Shape);
+
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ aSeq->Append(aShape);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2,
+ theH, theW, 0., aSeq, aTrsf))
+ return NULL;
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, aTrsf)) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theH << ", " << theW << ", " << theHexMesh << ", "
+ << theP1 << ", " << theP2 << ", " << theP3;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeFillet
+ * 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.
+ * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet
+ (double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theRF, bool theHexMesh)
+{
+ 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_FILLET);
+ 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.SetRF(theRF);
+ aData.SetHexMesh(theHexMesh);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //Compute the resulting value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("TShape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // BEGIN of fillet
+ TopoDS_Shape aShapeShape = aShape->GetValue();
+ TopTools_IndexedMapOfShape anEdgesIndices;
+ TopExp::MapShapes(aShapeShape, anEdgesIndices);
+ // Common edges on external cylinders
+ Handle(GEOM_Object) box_e;
+ if (theHexMesh) {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+ }
+ else {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+ }
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+ box_e->GetLastFunction()->SetDescription("");
+
+ Handle(TColStd_HSequenceOfInteger) edges_e =
+ myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ box_e->GetLastFunction()->SetDescription("");
+
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return NULL;
+ }
+ int nbEdgesInFillet = 0;
+ std::list<int> theEdges;
+ for (int i=1; i<=edges_e->Length();i++) {
+ int edgeID = edges_e->Value(i);
+ TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+ TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+ while (Ex.More()) {
+ gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+ nbEdgesInFillet ++;
+ theEdges.push_back(edgeID);
+ }
+ Ex.Next();
+ }
+ if (theHexMesh && nbEdgesInFillet == 1)
+ break;
+ }
+
+ Handle(GEOM_Object) aFillet;
+ try {
+ aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+ if (aFillet.IsNull()) {
+ //SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
+ SetErrorCode(myLocalOperations->GetErrorCode());
+ return NULL;
+ }
+ aFillet->GetLastFunction()->SetDescription("");
+
+ TopoDS_Shape aFilletShape = aFillet->GetValue();
+ aFunction->SetValue(aFilletShape);
+ // END of fillet
+
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (1)
+// the following block, when enabled, leads to partitioning problems
+#if 0
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (1)
+ // BEGIN: Limit tolerances (debug)
+ Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07);
+ TopoDS_Shape aCorr1Shape = aCorr1->GetValue();
+ aShape->GetLastFunction()->SetValue(aCorr1Shape);
+ aCorr1->GetLastFunction()->SetDescription("");
+ // END: Limit tolerances (debug)
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (2)
+#endif
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (2)
+
+ if (theHexMesh) {
+ if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
+ return NULL;
+ if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+ return NULL;
+ }
+
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (isTRL || isTRR || isTRI) {
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ 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);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., theRF, aSeq, gp_Trsf()))
+ return NULL;
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, gp_Trsf())) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theRF << ", " << theHexMesh;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeFilletWithPosition
+ * \brief 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition
+ (double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theRF, bool theHexMesh,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3)
+{
+ 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_FILLET);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
+
+ // Check new position
+ if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
+ 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.SetRF(theRF);
+ aData.SetHexMesh(theHexMesh);
+
+ bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
+ bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
+ bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
+
+ //Compute the resulting value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("TShape driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // BEGIN of fillet
+ TopoDS_Shape aShapeShape = aShape->GetValue();
+ TopTools_IndexedMapOfShape anEdgesIndices;
+ TopExp::MapShapes(aShapeShape, anEdgesIndices);
+ // Common edges on external cylinders
+ Handle(GEOM_Object) box_e;
+ if (theHexMesh) {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
+ }
+ else {
+ box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
+ }
+ box_e->GetLastFunction()->SetDescription("");
+ box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
+ box_e->GetLastFunction()->SetDescription("");
+
+ Handle(TColStd_HSequenceOfInteger) edges_e =
+ myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ box_e->GetLastFunction()->SetDescription("");
+
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ SetErrorCode("External edges not found");
+ return NULL;
+ }
+ int nbEdgesInFillet = 0;
+ std::list<int> theEdges;
+ for (int i=1; i<=edges_e->Length();i++) {
+ int edgeID = edges_e->Value(i);
+ TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
+ TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
+ while (Ex.More()) {
+ gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
+ if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
+ nbEdgesInFillet ++;
+ theEdges.push_back(edgeID);
+ }
+ Ex.Next();
+ }
+ if (theHexMesh && nbEdgesInFillet == 1)
+ break;
+ }
+
+ Handle(GEOM_Object) aFillet;
+ try {
+ aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+ if (aFillet.IsNull()) {
+ SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
+ return NULL;
+ }
+ aFillet->GetLastFunction()->SetDescription("");
+
+ TopoDS_Shape aFilletShape = aFillet->GetValue();
+ aFunction->SetValue(aFilletShape);
+ // END of fillet
+
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (3)
+// the following block, when enabled, leads to partitioning problems
+#if 0
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (3)
+ // BEGIN: Limit tolerances (debug)
+ Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07);
+ TopoDS_Shape aCorr1Shape = aCorr1->GetValue();
+ aShape->GetLastFunction()->SetValue(aCorr1Shape);
+ aCorr1->GetLastFunction()->SetDescription("");
+ // END: Limit tolerances (debug)
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (4)
+#endif
+// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (4)
+
+ if (theHexMesh) {
+ if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
+ return NULL;
+ if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
+ return NULL;
+ }
+
+ // Add thickness reduction elements
+ // at the three extremities: Left, Right and Incident
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (isTRL || isTRR || isTRI) {
+ TopoDS_Shape aResShape =
+ MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ !theHexMesh);
+ aFunction->SetValue(aResShape);
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ // Set Position
+ gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
+ BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), aTrsf, Standard_False);
+ TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
+ aFunction->SetValue(aTrsf_Shape);
+
+ Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
+ aSeq->Append(aShape);
+
+ try {
+ if (theHexMesh) {
+ // Get the groups
+ if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., theRF, aSeq, aTrsf))
+ return NULL;
+ }
+
+ // Get internal group.
+ if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
+ theRR, theLtransR, theRI, theLtransI,
+ aSeq, aTrsf)) {
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aListRes("[");
+ // Iterate over the sequence aSeq
+ Standard_Integer aNbGroups = aSeq->Length();
+ Standard_Integer i = 1;
+ 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);
+
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet("
+ << theR1 << ", " << theW1 << ", " << theL1 << ", "
+ << theR2 << ", " << theW2 << ", " << theL2 << ", "
+ << theRF << ", " << theHexMesh << ", "
+ << theP1 << ", " << theP2 << ", " << theP3;
+
+ // thickness reduction
+ if (isTRL)
+ pd << ", theRL=" << theRL << ", theWL=" << theWL
+ << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
+ if (isTRR)
+ pd << ", theRR=" << theRR << ", theWR=" << theWR
+ << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
+ if (isTRI)
+ pd << ", theRI=" << theRI << ", theWI=" << theWI
+ << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
+
+ pd << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
+//=============================================================================
+/*!
+ * This function allows to create a disk already divided into blocks. It can be
+ * used to create divided pipes for later meshing in hexaedra.
+ * \param theR Radius of the disk
+ * \param theRatio Relative size of the central square diagonal against the disk diameter
+ * \param theOrientation Plane on which the disk will be built
+ * \param thePattern The division pattern of the disk (hexagon or square in the center)
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio,
+ int theOrientation, int thePattern)
+{
+ SetErrorCode(KO);
+
+ if (theOrientation != 1 &&
+ theOrientation != 2 &&
+ theOrientation != 3)
+ {
+ SetErrorCode("theOrientation must be 1(=OXY), 2(=OYZ) or 3(=OZX)");
+ return NULL;
+ }
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
+
+ //Add a new shape function with parameters
+ Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_RATIO);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
+
+ GEOMImpl_IDividedDisk aData (aFunction);
+
+ aData.SetR(theR);
+ aData.SetRatio(theRatio);
+ aData.SetOrientation(theOrientation);
+ aData.SetType(thePattern);
+
+ //Compute the resulting value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("DividedDisk driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ std::string aPatternStr;
+
+ switch(thePattern)
+ {
+ case 0:
+ aPatternStr = "GEOM.SQUARE";
+ break;
+ case 1:
+ aPatternStr = "GEOM.HEXAGON";
+ break;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ", " << aPatternStr.c_str() << ")";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+
+//=============================================================================
+/*!
+ * This function allows to create a disk already divided into blocks. It can be
+ * used to create divided pipes for later meshing in hexaedra.
+ * \param theR Radius of the disk
+ * \param theRatio Relative size of the central square diagonal against the disk diameter
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
+ Handle(GEOM_Object) theVec,
+ double theR,
+ double theRatio,
+ int thePattern)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
+
+ //Add a new shape function with parameters
+ Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_VECTOR_PNT);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
+
+ GEOMImpl_IDividedDisk aData (aFunction);
+
+ Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
+ Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
+
+ if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
+
+ aData.SetCenter(aRefPnt);
+ aData.SetVector(aRefVec);
+
+ aData.SetR(theR);
+ aData.SetRatio(theRatio);
+ aData.SetType(thePattern);
+
+ //Compute the resulting value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("DividedDisk driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ std::string aPatternStr;
+
+ switch(thePattern)
+ {
+ case 0:
+ aPatternStr = "GEOM.SQUARE";
+ break;
+ case 1:
+ aPatternStr = "GEOM.HEXAGON";
+ break;
+ }
+
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDiskPntVecR(" << thePnt << ", " << theVec << ", " << theR << ", " << aPatternStr.c_str() << ")";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+
+//=============================================================================
+/*!
+ * Builds a cylinder prepared for hexa meshes
+ * \param theR Radius of the cylinder
+ * \param theH Height of the cylinder
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR,
+ double theH,
+ int thePattern)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER);
+
+ Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 67.0, 1, thePattern);
+ aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk
+
+ aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0);
+
+ Handle(GEOM_Function) aFunction = aShape->GetLastFunction();
+ aFunction->SetDescription(""); // Erase dump of MakePrismDXDYDZ
+ aShape->SetType(GEOM_DIVIDEDCYLINDER);
+
+ std::string aPatternStr;
+
+ switch(thePattern)
+ {
+ case 0:
+ aPatternStr = "GEOM.SQUARE";
+ break;
+ case 1:
+ aPatternStr = "GEOM.HEXAGON";
+ break;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedCylinder(" << theR << ", " << theH << ", " << aPatternStr.c_str() << ")";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+//=============================================================================
+/*!
+ * Create a smoothing surface from a set of points
+ * \param thelPoints list of points
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints)
+{
+ SetErrorCode(KO);
+
+ //Add a new object
+ Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_SMOOTHINGSURFACE);
+
+ //Add a new shape function with parameters
+ Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_SmoothingSurfaceDriver::GetID(), SMOOTHINGSURFACE_LPOINTS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_SmoothingSurfaceDriver::GetID()) return NULL;
+
+ GEOMImpl_ISmoothingSurface aData (aFunction);
+
+ int aLen = thelPoints.size();
+ aData.SetLength(aLen);
+ int ind = 1;
+ std::list<Handle(GEOM_Object)>::iterator it = thelPoints.begin();
+ for (; it != thelPoints.end(); it++, ind++) {
+ Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
+ if (aRefPnt.IsNull()) {
+ SetErrorCode("NULL point for bSplineFaceShape");
+ return NULL;
+ }
+ aData.SetPoint(ind, aRefPnt);
+ }
+
+
+ //Compute the resulting value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("SmoothingSurface driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << aShape << " = geompy.MakeSmoothingSurface([";
+ it = thelPoints.begin();
+ pd << (*it++);
+ while (it != thelPoints.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+
+ return aShape;
+}
+/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMImpl_IAdvancedOperations.hxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef _GEOMImpl_IAdvancedOperations_HXX_
+#define _GEOMImpl_IAdvancedOperations_HXX_
+
+#include <Utils_SALOME_Exception.hxx>
+#include "GEOM_IOperations.hxx"
+#include "GEOM_Engine.hxx"
+#include "GEOM_Object.hxx"
+
+#include <list>
+#include <gp_Ax2.hxx>
+
+class GEOMImpl_IBasicOperations;
+class GEOMImpl_IBooleanOperations;
+class GEOMImpl_IShapesOperations;
+class GEOMImpl_ITransformOperations;
+class GEOMImpl_IBlocksOperations;
+class GEOMImpl_I3DPrimOperations;
+class GEOMImpl_ILocalOperations;
+class GEOMImpl_IHealingOperations;
+class GEOMImpl_IGroupOperations;
+class Handle_Geom_Surface;
+class TopTools_ListOfShape;
+
+class GEOMImpl_IAdvancedOperations: public GEOM_IOperations {
+private:
+ bool MakePipeTShapePartition(Handle(GEOM_Object) theShape,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH = 0, double theW = 0,
+ double theRF = 0, bool isNormal = true);
+
+ bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2);
+
+ bool MakePipeTShapeThicknessReduction (Handle(GEOM_Object) theShape,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI);
+
+ bool MakeGroups(Handle(GEOM_Object) theShape, int shapType,
+ double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW, double theRF,
+ Handle(TColStd_HSequenceOfTransient) theSeq,
+ gp_Trsf aTrsf);
+
+ bool GetFacesOnSurf(const TopoDS_Shape &theShape,
+ const Handle_Geom_Surface& theSurface,
+ const Standard_Real theTolerance,
+ TopTools_ListOfShape &theFaces);
+
+ TopoDS_Shape MakeConicalFace(const gp_Ax2 &theAxis,
+ const double theRadius,
+ const double theRadiusThin,
+ const double theHeight,
+ const gp_Trsf &theTrsf);
+
+ bool MakeInternalGroup(const Handle(GEOM_Object) &theShape,
+ const double theR1, const double theLen1,
+ const double theR2, const double theLen2,
+ const double theRL, const double theTransLenL,
+ const double theRR, const double theTransLenR,
+ const double theRI, const double theTransLenI,
+ const Handle(TColStd_HSequenceOfTransient) &theSeq,
+ const gp_Trsf &theTrsf);
+
+ gp_Trsf GetPositionTrsf(double theL1, double theL2,
+ Handle(GEOM_Object) P1 = 0,
+ Handle(GEOM_Object) P2 = 0,
+ Handle(GEOM_Object) P3 = 0);
+
+ bool CheckCompatiblePosition(double& theL1, double& theL2,
+ Handle(GEOM_Object) theP1,
+ Handle(GEOM_Object) theP2,
+ Handle(GEOM_Object) theP3,
+ double theTolerance);
+
+private:
+ GEOMImpl_IBasicOperations* myBasicOperations;
+ GEOMImpl_IBooleanOperations* myBooleanOperations;
+ GEOMImpl_IShapesOperations* myShapesOperations;
+ GEOMImpl_ITransformOperations* myTransformOperations;
+ GEOMImpl_IBlocksOperations* myBlocksOperations;
+ GEOMImpl_I3DPrimOperations* my3DPrimOperations;
+ GEOMImpl_ILocalOperations* myLocalOperations;
+ GEOMImpl_IHealingOperations* myHealingOperations;
+ GEOMImpl_IGroupOperations* myGroupOperations;
+
+public:
+
+ /*!
+ * \brief Add three thickness reductions at the open ends of the pipe T-Shape
+ *
+ * \param theShape - the pipe T-Shape
+ * \param r1 - the internal radius of main pipe
+ * \param w1 - the thickness of main pipe
+ * \param l1 - the half-length of main pipe
+ * \param r2 - the internal radius of incident pipe
+ * \param w2 - the thickness of incident pipe
+ * \param l2 - the half-length of main pipe
+ * \param r*, w*, ltrans* and lthin* - internal radius, thickness, length of transition part
+ * and length of thin part of left(L), right(R) and
+ * incident(I) thickness reduction correspondingly
+ * \param fuseReductions - boolean flag (use true to generate single solid,
+ * false to obtain parts, useful for hexameshing)
+ * \retval TopoDS_Shape - Resulting shape
+ */
+ Standard_EXPORT static TopoDS_Shape MakePipeTShapeThicknessReduction
+ (TopoDS_Shape theShape,
+ double r1, double w1, double l1,
+ double r2, double w2, double l2,
+ double rL, double wL, double ltransL, double lthinL,
+ double rR, double wR, double ltransR, double lthinR,
+ double rI, double wI, double ltransI, double lthinI,
+ bool fuseReductions);
+
+ /*!
+ * \brief Create one thickness reduction element
+ *
+ * This method is called three times from MakePipeTShapeThicknessReduction
+ * to create three thickness reductions (one per each open end of a pipe T-Shape)
+ *
+ * \param theAxes - the position
+ * \param R - the internal radius of main pipe
+ * \param W - the thickness of main pipe
+ * \param Rthin - the internal radius of thin part
+ * \param Wthin - the thickness of thin part
+ * \param Ltrans - the length of transition part
+ * \param Lthin - the length of thin part
+ * \param fuse - boolean flag (use true to generate single solid,
+ * false to obtain parts, useful for hexameshing)
+ * \retval TopoDS_Shape - Resulting shape
+ */
+ Standard_EXPORT static TopoDS_Shape MakeThicknessReduction (gp_Ax2 theAxes,
+ const double R, const double W,
+ const double Rthin, const double Wthin,
+ const double Ltrans, const double Lthin,
+ bool fuse);
+
+public:
+ Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);
+ Standard_EXPORT ~GEOMImpl_IAdvancedOperations();
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShape(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh = true);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShapeWithPosition(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh = true,
+ Handle(GEOM_Object) P1 = 0,
+ Handle(GEOM_Object) P2 = 0,
+ Handle(GEOM_Object) P3 = 0);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theH, double theW,
+ bool theHexMesh = true);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theH, double theW,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ bool theHexMesh = true,
+ Handle(GEOM_Object) P1 = 0,
+ Handle(GEOM_Object) P2 = 0,
+ Handle(GEOM_Object) P3 = 0);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShapeFillet(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theRF, bool theHexMesh = true);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
+ MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1,
+ double theR2, double theW2, double theL2,
+ double theRL, double theWL, double theLtransL, double theLthinL,
+ double theRR, double theWR, double theLtransR, double theLthinR,
+ double theRI, double theWI, double theLtransI, double theLthinI,
+ double theRF, bool theHexMesh = true,
+ Handle(GEOM_Object) P1 = 0,
+ Handle(GEOM_Object) P2 = 0,
+ Handle(GEOM_Object) P3 = 0);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio,
+ int theOrientation, int thePattern);
+ Standard_EXPORT Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
+ Handle(GEOM_Object) theVec,
+ double theR,
+ double theRatio,
+ int thePattern);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR,
+ double theH,
+ int thePattern);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints);
+ /*@@ insert new functions before this line @@ do not remove this line @@*/
+};
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _GEOMImpl_IDividedDisk_HXX_
+#define _GEOMImpl_IDividedDisk_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define DIVIDEDDISK_ARG_R 1
+#define DIVIDEDDISK_ARG_RATIO 2
+#define DIVIDEDDISK_ARG_ORIENT 3
+
+#define DIVIDEDDISK_ARG_CENTER 4
+#define DIVIDEDDISK_ARG_VECTOR 5
+
+#define DIVIDEDDISK_ARG_TYPE 6
+
+class GEOMImpl_IDividedDisk
+{
+public:
+ GEOMImpl_IDividedDisk(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetR(double theR) { _func->SetReal(DIVIDEDDISK_ARG_R, theR); }
+ double GetR() { return _func->GetReal(DIVIDEDDISK_ARG_R); }
+
+ void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); }
+ double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); }
+
+ void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); }
+ int GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); }
+
+ void SetType(int theType) { _func->SetInteger(DIVIDEDDISK_ARG_TYPE, theType); }
+ int GetType() { return _func->GetInteger(DIVIDEDDISK_ARG_TYPE); }
+
+ void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DIVIDEDDISK_ARG_CENTER, theP); }
+ void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DIVIDEDDISK_ARG_VECTOR, theV); }
+
+ Handle(GEOM_Function) GetCenter() { return _func->GetReference(DIVIDEDDISK_ARG_CENTER); }
+ Handle(GEOM_Function) GetVector() { return _func->GetReference(DIVIDEDDISK_ARG_VECTOR); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_IDividedDisk_HXX_
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _GEOMImpl_IPipeTShape_HXX_
+#define _GEOMImpl_IPipeTShape_HXX_
+
+#include "GEOM_Function.hxx"
+
+#include <TColStd_HArray1OfReal.hxx>
+
+class GEOMImpl_IPipeTShape
+{
+public:
+ GEOMImpl_IPipeTShape(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetR1(double theR1) { _func->SetReal(TSHAPE_ARG_R1, theR1); }
+ double GetR1() { return _func->GetReal(TSHAPE_ARG_R1); }
+
+ void SetW1(double theW1) { _func->SetReal(TSHAPE_ARG_W1, theW1); }
+ double GetW1() { return _func->GetReal(TSHAPE_ARG_W1); }
+
+ void SetL1(double theL1) { _func->SetReal(TSHAPE_ARG_L1, theL1); }
+ double GetL1() { return _func->GetReal(TSHAPE_ARG_L1); }
+
+ void SetR2(double theR2) { _func->SetReal(TSHAPE_ARG_R2, theR2); }
+ double GetR2() { return _func->GetReal(TSHAPE_ARG_R2); }
+
+ void SetW2(double theW2) { _func->SetReal(TSHAPE_ARG_W2, theW2); }
+ double GetW2() { return _func->GetReal(TSHAPE_ARG_W2); }
+
+ void SetL2(double theL2) { _func->SetReal(TSHAPE_ARG_L2, theL2); }
+ double GetL2() { return _func->GetReal(TSHAPE_ARG_L2); }
+
+ void SetH(double theH) { _func->SetReal(TSHAPE_ARG_H, theH); }
+ double GetH() { return _func->GetReal(TSHAPE_ARG_H); }
+
+ void SetW(double theW) { _func->SetReal(TSHAPE_ARG_W, theW); }
+ double GetW() { return _func->GetReal(TSHAPE_ARG_W); }
+
+ void SetRF(double theRF) { _func->SetReal(TSHAPE_ARG_RF, theRF); }
+ double GetRF() { return _func->GetReal(TSHAPE_ARG_RF); }
+
+ void SetHexMesh(int theHexMesh) { _func->SetInteger(TSHAPE_ARG_HEXMESH, theHexMesh); }
+ int GetHexMesh() { return _func->GetInteger(TSHAPE_ARG_HEXMESH); }
+
+ void SetP1(const Handle(GEOM_Function)& theP1){_func->SetReference(TSHAPE_ARG_P1, theP1); }
+ Handle(GEOM_Function) GetP1() { return _func->GetReference(TSHAPE_ARG_P1); }
+
+ void SetP2(const Handle(GEOM_Function)& theP2){_func->SetReference(TSHAPE_ARG_P2, theP2); }
+ Handle(GEOM_Function) GetP2() { return _func->GetReference(TSHAPE_ARG_P2); }
+
+ void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); }
+ Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); }
+
+private:
+ enum {
+ // main pipe
+ TSHAPE_ARG_R1 = 1,
+ TSHAPE_ARG_W1 = 2,
+ TSHAPE_ARG_L1 = 3,
+
+ // incident pipe
+ TSHAPE_ARG_R2 = 4,
+ TSHAPE_ARG_W2 = 5,
+ TSHAPE_ARG_L2 = 6,
+
+ // chamfer
+ TSHAPE_ARG_H = 7,
+ TSHAPE_ARG_W = 8,
+
+ // fillet
+ TSHAPE_ARG_RF = 9,
+
+ // partition
+ TSHAPE_ARG_HEXMESH = 10,
+
+ // junction points
+ TSHAPE_ARG_P1 = 11,
+ TSHAPE_ARG_P2 = 12,
+ TSHAPE_ARG_P3 = 13
+ };
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_IPipeTShape_HXX_
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOMImpl_ISmoothingSurface_HXX_
+#define _GEOMImpl_ISmoothingSurface_HXX_
+
+#include "GEOM_Function.hxx"
+
+#define SMOOTHINGSURFACE_ARG_LENG 1
+#define SMOOTHINGSURFACE_ARG_LAST 2
+
+class GEOMImpl_ISmoothingSurface
+{
+public:
+ GEOMImpl_ISmoothingSurface(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetLength(int theLen) { _func->SetInteger(SMOOTHINGSURFACE_ARG_LENG, theLen); }
+ int GetLength() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_LENG); }
+
+ void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SMOOTHINGSURFACE_ARG_LAST + theId, theP); }
+ Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SMOOTHINGSURFACE_ARG_LAST + theId); }
+
+private:
+ Handle(GEOM_Function) _func;
+};
+
+#endif // _GEOMImpl_ISmoothingSurface_HXX_
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include <GEOMImpl_PipeTShapeDriver.hxx>
+
+#include <GEOMImpl_IPipeTShape.hxx>
+#include <GEOMImpl_Types.hxx>
+#include <GEOMImpl_Block6Explorer.hxx>
+#include <GEOMImpl_IAdvancedOperations.hxx>
+
+#include <GEOM_Function.hxx>
+#include <GEOM_IOperations.hxx>
+
+#include <GEOMUtils.hxx>
+
+#include <GEOMAlgo_FinderShapeOn1.hxx>
+#include <GEOMAlgo_FinderShapeOn2.hxx>
+#include <GEOMAlgo_ClsfBox.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+// Partition includes
+#include <GEOMAlgo_Splitter.hxx>
+#include <Geom_CylindricalSurface.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Ax2.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Trsf.hxx>
+
+#include <BRepPrimAPI_MakeCone.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepFilletAPI_MakeFillet.hxx>
+#include <BRepFilletAPI_MakeChamfer.hxx>
+#include <BRep_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
+#include <TopoDS.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <vector>
+//@@ include required header files here @@//
+
+#include "AdvancedEngine_Types.hxx"
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_PipeTShapeDriver::GetID()
+{
+ static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
+ return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_PipeTShapeDriver
+//purpose :
+//=======================================================================
+GEOMImpl_PipeTShapeDriver::GEOMImpl_PipeTShapeDriver()
+{
+}
+
+//=======================================================================
+//function : getShapesOnBoxIDs
+ /*!
+ * \brief Find IDs of sub-shapes complying with given status about surface
+ * \param theBox - the box to check state of sub-shapes against
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of sub-shape of theShape
+ * \param theState - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
+ const TopoDS_Shape& aShape,
+ const Standard_Integer theShapeType,
+ GEOMAlgo_State theState) const
+{
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+ // Check presence of triangulation, build if need
+ if (!GEOMUtils::CheckTriangulation(aShape)) {
+ StdFail_NotDone::Raise("Cannot build triangulation on the shape");
+ return aSeqOfIDs;
+ }
+
+ // Call algo
+ GEOMAlgo_FinderShapeOn2 aFinder;
+ Standard_Real aTol = 0.0001; // default value
+
+ Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox;
+ aClsfBox->SetBox(aBox);
+
+ aFinder.SetShape(aShape);
+ aFinder.SetTolerance(aTol);
+ aFinder.SetClsf(aClsfBox);
+ aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
+ aFinder.SetState(theState);
+ aFinder.Perform();
+
+ // Interprete results
+ Standard_Integer iErr = aFinder.ErrorStatus();
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iErr) {
+ TCollection_AsciiString aMsg (" iErr : ");
+ aMsg += TCollection_AsciiString(iErr);
+ StdFail_NotDone::Raise(aMsg.ToCString());
+ return aSeqOfIDs;
+ }
+
+
+ const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
+
+ if (listSS.Extent() < 1) {
+ StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
+ return aSeqOfIDs;
+ }
+
+ // Fill sequence of object IDs
+ aSeqOfIDs = new TColStd_HSequenceOfInteger;
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aShape, anIndices);
+
+ TopTools_ListIteratorOfListOfShape itSub (listSS);
+ for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+ int id = anIndices.FindIndex(itSub.Value());
+// std::cerr << "Shape with ID " << id << " found" << std::endl;
+ aSeqOfIDs->Append(id);
+ }
+
+ return aSeqOfIDs;
+}
+
+//=======================================================================
+//function : GetShapesOnSurfaceIDs
+ /*!
+ * \brief Find IDs of sub-shapes complying with given status about surface
+ * \param theSurface - the surface to check state of sub-shapes against
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of sub-shape of theShape
+ * \param theState - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
+ */
+//=======================================================================
+Handle(TColStd_HSequenceOfInteger)
+ GEOMImpl_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
+ const TopoDS_Shape& theShape,
+ TopAbs_ShapeEnum theShapeType,
+ GEOMAlgo_State theState) const
+{
+ Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
+
+ // Check presence of triangulation, build if need
+ if (!GEOMUtils::CheckTriangulation(theShape)) {
+ StdFail_NotDone::Raise("Cannot build triangulation on the shape");
+ return aSeqOfIDs;
+ }
+
+ // Call algo
+ GEOMAlgo_FinderShapeOn1 aFinder;
+ Standard_Real aTol = 1e-6;
+
+ aFinder.SetShape(theShape);
+ aFinder.SetTolerance(aTol);
+ aFinder.SetSurface(theSurface);
+ aFinder.SetShapeType(theShapeType);
+ aFinder.SetState(theState);
+
+ // Sets the minimal number of inner points for the faces that do not have own
+ // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
+ // Default value=3
+ aFinder.SetNbPntsMin(3);
+ // Sets the maximal number of inner points for edges or faces.
+ // It is usefull for the cases when this number is very big (e.g =2000) to improve
+ // the performance. If this value =0, all inner points will be taken into account.
+ // Default value=0
+ aFinder.SetNbPntsMax(0);
+
+ aFinder.Perform();
+
+ // Interprete results
+ Standard_Integer iErr = aFinder.ErrorStatus();
+ // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
+ if (iErr) {
+// MESSAGE(" iErr : " << iErr);
+ TCollection_AsciiString aMsg (" iErr : ");
+ aMsg += TCollection_AsciiString(iErr);
+ StdFail_NotDone::Raise(aMsg.ToCString());
+ return aSeqOfIDs;
+ }
+// Standard_Integer iWrn = aFinder.WarningStatus();
+ // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
+// if (iWrn) {
+// MESSAGE(" *** iWrn : " << iWrn);
+// }
+
+ const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
+
+ if (listSS.Extent() < 1) {
+ //StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface");
+ StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
+ return aSeqOfIDs;
+ }
+
+ // Fill sequence of object IDs
+ aSeqOfIDs = new TColStd_HSequenceOfInteger;
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(theShape, anIndices);
+
+ TopTools_ListIteratorOfListOfShape itSub (listSS);
+ for (int index = 1; itSub.More(); itSub.Next(), ++index) {
+ int id = anIndices.FindIndex(itSub.Value());
+ aSeqOfIDs->Append(id);
+ }
+
+ return aSeqOfIDs;
+}
+
+//=======================================================================
+//function : GetCommonShapesOnCylinders
+//purpose : return the common shapes between 2 cylindrical surfaces
+// along OX and OZ
+//=======================================================================
+void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
+ TopAbs_ShapeEnum theShapeType,
+ double r1,
+ double r2,
+ Handle(TopTools_HSequenceOfShape)& commonShapes) const
+{
+ gp_Pnt aP0 (0, 0, 0);
+ gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
+ gp_Ax3 anAxis1 (aP0, aVX, aVZ), anAxis2 (aP0, aVZ, aVX);
+
+ TopTools_IndexedMapOfShape aMapOfShapes;
+ aMapOfShapes.Clear();
+ TopExp::MapShapes(theShape, aMapOfShapes);
+
+ commonShapes->Clear();
+
+ int myID;
+ bool found = false;
+
+ // Create a cylinder surface
+ Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1);
+ if ( aC1Ext.IsNull() )
+ StdFail_NotDone::Raise("Couldn't build main cylindrical surface");
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
+ // Create a cylinder surface
+ Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2);
+ if ( aC2Ext.IsNull() )
+ StdFail_NotDone::Raise("Couldn't build incident cylindrical surface");
+ // Find object IDs
+ Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
+ // # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres
+ // # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes
+ found = false;
+ for (int i=1; i<=aSeqExt2->Length();i++) {
+// std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl;
+ for (int j=1; j<=aSeqExt1->Length();j++) {
+// std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl;
+ if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) {
+ myID = aSeqExt1->Value(j);
+ commonShapes->Append(aMapOfShapes.FindKey(myID));
+ found = true;
+ }
+ }
+ }
+ if (!found)
+ StdFail_NotDone::Raise("Common shapes couldn't be found");
+}
+
+//=======================================================================
+//function : MakePipeTShape
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape (const double r1, const double w1, const double l1,
+ const double r2, const double w2, const double l2) const
+{
+ double r1Ext = r1 + w1;
+ double r2Ext = r2 + w2;
+
+ gp_Pnt aP0 (0, 0, 0);
+ gp_Pnt aP1 (-l1, 0, 0);
+ gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
+ gp_Ax2 anAxes1 (aP1, aVX, aVZ);
+ gp_Ax2 anAxes2 (aP0, aVZ, aVX);
+
+ // Build the initial pipes
+ BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1));
+ BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1));
+ BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2));
+ BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2));
+ C1Int.Build();
+ C1Ext.Build();
+ C2Int.Build();
+ C2Ext.Build();
+ if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) {
+ StdFail_NotDone::Raise("Cannot build cylinders");
+ }
+
+ // Fuse the 2 pipes
+ BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape());
+ if (!fuse1.IsDone()) {
+ StdFail_NotDone::Raise("Cannot fuse cylinders");
+ }
+
+ // Remove small radius main pipe
+ BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
+ if (!cut1.IsDone()) {
+ StdFail_NotDone::Raise("Coudn't cut cylinders");
+ }
+
+ // Remove small radius incident pipe => Te
+ BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
+ if (!Te.IsDone()) {
+ StdFail_NotDone::Raise("Coudn't cut cylinders");
+ }
+
+ return Te.Shape();
+}
+
+//=======================================================================
+//function : MakeQuarterPipeTShape
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape (const double r1, const double w1, const double l1,
+ const double r2, const double w2, const double l2) const
+{
+ TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
+ if (Te.IsNull())
+ StdFail_NotDone::Raise("Couldn't build Pipe TShape");
+
+ // Get a quarter of shape => Te2
+ double r1Ext = r1 + w1;
+ BRepPrimAPI_MakeBox box1 (gp_Pnt(0, -2*r1Ext, -2*r1Ext), gp_Pnt( Abs(2 * l1), 2*r1Ext, Abs(2*l2)));
+ BRepPrimAPI_MakeBox box2 (gp_Pnt(0, 2*r1Ext, -2*r1Ext), gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2)));
+ box1.Build();
+ box2.Build();
+ if (!box1.IsDone() || !box2.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't build boxes");
+ }
+ BRepAlgoAPI_Cut cut3 (Te, box1.Shape());
+ if (!cut3.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
+ }
+ BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape());
+ if (!Te4.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
+ }
+
+ return Te4.Shape();
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_PipeTShapeDriver::Execute (TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IPipeTShape aData (aFunction);
+ Standard_Integer aType = aFunction->GetType();
+
+ TopoDS_Shape aShape, Te4, Te4Part;
+ //TopoDS_Edge arete_intersect_int;
+ //Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape;
+ Handle(TColStd_HSequenceOfInteger) edges_e;
+ //Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape;
+ //gp_Pnt aP0 (0, 0, 0);
+ //gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
+ bool hexMesh = (bool) aData.GetHexMesh();
+
+ // Useful values
+ //double aSize = 2*(aData.GetL1() + aData.GetL2());
+ double epsilon = Precision::Approximation();
+ double aR1Ext = aData.GetR1() + aData.GetW1();
+ double aR2Ext = aData.GetR2() + aData.GetW2();
+
+ if (aData.GetR2() > aData.GetR1() + epsilon) {
+ StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1");
+ }
+
+ if (aR2Ext > aR1Ext + epsilon) {
+ StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1");
+ }
+
+ // external radius are equal
+ if (fabs(aR2Ext - aR1Ext) < epsilon) {
+ if (aType == TSHAPE_CHAMFER)
+ StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1");
+ if (aType == TSHAPE_FILLET)
+ StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1");
+ // internal radius are different => not possible
+ if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) {
+ StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1");
+ }
+ }
+
+ if (aR1Ext >= aData.GetL2() + epsilon) {
+ StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2");
+ }
+ if (aR2Ext >= aData.GetL1() + epsilon) {
+ StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1");
+ }
+
+ if (aType == TSHAPE_CHAMFER) {
+ if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) {
+ StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high");
+ }
+
+ if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon))
+ StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high");
+ }
+
+ if (aType == TSHAPE_FILLET) {
+ if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) ||
+ aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon))
+ StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high");
+ }
+
+ if (hexMesh) {
+ // Create a quarter of a basic T-Shape pipe
+ //std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl;
+ Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+ aData.GetR2(), aData.GetW2(), aData.GetL2());
+ }
+ else {
+ // No need to cut pipe t-shape
+ //std::cerr << "Create a basic T-Shape pipe" << std::endl;
+ Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+ aData.GetR2(), aData.GetW2(), aData.GetL2());
+ }
+ aShape = Te4;
+/*
+ if (aType == TSHAPE_BASIC) {
+ aShape = Te4;
+// aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
+// aData.GetR2(), aData.GetW2(), aData.GetL2());
+ }
+ else if (aType == TSHAPE_CHAMFER) {
+ // TShape with chamfer
+// BRep_Builder BB;
+// TopoDS_Compound CC;
+// BB.MakeCompound(CC);
+ // Create chamfer on the edges edges_e
+ BRepFilletAPI_MakeChamfer chamfer (Te4);
+ TopTools_IndexedMapOfShape anEdgesIndices;
+ TopExp::MapShapes(Te4, anEdgesIndices);
+
+ TopoDS_Shape theBox;
+ if (hexMesh) {
+ BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+ aBox.Build();
+ if (!aBox.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't build box");
+ }
+ theBox = aBox.Shape();
+ }
+ else {
+ BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+ aBox.Build();
+ if (!aBox.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't build box");
+ }
+ theBox = aBox.Shape();
+ }
+ Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
+ edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ StdFail_NotDone::Raise("Common edges not found");
+ }
+
+ TopTools_IndexedDataMapOfShapeListOfShape M;
+ GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M);
+// std::cerr << "Number of IDs: " << edges_e->Length() << std::endl;
+ int nbEdgesInChamfer = 0;
+ for (int i=1;i<=edges_e->Length();i++) {
+// std::cerr << "Get Edge with ID #" << i << std::endl;
+ int theId = edges_e->Value(i);
+// std::cerr << "ID #" << i << "= " << theId << std::endl;
+// std::cerr << "Search for edge in shape" << std::endl;
+ TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId));
+// std::cerr << "Found" << std::endl;
+// std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl;
+ TopExp_Explorer ExVertices;
+ for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) {
+ gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current()));
+ if (aPt.Z() - aR1Ext <= epsilon) {
+// std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl;
+ nbEdgesInChamfer ++;
+ const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge);
+ TopoDS_Face F = TopoDS::Face( aFL.First() );
+ if (hexMesh)
+ chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F);
+ else
+ chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F);
+ break;
+ }
+ }
+// std::cerr << "Test if hexMesh: ";
+ if (hexMesh && nbEdgesInChamfer == 1) {
+// std::cerr << "Yes => stop after 1 edge" << std::endl;
+ break;
+ }
+// std::cerr << "No => continue for other edges" << std::endl;
+ // BB.Add(CC, edges_e->Value(i));
+ // const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i)));
+ // chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F);
+ }
+// std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl;
+// }
+ chamfer.Build();
+ if (!chamfer.IsDone()) {
+ StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
+ }
+
+// BB.Add(CC, chamfer.Shape());
+
+// aShape = CC;
+ aShape = chamfer.Shape();
+ }
+ else if (aType == TSHAPE_FILLET) {
+ // TShape with fillet
+ // Create fillet on the edge arete_intersect_ext
+ BRepFilletAPI_MakeFillet fill (Te4);
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(Te4, anIndices);
+
+ TopoDS_Shape theBox;
+ if (hexMesh) {
+ BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+ aBox.Build();
+ if (!aBox.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't build box");
+ }
+ theBox = aBox.Shape();
+ }
+ else {
+ BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
+ aBox.Build();
+ if (!aBox.IsDone()) {
+ StdFail_NotDone::Raise("Couldn't build box");
+ }
+ theBox = aBox.Shape();
+ }
+ Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
+ edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
+ if (edges_e.IsNull() || edges_e->Length() == 0) {
+ StdFail_NotDone::Raise("Common edges not found");
+ }
+
+// fill.Add(TopoDS::Edge(edges_e->Value(1)));
+// if (!hexMesh) {
+ for (int i=1;i<=edges_e->Length();i++) {
+ if (hexMesh && (i > 1))
+ break;
+ TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i)));
+ fill.Add(theEdge);
+// fill.Add(TopoDS::Edge(edges_e->Value(i)));
+ }
+// }
+ fill.SetRadius(aData.GetRF(), 1, 1);
+ fill.Build();
+ if (!fill.IsDone()) {
+ StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
+ }
+
+ aShape = fill.Shape();
+ }
+ else {
+ // other construction modes here
+ }
+*/
+ if (aShape.IsNull()) return 0;
+
+ aFunction->SetValue(aShape);
+
+ log.SetTouched(Label());
+
+ return 1;
+}
+
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
+
+bool GEOMImpl_PipeTShapeDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_IPipeTShape aCI( function );
+ Standard_Integer aType = function->GetType();
+
+ theOperationName = "PIPETSHAPE";
+
+ switch ( aType ) {
+ case TSHAPE_BASIC:
+ AddParam( theParams, "Main radius", aCI.GetR1() );
+ AddParam( theParams, "Main width", aCI.GetW1() );
+ AddParam( theParams, "Main half-length", aCI.GetL1() );
+ AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
+ AddParam( theParams, "Incident pipe width", aCI.GetW2() );
+ AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
+ AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
+ break;
+ case TSHAPE_CHAMFER:
+ AddParam( theParams, "Main radius", aCI.GetR1() );
+ AddParam( theParams, "Main width", aCI.GetW1() );
+ AddParam( theParams, "Main half-length", aCI.GetL1() );
+ AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
+ AddParam( theParams, "Incident pipe width", aCI.GetW2() );
+ AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
+ AddParam( theParams, "Chamfer height", aCI.GetH() );
+ AddParam( theParams, "Chamfer width", aCI.GetW() );
+ AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
+ break;
+ case TSHAPE_FILLET:
+ AddParam( theParams, "Main radius", aCI.GetR1() );
+ AddParam( theParams, "Main width", aCI.GetW1() );
+ AddParam( theParams, "Main half-length", aCI.GetL1() );
+ AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
+ AddParam( theParams, "Incident pipe width", aCI.GetW2() );
+ AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
+ AddParam( theParams, "Fillet radius", aCI.GetRF() );
+ AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver);
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _GEOMImpl_PipeTShapeDriver_HXX
+#define _GEOMImpl_PipeTShapeDriver_HXX
+
+#include <TFunction_Driver.hxx>
+
+#include "GEOMAlgo_State.hxx"
+
+#include <TopAbs_ShapeEnum.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <gp_Ax2.hxx>
+
+#include <Handle_Geom_Surface.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_PipeTShapeDriver;
+
+
+
+#include "GEOM_BaseDriver.hxx"
+
+DEFINE_STANDARD_HANDLE( GEOMImpl_PipeTShapeDriver, GEOM_BaseDriver );
+
+class GEOMImpl_PipeTShapeDriver : public GEOM_BaseDriver {
+public:
+ // Methods PUBLIC
+ //
+ Standard_EXPORT GEOMImpl_PipeTShapeDriver();
+ Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+ Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
+ {
+ return Standard_True;
+ }
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
+
+ Standard_EXPORT virtual
+ bool GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& params);
+ // Type management
+ //
+DEFINE_STANDARD_RTTI( GEOMImpl_PipeTShapeDriver )
+
+private:
+
+ /*!
+ * \brief Create a T-Shape based on pipes
+ * \param r1 - the internal radius of main pipe
+ * \param w1 - the thickness of main pipe
+ * \param l1 - the half-length of main pipe
+ * \param r2 - the internal radius of incident pipe
+ * \param w2 - the thickness of incident pipe
+ * \param l2 - the half-length of main pipe
+ * \retval TopoDS_Shape - Resulting shape
+ */
+ TopoDS_Shape MakePipeTShape(double r1, double w1, double l1,
+ double r2, double w2, double l2) const;
+
+ /*!
+ * \brief Create a quarter of a T-Shape based on pipes
+ * \param r1 - the internal radius of main pipe
+ * \param w1 - the thickness of main pipe
+ * \param l1 - the half-length of main pipe
+ * \param r2 - the internal radius of incident pipe
+ * \param w2 - the thickness of incident pipe
+ * \param l2 - the half-length of main pipe
+ * \retval TopoDS_Shape - Resulting shape
+ */
+ TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1,
+ double r2, double w2, double l2) const;
+
+ /*!
+ * \brief Find IDs of sub-shapes complying with given status about surface
+ * \param theSurface - the surface to check state of sub-shapes against
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of sub-shape of theShape
+ * \param theState - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
+ */
+ Handle(TColStd_HSequenceOfInteger)
+ GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
+ const TopoDS_Shape& theShape,
+ TopAbs_ShapeEnum theShapeType,
+ GEOMAlgo_State theState) const;
+
+ /*!
+ * \brief Find IDs of sub-shapes complying with given status about surface
+ * \param theBox - the box to check state of sub-shapes against
+ * \param theShape - the shape to explore
+ * \param theShapeType - type of sub-shape of theShape
+ * \param theState - required state
+ * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
+ */
+ Handle(TColStd_HSequenceOfInteger)
+ GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
+ const TopoDS_Shape& aShape,
+ const Standard_Integer theShapeType,
+ GEOMAlgo_State theState) const;
+
+ //=======================================================================
+ //function : getCommonShapesOnCylinders
+ //purpose : return the common edge between 2 cylindrical surfaces
+ // along OX and OZ
+ //=======================================================================
+ void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
+ TopAbs_ShapeEnum theShapeType,
+ double r, double r2,
+ Handle(TopTools_HSequenceOfShape)& commonShapes) const;
+
+};
+
+#endif // _GEOMImpl_PipeTShapeDriver_HXX
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#include <Standard_Stream.hxx>
+
+#include "AdvancedEngine_Types.hxx"
+
+#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
+#include <GEOMImpl_ISmoothingSurface.hxx>
+#include <GEOMImpl_Types.hxx>
+#include <GEOM_Function.hxx>
+
+#include <TFunction_Logbook.hxx>
+#include <StdFail_NotDone.hxx>
+
+//@@ include required header files here @@//
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS.hxx>
+
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColgp_Array2OfPnt.hxx>
+#include <TColgp_SequenceOfXY.hxx>
+#include <TColgp_SequenceOfXYZ.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+
+#include <BRepAdaptor_HSurface.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRepGProp.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+
+#include <GeomPlate_Surface.hxx>
+#include <GeomPlate_BuildPlateSurface.hxx>
+#include <GeomPlate_PointConstraint.hxx>
+#include <GeomPlate_MakeApprox.hxx>
+#include <GeomPlate_PlateG0Criterion.hxx>
+#include <GeomPlate_BuildAveragePlane.hxx>
+
+#include <Geom_BSplineSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Plane.hxx>
+
+#include <GProp_GProps.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Ax3.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Vec.hxx>
+
+#include <GC_MakePlane.hxx>
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_SmoothingSurfaceDriver::GetID()
+{
+ static Standard_GUID aGUID("1C3A0F30-729D-4E83-8232-78E74FC5637C");
+ return aGUID;
+}
+
+//=======================================================================
+//function : GEOMImpl_SmoothingSurfaceDriver
+//purpose :
+//=======================================================================
+GEOMImpl_SmoothingSurfaceDriver::GEOMImpl_SmoothingSurfaceDriver()
+{
+}
+
+//=======================================================================
+//function : MakeSmoothingSurfaceUnClosed
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const
+{
+ TopoDS_Face aInitShape;
+
+ // Create an average Plane
+ //Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,myListOfPoints.Length())
+ GeomPlate_BuildAveragePlane gpbap(myListOfPoints,myListOfPoints->Length(),Precision::Confusion(),1,1);
+ Handle(Geom_Plane) plane(gpbap.Plane());
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ gpbap.MinMaxBox(Umin,Umax,Vmin,Vmax);
+ // cout << "Vals : " << Umin << ", " << Umax << ", " << Vmin << ", " << Vmax << endl;
+ BRepBuilderAPI_MakeFace mf(plane,Umin,Umax,Vmin,Vmax,Precision::Confusion());
+ aInitShape = mf.Face();
+ //return aInitShape;
+
+ GeomPlate_BuildPlateSurface aBuilder(3,10);
+ // ** Initialization of surface
+ Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
+ HSI->ChangeSurface().Initialize(aInitShape);
+ aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
+
+ Standard_Integer j, j1, j2;
+ // cout << "Init surface" << endl;
+ j1 = myListOfPoints->Lower();
+ j2 = myListOfPoints->Upper();
+ for (j=j1; j<=j2 ; j++)
+ {
+ gp_Pnt aPnt = myListOfPoints->Value(j);
+ Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(aPnt,0);
+ aBuilder.Add(PCont);
+ }
+ // cout << "avant Perform surface" << endl;
+ aBuilder.Perform();
+ // cout << "Perform surface" << endl;
+
+ // A ce niveau : surface algo
+ Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
+
+ Standard_Integer nbcarreau=2;
+ Standard_Integer degmax=8;
+ Standard_Real seuil;
+ seuil = Max(0.0001,10*aBuilder.G0Error());
+ GeomPlate_MakeApprox Mapp(gpPlate,0.0001,nbcarreau,degmax,seuil);
+ // cout << "Approx surface" << endl;
+
+ Handle (Geom_Surface) Surf (Mapp.Surface());
+
+ aBuilder.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
+
+ BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax, Precision::Confusion());
+ TopoDS_Shape aShape = MF.Shape();
+
+ return aShape;
+}
+
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+ if (aFunction.IsNull()) return 0;
+
+ Standard_Integer aType = aFunction->GetType();
+
+ if (aType != SMOOTHINGSURFACE_LPOINTS) return 0;
+ // cout << "Youhou : " << aType << endl;
+
+ GEOMImpl_ISmoothingSurface aData (aFunction);
+
+ Standard_Integer nbPoints = aData.GetLength();
+
+ Handle(TColgp_HArray1OfPnt) anArrayofPnt = new TColgp_HArray1OfPnt(1,nbPoints);
+ for (int ind=1;ind<=nbPoints;ind++)
+ {
+ Handle(GEOM_Function) aPoint = aData.GetPoint(ind);
+ TopoDS_Shape aShapePnt = aPoint->GetValue();
+ TopoDS_Vertex dsPoint;
+ dsPoint = TopoDS::Vertex( aShapePnt );
+ gp_Pnt aPnt = BRep_Tool::Pnt( dsPoint );
+ anArrayofPnt->SetValue(ind,aPnt);
+ }
+
+ TopoDS_Shape aShape;
+ aShape = GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(anArrayofPnt);
+
+ if (aShape.IsNull()) return 0;
+
+ aFunction->SetValue(aShape);
+
+ log.SetTouched(Label());
+
+ return 1;
+}
+
+//================================================================================
+/*!
+ * \brief Returns a name of creation operation and names and values of creation parameters
+ */
+//================================================================================
+
+bool GEOMImpl_SmoothingSurfaceDriver::
+GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& theParams)
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_ISmoothingSurface aCI( function );
+ Standard_Integer aType = function->GetType();
+
+ theOperationName = "SMOOTHINGSURFACE";
+
+ switch ( aType ) {
+ case SMOOTHINGSURFACE_LPOINTS:
+ AddParam( theParams, "Points" );
+ if ( aCI.GetLength() > 1 )
+ theParams[0] << aCI.GetLength() << " points: ";
+ for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i )
+ theParams[0] << aCI.GetPoint( i ) << " ";
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver);
+IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver);
--- /dev/null
+// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOMImpl_SmoothingSurfaceDriver_HXX
+#define _GEOMImpl_SmoothingSurfaceDriver_HXX
+
+#ifndef _TFunction_Driver_HeaderFile
+#include <TFunction_Driver.hxx>
+#endif
+#ifndef _TFunction_Logbook_HeaderFile
+#include <TFunction_Logbook.hxx>
+#endif
+#ifndef _Standard_CString_HeaderFile
+#include <Standard_CString.hxx>
+#endif
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TopoDS_Shape.hxx>
+
+class Handle_Standard_Type;
+class GEOMImpl_SmoothingSurfaceDriver;
+
+
+
+#include "GEOM_BaseDriver.hxx"
+
+DEFINE_STANDARD_HANDLE( GEOMImpl_SmoothingSurfaceDriver, GEOM_BaseDriver );
+
+class GEOMImpl_SmoothingSurfaceDriver : public GEOM_BaseDriver {
+public:
+ // Methods PUBLIC
+ //
+ Standard_EXPORT GEOMImpl_SmoothingSurfaceDriver();
+ Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+ Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+ Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
+ {
+ return Standard_True;
+ }
+ Standard_EXPORT static const Standard_GUID& GetID();
+ Standard_EXPORT ~GEOMImpl_SmoothingSurfaceDriver() {};
+
+ Standard_EXPORT virtual
+ bool GetCreationInformation(std::string& theOperationName,
+ std::vector<GEOM_Param>& params);
+ // Type management
+ //
+DEFINE_STANDARD_RTTI( GEOMImpl_SmoothingSurfaceDriver )
+
+private:
+ TopoDS_Shape MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const;
+};
+
+#endif // _GEOMImpl_SmoothingSurfaceDriver_HXX
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+#ifndef _GEOM_ADVANCEDENGINE_HXX_
+#define _GEOM_ADVANCEDENGINE_HXX_
+
+#ifdef WNT
+ #if defined ADVANCEDENGINE_EXPORTS || defined AdvancedEngine_EXPORTS
+ #if defined WIN32
+ #define ADVANCEDENGINE_EXPORT __declspec( dllexport )
+ #else
+ #define ADVANCEDENGINE_EXPORT
+ #endif
+ #else
+ #if defined WIN32
+ #define ADVANCEDENGINE_EXPORT __declspec( dllimport )
+ #else
+ #define ADVANCEDENGINE_EXPORT
+ #endif
+ #endif
+#else
+ #define ADVANCEDENGINE_EXPORT
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GEOM_IAdvancedOperations.cc
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include <Standard_Stream.hxx>
+
+#include "GEOM_IAdvancedOperations_i.hh"
+
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
+
+#include "GEOM_Engine.hxx"
+#include "GEOM_Object.hxx"
+
+//=============================================================================
+/*!
+ * constructor:
+ */
+//=============================================================================
+GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IAdvancedOperations* theImpl)
+:GEOM_IOperations_i(thePOA, theEngine, theImpl)
+{
+ MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i");
+}
+
+//=============================================================================
+/*!
+ * destructor
+ */
+//=============================================================================
+GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
+{
+ MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShape
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length).
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+ if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeChamfer
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of chamfer.
+ * \param theW Width of chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theH, theW, theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeChamferWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of the chamfer.
+ * \param theW Width of the chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theH, theW, theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeFillet
+ * 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.
+ * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theRF, theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeFilletWithPosition
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
+ theRF, theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTR
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTR
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTRWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length).
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+ if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull()) return aSeq._retn();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTRChamfer
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of chamfer.
+ * \param theW Width of chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamfer
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theH, theW, theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTRChamferWithPosition
+ * Create a T-shape object with specified caracteristics for the main and
+ * the incident pipes (radius, width, half-length). 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theH Height of the chamfer.
+ * \param theW Width of the chamfer.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamferWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theH, theW, theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTRFillet
+ * 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.
+ * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet.
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFillet
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theRF, theHexMesh);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * MakePipeTShapeTRFilletWithPosition
+ * 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.
+ * \param theR1 Internal radius of main pipe
+ * \param theW1 Width of main pipe
+ * \param theL1 Half-length of main pipe
+ * \param theR2 Internal radius of incident pipe (R2 < R1)
+ * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
+ * \param theL2 Half-length of incident pipe
+ * \param theRF Radius of curvature of fillet
+ * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
+ * \param theP1 1st junction point of main pipe
+ * \param theP2 2nd junction point of main pipe
+ * \param theP3 Junction point of incident pipe
+ * \return List of GEOM_Objects, containing the created shape and propagation groups.
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFilletWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference vertices
+ Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
+ Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
+ Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
+
+ //Create the TShape
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
+ theRL, theWL, theLtransL, theLthinL,
+ theRR, theWR, theLtransR, theLthinR,
+ theRI, theWI, theLtransI, theLthinI,
+ theRF, theHexMesh, aP1, aP2, aP3);
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ Standard_Integer aLength = aHSeq->Length();
+ aSeq->length(aLength);
+ for (Standard_Integer i = 1; i <= aLength; i++)
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+
+ return aSeq._retn();
+}
+
+//=============================================================================
+/*!
+ * This function allows to create a disk already divided into blocks. It can be
+ * use to create divided pipes for later meshing in hexaedra.
+ * \param theR Radius of the disk
+ * \param theRatio Relative size of the central square diagonal against the disk diameter
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR,
+ CORBA::Double theRatio,
+ CORBA::Short theOrientation,
+ GEOM::pattern thePattern)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the DividedDisk
+ Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation, thePattern);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MakeDividedDiskPntVecR
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt,
+ GEOM::GEOM_Object_ptr theVec,
+ CORBA::Double theR,
+ CORBA::Double theRatio,
+ GEOM::pattern thePattern)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference points
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
+ Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
+
+ if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
+
+ // Make DividedDisk
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio, thePattern);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * Builds a cylinder prepared for hexa meshes
+ * \param theR Radius of the cylinder
+ * \param theH Height of the cylinder
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR,
+ CORBA::Double theH,
+ GEOM::pattern thePattern)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Create the DividedCylinder
+ Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH, thePattern);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ *
+ * \param thelPoints list of points
+ * \return New GEOM_Object, containing the created shape.
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference point
+ int ind = 0;
+ int aLen = thelPoints.length();
+ std::list<Handle(GEOM_Object)> aPoints;
+ for (; ind < aLen; ind++) {
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thelPoints[ind]);
+ if (aPnt.IsNull()) return aGEOMObject._retn();
+ aPoints.push_back(aPnt);
+ }
+ //Create the SmoothingSurface
+ Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface(aPoints);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+/*@@ insert new functions before this line @@ do not remove this line @@*/
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File : GEOM_IAdvancedOperations.hh
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef _GEOM_IAdvancedOperations_i_HeaderFile
+#define _GEOM_IAdvancedOperations_i_HeaderFile
+
+#include "GEOMImpl_Gen.hxx"
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+#include "GEOM_IOperations_i.hh"
+#include "GEOM_Object_i.hh"
+
+#include "GEOMImpl_IAdvancedOperations.hxx"
+
+class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
+ public virtual POA_GEOM::GEOM_IAdvancedOperations,
+ public virtual GEOM_IOperations_i
+{
+ public:
+ GEOM_IAdvancedOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_IAdvancedOperations* theImpl);
+ ~GEOM_IAdvancedOperations_i();
+
+ // PipeTShape without thickness reduction
+ GEOM::ListOfGO* MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+ GEOM::ListOfGO* MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+ GEOM::ListOfGO* MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+
+ // PipeTShape with thickness reduction
+ GEOM::ListOfGO* MakePipeTShapeTR
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeTRWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+ GEOM::ListOfGO* MakePipeTShapeTRChamfer
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeTRChamferWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+ GEOM::ListOfGO* MakePipeTShapeTRFillet
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh);
+ GEOM::ListOfGO* MakePipeTShapeTRFilletWithPosition
+ (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
+ CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
+ CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
+ CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
+ CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
+ CORBA::Double theRF, CORBA::Boolean theHexMesh,
+ GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
+
+ GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR,
+ CORBA::Double theRatio,
+ CORBA::Short theOrientation,
+ GEOM::pattern thePattern);
+
+ GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theR,
+ CORBA::Double theRatio,
+ GEOM::pattern thePattern);
+
+ GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
+ CORBA::Double theH,
+ GEOM::pattern thePattern);
+ GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints);
+ /*@@ insert new functions before this line @@ do not remove this line @@*/
+
+ ::GEOMImpl_IAdvancedOperations* GetOperations()
+ { return (::GEOMImpl_IAdvancedOperations*)GetImpl(); }
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# Libraries targets
+lib_LTLIBRARIES = libAdvancedEngine.la
+
+# header files
+salomeinclude_HEADERS = \
+ AdvancedEngine_Types.hxx \
+ AdvancedEngine_OperationsCreator.hh \
+ GEOM_AdvancedEngine.hxx \
+ GEOMImpl_IAdvancedOperations.hxx \
+ GEOM_IAdvancedOperations_i.hh
+
+ADVANCED_INCLUDES =
+ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
+ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
+##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx
+ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx
+##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
+
+salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
+
+dist_libAdvancedEngine_la_SOURCES = \
+ AdvancedEngine.cxx \
+ AdvancedEngine_OperationsCreator.cc \
+ GEOMImpl_IAdvancedOperations.cxx \
+ GEOM_IAdvancedOperations_i.cc
+
+ADVANCED_SOURCES =
+ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
+ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
+##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
+ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx
+##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
+
+dist_libAdvancedEngine_la_SOURCES += $(ADVANCED_SOURCES)
+
+# additional information to compile and link file
+
+libAdvancedEngine_la_CPPFLAGS = \
+ $(CORBA_CXXFLAGS) \
+ $(CORBA_INCLUDES) \
+ $(CAS_CPPFLAGS) \
+ $(BOOST_CPPFLAGS) \
+ $(KERNEL_CXXFLAGS) \
+ -I$(srcdir)/../GEOMUtils \
+ -I$(srcdir)/../NMTDS \
+ -I$(srcdir)/../NMTTools \
+ -I$(srcdir)/../GEOMAlgo \
+ -I$(srcdir)/../GEOM \
+ -I$(srcdir)/../GEOMImpl \
+ -I$(srcdir)/../GEOM_I \
+ -I$(top_builddir)/idl \
+ -I$(top_builddir)
+
+libAdvancedEngine_la_LDFLAGS = \
+ ../../idl/libSalomeIDLGEOM.la \
+ ../GEOMUtils/libGEOMUtils.la \
+ ../GEOMAlgo/libGEOMAlgo.la \
+ ../GEOM/libGEOMbasic.la \
+ ../GEOMImpl/libGEOMimpl.la \
+ ../GEOM_I/libGEOMEngine.la \
+ $(KERNEL_LDFLAGS) -lOpUtil -lSalomeNS -lSalomeContainer -lSalomeGenericObj -lTOOLSDS \
+ $(CAS_DATAEXCHANGE) \
+ $(CAS_LDPATH) -lTKFillet -lTKOffset
#include "AdvancedGUI.h"
#include "GeometryGUI.h"
-#include "GeometryGUI_Operations.h"
+//#include "GeometryGUI_Operations.h"
#include <SUIT_Desktop.h>
#include <SalomeApp_Application.h>
#include <QDialog>
+#include <iostream>
+
//=======================================================================
// function : AdvancedGUI()
// purpose : Constructor
//=======================================================================
-AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMGUI( parent )
+AdvancedGUI::AdvancedGUI( GeometryGUI* parent ) : GEOMPluginGUI( parent )
{
}
// purpose :
//=======================================================================
bool AdvancedGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
+{
+ switch ( theCommandID ) {
+ case 1:
+ return OnGUIEvent("TShape_Basic", parent);
+ case 2:
+ return OnGUIEvent("DividedDisk", parent);
+ case 3:
+ return OnGUIEvent("DividedCylinder", parent);
+ case 4:
+ return OnGUIEvent("SmoothingSurface", parent);
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
+ default:
+ return OnGUIEvent("", parent);
+ }
+ return false;
+}
+
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool AdvancedGUI::OnGUIEvent( const QString& theCommandID, SUIT_Desktop* parent )
{
SalomeApp_Application* app = getGeometryGUI()->getApp();
if ( !app ) return false;
QDialog* aDlg = NULL;
- switch ( theCommandID ) {
- case GEOMOp::OpPipeTShape:
+ if (theCommandID == "TShape_Basic") {
aDlg = new AdvancedGUI_PipeTShapeDlg( getGeometryGUI(), parent );
- break;
-// case GEOMOp::OpPipeTShapeGroups:
-// aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
-// break;
- case GEOMOp::OpDividedDisk:
+ }
+ //else if (theCommandID == "TShape_Groups") {
+ // aDlg = new AdvancedGUI_PipeTShapeGroupsDlg( getGeometryGUI(), parent );
+ //}
+ else if (theCommandID == "DividedDisk") {
aDlg = new AdvancedGUI_DividedDiskDlg( getGeometryGUI(), parent );
- break;
- case GEOMOp::OpDividedCylinder:
+ }
+ else if (theCommandID == "DividedCylinder") {
aDlg = new AdvancedGUI_DividedCylinderDlg( getGeometryGUI(), parent );
- break;
- case GEOMOp::OpSmoothingSurface:
+ }
+ else if (theCommandID == "SmoothingSurface") {
aDlg = new AdvancedGUI_SmoothingSurfaceDlg( getGeometryGUI(), parent );
- break;
+ }
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
- default:
+ else {
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
- break;
}
if ( aDlg != NULL )
#ifdef WIN32
__declspec( dllexport )
#endif
- GEOMGUI* GetLibGUI( GeometryGUI* parent )
+ GEOMPluginGUI* GetLibGUI( GeometryGUI* parent )
{
return new AdvancedGUI( parent );
}
#ifndef ADVANCEDGUI_H
#define ADVANCEDGUI_H
-#include "GEOMGUI.h"
+#include "GEOMPluginGUI.h"
//=================================================================================
// class : AdvancedGUI
// purpose :
//=================================================================================
-class AdvancedGUI : public GEOMGUI
+class AdvancedGUI : public GEOMPluginGUI
{
public:
AdvancedGUI( GeometryGUI* );
~AdvancedGUI();
bool OnGUIEvent( int, SUIT_Desktop* );
+ bool OnGUIEvent( const QString&, SUIT_Desktop* );
};
#endif // ADVANCEDGUI_H
//=================================================================================
GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedCylinderDlg::createOperation()
{
- return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
}
//=================================================================================
//=================================================================================
GEOM::GEOM_IOperations_ptr AdvancedGUI_DividedDiskDlg::createOperation()
{
- return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
}
//=================================================================================
//=================================================================================
GEOM::GEOM_IOperations_ptr AdvancedGUI_PipeTShapeDlg::createOperation()
{
- return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
}
//=================================================================================
//=================================================================================
GEOM::GEOM_IOperations_ptr AdvancedGUI_SmoothingSurfaceDlg::createOperation()
{
- return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ //return getGeomEngine()->GetIAdvancedOperations(getStudyId());
+ return getGeomEngine()->GetPluginOperations(getStudyId(), "AdvancedEngine");
}
//=================================================================================
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+ <context>
+ <name>@default</name>
+ <message>
+ <source>ICON_OBJBROWSER_ADVANCED_201</source>
+ <translation>tree_pipetshape.png</translation>
+ </message>
+ <message>
+ <source>ICON_OBJBROWSER_ADVANCED_202</source>
+ <translation>divided_disk.png</translation>
+ </message>
+ <message>
+ <source>ICON_OBJBROWSER_ADVANCED_203</source>
+ <translation>dividedcylinder.png</translation>
+ </message>
+ <message>
+ <source>ICON_OBJBROWSER_ADVANCED_204</source>
+ <translation>tree_smoothingsurface.png</translation>
+ </message>
+
+ <message>
+ <source>ICON_DLG_PIPETSHAPE</source>
+ <translation>pipetshape.png</translation>
+ </message>
+ <message>
+ <source>ICO_PIPETSHAPE</source>
+ <translation>pipetshape.png</translation>
+ </message>
+ <message>
+ <source>ICO_PIPETSHAPE_IMPORT</source>
+ <translation>pipetshape_import_icon.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE</source>
+ <translation>dlg_pipetshape.png</translation>
+ </message>
+ <message>
+ <source>IMG_PIPETSHAPE_SECT</source>
+ <translation>pipetshape_section.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_L1</source>
+ <translation>dlg_pipetshapel1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_R1</source>
+ <translation>dlg_pipetshaper1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_W1</source>
+ <translation>dlg_pipetshapew1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_L2</source>
+ <translation>dlg_pipetshapel2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_R2</source>
+ <translation>dlg_pipetshaper2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_W2</source>
+ <translation>dlg_pipetshapew2.png</translation>
+ </message>
+
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET</source>
+ <translation>dlg_pipetshapefillet.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_L1</source>
+ <translation>dlg_pipetshapefilletl1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_R1</source>
+ <translation>dlg_pipetshapefilletr1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_W1</source>
+ <translation>dlg_pipetshapefilletw1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_L2</source>
+ <translation>dlg_pipetshapefilletl2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_R2</source>
+ <translation>dlg_pipetshapefilletr2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_W2</source>
+ <translation>dlg_pipetshapefilletw2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_FILLET_RF</source>
+ <translation>dlg_pipetshapefilletrf.png</translation>
+ </message>
+
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER</source>
+ <translation>dlg_pipetshapechamfer.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_L1</source>
+ <translation>dlg_pipetshapechamferl1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_R1</source>
+ <translation>dlg_pipetshapechamferr1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_W1</source>
+ <translation>dlg_pipetshapechamferw1.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_L2</source>
+ <translation>dlg_pipetshapechamferl2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_R2</source>
+ <translation>dlg_pipetshapechamferr2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_W2</source>
+ <translation>dlg_pipetshapechamferw2.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_H</source>
+ <translation>dlg_pipetshapechamferh.png</translation>
+ </message>
+ <message>
+ <source>DLG_PIPETSHAPE_CHAMFER_W</source>
+ <translation>dlg_pipetshapechamferw.png</translation>
+ </message>
+
+<!--
+ <message>
+ <source>ICON_DLG_PIPETSHAPEGROUPS</source>
+ <translation>pipetshapegroups.png</translation>
+ </message>
+ <message>
+ <source>ICO_PIPETSHAPEGROUPS</source>
+ <translation>pipetshapegroups.png</translation>
+ </message>
+-->
+
+ <message>
+ <source>ICON_DLG_DIVIDEDDISK_R_RATIO</source>
+ <translation>divided_disk.png</translation>
+ </message>
+ <message>
+ <source>ICO_DIVIDEDDISK</source>
+ <translation>divided_disk.png</translation>
+ </message>
+
+ <message>
+ <source>ICON_DLG_DIVIDEDCYLINDER_R_H</source>
+ <translation>dividedcylinder_r_h.png</translation>
+ </message>
+ <message>
+ <source>ICO_DIVIDEDCYLINDER</source>
+ <translation>dividedcylinder.png</translation>
+ </message>
+
+ <message>
+ <source>ICON_DLG_SMOOTHINGSURFACE_LPOINTS</source>
+ <translation>smoothingsurface_lpoints.png</translation>
+ </message>
+ <message>
+ <source>ICO_SMOOTHINGSURFACE</source>
+ <translation>smoothingsurface.png</translation>
+ </message>
+ <!-- @@ insert new functions before this line @@ do not remove this line @@ -->
+ </context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>GEOM_ADVANCED</source>
+ <translation>Advanced shape: type %1</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_201</source>
+ <translation>Pipe TShape</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_202</source>
+ <translation>Divided Disk</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_203</source>
+ <translation>Divided Cylinder</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK</source>
+ <translation>Divided Disk</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK_TITLE</source>
+ <translation>Divided Disk construction</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER</source>
+ <translation>Divided Cylinder</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
+ <translation>Divided Cylinder construction</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDCYLINDER</source>
+ <translation>Divided Cylinder</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDCYLINDER</source>
+ <translation>Divided Cylinder</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDCYLINDER</source>
+ <translation>Divided Cylinder</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDDISK</source>
+ <translation>Divided Disk</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDDISK</source>
+ <translation>Divided Disk</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDDISK</source>
+ <translation>Divided Disk</translation>
+ </message>
+ <message>
+ <source>TOP_PIPETSHAPE</source>
+ <translation>Create Pipe TShape</translation>
+ </message>
+ <message>
+ <source>MEN_PIPETSHAPE</source>
+ <translation>Pipe TShape</translation>
+ </message>
+ <message>
+ <source>STB_PIPETSHAPE</source>
+ <translation>Create new Pipe TShape object</translation>
+ </message>
+ <message>
+ <source>TOP_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>MEN_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>STB_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_MAIN_PIPE</source>
+ <translation>Main pipe half length</translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_INCIDENT_PIPE</source>
+ <translation>Incident pipe half length</translation>
+ </message>
+ <message>
+ <source>CIRCULAR_QUARTER_PIPE</source>
+ <translation>Circular quarter of pipe</translation>
+ </message>
+ <message>
+ <source>THICKNESS</source>
+ <translation>Thickness</translation>
+ </message>
+ <message>
+ <source>FLANGE</source>
+ <translation>Flange</translation>
+ </message>
+ <message>
+ <source>CHAMFER_OR_FILLET</source>
+ <translation>Chamfer or fillet</translation>
+ </message>
+ <message>
+ <source>CHAMFER</source>
+ <translation>Chamfer</translation>
+ </message>
+ <message>
+ <source>FILLET</source>
+ <translation>Fillet</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_1</source>
+ <translation>Junction 1</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_2</source>
+ <translation>Junction 2</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_3</source>
+ <translation>Junction 3</translation>
+ </message>
+ <message>
+ <source>INTERNAL_FACES</source>
+ <translation>Internal faces</translation>
+ </message>
+</context>
+<context>
+ <name>AdvancedGUI_PipeTShapeDlg</name>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TITLE</source>
+ <translation>Pipe TShape Construction</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE</source>
+ <translation>PipeTShape</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_MPIPE</source>
+ <translation>Main pipe</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_R</source>
+ <translation>Radius</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_W</source>
+ <translation>Width</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_L</source>
+ <translation>Half-length</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_IPIPE</source>
+ <translation>Incident pipe</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
+ <translation>Chamfer</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
+ <translation>Height</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
+ <translation>Width</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_FILLET</source>
+ <translation>Fillet</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_HEX</source>
+ <translation>Prepare for hex mesh</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION</source>
+ <translation>Set position</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
+ <translation>Junction P1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
+ <translation>Junction P2</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
+ <translation>Junction P3</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
+ <translation>New L1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
+ <translation>New L2</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_LEFT_TR</source>
+ <translation>Left thickness reduction</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_RIGHT_TR</source>
+ <translation>Right thickness reduction</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_INCI_TR</source>
+ <translation>Incident pipe thickness reduction</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_R</source>
+ <translation>Radius (r%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_W</source>
+ <translation>Width (w%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_L_TRANS</source>
+ <translation>Transition length (ltrans%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_L_THIN</source>
+ <translation>Thin part length (lthin%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPMAIN</source>
+ <translation>Main parameters</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPREDUCT</source>
+ <translation>Thickness reduction</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPPOS</source>
+ <translation>Position</translation>
+ </message>
+</context>
+<context>
+ <name>AdvancedGUI_SmoothingSurfaceDlg</name>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_TITLE</source>
+ <translation>Smoothing surface Construction</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE</source>
+ <translation>Smoothing surface</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_RESULT</source>
+ <translation>Result name</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG</source>
+ <translation>Nodes</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
+ <translation>Points</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>GEOM_ADVANCED</source>
+ <translation>Objet géométrique avancé : type %1</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_201</source>
+ <translation>Tuyau en T</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_202</source>
+ <translation>Disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_203</source>
+ <translation>Cylindre prédécoupé</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK</source>
+ <translation>Disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK_TITLE</source>
+ <translation>Construction d'un disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER</source>
+ <translation>Cylinder prédécoupé</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
+ <translation>Construction d'un cylindre prédécoupé</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDCYLINDER</source>
+ <translation>Cylinder prédécoupé</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDCYLINDER</source>
+ <translation>Cylinder prédécoupé</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDCYLINDER</source>
+ <translation>Cylinder prédécoupé</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDDISK</source>
+ <translation>Disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDDISK</source>
+ <translation>Disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDDISK</source>
+ <translation>Disque prédécoupé</translation>
+ </message>
+ <message>
+ <source>TOP_PIPETSHAPE</source>
+ <translation>Créer un tuyau en T</translation>
+ </message>
+ <message>
+ <source>MEN_PIPETSHAPE</source>
+ <translation>Tuyau en T</translation>
+ </message>
+ <message>
+ <source>STB_PIPETSHAPE</source>
+ <translation>Créer un tuyau en T</translation>
+ </message>
+ <message>
+ <source>TOP_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>MEN_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>STB_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_MAIN_PIPE</source>
+ <translation>Demi-longueur du tuyau principal </translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_INCIDENT_PIPE</source>
+ <translation>Demi-longueur du tuyau incident</translation>
+ </message>
+ <message>
+ <source>CIRCULAR_QUARTER_PIPE</source>
+ <translation>Un quart circulaire du tuyau</translation>
+ </message>
+ <message>
+ <source>THICKNESS</source>
+ <translation>Epaisseur</translation>
+ </message>
+ <message>
+ <source>FLANGE</source>
+ <translation>Collerette</translation>
+ </message>
+ <message>
+ <source>CHAMFER_OR_FILLET</source>
+ <translation>Chanfrein ou congé</translation>
+ </message>
+ <message>
+ <source>CHAMFER</source>
+ <translation>Chanfrein</translation>
+ </message>
+ <message>
+ <source>FILLET</source>
+ <translation>Congé</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_1</source>
+ <translation>Jonction 1</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_2</source>
+ <translation>Jonction 2</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_3</source>
+ <translation>Jonction 3</translation>
+ </message>
+ <message>
+ <source>INTERNAL_FACES</source>
+ <translation type="unfinished">Internal faces</translation>
+ </message>
+</context>
+<context>
+ <name>AdvancedGUI_PipeTShapeDlg</name>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TITLE</source>
+ <translation>Construction d'un tuyau en T</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE</source>
+ <translation>Tuyau en T</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_MPIPE</source>
+ <translation>Tuyau principal</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_R</source>
+ <translation>Rayon</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_W</source>
+ <translation>Largeur</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_L</source>
+ <translation>Demi-longueur</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_IPIPE</source>
+ <translation>Tuyau incident</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
+ <translation>Chanfrein</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
+ <translation>Hauteur</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
+ <translation>Largeur</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_FILLET</source>
+ <translation>Congé</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_HEX</source>
+ <translation>Préparer pour un maillage hexaédrique</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION</source>
+ <translation>Définir la position</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
+ <translation>Jonction P1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
+ <translation>Jonction P2</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
+ <translation>Jonction P3</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
+ <translation>Nouvelle L1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
+ <translation>Nouvelle L2</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_LEFT_TR</source>
+ <translation>Réduction d'épaisseur à gauche</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_RIGHT_TR</source>
+ <translation>Réduction d'épaisseur à droite</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_INCI_TR</source>
+ <translation>Réduction d'épaisseur du tuyau incident</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_R</source>
+ <translation>Rayon (r%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_W</source>
+ <translation>Epaisseur (w%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_L_TRANS</source>
+ <translation>Longueur de transition (ltrans%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TR_L_THIN</source>
+ <translation>Longueur de la partie étroite (lthin%1)</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPMAIN</source>
+ <translation>Paramètres principaux</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPREDUCT</source>
+ <translation>Réduction d'épaisseur</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPETSHAPE_GROUPPOS</source>
+ <translation>Position</translation>
+ </message>
+</context>
+<context>
+ <name>AdvancedGUI_SmoothingSurfaceDlg</name>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_TITLE</source>
+ <translation>Constructions de surface lisse</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE</source>
+ <translation>Surface lissee</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_RESULT</source>
+ <translation>Nom du résultat</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG</source>
+ <translation>Noeuds</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
+ <translation>Points</translation>
+ </message>
+</context>
+</TS>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="en_US">
+<context>
+ <name>@default</name>
+ <message>
+ <source>GEOM_ADVANCED</source>
+ <translation>形状を高度な:%1 入力</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_201</source>
+ <translation>TShape をパイプします。</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_202</source>
+ <translation>分割ディスク</translation>
+ </message>
+ <message>
+ <source>GEOM_ADVANCED_203</source>
+ <translation>分割シリンダー</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK</source>
+ <translation>分割ディスク</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDDISK_TITLE</source>
+ <translation>分割ディスク建設</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER</source>
+ <translation>分割シリンダー</translation>
+ </message>
+ <message>
+ <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
+ <translation>分割構造</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDCYLINDER</source>
+ <translation>分割シリンダー</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDCYLINDER</source>
+ <translation>分割シリンダー</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDCYLINDER</source>
+ <translation>分割シリンダー</translation>
+ </message>
+ <message>
+ <source>MEN_DIVIDEDDISK</source>
+ <translation>分割ディスク</translation>
+ </message>
+ <message>
+ <source>TOP_DIVIDEDDISK</source>
+ <translation>分割ディスク</translation>
+ </message>
+ <message>
+ <source>STB_DIVIDEDDISK</source>
+ <translation>分割ディスク</translation>
+ </message>
+ <message>
+ <source>TOP_PIPETSHAPE</source>
+ <translation>TShape パイプを作成します。</translation>
+ </message>
+ <message>
+ <source>MEN_PIPETSHAPE</source>
+ <translation>TShape をパイプします。</translation>
+ </message>
+ <message>
+ <source>STB_PIPETSHAPE</source>
+ <translation>新しいパイプ TShape オブジェクトを作成します。</translation>
+ </message>
+ <message>
+ <source>TOP_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>MEN_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>STB_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing Surface</translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_MAIN_PIPE</source>
+ <translation>主配管の長さの半分</translation>
+ </message>
+ <message>
+ <source>HALF_LENGTH_INCIDENT_PIPE</source>
+ <translation>インシデント管長さの半分</translation>
+ </message>
+ <message>
+ <source>CIRCULAR_QUARTER_PIPE</source>
+ <translation>円形の四半期パイプの</translation>
+ </message>
+ <message>
+ <source>THICKNESS</source>
+ <translation>厚</translation>
+ </message>
+ <message>
+ <source>FLANGE</source>
+ <translation>フランジ</translation>
+ </message>
+ <message>
+ <source>CHAMFER_OR_FILLET</source>
+ <translation>面取りまたはフィレット</translation>
+ </message>
+ <message>
+ <source>CHAMFER</source>
+ <translation>面取り</translation>
+ </message>
+ <message>
+ <source>FILLET</source>
+ <translation>フィレット</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_1</source>
+ <translation>ジャンクション 1</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_2</source>
+ <translation>ジャンクション 2</translation>
+ </message>
+ <message>
+ <source>JUNCTION_FACE_3</source>
+ <translation>ジャンクション 3</translation>
+ </message>
+ <message>
+ <source>INTERNAL_FACES</source>
+ <translation type="unfinished">Internal faces</translation>
+ </message>
+</context>
+ <context>
+ <name>AdvancedGUI_PipeTShapeDlg</name>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_TITLE</source>
+ <translation>パイプ TShape 建設</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE</source>
+ <translation>PipeTShape</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_MPIPE</source>
+ <translation>主配管</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_R</source>
+ <translation>半径</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_W</source>
+ <translation>幅</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_L</source>
+ <translation>ハーフレングス</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_IPIPE</source>
+ <translation>インシデント管</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
+ <translation>面取り</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
+ <translation>高さ</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
+ <translation>幅</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_FILLET</source>
+ <translation>フィレット</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_HEX</source>
+ <translation>16 進数のメッシュのための準備します。</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION</source>
+ <translation>位置の設定</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
+ <translation>ジャンクション P1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
+ <translation>ジャンクション P2</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
+ <translation>ジャンクション P3</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
+ <translation>新しい L1</translation>
+ </message>
+ <message>
+ <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
+ <translation>新しい L2</translation>
+ </message>
+ </context>
+<context>
+ <name>AdvancedGUI_SmoothingSurfaceDlg</name>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_TITLE</source>
+ <translation type="unfinished">Smoothing surface Construction</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE</source>
+ <translation type="unfinished">Smoothing surface</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_RESULT</source>
+ <translation type="unfinished">Result name</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG</source>
+ <translation type="unfinished">Nodes</translation>
+ </message>
+ <message>
+ <source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
+ <translation type="unfinished">Points</translation>
+ </message>
+</context>
+</TS>
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
# File : Makefile.am
# Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-#
+
include $(top_srcdir)/adm_local/unix/make_common_starter.am
-# header files
+# header files
salomeinclude_HEADERS = \
AdvancedGUI.h
nodist_libAdvancedGUI_la_SOURCES = \
$(MOC_FILES)
+# resources files
+nodist_salomeres_DATA = \
+ AdvancedGUI_images.qm \
+ AdvancedGUI_msg_en.qm \
+ AdvancedGUI_msg_fr.qm \
+ AdvancedGUI_msg_ja.qm
+
# additional information to compile and link file
libAdvancedGUI_la_CPPFLAGS = \
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : reading of xml file with list of available plugin actions
+// File : GEOMGUI_XmlHandler.cxx
+// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
+
+#include "GEOMGUI_XmlHandler.h"
+
+#include "GEOMGUI.h"
+
+// SALOME KERNEL includes
+#include <utilities.h>
+
+/*!
+ * Constructor
+ */
+GEOMGUI_XmlHandler::GEOMGUI_XmlHandler()
+{
+}
+
+/*!
+ * Destructor
+ */
+GEOMGUI_XmlHandler::~GEOMGUI_XmlHandler()
+{
+}
+
+/*!
+ * Starts parsing of document. Does some initialization
+ *
+ * Reimplemented from QXmlDefaultHandler.
+ */
+bool GEOMGUI_XmlHandler::startDocument()
+{
+ myErrorProt = "";
+ return true;
+}
+
+/*!
+ * Does different actions depending on the name of the tag and the
+ * state you are in document.
+ *
+ * Reimplemented from QXmlDefaultHandler.
+ */
+bool GEOMGUI_XmlHandler::startElement (const QString&, const QString&,
+ const QString& qName,
+ const QXmlAttributes& atts)
+{
+ if (qName == "geom-plugins") { // set of plugins
+ //myHypothesesMap.clear();
+ //myAlgorithmsMap.clear();
+ }
+ else if (qName == "geom-plugin") { // group of actions
+ myPluginData.myName = atts.value("name");
+ myPluginData.myServerLib = atts.value("server-lib");
+ myPluginData.myClientLib = atts.value("gui-lib");
+
+ //QString aResName = atts.value("resources");
+ //if (aResName != "") {
+ // SUIT_ResourceMgr* resMgr = GEOMGUI::resourceMgr();
+ // QString lang = resMgr->stringValue( resMgr->langSection(), "language", "en" );
+ // resMgr->loadTranslator( "resources", QString( "%1_msg_%2.qm" ).arg( aResName, lang ) );
+ // resMgr->loadTranslator( "resources", QString( "%1_images.qm" ).arg( aResName, lang ) );
+ //}
+ }
+ else if (qName == "actions") { // group of actions
+ }
+ else if (qName == "action") { // an action
+ GEOMGUI_ActionData aData;
+ aData.myLabel = atts.value("label");
+ aData.myIcon = atts.value("icon");
+ aData.myMenu = atts.value("menu");
+ aData.myTooltip = atts.value("tooltip");
+ aData.myStatusBar = atts.value("status-bar");
+
+ myPluginData.myListOfActions.append(aData);
+ }
+ else {
+ // error
+ return false;
+ }
+ return true;
+}
+
+/*!
+ * Reimplemented from QXmlDefaultHandler.
+ */
+bool GEOMGUI_XmlHandler::endElement (const QString&, const QString&, const QString&)
+{
+ return true;
+}
+
+/*!
+ * Reimplemented from QXmlDefaultHandler.
+ */
+bool GEOMGUI_XmlHandler::characters (const QString& ch)
+{
+ // we are not interested in whitespaces
+ //QString ch_simplified = ch.simplified();
+ //if ( ch_simplified.isEmpty() )
+ // return true;
+ return true;
+}
+
+/*!
+ * Returns the default error string.
+ *
+ * Reimplemented from QXmlDefaultHandler.
+ */
+QString GEOMGUI_XmlHandler::errorString()
+{
+ return "the document is not in the quote file format";
+}
+
+/*!
+ * Returns the error protocol if parsing failed
+ *
+ * Reimplemented from QXmlDefaultHandler.
+ */
+QString GEOMGUI_XmlHandler::errorProtocol()
+{
+ return myErrorProt;
+}
+
+/*!
+ * Returns exception
+ *
+ * Reimplemented from QXmlDefaultHandler.
+ */
+bool GEOMGUI_XmlHandler::fatalError (const QXmlParseException& exception)
+{
+ myErrorProt += QString("fatal parsing error: %1 in line %2, column %3\n")
+ .arg(exception.message())
+ .arg(exception.lineNumber())
+ .arg(exception.columnNumber());
+
+ return QXmlDefaultHandler::fatalError( exception );
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// GEOM GEOMGUI : reading of xml file with list of available plugin actions
+// File : GEOMGUI_XmlHandler.h
+// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
+
+#ifndef GEOMGUI_XMLHANDLER_H
+#define GEOMGUI_XMLHANDLER_H
+
+// GEOM includes
+#include "GEOMGUI.h"
+
+// Qt includes
+#include <QXmlDefaultHandler>
+#include <QMap>
+#include <QList>
+
+//GUI includes
+#include <QtxMap.h>
+
+//class HypothesisData;
+//class HypothesesSet;
+
+struct GEOMGUI_ActionData
+{
+ QString myLabel; // unique ID
+ QString myIcon;
+ QString myMenu;
+ QString myTooltip;
+ QString myStatusBar;
+
+ //int myAccel;
+ //bool myToggle;
+ //QString myShortcut;
+};
+
+struct GEOMGUI_PluginData
+{
+ QString myName;
+ QString myServerLib;
+ QString myClientLib;
+
+ //QList<GEOMGUI_ActionData*> myListOfActions;
+ QList<GEOMGUI_ActionData> myListOfActions;
+};
+
+class GEOMGUI_EXPORT GEOMGUI_XmlHandler : public QXmlDefaultHandler
+{
+public:
+ GEOMGUI_XmlHandler();
+ virtual ~GEOMGUI_XmlHandler();
+
+ bool startDocument();
+ bool startElement( const QString&, const QString&,
+ const QString&, const QXmlAttributes& );
+ bool endElement( const QString&, const QString&, const QString& );
+ bool characters( const QString& );
+
+ QString errorString();
+ QString errorProtocol();
+ bool fatalError( const QXmlParseException& );
+
+public:
+ GEOMGUI_PluginData myPluginData;
+
+private:
+ QString myErrorProt;
+};
+
+#endif // GEOMGUI_XMLHANDLER_H
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : GEOMPluginGUI.cxx
+
+#include "GEOMPluginGUI.h"
+#include "GeometryGUI.h"
+
+#include <SUIT_Desktop.h>
+
+//=================================================================================
+// function : GEOMPluginGUI::GEOMPluginGUI
+// purpose : Constructor
+//=================================================================================
+GEOMPluginGUI::GEOMPluginGUI (GeometryGUI* parent)
+ : GEOMGUI (parent)
+{
+}
+
+//=================================================================================
+// function : GEOMPluginGUI::~GEOMPluginGUI
+// purpose : Destructor
+//=================================================================================
+GEOMPluginGUI::~GEOMPluginGUI()
+{
+}
+
+//=================================================================================
+// class : GEOMPluginGUI::OnGUIEvent
+// purpose : Main/popup menu events processing
+//=================================================================================
+bool GEOMPluginGUI::OnGUIEvent (const QString& /*action*/, SUIT_Desktop* /*parent*/)
+{
+ return true;
+}
--- /dev/null
+// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File : GEOMPluginGUI.h
+
+#ifndef GEOMPLUGINGUI_H
+#define GEOMPLUGINGUI_H
+
+#include "GEOMGUI.h"
+
+#include <QObject>
+
+//=================================================================================
+// class : GEOMPluginGUI
+// purpose : Base class for all geometry Plugins
+//=================================================================================
+class GEOMGUI_EXPORT GEOMPluginGUI : public GEOMGUI
+{
+public :
+ // Constructor
+ GEOMPluginGUI (GeometryGUI* parent);
+ // Destructor
+ virtual ~GEOMPluginGUI();
+
+ //! Parameter action specifies the operation ID
+ virtual bool OnGUIEvent (const QString& action, SUIT_Desktop* parent);
+ //virtual bool OnGUIEvent (const QString& action, SUIT_Desktop* parent, const QVariant& theParam);
+};
+
+#endif // GEOMPluginGUI_H
<source>ICON_DLG_SCALE_ALONG_AXES</source>
<translation>scale_along_axes.png</translation>
</message>
- <message>
- <source>ICON_DLG_PIPETSHAPE</source>
- <translation>pipetshape.png</translation>
- </message>
- <message>
- <source>ICO_PIPETSHAPE</source>
- <translation>pipetshape.png</translation>
- </message>
- <message>
- <source>ICO_PIPETSHAPE_IMPORT</source>
- <translation>pipetshape_import_icon.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE</source>
- <translation>dlg_pipetshape.png</translation>
- </message>
- <message>
- <source>IMG_PIPETSHAPE_SECT</source>
- <translation>pipetshape_section.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_L1</source>
- <translation>dlg_pipetshapel1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_R1</source>
- <translation>dlg_pipetshaper1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_W1</source>
- <translation>dlg_pipetshapew1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_L2</source>
- <translation>dlg_pipetshapel2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_R2</source>
- <translation>dlg_pipetshaper2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_W2</source>
- <translation>dlg_pipetshapew2.png</translation>
- </message>
-
- <message>
- <source>DLG_PIPETSHAPE_FILLET</source>
- <translation>dlg_pipetshapefillet.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_L1</source>
- <translation>dlg_pipetshapefilletl1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_R1</source>
- <translation>dlg_pipetshapefilletr1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_W1</source>
- <translation>dlg_pipetshapefilletw1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_L2</source>
- <translation>dlg_pipetshapefilletl2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_R2</source>
- <translation>dlg_pipetshapefilletr2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_W2</source>
- <translation>dlg_pipetshapefilletw2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_FILLET_RF</source>
- <translation>dlg_pipetshapefilletrf.png</translation>
- </message>
-
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER</source>
- <translation>dlg_pipetshapechamfer.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_L1</source>
- <translation>dlg_pipetshapechamferl1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_R1</source>
- <translation>dlg_pipetshapechamferr1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_W1</source>
- <translation>dlg_pipetshapechamferw1.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_L2</source>
- <translation>dlg_pipetshapechamferl2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_R2</source>
- <translation>dlg_pipetshapechamferr2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_W2</source>
- <translation>dlg_pipetshapechamferw2.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_H</source>
- <translation>dlg_pipetshapechamferh.png</translation>
- </message>
- <message>
- <source>DLG_PIPETSHAPE_CHAMFER_W</source>
- <translation>dlg_pipetshapechamferw.png</translation>
- </message>
-
- <message>
- <source>ICON_OBJBROWSER_ADVANCED_201</source>
- <translation>tree_pipetshape.png</translation>
- </message>
-<!--
- <message>
- <source>ICON_DLG_PIPETSHAPEGROUPS</source>
- <translation>pipetshapegroups.png</translation>
- </message>
- <message>
- <source>ICO_PIPETSHAPEGROUPS</source>
- <translation>pipetshapegroups.png</translation>
- </message>
--->
- <message>
- <source>ICON_DLG_DIVIDEDDISK_R_RATIO</source>
- <translation>divided_disk.png</translation>
- </message>
- <message>
- <source>ICO_DIVIDEDDISK</source>
- <translation>divided_disk.png</translation>
- </message>
- <message>
- <source>ICON_OBJBROWSER_ADVANCED_202</source>
- <translation>divided_disk.png</translation>
- </message>
- <message>
- <source>ICON_DLG_DIVIDEDCYLINDER_R_H</source>
- <translation>dividedcylinder_r_h.png</translation>
- </message>
- <message>
- <source>ICO_DIVIDEDCYLINDER</source>
- <translation>dividedcylinder.png</translation>
- </message>
- <message>
- <source>ICON_OBJBROWSER_ADVANCED_203</source>
- <translation>dividedcylinder.png</translation>
- </message>
- <message>
- <source>ICON_DLG_SMOOTHINGSURFACE_LPOINTS</source>
- <translation>smoothingsurface_lpoints.png</translation>
- </message>
- <message>
- <source>ICO_SMOOTHINGSURFACE</source>
- <translation>smoothingsurface.png</translation>
- </message>
- <message>
- <source>ICON_OBJBROWSER_ADVANCED_204</source>
- <translation>tree_smoothingsurface.png</translation>
- </message>
- <!-- @@ insert new functions before this line @@ do not remove this line @@ -->
</context>
</TS>
<source>GEOM_DIVIDE_EDGE_TITLE</source>
<translation>Addition of point</translation>
</message>
- <message>
- <source>GEOM_DIVIDEDDISK</source>
- <translation>Divided Disk</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDDISK_TITLE</source>
- <translation>Divided Disk construction</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER</source>
- <translation>Divided Cylinder</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
- <translation>Divided Cylinder construction</translation>
- </message>
<message>
<source>GEOM_DX</source>
<translation>Dx :</translation>
<source>MEN_DISK</source>
<translation>Disk</translation>
</message>
- <message>
- <source>MEN_DIVIDEDDISK</source>
- <translation>Divided Disk</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDDISK</source>
- <translation>Divided Disk</translation>
- </message>
- <message>
- <source>STB_DIVIDEDDISK</source>
- <translation>Divided Disk</translation>
- </message>
- <message>
- <source>MEN_DIVIDEDCYLINDER</source>
- <translation>Divided Cylinder</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDCYLINDER</source>
- <translation>Divided Cylinder</translation>
- </message>
- <message>
- <source>STB_DIVIDEDCYLINDER</source>
- <translation>Divided Cylinder</translation>
- </message>
<message>
<source>MEN_DISPLAY_ALL</source>
<translation>Show All</translation>
<translation>Take into account the units (%1) embedded to the file?
Ignoring units will cause model scaling (as dimensions are supposed to be specified in meters).</translation>
</message>
- <message>
- <source>GEOM_ADVANCED</source>
- <translation>Advanced shape: type %1</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_202</source>
- <translation>Divided Disk</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_203</source>
- <translation>Divided Cylinder</translation>
- </message>
<message>
<source>GEOM_PRECISION_HINT</source>
<translation>Input value precision can be adjusted using
'%1' parameter in Geometry module preferences.</translation>
</message>
- <message>
- <source>TOP_PIPETSHAPE</source>
- <translation>Create Pipe TShape</translation>
- </message>
- <message>
- <source>MEN_PIPETSHAPE</source>
- <translation>Pipe TShape</translation>
- </message>
- <message>
- <source>STB_PIPETSHAPE</source>
- <translation>Create new Pipe TShape object</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_201</source>
- <translation>Pipe TShape</translation>
- </message>
- <message>
- <source>HALF_LENGTH_MAIN_PIPE</source>
- <translation>Main pipe half length</translation>
- </message>
- <message>
- <source>HALF_LENGTH_INCIDENT_PIPE</source>
- <translation>Incident pipe half length</translation>
- </message>
- <message>
- <source>CIRCULAR_QUARTER_PIPE</source>
- <translation>Circular quarter of pipe</translation>
- </message>
- <message>
- <source>THICKNESS</source>
- <translation>Thickness</translation>
- </message>
- <message>
- <source>FLANGE</source>
- <translation>Flange</translation>
- </message>
- <message>
- <source>CHAMFER_OR_FILLET</source>
- <translation>Chamfer or fillet</translation>
- </message>
- <message>
- <source>CHAMFER</source>
- <translation>Chamfer</translation>
- </message>
- <message>
- <source>FILLET</source>
- <translation>Fillet</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_1</source>
- <translation>Junction 1</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_2</source>
- <translation>Junction 2</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_3</source>
- <translation>Junction 3</translation>
- </message>
- <message>
- <source>INTERNAL_FACES</source>
- <translation>Internal faces</translation>
- </message>
<message>
<source>GEOM_PLUGINS_OTHER</source>
<translation>Other</translation>
<source>TOP_SMOOTHINGSURFACE</source>
<translation type="unfinished">Smoothing Surface</translation>
</message>
- <message>
- <source>MEN_SMOOTHINGSURFACE</source>
- <translation type="unfinished">Smoothing Surface</translation>
- </message>
- <message>
- <source>STB_SMOOTHINGSURFACE</source>
- <translation type="unfinished">Smoothing Surface</translation>
- </message>
<message>
<source>GEOM_SELECT_IMAGE</source>
<translation>Select image...</translation>
<translation>Shared_%1</translation>
</message>
</context>
-<context>
- <name>AdvancedGUI_PipeTShapeDlg</name>
- <message>
- <source>GEOM_PIPE_TSHAPE_TITLE</source>
- <translation>Pipe TShape Construction</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE</source>
- <translation>PipeTShape</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_MPIPE</source>
- <translation>Main pipe</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_R</source>
- <translation>Radius</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_W</source>
- <translation>Width</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_L</source>
- <translation>Half-length</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_IPIPE</source>
- <translation>Incident pipe</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
- <translation>Chamfer</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
- <translation>Height</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
- <translation>Width</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_FILLET</source>
- <translation>Fillet</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_HEX</source>
- <translation>Prepare for hex mesh</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION</source>
- <translation>Set position</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
- <translation>Junction P1</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
- <translation>Junction P2</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
- <translation>Junction P3</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
- <translation>New L1</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
- <translation>New L2</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_LEFT_TR</source>
- <translation>Left thickness reduction</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_RIGHT_TR</source>
- <translation>Right thickness reduction</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_INCI_TR</source>
- <translation>Incident pipe thickness reduction</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_R</source>
- <translation>Radius (r%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_W</source>
- <translation>Width (w%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_L_TRANS</source>
- <translation>Transition length (ltrans%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_L_THIN</source>
- <translation>Thin part length (lthin%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPMAIN</source>
- <translation>Main parameters</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPREDUCT</source>
- <translation>Thickness reduction</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPPOS</source>
- <translation>Position</translation>
- </message>
-</context>
-<context>
- <name>AdvancedGUI_SmoothingSurfaceDlg</name>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_TITLE</source>
- <translation>Smoothing surface Construction</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE</source>
- <translation>Smoothing surface</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_RESULT</source>
- <translation>Result name</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_ARG</source>
- <translation>Nodes</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
- <translation>Points</translation>
- </message>
-</context>
<context>
<name>GEOMToolsGUI_PublishDlg</name>
<message>
<source>GEOM_DIVIDE_EDGE_TITLE</source>
<translation>Ajouter un point</translation>
</message>
- <message>
- <source>GEOM_DIVIDEDDISK</source>
- <translation>Disque prédécoupé</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDDISK_TITLE</source>
- <translation>Construction d'un disque prédécoupé</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER</source>
- <translation>Cylinder prédécoupé</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
- <translation>Construction d'un cylindre prédécoupé</translation>
- </message>
<message>
<source>GEOM_DX</source>
<translation>Dx :</translation>
<source>MEN_DISK</source>
<translation>Disque</translation>
</message>
- <message>
- <source>MEN_DIVIDEDDISK</source>
- <translation>Disque prédécoupé</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDDISK</source>
- <translation>Disque prédécoupé</translation>
- </message>
- <message>
- <source>STB_DIVIDEDDISK</source>
- <translation>Disque prédécoupé</translation>
- </message>
- <message>
- <source>MEN_DIVIDEDCYLINDER</source>
- <translation>Cylinder prédécoupé</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDCYLINDER</source>
- <translation>Cylinder prédécoupé</translation>
- </message>
- <message>
- <source>STB_DIVIDEDCYLINDER</source>
- <translation>Cylinder prédécoupé</translation>
- </message>
<message>
<source>MEN_DISPLAY_ALL</source>
<translation>Afficher tout</translation>
<translation>Voulez-vous prendre les unités du fichier (%1) en considération?
Sinon le modèle sera mis à l'échelle GEOM (unités interprétées comme des mètres).</translation>
</message>
- <message>
- <source>GEOM_ADVANCED</source>
- <translation>Objet géométrique avancé : type %1</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_202</source>
- <translation>Disque prédécoupé</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_203</source>
- <translation>Cylindre prédécoupé</translation>
- </message>
<message>
<source>GEOM_PRECISION_HINT</source>
<translation>Il est possible d'ajuster la précision de la valeur d'entrée avec
le paramètre '%1' aux préférences du module Géométrie.</translation>
</message>
- <message>
- <source>TOP_PIPETSHAPE</source>
- <translation>Créer un tuyau en T</translation>
- </message>
- <message>
- <source>MEN_PIPETSHAPE</source>
- <translation>Tuyau en T</translation>
- </message>
- <message>
- <source>STB_PIPETSHAPE</source>
- <translation>Créer un tuyau en T</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_201</source>
- <translation>Tuyau en T</translation>
- </message>
- <message>
- <source>HALF_LENGTH_MAIN_PIPE</source>
- <translation>Demi-longueur du tuyau principal </translation>
- </message>
- <message>
- <source>HALF_LENGTH_INCIDENT_PIPE</source>
- <translation>Demi-longueur du tuyau incident</translation>
- </message>
- <message>
- <source>CIRCULAR_QUARTER_PIPE</source>
- <translation>Un quart circulaire du tuyau</translation>
- </message>
- <message>
- <source>THICKNESS</source>
- <translation>Epaisseur</translation>
- </message>
- <message>
- <source>FLANGE</source>
- <translation>Collerette</translation>
- </message>
- <message>
- <source>CHAMFER_OR_FILLET</source>
- <translation>Chanfrein ou congé</translation>
- </message>
- <message>
- <source>CHAMFER</source>
- <translation>Chanfrein</translation>
- </message>
- <message>
- <source>FILLET</source>
- <translation>Congé</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_1</source>
- <translation>Jonction 1</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_2</source>
- <translation>Jonction 2</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_3</source>
- <translation>Jonction 3</translation>
- </message>
- <message>
- <source>INTERNAL_FACES</source>
- <translation type="unfinished">Internal faces</translation>
- </message>
<message>
<source>GEOM_PLUGINS_OTHER</source>
<translation>Autre</translation>
<translation>Partagé_%1</translation>
</message>
</context>
-<context>
- <name>AdvancedGUI_PipeTShapeDlg</name>
- <message>
- <source>GEOM_PIPE_TSHAPE_TITLE</source>
- <translation>Construction d'un tuyau en T</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE</source>
- <translation>Tuyau en T</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_MPIPE</source>
- <translation>Tuyau principal</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_R</source>
- <translation>Rayon</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_W</source>
- <translation>Largeur</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_L</source>
- <translation>Demi-longueur</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_IPIPE</source>
- <translation>Tuyau incident</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER</source>
- <translation>Chanfrein</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER_H</source>
- <translation>Hauteur</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_CHAMFER_W</source>
- <translation>Largeur</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_FILLET</source>
- <translation>Congé</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_HEX</source>
- <translation>Préparer pour un maillage hexaédrique</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION</source>
- <translation>Définir la position</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P1</source>
- <translation>Jonction P1</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P2</source>
- <translation>Jonction P2</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_P3</source>
- <translation>Jonction P3</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L1</source>
- <translation>Nouvelle L1</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
- <translation>Nouvelle L2</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_LEFT_TR</source>
- <translation>Réduction d'épaisseur à gauche</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_RIGHT_TR</source>
- <translation>Réduction d'épaisseur à droite</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_INCI_TR</source>
- <translation>Réduction d'épaisseur du tuyau incident</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_R</source>
- <translation>Rayon (r%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_W</source>
- <translation>Epaisseur (w%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_L_TRANS</source>
- <translation>Longueur de transition (ltrans%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPE_TSHAPE_TR_L_THIN</source>
- <translation>Longueur de la partie étroite (lthin%1)</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPMAIN</source>
- <translation>Paramètres principaux</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPREDUCT</source>
- <translation>Réduction d'épaisseur</translation>
- </message>
- <message>
- <source>GEOM_PIPETSHAPE_GROUPPOS</source>
- <translation>Position</translation>
- </message>
-</context>
-<context>
- <name>AdvancedGUI_SmoothingSurfaceDlg</name>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_TITLE</source>
- <translation>Constructions de surface lisse</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE</source>
- <translation>Surface lissee</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_RESULT</source>
- <translation>Nom du résultat</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_ARG</source>
- <translation>Noeuds</translation>
- </message>
- <message>
- <source>GEOM_SMOOTHINGSURFACE_ARG_POINTS</source>
- <translation>Points</translation>
- </message>
-</context>
<context>
<name>GEOMToolsGUI_PublishDlg</name>
<message>
<source>GEOM_DIVIDE_EDGE_TITLE</source>
<translation>ポイントの追加</translation>
</message>
- <message>
- <source>GEOM_DIVIDEDDISK</source>
- <translation>分割ディスク</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDDISK_TITLE</source>
- <translation>分割ディスク建設</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER</source>
- <translation>分割シリンダー</translation>
- </message>
- <message>
- <source>GEOM_DIVIDEDCYLINDER_TITLE</source>
- <translation>分割構造</translation>
- </message>
<message>
<source>GEOM_DX</source>
<translation>Dx:</translation>
<source>MEN_DISK</source>
<translation>ディスク</translation>
</message>
- <message>
- <source>MEN_DIVIDEDDISK</source>
- <translation>分割ディスク</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDDISK</source>
- <translation>分割ディスク</translation>
- </message>
- <message>
- <source>STB_DIVIDEDDISK</source>
- <translation>分割ディスク</translation>
- </message>
- <message>
- <source>MEN_DIVIDEDCYLINDER</source>
- <translation>分割シリンダー</translation>
- </message>
- <message>
- <source>TOP_DIVIDEDCYLINDER</source>
- <translation>分割シリンダー</translation>
- </message>
- <message>
- <source>STB_DIVIDEDCYLINDER</source>
- <translation>分割シリンダー</translation>
- </message>
<message>
<source>MEN_DISPLAY_ALL</source>
<translation>すべて表示します。</translation>
<source>GEOM_SCALE_DIMENSIONS</source>
<translation>ユニット (%1) ファイルに埋め込まれたアカウントを考慮か?ユニットを無視することにより、モデルをスケーリング (メートル単位で指定するにはサイズを想定)。</translation>
</message>
- <message>
- <source>GEOM_ADVANCED</source>
- <translation>形状を高度な:%1 入力</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_202</source>
- <translation>分割ディスク</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_203</source>
- <translation>分割シリンダー</translation>
- </message>
<message>
<source>GEOM_PRECISION_HINT</source>
<translation>入力値の精度は、ジオメトリのモジュール設定に '%1' パラメーターを使用して調整できます。</translation>
</message>
- <message>
- <source>TOP_PIPETSHAPE</source>
- <translation>TShape パイプを作成します。</translation>
- </message>
- <message>
- <source>MEN_PIPETSHAPE</source>
- <translation>TShape をパイプします。</translation>
- </message>
- <message>
- <source>STB_PIPETSHAPE</source>
- <translation>新しいパイプ TShape オブジェクトを作成します。</translation>
- </message>
- <message>
- <source>GEOM_ADVANCED_201</source>
- <translation>TShape をパイプします。</translation>
- </message>
- <message>
- <source>HALF_LENGTH_MAIN_PIPE</source>
- <translation>主配管の長さの半分</translation>
- </message>
- <message>
- <source>HALF_LENGTH_INCIDENT_PIPE</source>
- <translation>インシデント管長さの半分</translation>
- </message>
- <message>
- <source>CIRCULAR_QUARTER_PIPE</source>
- <translation>円形の四半期パイプの</translation>
- </message>
- <message>
- <source>THICKNESS</source>
- <translation>厚</translation>
- </message>
- <message>
- <source>FLANGE</source>
- <translation>フランジ</translation>
- </message>
- <message>
- <source>CHAMFER_OR_FILLET</source>
- <translation>面取りまたはフィレット</translation>
- </message>
- <message>
- <source>CHAMFER</source>
- <translation>面取り</translation>
- </message>
- <message>
- <source>FILLET</source>
- <translation>フィレット</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_1</source>
- <translation>ジャンクション 1</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_2</source>
- <translation>ジャンクション 2</translation>
- </message>
- <message>
- <source>JUNCTION_FACE_3</source>
- <translation>ジャンクション 3</translation>
- </message>
<message>
<source>GEOM_PLUGINS_OTHER</source>
<translation>その他</translation>
#include "Python.h"
#include "GeometryGUI.h"
#include "GeometryGUI_Operations.h"
+#include "GEOMPluginGUI.h"
+#include "GEOMGUI_XmlHandler.h"
#include "GEOMGUI_OCCSelector.h"
#include "GEOMGUI_Selection.h"
#include "GEOMGUI_CreationInfoWdg.h"
#include <Basics_OCCTVersion.hxx>
// External includes
+#include <QDir>
#include <QMenu>
#include <QTime>
#include <QAction>
return myGUIMap.contains( libraryName ) ? myGUIMap[ libraryName ] : 0;
}
+//=======================================================================
+// function : GeometryGUI::getPluginLibrary()
+// purpose : get or load GUI Plugin library by name [ internal ]
+//=======================================================================
+typedef GEOMPluginGUI* (*PluginLibraryGUI)( GeometryGUI* );
+GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
+{
+ if ( !myGUIMap.contains( libraryName ) ) {
+ // try to load library if it is not loaded yet
+#ifndef WNT
+ QString dirs = getenv( "LD_LIBRARY_PATH" );
+ QString sep = ":";
+#else
+ QString dirs = getenv( "PATH" );
+ QString sep = ";";
+#endif
+ if ( !dirs.isEmpty() ) {
+ QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
+ QListIterator<QString> it( dirList ); it.toBack();
+ while ( it.hasPrevious() ) {
+ QFileInfo fi( Qtx::addSlash( it.previous() ) + libraryName );
+ if ( fi.exists() ) {
+ OSD_SharedLibrary aSharedLibrary( fi.fileName().toLatin1().constData() );
+ bool res = aSharedLibrary.DlOpen( OSD_RTLD_LAZY );
+ if ( !res ) {
+ MESSAGE( "Can't open library : " << aSharedLibrary.DlError() );
+ continue; // continue search further
+ }
+ OSD_Function osdF = aSharedLibrary.DlSymb( "GetLibGUI" );
+ if ( osdF != NULL ) {
+ PluginLibraryGUI func = (GEOMPluginGUI* (*) (GeometryGUI*))osdF;
+ GEOMPluginGUI* libGUI = (*func)( this );
+ if ( libGUI ) {
+ myGUIMap[ libraryName ] = libGUI;
+ break; // found and loaded!
+ }
+ }
+ }
+ }
+ }
+ }
+ return myGUIMap.contains( libraryName ) ? (GEOMPluginGUI*)myGUIMap[ libraryName ] : 0;
+}
+
//=======================================================================
// function : GeometryGUI::ActiveWorkingPlane()
// purpose : Activate Working Plane View
<< GEOMOp::OpPointMarker
<< GEOMOp::OpCreateFolder
<< GEOMOp::OpSortChildren;
- if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) )
- return;
+ if ( !ViewOCC && !ViewVTK && !NotViewerDependentCommands.contains( id ) ) {
+ // activate OCC viewer
+ getApp()->getViewManager(OCCViewer_Viewer::Type(), /*create=*/true);
+ }
// fix for IPAL9103, point 2
if ( CORBA::is_nil( GetGeomGen() ) ) {
case GEOMOp::OpExplodeBlock: // MENU BLOCKS - EXPLODE ON BLOCKS
libName = "BlocksGUI";
break;
- case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
- case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
-// case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
- case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
- case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
- case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
- //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
- libName = "AdvancedGUI";
- break;
+ //case GEOMOp::OpAdvancedNoOp: // NO OPERATION (advanced operations base)
+ //case GEOMOp::OpPipeTShape: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
+ //case GEOMOp::OpPipeTShapeGroups: // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
+ //case GEOMOp::OpDividedDisk: // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
+ //case GEOMOp::OpDividedCylinder: // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
+ //case GEOMOp::OpSmoothingSurface: // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@//
+ //libName = "AdvancedGUI";
+ //break;
default:
+ if (myPluginActions.contains(id)) {
+ libName = myPluginActions[id].first;
+
+ GEOMPluginGUI* library = 0;
+ if ( !libName.isEmpty() ) {
+#ifndef WNT
+ libName = QString( "lib" ) + libName + ".so";
+#else
+ libName = libName + ".dll";
+#endif
+ library = getPluginLibrary( libName );
+ }
+
+ // call method of corresponding GUI library
+ if ( library ) {
+ //QString action ("%1");
+ //action = action.arg(id);
+
+ //if( !theParam.isValid() )
+ library->OnGUIEvent( myPluginActions[id].second, desk );
+ //else
+ // library->OnGUIEvent( id, desk, theParam);
+ }
+ else
+ SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
+
+ updateCreationInfo();
+ return;
+ }
break;
}
updateCreationInfo();
}
+//=================================================================================
+// function : GeometryGUI::activateOperation()
+// purpose :
+//=================================================================================
+bool GeometryGUI::activateOperation( int actionId )
+{
+ OnGUIEvent(actionId);
+ return true;
+}
+
+//=================================================================================
+// function : GeometryGUI::activateOperation()
+// purpose :
+//=================================================================================
+bool GeometryGUI::activateOperation( const QString& actionId )
+{
+ bool isOk = false;
+
+ int id = actionId.toInt(&isOk);
+ if (isOk)
+ OnGUIEvent(id);
+
+ return isOk;
+}
+
+//=================================================================================
+// function : GeometryGUI::activateOperation()
+// purpose :
+//=================================================================================
+bool GeometryGUI::activateOperation( const QString& actionId, const QString& plugin )
+{
+ bool isOk = false;
+
+ QString pluginLib = plugin;
+ // TODO: if <plugin> is a plugin name, find plugin library name
+ if (myPluginLibs.contains(plugin))
+ pluginLib = myPluginLibs[plugin];
+
+ QMap<int, PluginAction>::iterator actionsIter = myPluginActions.begin();
+ for (; actionsIter != myPluginActions.end(); ++actionsIter) {
+ const PluginAction& anAction = actionsIter.value();
+ if (anAction.first == pluginLib && anAction.second == actionId) {
+ // activate operation
+ OnGUIEvent(actionsIter.key());
+ isOk = true;
+ }
+ }
+
+ return isOk;
+}
+
//=================================================================================
// function : GeometryGUI::OnKeyPress()
// purpose : Called when any key is pressed by user [static]
createGeomAction( GEOMOp::OpCreateFolder, "POP_CREATE_FOLDER" );
createGeomAction( GEOMOp::OpSortChildren, "POP_SORT_CHILD_ITEMS" );
- createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
-
// Create actions for increase/decrease transparency shortcuts
createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false,
"Geometry:Increase transparency");
createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false,
"Geometry:Decrease number of isolines");
-// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
- createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
- createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
- createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" );
+ //createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
+ //createGeomAction( GEOMOp::OpDividedDisk, "DIVIDEDDISK" );
+ //createGeomAction( GEOMOp::OpDividedCylinder, "DIVIDEDCYLINDER" );
+ //createGeomAction( GEOMOp::OpSmoothingSurface, "SMOOTHINGSURFACE" );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create menus --------------------------
createMenu( GEOMOp::OpCone, primId, -1 );
createMenu( GEOMOp::OpRectangle, primId, -1 );
createMenu( GEOMOp::OpDisk, primId, -1 );
- createMenu( GEOMOp::OpPipeTShape,primId, -1 );
+ //createMenu( GEOMOp::OpPipeTShape,primId, -1 );
int genId = createMenu( tr( "MEN_GENERATION" ), newEntId, -1 );
createMenu( GEOMOp::OpPrism, genId, -1 );
createMenu( GEOMOp::OpPipePath, genId, -1 );
#endif
- int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
- createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
- //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
+ //int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
+ //createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
+ //@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
createMenu( separator(), newEntId, -1 );
int blocksId = createMenu( tr( "MEN_BLOCKS" ), newEntId, -1 );
createMenu( GEOMOp::OpQuadFace, blocksId, -1 );
createMenu( GEOMOp::OpHexaSolid, blocksId, -1 );
- createMenu( GEOMOp::OpDividedDisk, blocksId, -1 );
- createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 );
+ //createMenu( GEOMOp::OpDividedDisk, blocksId, -1 );
+ //createMenu( GEOMOp::OpDividedCylinder, blocksId, -1 );
createMenu( separator(), newEntId, -1 );
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
#endif
-
+
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpMaterialsLibrary, toolsId, -1 );
createMenu( separator(), toolsId, -1 );
createTool( GEOMOp::OpCone, primTbId );
createTool( GEOMOp::OpRectangle, primTbId );
createTool( GEOMOp::OpDisk, primTbId );
- createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc
-
- int blocksTbId = createTool( tr( "TOOL_BLOCKS" ) );
- createTool( GEOMOp::OpDividedDisk, blocksTbId );
- createTool( GEOMOp::OpDividedCylinder, blocksTbId );
+ //createTool( GEOMOp::OpPipeTShape, primTbId ); //rnc
-// int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) ); //rnc
-// createTool( GEOMOp::OpPipeTShape, advancedTbId );
+ //int blocksTbId = createTool( tr( "TOOL_BLOCKS" ) );
+ //createTool( GEOMOp::OpDividedDisk, blocksTbId );
+ //createTool( GEOMOp::OpDividedCylinder, blocksTbId );
int boolTbId = createTool( tr( "TOOL_BOOLEAN" ) );
createTool( GEOMOp::OpFuse, boolTbId );
int picturesTbId = createTool( tr( "TOOL_PICTURES" ) );
createTool( GEOMOp::OpPictureImport, picturesTbId );
- #ifdef WITH_OPENCV
- createTool( GEOMOp::OpFeatureDetect, picturesTbId );
- #endif
+#ifdef WITH_OPENCV
+ createTool( GEOMOp::OpFeatureDetect, picturesTbId );
+#endif
- int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
- createTool( GEOMOp::OpSmoothingSurface, advancedTbId );
+ //int advancedTbId = createTool( tr( "TOOL_ADVANCED" ) );
+ //createTool( GEOMOp::OpSmoothingSurface, advancedTbId );
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
// ---- create popup menus --------------------------
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK + " and isVectorsMode", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), -1, -1 ); // -----------
-
+
mgr->insert( action( GEOMOp::OpColor ), -1, -1 ); // color
mgr->setRule( action( GEOMOp::OpColor ), clientOCCorVTKorOB_AndSomeVisible + " and ($component={'GEOM'})" + "and isPhysicalMaterial=false", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpTransparency ), -1, -1 ); // transparency
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and ( $typeid in {%1} or compoundOfVertices=true ) " ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
-
+
// material properties
- mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 );
+ mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 );
mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
// texture
QColor c = resMgr->colorValue( "Geometry", "toplevel_color", QColor( 170, 85, 0 ) );
GEOM_AISShape::setTopLevelColor(SalomeApp_Tools::color(c));
}
+
+ // create plugin actions and menus
+ addPluginActions();
+}
+
+//=======================================================================
+// function : GeometryGUI::addPluginActions()
+// purpose :
+//=======================================================================
+void GeometryGUI::addPluginActions()
+{
+ // Resource manager
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ if (!resMgr) return;
+
+ // Find names of a resource XML files ("GEOMActions.xml" and others);
+ QString PluginsXml;
+ char* cenv = getenv("GEOM_PluginsList");
+ if (cenv)
+ PluginsXml.sprintf("%s", cenv);
+
+ QStringList PluginsXmlList = PluginsXml.split(":", QString::SkipEmptyParts);
+ if (PluginsXmlList.count() == 0) return;
+
+ // get full names of xml files from PluginsXmlList
+ QStringList xmlFiles;
+ xmlFiles.append(QDir::home().filePath("CustomGeomPlugins.xml")); // may be inexistent
+ for (int i = 0; i < PluginsXmlList.count(); i++) {
+ PluginsXml = PluginsXmlList[ i ];
+
+ // Find full path to the resource XML file
+ QString xmlFile = resMgr->path("resources", "GEOM", PluginsXml + ".xml");
+ if ( xmlFile.isEmpty() ) // try PLUGIN resources
+ xmlFile = resMgr->path("resources", PluginsXml, PluginsXml + ".xml");
+ if ( !xmlFile.isEmpty() )
+ xmlFiles.append( xmlFile );
+ }
+
+ // create "Advanced Operations" menu and corresponding toolbar
+ //int advancedMenuId = createMenu(tr("MEN_ADVANCED"), -1, -1, 10);
+ //int advancedTbarId = createTool(tr("TOOL_ADVANCED"));
+ int id = GEOMOp::OpLastOperationID; // TODO?
+
+ // loop on xmlFiles
+ QString aNoAccessFiles;
+ for (int i = 0; i < xmlFiles.count(); i++) {
+ QString xmlFile = xmlFiles[ i ];
+
+ QFile file (xmlFile);
+ if (file.exists() && file.open(QIODevice::ReadOnly)) {
+ file.close();
+
+ GEOMGUI_XmlHandler* aXmlHandler = new GEOMGUI_XmlHandler();
+ ASSERT(aXmlHandler);
+
+ QXmlInputSource source (&file);
+ QXmlSimpleReader reader;
+ reader.setContentHandler(aXmlHandler);
+ reader.setErrorHandler(aXmlHandler);
+ bool ok = reader.parse(source);
+ file.close();
+
+ if (ok) {
+ // bind action lib and label to its ID for activateOperation() method proper work
+ myPluginLibs[aXmlHandler->myPluginData.myName] = aXmlHandler->myPluginData.myClientLib;
+
+ QListIterator<GEOMGUI_ActionData> anActionsIter (aXmlHandler->myPluginData.myListOfActions);
+ while (anActionsIter.hasNext()) {
+ GEOMGUI_ActionData anActionData = anActionsIter.next();
+
+ //QPixmap icon = resMgr->loadPixmap("GEOM", tr(anActionData.myIcon.toLatin1().constData()));
+ QPixmap icon = resMgr->loadPixmap(aXmlHandler->myPluginData.myName,
+ anActionData.myIcon.toLatin1().constData());
+
+ // path to action in menu
+ QStringList smenus = anActionData.myMenu.split( "/" );
+ QString actionName = smenus.last();
+ actionName = actionName.toUpper().prepend("MEN_");
+ smenus.removeLast();
+
+ // path to action in toolbar
+ QStringList stools = anActionData.myTooltip.split( "/" );
+ QString actionTool = stools.last();
+ actionTool = actionTool.toUpper().prepend("TOP_");
+ stools.removeLast();
+
+ createAction(id, // ~ anActionData.myLabel
+ tr(actionTool.toLatin1().constData()),
+ icon,
+ tr(actionName.toLatin1().constData()),
+ anActionData.myStatusBar.toLatin1().constData(),
+ 0 /*accel*/,
+ application()->desktop(),
+ false /*toggle*/,
+ this, SLOT(OnGUIEvent()),
+ QString() /*shortcutAction*/);
+
+ int menuId = -1;
+ foreach (QString subMenu, smenus) {
+ subMenu = subMenu.toUpper().prepend("MEN_");
+ menuId = createMenu(tr(subMenu.toLatin1().constData()), menuId, -1);
+ }
+ //createMenu(id, pluginMenuId, -1);
+ createMenu(id, menuId, -1);
+
+ QString subTool = stools[0];
+ subTool = subTool.toUpper().prepend("TOOL_");
+ int toolId = createTool(tr(subTool.toLatin1().constData()));
+ //createTool(id, advancedTbarId);
+ createTool(id, toolId);
+
+ // add action id to map
+ PluginAction anAction (aXmlHandler->myPluginData.myClientLib, anActionData.myLabel);
+ myPluginActions[id] = anAction;
+
+ id++;
+ }
+ }
+ else {
+ SUIT_MessageBox::critical(application()->desktop(),
+ tr("INF_PARSE_ERROR"),
+ tr(aXmlHandler->errorProtocol().toLatin1().data()));
+ }
+ delete aXmlHandler;
+ }
+ else if ( i > 0 ) { // 1st is ~/CustomGeomPlugins.xml
+ if (aNoAccessFiles.isEmpty())
+ aNoAccessFiles = xmlFile;
+ else
+ aNoAccessFiles += ", " + xmlFile;
+ }
+ } // end loop on xmlFiles
+
+ if (!aNoAccessFiles.isEmpty()) {
+ QString aMess = QObject::tr("PLUGIN_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
+ aMess += QObject::tr("PLUGIN_FILE_CHECK_VARIABLE");
+ SUIT_MessageBox::warning(application()->desktop(), tr("GEOM_WRN_WARNING"), aMess);
+ }
}
//=======================================================================
//================================================================================
/*!
- * \brief Slot called when selection changed. Shows creation info of a selected object
+ * \brief Slot called when selection changed. Shows creation info of a selected object
*/
//================================================================================
void GeometryGUI::updateCreationInfo()
{
- myCreationInfoWdg->clear();
+ if ( myCreationInfoWdg )
+ myCreationInfoWdg->clear();
// Code below is commented to have myCreationInfoWdg filled as soon as it is shown again
// if ( !myCreationInfoWdg->isVisible() )
// pass creation info of geomObj to myCreationInfoWdg
- QPixmap icon;
- QString operationName;
- myCreationInfoWdg->setOperation( icon, operationName );
-
- try
- {
- OCC_CATCH_SIGNALS;
- GEOM::CreationInformation_var info = geomObj->GetCreationInformation();
- if ( &info.in() )
- {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- QString name = info->operationName.in();
- if ( !name.isEmpty() )
- {
- icon = resMgr->loadPixmap( "GEOM", tr( ("ICO_"+name).toLatin1().constData() ), false );
- operationName = tr( ("MEN_"+name).toLatin1().constData() );
- if ( operationName.startsWith( "MEN_" ))
- operationName = name; // no translation
- myCreationInfoWdg->setOperation( icon, operationName );
-
- for ( size_t i = 0; i < info->params.length(); ++i )
- myCreationInfoWdg->addParam( info->params[i].name.in(),
- info->params[i].value.in() );
+ if ( myCreationInfoWdg ) {
+ QPixmap icon;
+ QString operationName;
+ myCreationInfoWdg->setOperation( icon, operationName );
+
+ try {
+ OCC_CATCH_SIGNALS;
+ GEOM::CreationInformation_var info = geomObj->GetCreationInformation();
+ if ( &info.in() ) {
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QString name = info->operationName.in();
+ if ( !name.isEmpty() ) {
+ icon = resMgr->loadPixmap( "GEOM", tr( ("ICO_"+name).toLatin1().constData() ), false );
+ operationName = tr( ("MEN_"+name).toLatin1().constData() );
+ if ( operationName.startsWith( "MEN_" ))
+ operationName = name; // no translation
+ myCreationInfoWdg->setOperation( icon, operationName );
+
+ for ( size_t i = 0; i < info->params.length(); ++i )
+ myCreationInfoWdg->addParam( info->params[i].name.in(),
+ info->params[i].value.in() );
+ }
}
}
- }
- catch (...)
- {
+ catch (...) {
+ }
}
}
if( isPredefMat ){
QMenu* matMenu = new QMenu();
QSignalMapper* signalMapper = new QSignalMapper( matMenu );
-
+
//Get current material model for the object
QVariant v;
LightApp_Application* anApp = dynamic_cast<LightApp_Application*>( getApp() );
// get list of all predefined materials
QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
bool found = false;
- foreach ( QString material, materials )
+ foreach ( QString material, materials )
{
QAction* menAct = matMenu->addAction( material );
connect(menAct, SIGNAL( toggled( bool ) ), signalMapper, SLOT( map() ) );
signalMapper->setMapping( menAct, material );
menAct->setCheckable( true );
- // Set checked if this material is current
+ // Set checked if this material is current
Material_Model aModel;
aModel.fromResources( material );
if ( !found && aModel.toProperties() == curModel ) {
addPreference( tr( "PREF_AUTO_BRING_TO_FRONT" ), genGroup,
LightApp_Preferences::Bool, "Geometry", "auto_bring_to_front" );
-
+
int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
setPreferenceProperty( isoGroup, "columns", 2 );
int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
- LightApp_Preferences::IntSpin, "Geometry", "iso_number_u" );
+ LightApp_Preferences::IntSpin, "Geometry", "iso_number_u" );
setPreferenceProperty( isoU, "min", 0 );
setPreferenceProperty( isoU, "max", 100000 );
int isoV = addPreference( tr( "PREF_ISOS_V" ), isoGroup,
- LightApp_Preferences::IntSpin, "Geometry", "iso_number_v" );
+ LightApp_Preferences::IntSpin, "Geometry", "iso_number_v" );
setPreferenceProperty( isoV, "min", 0 );
setPreferenceProperty( isoV, "max", 100000 );
// Set property for default material
setPreferenceProperty( material, "strings", Material_ResourceMgr::resourceMgr()->materials() );
-
+
// Set property vertex marker type
QList<QVariant> aMarkerTypeIndicesList;
QList<QVariant> aMarkerTypeIconsList;
#include <SALOMEDSClient.hxx>
#include "GEOMGUI.h"
+#include "GEOMPluginGUI.h"
// QT Includes
#include <QMap>
+#include <QPair>
// OCCT Includes
#include <gp_Ax3.hxx>
// Process action
void OnGUIEvent( int id, const QVariant& theParam = QVariant( QVariant::Invalid ) );
+ virtual bool activateOperation( int actionId );
+ virtual bool activateOperation( const QString& actionId );
+ virtual bool activateOperation( const QString& actionId, const QString& plugin );
// The Working Plane management
void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
private:
GEOMGUI* getLibrary( const QString& libraryName );
+ GEOMPluginGUI* getPluginLibrary( const QString& libraryName );
void createGeomAction( const int id, const QString& po_id,
const QString& icon_id = QString(""),
const int key = 0, const bool toggle = false,
const bool isSingle = false, const int isVisible = -1,
const bool isExpandAll = false, const bool isOCC = false,
const int parentId = -1 );
+ void addPluginActions();
void createOriginAndBaseVectors();
typedef QMap<long, TextureMap> StudyTextureMap;
typedef QMap<QString, GEOMGUI*> GUIMap;
+ typedef QPair<QString, QString> PluginAction;
+
GUIMap myGUIMap; // GUI libraries map
QDialog* myActiveDialogBox; // active dialog box
gp_Ax3 myWorkingPlane;
- QMap<int,QString> myRules; // popup rules
+ //QMap<int,QString> myRules; // popup rules
static StudyTextureMap myTextureMap; // texture map
+ QMap<int, PluginAction> myPluginActions; // plugin actions
+ QMap<QString, QString> myPluginLibs; // plugin name to plugin client library
+
QList<GEOMGUI_OCCSelector*> myOCCSelectors;
QList<LightApp_VTKSelector*> myVTKSelectors;
OpExplodeBlock = 6104, // MENU BLOCKS - EXPLODE ON BLOCKS
// AdvancedGUI -----------------//--------------------------------
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
- OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
- //OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
- OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
- OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
- OpSmoothingSurface = 10005, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
+ //OpPipeTShape = 10001, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE
+ //OpPipeTShapeGroups = 10002, // MENU NEW ENTITY - ADVANCED - PIPE TSHAPE GROUPS
+ //OpDividedDisk = 10003, // MENU NEW ENTITY - ADVANCED - DIVIDEDDISK
+ //OpDividedCylinder = 10004, // MENU NEW ENTITY - ADVANCED - DIVIDEDCYLINDER
+ //OpSmoothingSurface = 10005, // MENU NEW ENTITY - ADVANCED - SMOOTHINGSURFACE
//@@ insert new functions before this line @@ do not remove this line @@//
+ OpLastOperationID = 20000 // DO NOT USE OPERATION IDs MORE THAN 20000 !!!
};
}
GeometryGUI.h \
GeometryGUI_Operations.h\
GEOMGUI.h \
+ GEOMPluginGUI.h \
+ GEOMGUI_XmlHandler.h \
GEOM_Displayer.h \
GEOMGUI_OCCSelector.h \
GEOMGUI_Selection.h \
dist_libGEOM_la_SOURCES = \
GeometryGUI.cxx \
GEOMGUI.cxx \
+ GEOMPluginGUI.cxx \
+ GEOMGUI_XmlHandler.cxx \
GEOM_Displayer.cxx \
GEOMGUI_OCCSelector.cxx \
GEOMGUI_Selection.cxx \
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include <Standard_Stream.hxx>
-
-#include <GEOMImpl_DividedDiskDriver.hxx>
-#include <GEOMImpl_IDividedDisk.hxx>
-#include <GEOMImpl_Types.hxx>
-#include <GEOM_Function.hxx>
-
-// OCCT includes
-#include <gp_Pnt.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Circ.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Ax2.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
-
-#include <Geom_Plane.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Edge.hxx>
-
-#include <TFunction_Logbook.hxx>
-#include <StdFail_NotDone.hxx>
-
-#include <TopExp.hxx>
-
-#include <utilities.h>
-//@@ include required header files here @@//
-
-enum
-{
- SQUARE,
- HEXAGON
-};
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-const Standard_GUID& GEOMImpl_DividedDiskDriver::GetID()
-{
- static Standard_GUID aGUID("0b01da9a-c5da-11e1-8d80-78e7d1879630");
- return aGUID;
-}
-
-//=======================================================================
-//function : GEOMImpl_DividedDiskDriver
-//purpose :
-//=======================================================================
-GEOMImpl_DividedDiskDriver::GEOMImpl_DividedDiskDriver()
-{
-}
-
-//=======================================================================
-//function : Execute
-//purpose :
-//=======================================================================
-Standard_Integer GEOMImpl_DividedDiskDriver::Execute(TFunction_Logbook& log) const
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
-
- GEOMImpl_IDividedDisk aData (aFunction);
- Standard_Integer aType = aFunction->GetType();
-
- TopoDS_Shape aShape;
-
- // Getting data
- double R = aData.GetR();
- double Ratio = aData.GetRatio();
- int Pattern = aData.GetType();
-
- // Build reference disk (in the global coordinate system)
- TopoDS_Shape aDisk;
-
- if (Pattern == SQUARE)
- aDisk = MakeDiskSquare( R, Ratio );
- else if (Pattern == HEXAGON)
- aDisk = MakeDiskHexagon( R, Ratio );
-
- if (aType == DIVIDEDDISK_R_RATIO)
- {
- int theOrientation = aData.GetOrientation();
- aShape = TransformShape(aDisk, theOrientation);
- }
- else if (aType == DIVIDEDDISK_R_VECTOR_PNT)
- {
- Handle(GEOM_Function) aRefPoint = aData.GetCenter();
- Handle(GEOM_Function) aRefVector = aData.GetVector();
- TopoDS_Shape aShapePnt = aRefPoint->GetValue();
- TopoDS_Shape aShapeVec = aRefVector->GetValue();
-
- if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
- aShapeVec.ShapeType() == TopAbs_EDGE)
- {
- gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
- TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(anE, V1, V2, Standard_True);
- if (!V1.IsNull() && !V2.IsNull())
- {
- gp_Vec aVec (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
- gp_Dir aDir(aVec);
- aShape = TransformShape(aDisk, aPnt, aDir);
- }
- }
- }
-
- if (aShape.IsNull()) return 0;
-
- aFunction->SetValue(aShape);
-
- log.SetTouched(Label());
-
- return 1;
-}
-
-
-//=======================================================================
-//function : MakeDiskHexagon
-//purpose :
-//=======================================================================
-TopoDS_Shell GEOMImpl_DividedDiskDriver::MakeDiskHexagon(double R, double Ratio) const
-{
- // Geometry
- gp_Dir ZDir(0,0,1);
- gp_Dir XDir(1,0,0);
- gp_Pnt Orig(0,0,0);
-
- // Circle
- gp_Ax1 Ax1(Orig,ZDir);
- gp_Ax2 Ax(Orig,ZDir,XDir);
- gp_Circ aCircle(Ax, R);
-
- // Points
-// gp_Pnt P4(0.01*Ratio*R,0,0);
-// gp_Pnt P3(R,0,0);
-// gp_Pnt P2 = P3.Rotated(Ax1,-M_PI/6.0);
-// gp_Pnt P1(P4.X(),
-// P4.X()/sqrt(3.0),0);
- gp_Pnt P1(0.01*Ratio*R*sqrt(3.0)/2,0,0);
- gp_Pnt P2(R,0,0);
- gp_Pnt P3 = P2.Rotated(Ax1,M_PI/6.0);
- gp_Pnt P4(P1.X(),
- P1.X()/sqrt(3.0),0);
-
-
- //surfaces
- gp_Ax2 anAx (gp::XOY());
- Handle(Geom_Plane) aPlane = new Geom_Plane (anAx);
-
- // Topology
-
- // Vertices
- TopoDS_Vertex O = BRepBuilderAPI_MakeVertex(Orig);
- TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1);
- TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2);
- TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(P3);
- TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(P4);
-
- TopoDS_Vertex V1 = V1_init;
- TopoDS_Vertex V2 = V2_init;
-
- //Rotation
- gp_Trsf myTrsf;
- myTrsf.SetRotation(Ax1, M_PI/3.0);
-
- BRepBuilderAPI_Transform xform(myTrsf);
- xform.Perform(V1,Standard_True);
- TopoDS_Vertex V1_60 = TopoDS::Vertex(xform.Shape());
- xform.Perform(V2,Standard_True);
- TopoDS_Vertex V2_60 = TopoDS::Vertex(xform.Shape());
-
- // Declaration of shapes (used in the loop)
- TopoDS_Edge E1, E2, E3, E4, E5, E6, E7, E8, E9;
- TopoDS_Wire W1, W2, W3;
- TopoDS_Face F1, F2, F3;
- TopoDS_Shell S;
-
- BRep_Builder aBuilder;
- aBuilder.MakeShell(S);
-
- // Initialisation of edges
- TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed()));
- E1 = E1_init;
- TopoDS_Edge E8_init = BRepBuilderAPI_MakeEdge(O,TopoDS::Vertex(V1.Reversed()));
- E8 = E8_init;
-
- for (int i=1;i<=6;i++)
- {
- // Edges
-
- // for Face1
- E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V3.Reversed()));
- E3 = BRepBuilderAPI_MakeEdge(V3,TopoDS::Vertex(V4.Reversed()));
- E4 = BRepBuilderAPI_MakeEdge(V4,TopoDS::Vertex(V1.Reversed()));
-
- // for Face2
- if (i==6)
- {
- E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_init.Reversed()));
- E7 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V4.Reversed()));
- }
- else
- {
- E5 = BRepBuilderAPI_MakeEdge(aCircle, V3, TopoDS::Vertex(V2_60.Reversed()));
- E7 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(V4.Reversed()));
- }
- E6 = BRepBuilderAPI_MakeEdge(V2_60,TopoDS::Vertex(V1_60.Reversed()));
-
- // for Face3
- E9 = BRepBuilderAPI_MakeEdge(V1_60,TopoDS::Vertex(O.Reversed()));
-
-
- // Wires
-
- //Wire1
- aBuilder.MakeWire(W1);
- if (i==1)
- aBuilder.Add(W1,E1);
- else
- aBuilder.Add(W1,TopoDS::Edge(E1.Reversed()));
- aBuilder.Add(W1,E2);
- aBuilder.Add(W1,E3);
- aBuilder.Add(W1,E4);
-
- // Wire 2
- aBuilder.MakeWire(W2);
- aBuilder.Add(W2,TopoDS::Edge(E3.Reversed()));
- aBuilder.Add(W2,E5);
- if (i==6)
- aBuilder.Add(W2,TopoDS::Edge(E1_init.Reversed()));
- else
- aBuilder.Add(W2,E6);
- aBuilder.Add(W2,E7);
-
- // Wire3
- aBuilder.MakeWire(W3);
- if (i==1)
- aBuilder.Add(W3,E8);
- else
- aBuilder.Add(W3,TopoDS::Edge(E8.Reversed()));
- aBuilder.Add(W3,TopoDS::Edge(E4.Reversed()));
- aBuilder.Add(W3,TopoDS::Edge(E7.Reversed()));
- if (i==6)
- aBuilder.Add(W3,TopoDS::Edge(E8_init.Reversed()));
- else
- aBuilder.Add(W3,E9);
-
- // Faces creation
- F1 = BRepBuilderAPI_MakeFace(aPlane,W1);
- F2 = BRepBuilderAPI_MakeFace(aPlane,W2);
- F3 = BRepBuilderAPI_MakeFace(aPlane,W3);
-
- //Shell
- aBuilder.Add(S, F1);
- aBuilder.Add(S, F2);
- aBuilder.Add(S, F3);
-
- // rotation
- V1=V1_60;
- V2=V2_60;
-
- xform.Perform(V1_60,Standard_True);
- V1_60 = TopoDS::Vertex(xform.Shape());
- xform.Perform(V2_60,Standard_True);
- V2_60 = TopoDS::Vertex(xform.Shape());
- xform.Perform(V3,Standard_True);
- V3 = TopoDS::Vertex(xform.Shape());
- xform.Perform(V4,Standard_True);
- V4 = TopoDS::Vertex(xform.Shape());
-
- // "Increment" of edges
- E1=E6;
- E8=E9;
- }
-
- return S;
-}
-
-//=======================================================================
-//function : MakeDiskSquare
-//purpose :
-//=======================================================================
-TopoDS_Shape GEOMImpl_DividedDiskDriver::MakeDiskSquare(double R, double Ratio) const
-{
- // Geometry
- gp_Dir ZDir(0,0,1);
- gp_Dir XDir(1,0,0);
- gp_Pnt Orig(0,0,0);
-
- // Circle
- gp_Ax1 Ax1(Orig,ZDir);
- gp_Ax2 Ax(Orig,ZDir,XDir);
- gp_Circ aCircle(Ax, R);
-
- // Points
- gp_Pnt P1(0.01*Ratio*R,0,0);
- gp_Pnt P2(R,0,0);
-
- //surfaces
- gp_Ax2 anAx (gp::XOY());
- Handle(Geom_Plane) aPlane = new Geom_Plane (anAx);
-
- // Topology
-
- // Vertices
- TopoDS_Vertex V1_init = BRepBuilderAPI_MakeVertex(P1);
- TopoDS_Vertex V2_init = BRepBuilderAPI_MakeVertex(P2);
-
- TopoDS_Vertex V1 = V1_init;
- TopoDS_Vertex V2 = V2_init;
-
- //Rotation
- gp_Trsf myTrsf;
- myTrsf.SetRotation(Ax1, M_PI/2);
-
- BRepBuilderAPI_Transform xform(myTrsf);
- xform.Perform(V1,Standard_True);
- TopoDS_Vertex V1_rotated = TopoDS::Vertex(xform.Shape());
- xform.Perform(V2,Standard_True);
- TopoDS_Vertex V2_rotated = TopoDS::Vertex(xform.Shape());
-
- // Declaration of shapes (used in the loop)
- TopoDS_Edge E1, E2, E3, E4;
- TopoDS_Wire W1, W2;
- TopoDS_Face F1, F2;
- TopoDS_Shell S;
-
- BRep_Builder aBuilder;
- aBuilder.MakeWire(W2); // Central Wire
- aBuilder.MakeShell(S); // Shell
-
- // Initialisation of edges
- TopoDS_Edge E1_init = BRepBuilderAPI_MakeEdge(V1,TopoDS::Vertex(V2.Reversed()));
- E1 = E1_init;
-
- for (int i=1;i<=4;i++)
- {
- // Edges
- // for Face1
-
- E3 = BRepBuilderAPI_MakeEdge(V2_rotated,TopoDS::Vertex(V1_rotated.Reversed()));
- if (i == 4)
- {
- E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_init.Reversed()));
- E4 = BRepBuilderAPI_MakeEdge(V1_init,TopoDS::Vertex(V1.Reversed()));
- }
- else
- {
- E2 = BRepBuilderAPI_MakeEdge(aCircle, V2, TopoDS::Vertex(V2_rotated.Reversed()));
- E4 = BRepBuilderAPI_MakeEdge(V1_rotated,TopoDS::Vertex(V1.Reversed()));
- }
-
- // Wires
- //Wire1
- aBuilder.MakeWire(W1);
- if (i==1)
- aBuilder.Add(W1,E1);
- else
- aBuilder.Add(W1,TopoDS::Edge(E1.Reversed()));
- aBuilder.Add(W1,E2);
- if (i==4)
- aBuilder.Add(W1,TopoDS::Edge(E1_init.Reversed()));
- else
- aBuilder.Add(W1,E3);
- aBuilder.Add(W1,E4);
-
- // Wire central
- aBuilder.Add(W2,TopoDS::Edge(E4.Reversed()));
-
- // Faces creation
- F1 = BRepBuilderAPI_MakeFace(aPlane,W1);
-
- //Shell
- aBuilder.Add(S, F1);
-
- // rotation
- V1=V1_rotated;
- V2=V2_rotated;
-
- xform.Perform(V1_rotated,Standard_True);
- V1_rotated = TopoDS::Vertex(xform.Shape());
- xform.Perform(V2_rotated,Standard_True);
- V2_rotated = TopoDS::Vertex(xform.Shape());
-
- // "Increment" of edges
- E1=E3;
- }
- // Central square Face
- F2 = BRepBuilderAPI_MakeFace(aPlane,W2);
- aBuilder.Add(S, F2);
-
- return S;
-}
-
-
-//=======================================================================
-//function : TrasformShape(TopoDS_Shape aShape,int theOrientation)
-//purpose : Perform shape transformation accordingly with specified
-// orientation
-//=======================================================================
-TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, int theOrientation) const
-{
- gp_Dir N, Vx;
- gp_Pnt theOrigin = gp::Origin();
-
- switch(theOrientation)
- {
- case 1:
- {
- N = gp::DZ();
- Vx = gp::DX();
- break;
- }
- case 2:
- {
- N = gp::DX();
- Vx = gp::DY();
- break;
- }
- case 3:
- {
- N = gp::DY();
- Vx = gp::DZ();
- break;
- }
- }
-
- gp_Ax3 aWPlane = gp_Ax3(theOrigin, N, Vx);
-
- return WPlaneTransform(theShape, aWPlane);
-}
-
-//=======================================================================
-//function : TrasformShape(TopoDS_Shape aShape, gp_Dir V, gp_Pnt P)
-//purpose : Perform shape transformation accordingly with specified
-// pnt and direction
-//=======================================================================
-TopoDS_Shape GEOMImpl_DividedDiskDriver::TransformShape(TopoDS_Shape theShape, gp_Pnt P, gp_Dir V) const
-{
- gp_Ax3 aWPlane( P, V );
- return WPlaneTransform(theShape, aWPlane);
-}
-
-//=======================================================================
-//function : WPlaneTransform
-//purpose : Perform shape transformation accordingly with the given
-// Working Plane
-//=======================================================================
-TopoDS_Shape GEOMImpl_DividedDiskDriver::WPlaneTransform(TopoDS_Shape theShape, gp_Ax3 theWPlane) const
-{
- gp_Trsf aTrans;
- aTrans.SetTransformation(theWPlane);
- aTrans.Invert();
- BRepBuilderAPI_Transform aTransformation (theShape, aTrans, Standard_False);
- return aTransformation.Shape();
-}
-
-//================================================================================
-/*!
- * \brief Returns a name of creation operation and names and values of creation parameters
- */
-//================================================================================
-
-bool GEOMImpl_DividedDiskDriver::
-GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& theParams)
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
-
- GEOMImpl_IDividedDisk aCI( function );
- Standard_Integer aType = function->GetType();
-
- theOperationName = "DIVIDEDDISK";
-
- switch ( aType ) {
- case DIVIDEDDISK_R_RATIO:
- AddParam( theParams, "Radius", aCI.GetR() );
- AddParam( theParams, "Ratio", aCI.GetRatio() );
- AddParam( theParams, "Orientation", aCI.GetOrientation() );
- AddParam( theParams, "Division pattern", aCI.GetType() );
- break;
- case DIVIDEDDISK_R_VECTOR_PNT:
- AddParam( theParams, "Center Point", aCI.GetCenter() );
- AddParam( theParams, "Vector", aCI.GetVector() );
- AddParam( theParams, "Radius", aCI.GetR() );
- AddParam( theParams, "Division pattern", aCI.GetType() );
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver);
-IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_DividedDiskDriver,GEOM_BaseDriver);
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _GEOMImpl_DividedDiskDriver_HXX
-#define _GEOMImpl_DividedDiskDriver_HXX
-
-#include <TFunction_Driver.hxx>
-
-class Handle_Standard_Type;
-class GEOMImpl_DividedDiskDriver;
-class TopoDS_Shape;
-class TopoDS_Shell;
-class gp_Pnt;
-class gp_Dir;
-class gp_Ax3;
-
-#include "GEOM_BaseDriver.hxx"
-
-DEFINE_STANDARD_HANDLE( GEOMImpl_DividedDiskDriver, GEOM_BaseDriver );
-
-class GEOMImpl_DividedDiskDriver : public GEOM_BaseDriver {
-public:
- // Methods PUBLIC
- //
- Standard_EXPORT GEOMImpl_DividedDiskDriver();
- Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
- Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
- Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
- {
- return Standard_True;
- }
- Standard_EXPORT static const Standard_GUID& GetID();
- Standard_EXPORT ~GEOMImpl_DividedDiskDriver() {};
-
- Standard_EXPORT virtual
- bool GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& params);
-private:
- TopoDS_Shape TransformShape (TopoDS_Shape aShape, int theOrientation) const;
- TopoDS_Shape TransformShape (TopoDS_Shape aShape, gp_Pnt P, gp_Dir V) const;
- TopoDS_Shape WPlaneTransform (TopoDS_Shape aShape, gp_Ax3 theWPlane) const;
- TopoDS_Shell MakeDiskHexagon (double R, double Ratio) const;
- TopoDS_Shape MakeDiskSquare (double R, double Ratio) const;
-
- DEFINE_STANDARD_RTTI( GEOMImpl_DividedDiskDriver )
-};
-
-#endif // _GEOMImpl_DividedDiskDriver_HXX
#include <GEOMImpl_FillingDriver.hxx>
#include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_MeasureDriver.hxx>
-// Advanced operations
-#include <GEOMImpl_PipeTShapeDriver.hxx>
-#include <GEOMImpl_DividedDiskDriver.hxx>
-// #include <GEOMImpl_DividedCylinderDriver.hxx>
-#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
-/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
//=============================================================================
/*!
// Measurements
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_MeasureDriver::GetID(), new GEOMImpl_MeasureDriver());
- // Advanced operations
- TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PipeTShapeDriver::GetID(), new GEOMImpl_PipeTShapeDriver());
- TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedDiskDriver::GetID(), new GEOMImpl_DividedDiskDriver());
-// TFunction_DriverTable::Get()->AddDriver(GEOMImpl_DividedCylinderDriver::GetID(), new GEOMImpl_DividedCylinderDriver());
- TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SmoothingSurfaceDriver::GetID(), new GEOMImpl_SmoothingSurfaceDriver());
- /*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
-
SetEngine(this);
}
return _mapOfGroupOperations[theDocID];
}
-
-//=============================================================================
-/*!
- * GetIAdvancedOperations
- */
-//=============================================================================
-GEOMImpl_IAdvancedOperations* GEOMImpl_Gen::GetIAdvancedOperations(int theDocID)
-{
- if(_mapOfAdvancedOperations.find(theDocID) == _mapOfAdvancedOperations.end()) {
- _mapOfAdvancedOperations[theDocID] = new GEOMImpl_IAdvancedOperations(this, theDocID);
- }
-
- return _mapOfAdvancedOperations[theDocID];
-}
-
#include "GEOMImpl_IInsertOperations.hxx"
#include "GEOMImpl_IMeasureOperations.hxx"
#include "GEOMImpl_IGroupOperations.hxx"
-#include "GEOMImpl_IAdvancedOperations.hxx"
#include "GEOM_Engine.hxx"
class GEOMIMPL_EXPORT GEOMImpl_Gen : public GEOM_Engine
GEOMImpl_IGroupOperations* GetIGroupOperations(int theDocID);
- GEOMImpl_IAdvancedOperations* GetIAdvancedOperations(int theDocID);
-
private:
std::map <int, GEOMImpl_IBasicOperations*> _mapOfBasicOperations;
std::map <int, GEOMImpl_IInsertOperations*> _mapOfInsertOperations;
std::map <int, GEOMImpl_IMeasureOperations*> _mapOfMeasureOperations;
std::map <int, GEOMImpl_IGroupOperations*> _mapOfGroupOperations;
- std::map <int, GEOMImpl_IAdvancedOperations*> _mapOfAdvancedOperations;
};
#endif
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : GEOMImpl_IAdvancedOperations.cxx
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-#include "GEOMImpl_IAdvancedOperations.hxx"
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <utilities.h>
-#include <OpUtil.hxx>
-#include <Utils_ExceptHandlers.hxx>
-
-#include "GEOM_Function.hxx"
-#include "GEOM_PythonDump.hxx"
-#include "GEOMUtils.hxx"
-#include "GEOMAlgo_Splitter.hxx"
-#include "GEOMAlgo_FinderShapeOn1.hxx"
-
-#include "GEOMImpl_Gen.hxx"
-#include "GEOMImpl_Types.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_IGroupOperations.hxx"
-
-#include "GEOMImpl_GlueDriver.hxx"
-#include "GEOMImpl_PipeTShapeDriver.hxx"
-#include "GEOMImpl_IPipeTShape.hxx"
-#include "GEOMImpl_DividedDiskDriver.hxx"
-#include "GEOMImpl_IDividedDisk.hxx"
-// #include "GEOMImpl_DividedCylinderDriver.hxx"
-// #include "GEOMImpl_IDividedCylinder.hxx"
-#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
-#include <GEOMImpl_ISmoothingSurface.hxx>
-/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
-
-#include <TDF_Tool.hxx>
-#include <TFunction_DriverTable.hxx>
-#include <TFunction_Driver.hxx>
-#include <TFunction_Logbook.hxx>
-#include <TNaming_CopyShape.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-
-#include <BRepAdaptor_Surface.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
-#include <BRepPrimAPI_MakeCone.hxx>
-#include <BRepPrimAPI_MakeCylinder.hxx>
-
-#include <gp_Ax3.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <GC_MakeConicalSurface.hxx>
-#include <Geom_CylindricalSurface.hxx>
-
-#include <cmath>
-
-#include <Standard_Stream.hxx>
-#include <Standard_Failure.hxx>
-#include <StdFail_NotDone.hxx>
-#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
-#define HALF_LENGTH_MAIN_PIPE "Main pipe half length" //"Tuyau principal - demi longueur"
-#define HALF_LENGTH_INCIDENT_PIPE "Incident pipe half length" //"Tuyau incident - demi longueur"
-#define CIRCULAR_QUARTER_PIPE "Circular quarter of pipe" //"Circulaire - quart de tuyau"
-#define THICKNESS "Thickness" //"Epaisseur"
-#define FLANGE "Flange" // "Collerette"
-#define CHAMFER_OR_FILLET "Chamfer or fillet" //"Chanfrein ou Raccord"
-#define JUNCTION_FACE_1 "Junction 1" //"Face de jonction 1"
-#define JUNCTION_FACE_2 "Junction 2" //"Face de jonction 2"
-#define JUNCTION_FACE_3 "Junction 3" //"Face de jonction 3"
-
-#define FIND_GROUPS_BY_POINTS 1
-
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID) :
- GEOM_IOperations(theEngine, theDocID)
-{
- MESSAGE("GEOMImpl_IAdvancedOperations::GEOMImpl_IAdvancedOperations");
- myBasicOperations = new GEOMImpl_IBasicOperations(GetEngine(), GetDocID());
- myBooleanOperations = new GEOMImpl_IBooleanOperations(GetEngine(), GetDocID());
- myShapesOperations = new GEOMImpl_IShapesOperations(GetEngine(), GetDocID());
- myTransformOperations = new GEOMImpl_ITransformOperations(GetEngine(), GetDocID());
- myBlocksOperations = new GEOMImpl_IBlocksOperations(GetEngine(), GetDocID());
- my3DPrimOperations = new GEOMImpl_I3DPrimOperations(GetEngine(), GetDocID());
- myLocalOperations = new GEOMImpl_ILocalOperations(GetEngine(), GetDocID());
- myHealingOperations = new GEOMImpl_IHealingOperations(GetEngine(), GetDocID());
- myGroupOperations = new GEOMImpl_IGroupOperations(GetEngine(), GetDocID());
-}
-
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations()
-{
- MESSAGE("GEOMImpl_IAdvancedOperations::~GEOMImpl_IAdvancedOperations");
- delete myBasicOperations;
- delete myBooleanOperations;
- delete myShapesOperations;
- delete myTransformOperations;
- delete myBlocksOperations;
- delete my3DPrimOperations;
- delete myLocalOperations;
- delete myHealingOperations;
- delete myGroupOperations;
-}
-
-//=============================================================================
-/*!
- * SetPosition
- */
-//=============================================================================
-gp_Trsf GEOMImpl_IAdvancedOperations::GetPositionTrsf(double theL1, double theL2,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3)
-{
- // Old Local Coordinates System oldLCS
- gp_Pnt P0(0, 0, 0);
- gp_Pnt P1(-theL1, 0, 0);
- gp_Pnt P2(theL1, 0, 0);
- gp_Pnt P3(0, 0, theL2);
-
- gp_Dir oldX(gp_Vec(P1, P2));
- gp_Dir oldZ(gp_Vec(P0, P3));
- gp_Ax3 oldLCS(P0, oldZ, oldX);
-
- // New Local Coordinates System newLCS
- double LocX, LocY, LocZ;
- gp_Pnt newP1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
- gp_Pnt newP2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
- gp_Pnt newP3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
- LocX = (newP1.X() + newP2.X()) / 2.;
- LocY = (newP1.Y() + newP2.Y()) / 2.;
- LocZ = (newP1.Z() + newP2.Z()) / 2.;
- gp_Pnt newO(LocX, LocY, LocZ);
-
- gp_Dir newX(gp_Vec(newP1, newP2)); // P1P2 Vector
- gp_Dir newZ(gp_Vec(newO, newP3)); // OP3 Vector
- gp_Ax3 newLCS = gp_Ax3(newO, newZ, newX);
-
- gp_Trsf aTrsf;
- aTrsf.SetDisplacement(oldLCS, newLCS);
-
- return aTrsf;
-}
-
-//=============================================================================
-/*!
- * CheckCompatiblePosition
- *
- */
-//=============================================================================
-bool GEOMImpl_IAdvancedOperations::CheckCompatiblePosition(double& theL1, double& theL2,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3,
- double theTolerance)
-{
- SetErrorCode(KO);
- gp_Pnt P1 = BRep_Tool::Pnt(TopoDS::Vertex(theP1->GetValue()));
- gp_Pnt P2 = BRep_Tool::Pnt(TopoDS::Vertex(theP2->GetValue()));
- gp_Pnt P3 = BRep_Tool::Pnt(TopoDS::Vertex(theP3->GetValue()));
-
- double d12 = P1.Distance(P2);
- double d13 = P1.Distance(P3);
- double d23 = P2.Distance(P3);
- // double d2 = newO.Distance(P3);
-
- if (Abs(d12) <= Precision::Confusion()) {
- SetErrorCode("Junctions points P1 and P2 are identical");
- return false;
- }
- if (Abs(d13) <= Precision::Confusion()) {
- SetErrorCode("Junctions points P1 and P3 are identical");
- return false;
- }
- if (Abs(d23) <= Precision::Confusion()) {
- SetErrorCode("Junctions points P2 and P3 are identical");
- return false;
- }
-
-
- double newL1 = 0.5 * d12;
- double newL2 = sqrt(pow(d13,2)-pow(newL1,2));
- //
- // theL1*(1-theTolerance) <= newL1 <= theL1*(1+theTolerance)
- //
- if (fabs(newL1 - theL1) > Precision::Approximation()) {
- if ( (newL1 * (1 - theTolerance) -theL1 <= Precision::Approximation()) &&
- (newL1 * (1 + theTolerance) -theL1 >= Precision::Approximation()) ) {
- // std::cerr << "theL1 = newL1" << std::endl;
- theL1 = newL1;
- } else {
- theL1 = -1;
- SetErrorCode("Dimension for main pipe (L1) is incompatible with new position");
- return false;
- }
- }
-
- //
- // theL2*(1-theTolerance) <= newL2 <= theL2*(1+theTolerance)
- //
- if (fabs(newL2 - theL2) > Precision::Approximation()) {
- if ( (newL2 * (1 - theTolerance) -theL2 <= Precision::Approximation()) &&
- (newL2 * (1 + theTolerance) -theL2 >= Precision::Approximation()) ) {
- theL2 = newL2;
- } else {
- theL2 = -1;
- SetErrorCode("Dimension for incident pipe (L2) is incompatible with new position");
- return false;
- }
- }
-
- SetErrorCode(OK);
- return true;
-
-}
-
-//=============================================================================
-/*!
- * Generate the propagation groups of a Pipe T-Shape used for hexa mesh
- */
-//=============================================================================
-bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int shapeType,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW, double theRF,
- Handle(TColStd_HSequenceOfTransient) theSeq,
- gp_Trsf aTrsf)
-{
- SetErrorCode(KO);
-
- if (theShape.IsNull()) return false;
-
- TopoDS_Shape aShape = theShape->GetValue();
- if (aShape.IsNull()) {
- SetErrorCode("Shape is not defined");
- return false;
- }
-
- gp_Trsf aTrsfInv = aTrsf.Inverted();
-
-// int expectedGroups = 0;
-// if (shapeType == TSHAPE_BASIC)
-// if (Abs(theR2+theW2-theR1-theW1) <= Precision::Approximation())
-// expectedGroups = 10;
-// else
-// expectedGroups = 11;
-// else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET)
-// expectedGroups = 12;
-
- double aR1Ext = theR1 + theW1;
- double aR2Ext = theR2 + theW2;
-
- /////////////////////////
- //// Groups of Faces ////
- /////////////////////////
-
- //
- // Comment the following lines when GetInPlace bug is solved
- // == BEGIN
- // Workaround of GetInPlace bug
- // Create a bounding box that fits the shape
- Handle(GEOM_Object) aBox = my3DPrimOperations->MakeBoxDXDYDZ(2*theL1, 2*aR1Ext, aR1Ext+theL2);
- aBox->GetLastFunction()->SetDescription("");
- myTransformOperations->TranslateDXDYDZ(aBox, -theL1, -aR1Ext, -aR1Ext);
- aBox->GetLastFunction()->SetDescription("");
- // Apply transformation to box
- BRepBuilderAPI_Transform aTransformationBox(aBox->GetValue(), aTrsf, Standard_False);
- TopoDS_Shape aBoxShapeTrsf = aTransformationBox.Shape();
- aBox->GetLastFunction()->SetValue(aBoxShapeTrsf);
-
- // Get the shell of the box
- Handle(GEOM_Object) aShell = Handle(GEOM_Object)::DownCast
- (myShapesOperations->MakeExplode(aBox, TopAbs_SHELL, true)->Value(1));
- aBox->GetLastFunction()->SetDescription("");
- aShell->GetLastFunction()->SetDescription("");
- // Get the common shapes between shell and shape
- Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon
- if (aCommonCompound.IsNull()) {
- SetErrorCode(myBooleanOperations->GetErrorCode());
- return false;
- }
- aCommonCompound->GetLastFunction()->SetDescription("");
- // Explode the faces of common shapes => 3 faces
- Handle(TColStd_HSequenceOfTransient) aCommonFaces =
- myShapesOperations->MakeExplode(aCommonCompound, TopAbs_FACE, true);
- aCommonCompound->GetLastFunction()->SetDescription("");
- std::list<Handle(GEOM_Object)> aCompoundOfFacesList;
-
- for (int i=0 ; i<= aCommonFaces->Length()-4 ; i+=4) {
- std::list<Handle(GEOM_Object)> aFacesList;
- for (int j = 1 ; j <= 4 ; j++) {
- Handle(GEOM_Object) aFace = Handle(GEOM_Object)::DownCast(aCommonFaces->Value(i+j)); // Junction faces
- if (!aFace.IsNull()) {
- aFace->GetLastFunction()->SetDescription("");
- aFacesList.push_back(aFace);
- }
- }
- Handle(GEOM_Object) aCompoundOfFaces = myShapesOperations->MakeCompound(aFacesList);
- if (!aCompoundOfFaces.IsNull()) {
- aCompoundOfFaces->GetLastFunction()->SetDescription("");
- aCompoundOfFacesList.push_back(aCompoundOfFaces);
- }
- }
-
- if (aCompoundOfFacesList.size() == 3) {
- Handle(GEOM_Object) aPln1 = aCompoundOfFacesList.front();
- aCompoundOfFacesList.pop_front();
- Handle(GEOM_Object) aPln2 = aCompoundOfFacesList.front();
- aCompoundOfFacesList.pop_front();
- Handle(GEOM_Object) aPln3 = aCompoundOfFacesList.front();
- aCompoundOfFacesList.pop_front();
- // == END
- //
-
-
- // Uncomment the following lines when GetInPlace bug is solved
- // == BEGIN
-// Handle(GEOM_Object) aP1 = myBasicOperations->MakePointXYZ(-theL1, 0, 0);
-// Handle(GEOM_Object) aP2 = myBasicOperations->MakePointXYZ(-0, 0, theL2);
-// Handle(GEOM_Object) aP3 = myBasicOperations->MakePointXYZ(theL1, 0, 0);
-// aP1->GetLastFunction()->SetDescription("");
-// aP2->GetLastFunction()->SetDescription("");
-// aP3->GetLastFunction()->SetDescription("");
-// Handle(GEOM_Object) aV1 = myBasicOperations->MakeVectorDXDYDZ(-1, 0, 0);
-// Handle(GEOM_Object) aV2 = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
-// Handle(GEOM_Object) aV3 = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
-// aV1->GetLastFunction()->SetDescription("");
-// aV2->GetLastFunction()->SetDescription("");
-// aV3->GetLastFunction()->SetDescription("");
-// Handle(GEOM_Object) aPln1 = myBasicOperations->MakePlanePntVec(aP1, aV1, 2*(aR1Ext+theL2));
-// Handle(GEOM_Object) aPln2 = myBasicOperations->MakePlanePntVec(aP2, aV2, 2*(aR2Ext));
-// Handle(GEOM_Object) aPln3 = myBasicOperations->MakePlanePntVec(aP3, aV3, 2*(aR1Ext+theL2));
-// aPln1->GetLastFunction()->SetDescription("");
-// aPln2->GetLastFunction()->SetDescription("");
-// aPln3->GetLastFunction()->SetDescription("");
-//
-// BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False);
-// TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape();
-// aPln1->GetLastFunction()->SetValue(aTrsf_Shape1);
-// BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False);
-// TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape();
-// aPln2->GetLastFunction()->SetValue(aTrsf_Shape2);
-// BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False);
-// TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape();
-// aPln3->GetLastFunction()->SetValue(aTrsf_Shape3);
- // == END
- //
-
- Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1);
- if (junctionFaces1.IsNull())
- junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
- if (!junctionFaces1.IsNull()) {
- junctionFaces1->GetLastFunction()->SetDescription("");
- junctionFaces1->SetName("JUNCTION_FACE_1");
- theSeq->Append(junctionFaces1);
- }
- else {
- SetErrorCode("Junction face 1 not found");
- // theSeq->Append(aPln1);
- // return false;
- }
- Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2);
- if (junctionFaces2.IsNull())
- junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
- if (!junctionFaces2.IsNull()) {
- junctionFaces2->GetLastFunction()->SetDescription("");
- junctionFaces2->SetName("JUNCTION_FACE_2");
- theSeq->Append(junctionFaces2);
- }
- else {
- SetErrorCode("Junction face 2 not found");
- // theSeq->Append(aPln2);
- // return false;
- }
- Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3);
- if (junctionFaces3.IsNull())
- junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
- if (!junctionFaces3.IsNull()) {
- junctionFaces3->GetLastFunction()->SetDescription("");
- junctionFaces3->SetName("JUNCTION_FACE_3");
- theSeq->Append(junctionFaces3);
- }
- else {
- SetErrorCode("Junction face 3 not found");
- // theSeq->Append(aPln3);
- // return false;
- }
- // Comment the following lines when GetInPlace bug is solved
- // == BEGIN
- }
- // == END
-
- /////////////////////////
- //// Groups of Edges ////
- /////////////////////////
- // Result of propagate
-
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
-
- TCollection_AsciiString theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) aSeqPropagate = myBlocksOperations->Propagate(theShape);
- if (aSeqPropagate.IsNull() || aSeqPropagate->Length() == 0) {
- SetErrorCode("Propagation groups not found");
- return false;
- }
- Standard_Integer aNbGroups = aSeqPropagate->Length();
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
-
-#ifdef FIND_GROUPS_BY_POINTS
- // BEGIN: new groups search
-
- // W2 R2
- // .----.-----.----.
- // e| | | | |
- // | | | | |
- // . | | | .
- // g / ''..| | |..'' \
- // f / ''''''' \
- // .---.--'.. | | | ..'--.---.
- // |a \ '''...........''' / |
- // |-------\------' | '------/-------.
- // | \ | / |
- // c| \ | / |
- // | R1 \ | / |
- // | \ | / |
- // ._________________|_________________.
- // | L1 | |
- // | | |
- // | | |
- // b| | |
- // | | |
- // |-----------------|-----------------|
- // | W1 | |
- // '-----------------'-----------------'
- // d
-
- // "Thickness" group (a)
- gp_Pnt aPntA (-theL1, 0, theR1 + theW1/2.);
- aPntA.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexA (aPntA);
- TopoDS_Vertex aVertA = TopoDS::Vertex(mkVertexA.Shape());
- TopoDS_Shape anEdgeA = GEOMUtils::GetEdgeNearPoint(aShape, aVertA);
-
- // "Circular quarter of pipe" group (b)
- gp_Pnt aPntB (-theL1, -aR1Ext * sin(M_PI/4.), -aR1Ext * sin(M_PI/4.));
- aPntB.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexB (aPntB);
- TopoDS_Vertex aVertB = TopoDS::Vertex(mkVertexB.Shape());
- TopoDS_Shape anEdgeB = GEOMUtils::GetEdgeNearPoint(aShape, aVertB);
-
- // "Circular quarter of pipe" group (c)
- gp_Pnt aPntC (-theL1, -aR1Ext * sin(M_PI/4.), aR1Ext * sin(M_PI/4.));
- aPntC.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexC (aPntC);
- TopoDS_Vertex aVertC = TopoDS::Vertex(mkVertexC.Shape());
- TopoDS_Shape anEdgeC = GEOMUtils::GetEdgeNearPoint(aShape, aVertC);
-
- // "Main pipe half length" group (d)
- gp_Pnt aPntD (-theL1/2., 0, -aR1Ext);
- aPntD.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexD (aPntD);
- TopoDS_Vertex aVertD = TopoDS::Vertex(mkVertexD.Shape());
- TopoDS_Shape anEdgeD = GEOMUtils::GetEdgeNearPoint(aShape, aVertD);
-
- // "Incident pipe half length" group (e)
- double aTol10 = Precision::Confusion() * 10.;
- gp_Pnt aPntE (-aR2Ext, 0, theL2 - aTol10);
- aPntE.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexE (aPntE);
- TopoDS_Vertex aVertE = TopoDS::Vertex(mkVertexE.Shape());
- TopoDS_Shape anEdgeE = GEOMUtils::GetEdgeNearPoint(aShape, aVertE);
-
- // "Flange" group (f)
- double aFx = - aR2Ext - aTol10;
- if (shapeType == TSHAPE_CHAMFER)
- aFx -= theW;
- else if (shapeType == TSHAPE_FILLET)
- aFx -= theRF;
- gp_Pnt aPntF (aFx, 0, aR1Ext);
- aPntF.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexF (aPntF);
- TopoDS_Vertex aVertF = TopoDS::Vertex(mkVertexF.Shape());
- TopoDS_Shape anEdgeF = GEOMUtils::GetEdgeNearPoint(aShape, aVertF);
-
- // "Chamfer or Fillet" group (g)
- TopoDS_Shape anEdgeG;
- if (shapeType == TSHAPE_CHAMFER) {
- gp_Pnt aPntG (-aR2Ext - theW/2., 0, aR1Ext + theH/2.);
- aPntG.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexG (aPntG);
- TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape());
- anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG);
- }
- else if (shapeType == TSHAPE_FILLET) {
- gp_Pnt aPntG (-aR2Ext - theRF/2., 0, aR1Ext + theRF/2.);
- aPntG.Transform(aTrsf);
- BRepBuilderAPI_MakeVertex mkVertexG (aPntG);
- TopoDS_Vertex aVertG = TopoDS::Vertex(mkVertexG.Shape());
- anEdgeG = GEOMUtils::GetEdgeNearPoint(aShape, aVertG);
- }
-
- for (int i = 1 ; i <= aNbGroups; i++) {
- Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i));
- if (aGroup.IsNull())
- continue;
-
- TopoDS_Shape aGroupShape = aGroup->GetValue();
- TopTools_IndexedMapOfShape anEdgesMap;
- TopExp::MapShapes(aGroupShape, TopAbs_EDGE, anEdgesMap);
-
- if (anEdgesMap.Contains(anEdgeA)) { // a
- aGroup->SetName("THICKNESS");
- theSeq->Append(aGroup);
- }
- else if (anEdgesMap.Contains(anEdgeB)) { // b
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- theSeq->Append(aGroup);
- }
- else if (anEdgesMap.Contains(anEdgeC)) { // c
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- theSeq->Append(aGroup);
- }
- else if (anEdgesMap.Contains(anEdgeD)) { // d
- aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
- theSeq->Append(aGroup);
- }
- else if (anEdgesMap.Contains(anEdgeE)) { // e
- aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
- theSeq->Append(aGroup);
- }
- else if (anEdgesMap.Contains(anEdgeF)) { // f
- aGroup->SetName("FLANGE");
- theSeq->Append(aGroup);
- }
- else if (shapeType == TSHAPE_CHAMFER) { // g
- if (anEdgesMap.Contains(anEdgeG)) {
- aGroup->SetName("CHAMFER");
- theSeq->Append(aGroup);
- }
- }
- else if (shapeType == TSHAPE_FILLET) { // g
- if (anEdgesMap.Contains(anEdgeG)) {
- aGroup->SetName("FILLET");
- theSeq->Append(aGroup);
- }
- }
- else {
- }
- }
- // END: new groups search
-#else
- bool addGroup;
- bool circularFoundAndAdded = false;
- bool circularFound10 = false;
- bool incidentPipeFound = false;
- bool mainPipeFound = false;
- bool mainPipeFoundAndAdded = false;
- bool radialFound =false;
- bool flangeFound = false;
- bool flangeFoundAndAdded = false;
- bool chamferOrFilletFound = false;
-
- for (int i = 1 ; i <= aNbGroups; i++) {
- addGroup = false;
-
- Handle(GEOM_Object) aGroup = Handle(GEOM_Object)::DownCast(aSeqPropagate->Value(i));
- if (aGroup.IsNull())
- continue;
-
- TopoDS_Shape aGroupShape = aGroup->GetValue();
- BRepBuilderAPI_Transform aTransformationShapeInv (aGroupShape, aTrsfInv, Standard_False);
- TopoDS_Shape aGroupShapeTrsfInv = aTransformationShapeInv.Shape();
-
- TopTools_IndexedMapOfShape anEdgesMap;
- TopExp::MapShapes(aGroupShapeTrsfInv,TopAbs_EDGE, anEdgesMap);
- Standard_Integer nbEdges = anEdgesMap.Extent();
-
- if (shapeType == TSHAPE_BASIC) {
- if ((nbEdges >= 21) || /*R1Ext = R2Ext*/(nbEdges == 17)) { // 17, 17+8*{1,2,3}, 21, 21+8*{1,2,3}
- addGroup = true;
- aGroup->SetName("THICKNESS");
- }
- else if (nbEdges == 6) {
- if (!circularFoundAndAdded) {
- circularFoundAndAdded = true;
- addGroup = true;
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- }
- }
- else if (nbEdges == 8) {
- incidentPipeFound = true;
- mainPipeFound = false;
- radialFound = false;
- flangeFound = false;
-
- TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX);
- while (Ex.More()) {
- gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- double x=aP.X(), y=aP.Y(), z=aP.Z();
-
-
- if ((Abs(x) > aR2Ext + Precision::Confusion()) ||
- (Abs(y) > aR2Ext + Precision::Confusion())) {
- incidentPipeFound = false;
- }
-
- if ( z < -Precision::Confusion()) {
- // length of main pipe
- mainPipeFound = true;
- if (!mainPipeFoundAndAdded) {
- mainPipeFoundAndAdded = true;
- addGroup = true;
- aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
- }
- }
-
- else if (Abs(x) > (theL1-Precision::Confusion())) {
- // discretisation circulaire
- radialFound = true;
- if (!circularFoundAndAdded) {
- circularFoundAndAdded = true;
- addGroup = true;
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- }
- }
- Ex.Next();
- }
- if (incidentPipeFound) {
- addGroup = true;
- aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
- }
- if (!addGroup && (!incidentPipeFound &&
- !radialFound &&
- !mainPipeFound &&
- !flangeFound)) {
- // Flange (collerette)
- flangeFound = true;
- addGroup = true;
- aGroup->SetName("FLANGE");
- }
- }
- else
- continue;
- }
- else if (shapeType == TSHAPE_CHAMFER || shapeType == TSHAPE_FILLET) {
- if (nbEdges >= 25) { // 25, 25+8, 25+16, 25+24
- addGroup = true;
- aGroup->SetName("THICKNESS");
- }
- else if ((nbEdges == 10) || (nbEdges == 6)) {
- if (!circularFoundAndAdded) {
- addGroup = true;
- circularFoundAndAdded = true;
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- if (nbEdges == 10) {
- circularFound10 = true;
- }
- }
- else if (!circularFound10 && nbEdges == 10) {
- circularFound10 = true;
- addGroup = true;
- aGroup->SetName("CIRCULAR_QUARTER_PIPE");
- }
- }
- else if (nbEdges == 8) {
- incidentPipeFound = true;
- mainPipeFound = true;
- flangeFound = false;
-
- bool isNearZ0 = false;
- bool isBelowZ0 = false;
-
- TopExp_Explorer Ex (aGroupShapeTrsfInv,TopAbs_VERTEX);
- while (Ex.More()) {
- gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- double x=aP.X(), y=aP.Y(), z=aP.Z();
-
- // tuy_princ_long_avant & tuy_princ_long_apres
- //bool isMain = (((z < Precision::Confusion()) || (x < Precision::Confusion())) &&
- // ((y <= aR1Ext + Precision::Confusion()) ||
- // (y <= -(aR1Ext + Precision::Confusion())) ||
- // (y <= theR1 + Precision::Confusion()) ||
- // (y == -(theR1 + Precision::Confusion()))));
- bool isMain = ((z < Precision::Confusion() || x < Precision::Confusion()) &&
- (fabs(y) > theR1 - Precision::Confusion() ||
- fabs(y) < Precision::Confusion()));
-
- if (!isMain) {
- mainPipeFound = false;
- }
-
- // collerette
- //if (z < Precision::Confusion() && !isMain) {
- // flangeFound = true;
- // if (!flangeFoundAndAdded) {
- // flangeFoundAndAdded = true;
- // addGroup = true;
- // aGroup->SetName("FLANGE");
- // }
- //}
- if (fabs(z) < Precision::Confusion()) isNearZ0 = true;
- if (z < - Precision::Confusion()) isBelowZ0 = true;
-
- // tuyau incident
- if ((Abs(x) > aR2Ext + Precision::Confusion()) ||
- (Abs(y) > aR2Ext + Precision::Confusion())) {
- incidentPipeFound = false;
- }
- Ex.Next();
- }
- if (mainPipeFound) {
- addGroup = true;
- aGroup->SetName("HALF_LENGTH_MAIN_PIPE");
- }
- if (incidentPipeFound) {
- addGroup = true;
- aGroup->SetName("HALF_LENGTH_INCIDENT_PIPE");
- }
- if (isNearZ0 && !isBelowZ0) {
- flangeFound = true;
- if (!flangeFoundAndAdded) {
- flangeFoundAndAdded = true;
- addGroup = true;
- aGroup->SetName("FLANGE");
- }
- }
- if (!addGroup && (!incidentPipeFound &&
- !mainPipeFound &&
- !flangeFound &&
- !chamferOrFilletFound)) {
- addGroup = true;
- chamferOrFilletFound = true;
- if (shapeType == TSHAPE_CHAMFER)
- aGroup->SetName("CHAMFER");
- else
- aGroup->SetName("FILLET");
- }
- }
- else
- continue;
- }
- // Add group to the list
- if (addGroup)
- theSeq->Append(aGroup);
- }
-#endif
-
- SetErrorCode(OK);
- return true;
-}
-
-//=============================================================================
-/*!
- * Return faces that are laying on surface.
- */
-//=============================================================================
-bool GEOMImpl_IAdvancedOperations::GetFacesOnSurf
- (const TopoDS_Shape &theShape,
- const Handle_Geom_Surface& theSurface,
- const Standard_Real theTolerance,
- TopTools_ListOfShape &theFaces)
-{
- GEOMAlgo_FinderShapeOn1 aFinder;
-
- aFinder.SetShape(theShape);
- aFinder.SetTolerance(theTolerance);
- aFinder.SetSurface(theSurface);
- aFinder.SetShapeType(TopAbs_FACE);
- aFinder.SetState(GEOMAlgo_ST_ON);
-
- // Sets the minimal number of inner points for the faces that do not have own
- // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
- // Default value=3
- aFinder.SetNbPntsMin(3);
- // Sets the maximal number of inner points for edges or faces.
- // It is usefull for the cases when this number is very big (e.g =2000) to improve
- // the performance. If this value =0, all inner points will be taken into account.
- // Default value=0
- aFinder.SetNbPntsMax(100);
- aFinder.Perform();
-
- // Interprete results
- Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
- if (iErr) {
- MESSAGE(" iErr : " << iErr);
- TCollection_AsciiString aMsg (" iErr : ");
- aMsg += TCollection_AsciiString(iErr);
- SetErrorCode(aMsg);
- return false;
- }
- Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
- if (iWrn) {
- MESSAGE(" *** iWrn : " << iWrn);
- }
-
- const TopTools_ListOfShape &aListRes = aFinder.Shapes(); // the result
- TopTools_ListIteratorOfListOfShape anIter (aListRes);
-
- for (; anIter.More(); anIter.Next()) {
- theFaces.Append(anIter.Value());
- }
-
- return true;
-}
-
-//=============================================================================
-/*!
- * Creates and returns conical face.
- */
-//=============================================================================
-TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeConicalFace
- (const gp_Ax2 &theAxis,
- const double theRadius,
- const double theRadiusThin,
- const double theHeight,
- const gp_Trsf &theTrsf)
-{
- BRepPrimAPI_MakeCone aMkCone (theAxis, theRadius, theRadiusThin, theHeight);
- TopoDS_Shape aResult;
-
- aMkCone.Build();
- if (aMkCone.IsDone()) {
- TopExp_Explorer anExp(aMkCone.Shape(), TopAbs_FACE);
-
- for (; anExp.More(); anExp.Next()) {
- TopoDS_Face aFace = TopoDS::Face(anExp.Current());
-
- if (aFace.IsNull() == Standard_False) {
- BRepAdaptor_Surface anAdaptor(aFace, Standard_False);
-
- if (anAdaptor.GetType() == GeomAbs_Cone) {
- // This is a conical face. Transform and return it.
- BRepBuilderAPI_Transform aTransf(aFace, theTrsf, Standard_False);
-
- aResult = aTransf.Shape();
- break;
- }
- }
- }
- }
-
- return aResult;
-}
-
-//=============================================================================
-/*!
- * Generate the internal group of a Pipe T-Shape
- */
-//=============================================================================
-bool GEOMImpl_IAdvancedOperations::MakeInternalGroup
- (const Handle(GEOM_Object) &theShape,
- const double theR1, const double theLen1,
- const double theR2, const double theLen2,
- const double theRL, double theTransLenL,
- const double theRR, double theTransLenR,
- const double theRI, double theTransLenI,
- const Handle(TColStd_HSequenceOfTransient) &theSeq,
- const gp_Trsf &theTrsf)
-{
- SetErrorCode(KO);
-
- if (theShape.IsNull()) {
- return false;
- }
-
- TopoDS_Shape aShape = theShape->GetValue();
-
- if (aShape.IsNull()) {
- SetErrorCode("Shape is not defined");
- return false;
- }
-
- // Compute tolerance
- Standard_Real aMaxTol = -RealLast();
- TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
-
- for (; anExp.More(); anExp.Next()) {
- TopoDS_Vertex aVertex = TopoDS::Vertex(anExp.Current());
-
- if (aVertex.IsNull() == Standard_False) {
- const Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
-
- if (aTol > aMaxTol) {
- aMaxTol = aTol;
- }
- }
- }
-
- // Construct internal surfaces.
- Standard_Integer i = 0;
- const Standard_Integer aMaxNbSurf = 5;
- Handle(Geom_Surface) aSurface[aMaxNbSurf];
- TopTools_ListOfShape aConicalFaces;
- Standard_Real aTolConf = Precision::Confusion();
-
- // 1. Construct the internal surface of main pipe.
- gp_Ax2 anAxis1 (gp::Origin(), gp::DX(), gp::DZ());
- gp_Ax2 anAxis2 (gp::Origin(), gp::DZ(), gp::DX());
-
- aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theR1);
-
- // 2. Construct the internal surface of incident pipe.
- aSurface[i++] = new Geom_CylindricalSurface(anAxis2, theR2);
-
- // 3. Construct the internal surface of left reduction pipe.
- if (theRL > aTolConf) {
- aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theRL);
-
- if (theTransLenL > aTolConf) {
- // 3.1. Construct the internal surface of left transition pipe.
- gp_Pnt aPLeft (-theLen1, 0., 0.);
- gp_Ax2 anAxisLeft (aPLeft, -gp::DX(), gp::DZ());
- TopoDS_Shape aConeLeft =
- MakeConicalFace(anAxisLeft, theR1, theRL, theTransLenL, theTrsf);
-
- if (aConeLeft.IsNull() == Standard_False) {
- aConicalFaces.Append(aConeLeft);
- }
- }
- }
-
- // 4. Construct the internal surface of right reduction pipe.
- if (theRR > aTolConf) {
- // There is no need to construct another cylinder of the same radius. Skip it.
- if (Abs(theRR - theRL) > aTolConf) {
- aSurface[i++] = new Geom_CylindricalSurface(anAxis1, theRR);
- }
-
- if (theTransLenL > aTolConf) {
- // 4.1. Construct the internal surface of right transition pipe.
- gp_Pnt aPRight (theLen1, 0., 0.);
- gp_Ax2 anAxisRight (aPRight, gp::DX(), gp::DZ());
- TopoDS_Shape aConeRight =
- MakeConicalFace(anAxisRight, theR1, theRR, theTransLenR, theTrsf);
-
- if (aConeRight.IsNull() == Standard_False) {
- aConicalFaces.Append(aConeRight);
- }
- }
- }
-
- // 5. Construct the internal surface of incident reduction pipe.
- if (theRI > aTolConf) {
- aSurface[i++] = new Geom_CylindricalSurface(anAxis2, theRI);
-
- if (theTransLenI > aTolConf) {
- // 5.1. Construct the internal surface of incident transition pipe.
- gp_Pnt aPInci (0., 0., theLen2);
- gp_Ax2 anAxisInci (aPInci, gp::DZ(), gp::DX());
- TopoDS_Shape aConeInci =
- MakeConicalFace(anAxisInci, theR2, theRI, theTransLenI, theTrsf);
-
- if (aConeInci.IsNull() == Standard_False) {
- aConicalFaces.Append(aConeInci);
- }
- }
- }
-
- // Get faces that are laying on cylindrical surfaces.
- TopTools_ListOfShape aFaces;
- gp_Trsf anInvTrsf = theTrsf.Inverted();
-
- for (i = 0; i < aMaxNbSurf; i++) {
- if (aSurface[i].IsNull()) {
- break;
- }
-
- aSurface[i]->Transform(theTrsf);
-
- TopTools_ListOfShape aLocalFaces;
-
- if (!GetFacesOnSurf(aShape, aSurface[i], aMaxTol, aLocalFaces)) {
- return false;
- }
-
- if (i < 2) {
- // Check if the result contains outer cylinders.
- // It is required for main and incident pipes.
- TopTools_ListIteratorOfListOfShape anIter(aLocalFaces);
-
- while (anIter.More()) {
- TopExp_Explorer anExp(anIter.Value(), TopAbs_VERTEX);
- Standard_Boolean isInside = Standard_False;
-
- // Get a vertex from this shape
- if (anExp.More()) {
- TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current());
-
- if (aVtx.IsNull() == Standard_False) {
- gp_Pnt aPnt = BRep_Tool::Pnt(aVtx);
-
- aPnt.Transform(anInvTrsf);
-
- if (i == 0) {
- // Check if the point is inside the main pipe.
- isInside = (Abs(aPnt.X()) <= theLen1);
- } else { // i == 1
- // Check if the point is inside the incident pipe.
- isInside = (aPnt.Z() <= theLen2);
- }
- }
- }
-
- if (isInside) {
- // Keep this face.
- anIter.Next();
- } else {
- // Remove this face.
- aLocalFaces.Remove(anIter);
- }
- }
- }
-
- aFaces.Append(aLocalFaces);
- }
-
- // Get faces that are laying on conical faces.
- if (aConicalFaces.IsEmpty() == Standard_False) {
- Handle(GEOM_Object) aCone =
- GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
- Handle(GEOM_Function) aFunction =
- aCone->AddFunction(GEOMImpl_PipeTShapeDriver::GetID(), TSHAPE_BASIC);
- TopTools_ListIteratorOfListOfShape aFIter(aConicalFaces);
- Handle(GEOM_Object) aConeFromShape;
-
- for (; aFIter.More(); aFIter.Next()) {
- aFunction->SetValue(aFIter.Value());
- aConeFromShape = myShapesOperations->GetInPlace(theShape, aCone);
-
- if (aConeFromShape.IsNull() == Standard_False) {
- aConeFromShape->GetLastFunction()->SetDescription("");
- TopoDS_Shape aConeFaces = aConeFromShape->GetValue();
- TopExp_Explorer anExp(aConeFaces, TopAbs_FACE);
-
- for (; anExp.More(); anExp.Next()) {
- TopoDS_Face aConeFace = TopoDS::Face(anExp.Current());
-
- if (aConeFace.IsNull() == Standard_False) {
- aFaces.Append(aConeFace);
- }
- }
- }
- }
- }
-
- // Create a group of internal faces.
- if (aFaces.IsEmpty() == Standard_False) {
- Handle(GEOM_Object) aGroup = myGroupOperations->CreateGroup(theShape, TopAbs_FACE);
-
- if (aGroup.IsNull() == Standard_False) {
- aGroup->GetLastFunction()->SetDescription("");
- aGroup->SetName("INTERNAL_FACES");
-
- TopTools_IndexedMapOfShape anIndices;
- Handle(TColStd_HSequenceOfInteger) aSeqIDs = new TColStd_HSequenceOfInteger;
-
- TopExp::MapShapes(aShape, anIndices);
-
- TopTools_ListIteratorOfListOfShape anIter(aFaces);
-
- for (; anIter.More(); anIter.Next()) {
- const TopoDS_Shape &aFace = anIter.Value();
- const Standard_Integer anIndex = anIndices.FindIndex(aFace);
-
- if (anIndex > 0) {
- aSeqIDs->Append(anIndex);
- }
- }
-
- myGroupOperations->UnionIDs(aGroup, aSeqIDs);
- aGroup->GetLastFunction()->SetDescription("");
- theSeq->Append(aGroup);
- }
- }
-
- SetErrorCode(OK);
-
- return true;
-}
-
-bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW,
- double theRF, bool isNormal)
-{
- SetErrorCode(KO);
-
- // Build tools for partition operation:
- // 1 face and 2 planes
- // Face
- Handle(GEOM_Object) arete_intersect_int;
- Handle(GEOM_Object) wire_t, wire_t2, face_t, face_t2;
- Handle(GEOM_Object) chan_racc;
- Handle(GEOM_Object) vi1, vi2;
- Handle(GEOM_Object) Te3;
-
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- Handle(GEOM_Object) Vector_Z = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
- Vector_Z->GetLastFunction()->SetDescription("");
-
- // Useful values
- double aSize = 2*(theL1 + theL2);
- double aR1Ext = theR1 + theW1;
- double aR2Ext = theR2 + theW2;
- double theVertCylinderRadius = aR2Ext + theW + theRF;
- double theHoriCylinderRadius = aR1Ext + theH + theRF;
-
- // Common edges on internal cylinder
- Handle(GEOM_Object) box_i = my3DPrimOperations->MakeBoxDXDYDZ(theR2, theR2, theR1);
- box_i->GetLastFunction()->SetDescription("");
- box_i = myTransformOperations->TranslateDXDYDZ(box_i, -theR2, -theR2, 0);
- box_i->GetLastFunction()->SetDescription("");
-
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- TCollection_AsciiString theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) edges_i =
- myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
- if (edges_i.IsNull() || edges_i->Length() == 0) {
- SetErrorCode("Internal edges not found");
- return false;
- }
- for (int i=1; i<=edges_i->Length();i++) {
- Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_i->Value(i));
- anObj->GetLastFunction()->SetDescription("");
- }
- arete_intersect_int = Handle(GEOM_Object)::DownCast(edges_i->Value(1));
-
- // search for vertices located on both internal pipes
- aFunction = theShape->GetLastFunction();
- theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) vertices_i =
- myShapesOperations->GetShapesOnBox(box_i, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
- if (vertices_i.IsNull() || vertices_i->Length() == 0) {
- SetErrorCode("Internal vertices not found");
- return false;
- }
-
- for (int i = 1; i <= vertices_i->Length(); i++) {
- Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_i->Value(i));
- v->GetLastFunction()->SetDescription("");
- TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
- gp_Pnt aP = BRep_Tool::Pnt(aVertex);
-// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
- if (Abs(aP.X()) <= Precision::Confusion()) {
- if (Abs(aP.Y()) - theR1 <= Precision::Confusion()) {
- vi1 = v;
- }
- } else if (Abs(aP.Y()) <= Precision::Confusion()) {
- if (Abs(aP.X()) - theR1 <= Precision::Confusion()) {
- vi2 = v;
- }
- }
- }
-
- std::list<Handle(GEOM_Object)> theShapes;
-
- if (isNormal) {
- Handle(GEOM_Object) ve1, ve2;
-
- Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ(aR2Ext, aR2Ext, aR1Ext);
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ(box_e, -aR2Ext, -aR2Ext, 0);
- box_e->GetLastFunction()->SetDescription("");
- // Common edges on external cylinder
- aFunction = theShape->GetLastFunction();
- theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) edges_e =
- myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return false;
- }
- for (int i=1; i<=edges_e->Length();i++) {
- Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(edges_e->Value(i));
- anObj->GetLastFunction()->SetDescription("");
- }
-
- // search for vertices located on both external pipes
- aFunction = theShape->GetLastFunction();
- theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) vertices_e =
- myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
- if (vertices_e.IsNull() || vertices_e->Length() == 0) {
- SetErrorCode("External vertices not found");
- return false;
- }
-
- for (int i = 1; i <= vertices_e->Length(); i++) {
- Handle(GEOM_Object) v = Handle(GEOM_Object)::DownCast(vertices_e->Value(i));
- v->GetLastFunction()->SetDescription("");
- TopoDS_Vertex aVertex = TopoDS::Vertex(v->GetValue());
- gp_Pnt aP = BRep_Tool::Pnt(aVertex);
-// std::cout << "Coords: " << aP.X() << ", " << aP.Y() << ", " << aP.Z() << std::endl;
- if (Abs(aP.X()) <= Precision::Confusion()) {
- if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
- ve1 = v;
- }
- } else if (Abs(aP.Y()) <= Precision::Confusion()) {
- if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
- ve2 = v;
- }
- }
- if ( !ve1.IsNull() && !ve2.IsNull())
- break;
- }
- Handle(GEOM_Object) edge_e1, edge_e2;
-
- edge_e1 = myBasicOperations->MakeLineTwoPnt(ve1, vi1);
- if (edge_e1.IsNull()) {
- SetErrorCode("Edge 1 could not be built");
- return false;
- }
-
- edge_e2 = myBasicOperations->MakeLineTwoPnt(ve2, vi2);
- if (edge_e2.IsNull()) {
- SetErrorCode("Edge 2 could not be built");
- return false;
- }
-
- edge_e1->GetLastFunction()->SetDescription("");
- edge_e2->GetLastFunction()->SetDescription("");
-
- std::list<Handle(GEOM_Object)> edge_e_elist;
- edge_e_elist.push_back(arete_intersect_int);
- edge_e_elist.push_back(edge_e1);
- edge_e_elist.push_back(Handle(GEOM_Object)::DownCast(edges_e->Value(1)));
- edge_e_elist.push_back(edge_e2);
- wire_t = myShapesOperations->MakeWire(edge_e_elist, 1e-7);
- if (wire_t.IsNull()) {
- SetErrorCode("Impossible to build wire");
- return false;
- }
- wire_t->GetLastFunction()->SetDescription("");
- face_t = myShapesOperations->MakeFace(wire_t, false);
- if (face_t.IsNull()) {
- SetErrorCode("Impossible to build face");
- return false;
- }
- face_t->GetLastFunction()->SetDescription("");
-
- theShapes.push_back(theShape);
- theShapes.push_back(vi1);
- theShapes.push_back(vi2);
- theShapes.push_back(ve1);
- theShapes.push_back(ve2);
- theShapes.push_back(edge_e1);
- theShapes.push_back(edge_e2);
- theShapes.push_back(wire_t);
- theShapes.push_back(face_t);
- }
- else {
- Handle(GEOM_Object) P1, P2, P3, P4, P5, P6;
- int idP1, idP2, idP3, idP4;
- int PZX, PZY;
- double ZX=0, ZY=0;
- std::vector<int> LX;
- std::vector<int> LY;
- Handle(GEOM_Object) box_e = my3DPrimOperations->MakeBoxDXDYDZ
- (theVertCylinderRadius, theVertCylinderRadius, theHoriCylinderRadius);
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ
- (box_e, -theVertCylinderRadius, -theVertCylinderRadius, 0);
- box_e->GetLastFunction()->SetDescription("");
-
- aFunction = theShape->GetLastFunction();
- theDesc = aFunction->GetDescription();
- Handle(TColStd_HSequenceOfTransient) extremVertices =
- myShapesOperations->GetShapesOnBox(box_e, theShape, TopAbs_VERTEX, GEOMAlgo_ST_ONIN);
- // Recover previous description to get rid of Propagate dump
- aFunction->SetDescription(theDesc);
-
- if (extremVertices.IsNull() || extremVertices->Length() == 0) {
- if (theRF == 0)
- SetErrorCode("Vertices on chamfer not found");
- else
- SetErrorCode("Vertices on fillet not found");
- return false;
- }
-
- theShapes.push_back(theShape);
- theShapes.push_back(box_e);
- if (extremVertices->Length() != 6) {
- // for (int i=1; i<=extremVertices->Length(); i++){
- // theShapes.push_back(Handle(GEOM_Object)::DownCast(extremVertices->Value(i)));
- // }
- // Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes);
- // TopoDS_Shape aCompoundShape = aCompound->GetValue();
- // theShape->GetLastFunction()->SetValue(aCompoundShape);
- SetErrorCode("Bad number of vertices on chamfer found");
- return false;
- }
-
- for (int i=1; i<=extremVertices->Length(); i++){
- Handle(GEOM_Object) aV = Handle(GEOM_Object)::DownCast(extremVertices->Value(i));
- aV->GetLastFunction()->SetDescription("");
- gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aV->GetValue()));
-
- if (Abs(aP.X()) <= Precision::Confusion()) {
- if (Abs(aP.Y()) - theR2 > Precision::Confusion()) {
- LX.push_back(i);
- if (aP.Z()-ZX > Precision::Confusion()) {
- ZX = aP.Z();
- PZX = i;
- }
- }
- }
- else {
- if (Abs(aP.X()) - theR2 > Precision::Confusion()) {
- LY.push_back(i);
- if (aP.Z() - ZY > Precision::Confusion()) {
- ZY = aP.Z();
- PZY = i;
- }
- }
- }
- }
-
- idP2 = PZX;
- idP4 = PZY;
- idP1 = LX.at(0);
- if (LX.at(0) == PZX)
- idP1 = LX.at(1);
- idP3 = LY.at(0);
- if (LY.at(0) == PZY)
- idP3 = LY.at(1);
-
- P1 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP1));
- P2 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP2));
- P3 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP3));
- P4 = Handle(GEOM_Object)::DownCast(extremVertices->Value(idP4));
-
- Handle(GEOM_Object) Cote_1 = myBasicOperations->MakeLineTwoPnt(P1, vi1);
- if (Cote_1.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_1->GetLastFunction()->SetDescription("");
-
- Handle(GEOM_Object) Cote_2 = myBasicOperations->MakeLineTwoPnt(vi2, P3);
- if (Cote_2.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_2->GetLastFunction()->SetDescription("");
-
- // edge_chan_princ = arete du chanfrein (ou raccord) sur le tuyau principal
- // edge_chan_inc = arete du chanfrein (ou raccord) sur le tuyau incident
- // std::cerr << "Getting chamfer edge on main pipe" << std::endl;
- Handle(GEOM_Object) edge_chan_princ = myBlocksOperations->GetEdge(theShape, P1, P3);
- if (edge_chan_princ.IsNull()) {
- SetErrorCode("Impossible to find edge on main pipe");
- return false;
- }
- edge_chan_princ->GetLastFunction()->SetDescription("");
-
- Handle(GEOM_Object) edge_chan_inc = myBlocksOperations->GetEdge(theShape, P2, P4);
- if (edge_chan_inc.IsNull()) {
- SetErrorCode("Impossible to find edge on incident pipe");
- return false;
- }
- edge_chan_inc->GetLastFunction()->SetDescription("");
-
- std::list<Handle(GEOM_Object)> edgeList1;
- edgeList1.push_back(edge_chan_princ);
- edgeList1.push_back(Cote_1);
- edgeList1.push_back(arete_intersect_int);
- edgeList1.push_back(Cote_2);
-
- // std::cerr << "Creating wire 1" << std::endl;
- wire_t = myShapesOperations->MakeWire(edgeList1, 1e-7);
- if (wire_t.IsNull()) {
- SetErrorCode("Impossible to build wire");
- return false;
- }
- wire_t->GetLastFunction()->SetDescription("");
-
- // std::cerr << "Creating face 1" << std::endl;
- face_t = myShapesOperations->MakeFace(wire_t, false);
- if (face_t.IsNull()) {
- SetErrorCode("Impossible to build face");
- return false;
- }
- face_t->GetLastFunction()->SetDescription("");
- theShapes.push_back(face_t);
-
- gp_Pnt aP2 = BRep_Tool::Pnt(TopoDS::Vertex(P2->GetValue()));
- gp_Pnt aP5 = BRep_Tool::Pnt(TopoDS::Vertex(vi1->GetValue()));
- double deltaZ = aP2.Z() - aP5.Z();
- // std::cerr << "Creating new point from vi1 with deltaZ = " << deltaZ << std::endl;
- Handle(GEOM_Object) P5bis = myTransformOperations->TranslateDXDYDZCopy(vi1, 0, 0, deltaZ);
- if (P5bis.IsNull()) {
- SetErrorCode("Impossible to translate vertex");
- return false;
- }
- P5bis->GetLastFunction()->SetDescription("");
-
- gp_Pnt aP4 = BRep_Tool::Pnt(TopoDS::Vertex(P4->GetValue()));
- gp_Pnt aP6 = BRep_Tool::Pnt(TopoDS::Vertex(vi2->GetValue()));
- deltaZ = aP4.Z() - aP6.Z();
- // std::cerr << "Creating new point from vi2 with deltaZ = " << deltaZ << std::endl;
- Handle(GEOM_Object) P6bis = myTransformOperations->TranslateDXDYDZCopy(vi2, 0, 0, deltaZ);
- if (P6bis.IsNull()) {
- SetErrorCode("Impossible to translate vertex");
- return false;
- }
- P6bis->GetLastFunction()->SetDescription("");
-
- // std::cerr << "Creating new line 1 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_3 = myBasicOperations->MakeLineTwoPnt(P5bis, P2);
- if (Cote_3.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_3->GetLastFunction()->SetDescription("");
-
- // std::cerr << "Creating new line 2 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_4 = myBasicOperations->MakeLineTwoPnt(P6bis, P4);
- if (Cote_4.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_4->GetLastFunction()->SetDescription("");
-
- // std::cerr << "Creating new line 3 from 2 previous points" << std::endl;
- Handle(GEOM_Object) Cote_5 = myBasicOperations->MakeLineTwoPnt(P5bis, P6bis);
- if (Cote_4.IsNull()) {
- SetErrorCode("Impossible to build edge in thickness");
- return false;
- }
- Cote_5->GetLastFunction()->SetDescription("");
-
- //std::list<Handle(GEOM_Object)> edgeList2;
- //edgeList2.push_back(edge_chan_inc);
- //edgeList2.push_back(Cote_3);
- //edgeList2.push_back(Cote_5);
- //edgeList2.push_back(Cote_4);
- // std::cerr << "Creating wire 2" << std::endl;
- //wire_t2 = myShapesOperations->MakeWire(edgeList2, 1e-7);
- //if (wire_t2.IsNull()) {
- // SetErrorCode("Impossible to build wire");
- // return false;
- //}
- //wire_t2->GetLastFunction()->SetDescription("");
- // std::cerr << "Creating face 2" << std::endl;
- //face_t2 = myShapesOperations->MakeFace(wire_t2, false);
-
- // Mantis issue 0021682
- face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - (theR2 + theW2));
- //face_t2 = my3DPrimOperations->MakePrismVecH(edge_chan_inc, Cote_4, - 2.0*theR2);
- if (face_t2.IsNull()) {
- SetErrorCode("Impossible to build face");
- return false;
- }
- face_t2->GetLastFunction()->SetDescription("");
- theShapes.push_back(face_t2);
- }
-
- // Planes
- Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0);
- Handle(GEOM_Object) aVZ = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
- Handle(GEOM_Object) aVXZ = myBasicOperations->MakeVectorDXDYDZ(aR1Ext, 0, 0.5*(theL1+theVertCylinderRadius));
- Handle(GEOM_Object) aPlnOZ = myBasicOperations->MakePlanePntVec(aP0, aVZ, aSize);
- Handle(GEOM_Object) aPlnOXZ = myBasicOperations->MakePlanePntVec(aP0, aVXZ, aSize);
- aP0->GetLastFunction()->SetDescription("");
- aVZ->GetLastFunction()->SetDescription("");
- aVXZ->GetLastFunction()->SetDescription("");
- aPlnOZ->GetLastFunction()->SetDescription("");
- aPlnOXZ->GetLastFunction()->SetDescription("");
- theShapes.push_back(aPlnOZ);
- theShapes.push_back(aPlnOXZ);
-
- // Partition
- Handle(TColStd_HSequenceOfTransient) partitionShapes = new TColStd_HSequenceOfTransient;
- Handle(TColStd_HSequenceOfTransient) theTools = new TColStd_HSequenceOfTransient;
- Handle(TColStd_HSequenceOfTransient) theKeepInside = new TColStd_HSequenceOfTransient;
- Handle(TColStd_HSequenceOfTransient) theRemoveInside = new TColStd_HSequenceOfTransient;
- Handle(TColStd_HArray1OfInteger) theMaterials;
-
- partitionShapes->Append(theShape);
- theTools->Append(aPlnOZ);
- if (Abs(aR1Ext - aR2Ext) > Precision::Confusion())
- theTools->Append(aPlnOXZ);
- theTools->Append(face_t);
- if (!isNormal)
- theTools->Append(face_t2);
-
- Te3 = myBooleanOperations->MakePartition
- (partitionShapes, theTools, theKeepInside, theRemoveInside,
- TopAbs_SOLID, false, theMaterials, 0, false);
- if (Te3.IsNull()) {
- SetErrorCode("Impossible to build partition of TShape");
- return false;
- }
- Te3->GetLastFunction()->SetDescription("");
-
- // Last verification: result should be a block
- std::list<GEOMImpl_IBlocksOperations::BCError> errList;
- if (!myBlocksOperations->CheckCompoundOfBlocks(Te3,errList)) {
- SetErrorCode("TShape is not a compound of block");
- return false;
- }
-
-// // BEGIN Compound of created shapes - Only for debug purpose
-// theShapes.clear();
-// theShapes.push_back(theShape);
-// theShapes.push_back(aPlnOZ);
-// if (Abs(aR1Ext - aR2Ext) > Precision::Confusion() )
-// theShapes.push_back(aPlnOXZ);
-// theShapes.push_back(face_t);
-// if (!isNormal)
-// theShapes.push_back(face_t2);
-//
-// Handle(GEOM_Object) aCompound = myShapesOperations->MakeCompound(theShapes);
-// TopoDS_Shape aCompoundShape = aCompound->GetValue();
-// theShape->GetLastFunction()->SetValue(aCompoundShape);
-// // END Compound of created shapes - Only for debug purpose
-
- TopoDS_Shape aShape = Te3->GetValue();
- theShape->GetLastFunction()->SetValue(aShape);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return false;
- }
-
- SetErrorCode(OK);
- return true;
-}
-
-// Mirror and glue faces
-bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2)
-{
- SetErrorCode(KO);
-
- // Useful values
- double aSize = 2*(theL1 + theL2);
- double aR1Ext = theR1 + theW1;
-
- // Planes
- Handle(GEOM_Object) aP0 = myBasicOperations->MakePointXYZ(0, 0, 0);
- aP0->GetLastFunction()->SetDescription("");
- Handle(GEOM_Object) aVX = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
- Handle(GEOM_Object) aVY = myBasicOperations->MakeVectorDXDYDZ(0, 1, 0);
- aVX->GetLastFunction()->SetDescription("");
- aVY->GetLastFunction()->SetDescription("");
- Handle(GEOM_Object) aPlane_OX = myBasicOperations->MakePlanePntVec(aP0, aVX, 2*(aR1Ext + theL2));
- Handle(GEOM_Object) aPlane_OY = myBasicOperations->MakePlanePntVec(aP0, aVY, aSize);
- aPlane_OX->GetLastFunction()->SetDescription("");
- aPlane_OY->GetLastFunction()->SetDescription("");
-
- Handle(GEOM_Object) Te4 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OX);
- if (Te4.IsNull()) {
- SetErrorCode("Impossible to build mirror of quarter TShape");
- return false;
- }
-
- Handle(GEOM_Object) Te5 = myTransformOperations->MirrorPlaneCopy(theShape, aPlane_OY);
- if (Te5.IsNull()) {
- SetErrorCode("Impossible to build mirror of half TShape");
- return false;
- }
-
- Handle(GEOM_Object) Te6 = myTransformOperations->MirrorPlaneCopy(Te4, aPlane_OY);
- if (Te6.IsNull()) {
- SetErrorCode("Impossible to build mirror of half TShape");
- return false;
- }
-
- std::list<Handle(GEOM_Object)> aShapesList;
- aShapesList.push_back(theShape);
- aShapesList.push_back(Te4);
- aShapesList.push_back(Te5);
- aShapesList.push_back(Te6);
- Handle(GEOM_Object) Te7 = myShapesOperations->MakeCompound(aShapesList);
- if (Te7.IsNull()) {
- SetErrorCode("Impossible to build compound");
- return false;
- }
-
- // Copy source shape
- TopoDS_Shape aShapeCopy;
- TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
- TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
-
- Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
- if (Te8.IsNull()) {
- SetErrorCode("Impossible to glue faces of TShape");
- return false;
- }
-
- TopoDS_Shape aShape = Te8->GetValue();
- BRepCheck_Analyzer anAna (aShape, Standard_True);
-
- if (!anAna.IsValid()) {
- // Try to do gluing with the tolerance equal to maximal
- // tolerance of vertices of the source shape.
- Standard_Real aTolMax = -RealLast();
-
- for (TopExp_Explorer ExV (aShapeCopy, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
- TopoDS_Vertex aVertex = TopoDS::Vertex(ExV.Current());
- Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
-
- if (aTol > aTolMax) {
- aTolMax = aTol;
- }
- }
-
- // Perform gluing
- Te7->GetLastFunction()->SetValue(aShapeCopy);
- Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
-
- if (Te8.IsNull()) {
- SetErrorCode("Impossible to glue faces of TShape");
- return false;
- }
-
- aShape = Te8->GetValue();
- }
-
-
- theShape->GetLastFunction()->SetValue(aShape);
-
- Te4->GetLastFunction()->SetDescription("");
- Te5->GetLastFunction()->SetDescription("");
- Te6->GetLastFunction()->SetDescription("");
- Te7->GetLastFunction()->SetDescription("");
- Te8->GetLastFunction()->SetDescription("");
-
- SetErrorCode(OK);
- return true;
-}
-
-//=======================================================================
-//function : MakePipeTShapeThicknessReduction
-//purpose : Static method. Add thiskness reduction elements at the three
-// open ends of the T-Shape.
-//=======================================================================
-TopoDS_Shape GEOMImpl_IAdvancedOperations::MakePipeTShapeThicknessReduction
- (TopoDS_Shape theShape,
- double r1, double w1, double l1,
- double r2, double w2, double l2,
- double rL, double wL, double ltransL, double lthinL,
- double rR, double wR, double ltransR, double lthinR,
- double rI, double wI, double ltransI, double lthinI,
- bool fuseReductions)
-{
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- //
- // ---------------------.
- // W \
- // ---------------------. \
- // ^ \ '-----------------.
- // |R \ Wthin |
- // | '-----------------'
- // v Rthin
- // --.--.--.--.--.--.--.--.--.--.--.--.--.--.--
- // Ltrans Lthin
-
- TopoDS_Shape aResult = theShape;
- double aTol = Precision::Confusion();
-
- gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
-
- // Left reduction (rL, wL, ltransL, lthinL)
- if (rL > aTol && wL > aTol && ltransL > aTol) {
- gp_Pnt aPLeft (-l1, 0, 0);
- gp_Ax2 anAxesLeft (aPLeft, -aVX, aVZ);
- TopoDS_Shape aReductionLeft = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
- (anAxesLeft, r1, w1, rL, wL, ltransL, lthinL, fuseReductions);
-
- if (fuseReductions) {
- BRepAlgoAPI_Fuse fuseL (aResult, aReductionLeft);
- if (!fuseL.IsDone())
- StdFail_NotDone::Raise("Cannot fuse Te with left reduction");
- aResult = fuseL.Shape();
- }
- else {
- BRep_Builder B;
- TopoDS_Compound C;
- B.MakeCompound(C);
- B.Add(C, aResult);
- B.Add(C, aReductionLeft);
- aResult = C;
- }
- }
-
- // Right reduction
- if (rR > aTol && wR > aTol && ltransR > aTol) {
- gp_Pnt aPRight (l1, 0, 0);
- gp_Ax2 anAxesRight (aPRight, aVX, aVZ);
- TopoDS_Shape aReductionRight = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
- (anAxesRight, r1, w1, rR, wR, ltransR, lthinR, fuseReductions);
-
- if (fuseReductions) {
- BRepAlgoAPI_Fuse fuseR (aResult, aReductionRight);
- if (!fuseR.IsDone())
- StdFail_NotDone::Raise("Cannot fuse Te with right reduction");
- aResult = fuseR.Shape();
- }
- else {
- BRep_Builder B;
- TopoDS_Compound C;
- B.MakeCompound(C);
- B.Add(C, aResult);
- B.Add(C, aReductionRight);
- aResult = C;
- }
- }
-
- // Incident reduction
- if (rI > aTol && wI > aTol && ltransI > aTol) {
- gp_Pnt aPInci (0, 0, l2);
- gp_Ax2 anAxesInci (aPInci, aVZ, aVX);
- TopoDS_Shape aReductionInci = GEOMImpl_IAdvancedOperations::MakeThicknessReduction
- (anAxesInci, r2, w2, rI, wI, ltransI, lthinI, fuseReductions);
-
- if (fuseReductions) {
- BRepAlgoAPI_Fuse fuseInci (aResult, aReductionInci);
- if (!fuseInci.IsDone())
- StdFail_NotDone::Raise("Cannot fuse Te with incident reduction");
- aResult = fuseInci.Shape();
- }
- else {
- BRep_Builder B;
- TopoDS_Compound C;
- B.MakeCompound(C);
- B.Add(C, aResult);
- B.Add(C, aReductionInci);
- aResult = C;
- }
- }
-
- // Get rid of extra compounds
- TopTools_ListOfShape listShapeRes;
- GEOMUtils::AddSimpleShapes(aResult, listShapeRes);
- aResult = listShapeRes.First(); // useful for the case "fuseReductions == true"
-
- if (!fuseReductions && listShapeRes.Extent() > 1) {
- // Simplify T-Shape compound (get rid of sub-compounds) and glue duplicated faces
- BRep_Builder B;
- TopoDS_Compound C;
- B.MakeCompound(C);
-
- TopTools_ListIteratorOfListOfShape itSub (listShapeRes);
- for (; itSub.More(); itSub.Next())
- B.Add(C, itSub.Value());
-
- // GlueFaces
- aResult = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion(), Standard_True);
- }
-
- return aResult;
-}
-
-//=======================================================================
-//function : MakeThicknessReduction
-//purpose : Static method. Create one thickness reduction element.
-//=======================================================================
-TopoDS_Shape GEOMImpl_IAdvancedOperations::MakeThicknessReduction (gp_Ax2 theAxes,
- const double R, const double W,
- const double Rthin, const double Wthin,
- const double Ltrans, const double Lthin,
- bool fuse)
-{
- double aTol = Precision::Confusion();
- if (Rthin < aTol || Wthin < aTol || Ltrans < aTol) {
- StdFail_NotDone::Raise("Cannot build thickness reduction: too small values");
- }
- bool isThinPart = (Lthin > aTol);
-
- // .
- // W |\
- // . \
- // ^ \ '-----------------.
- // |R \| | Wthin
- // | '-----------------'
- // v Rthin
- // --.--.--.--.--.--.--.--.--.--.--.--.--> theAxes.Direction()
- // Ltrans Lthin
-
- double RExt = R + W;
- double RthinExt = Rthin + Wthin;
-
- gp_Dir aNormal = theAxes.Direction();
- gp_Dir anXDir = theAxes.XDirection();
- gp_Pnt aPntCyl (theAxes.Location().XYZ() + aNormal.XYZ()*Ltrans);
- gp_Ax2 anAxesCyl (aPntCyl, aNormal, anXDir);
-
- // Build the transition part
- BRepPrimAPI_MakeCone ConeExt (theAxes, RExt, RthinExt, Ltrans);
- BRepPrimAPI_MakeCone ConeInt (theAxes, R, Rthin, Ltrans);
- ConeExt.Build();
- ConeInt.Build();
- if (!ConeExt.IsDone() || !ConeInt.IsDone())
- StdFail_NotDone::Raise("Cannot build cones of thickness reduction");
- BRepAlgoAPI_Cut cut1 (ConeExt.Shape(), ConeInt.Shape());
- if (!cut1.IsDone())
- StdFail_NotDone::Raise("Coudn't build transition part of thickness reduction");
- TopoDS_Shape aReduction = cut1.Shape();
-
- // Build the thin part, if required
- TopoDS_Shape aThinPart;
- if (isThinPart) {
- BRepPrimAPI_MakeCylinder CExt (anAxesCyl, RthinExt, Lthin);
- BRepPrimAPI_MakeCylinder CInt (anAxesCyl, Rthin, Lthin);
- CExt.Build();
- CInt.Build();
- if (!CExt.IsDone() || !CInt.IsDone())
- StdFail_NotDone::Raise("Cannot build cylinders of thickness reduction");
- BRepAlgoAPI_Cut cut2 (CExt.Shape(), CInt.Shape());
- if (!cut2.IsDone())
- StdFail_NotDone::Raise("Coudn't build thin part of thickness reduction");
- aThinPart = cut2.Shape();
- }
-
- // Join parts
- if (fuse) {
- if (isThinPart) {
- BRepAlgoAPI_Fuse fuse1 (aReduction, aThinPart);
- if (!fuse1.IsDone())
- StdFail_NotDone::Raise("Cannot fuse parts of thickness reduction");
- aReduction = fuse1.Shape();
- }
- }
- else {
- // Partition the reduction on blocks
- gp_Ax3 anAxesPln1 (aPntCyl, theAxes.XDirection(), aNormal);
- gp_Ax3 anAxesPln2 (aPntCyl, theAxes.YDirection(), aNormal);
- gp_Pln aPln1 (anAxesPln1);
- gp_Pln aPln2 (anAxesPln2);
- double aSize = Ltrans + Lthin + R + Rthin + Wthin; // to guarantee enough size in all directions
- TopoDS_Shape aTool1 = BRepBuilderAPI_MakeFace(aPln1, -aSize, +aSize, -aSize, +aSize).Shape();
- TopoDS_Shape aTool2 = BRepBuilderAPI_MakeFace(aPln2, -aSize, +aSize, -aSize, +aSize).Shape();
-
- GEOMAlgo_Splitter PS;
- PS.AddShape(aReduction);
- if (isThinPart)
- PS.AddShape(aThinPart);
- PS.AddTool(aTool1);
- PS.AddTool(aTool2);
- PS.SetLimit(TopAbs_SOLID);
- PS.Perform();
-
- aReduction = PS.Shape();
- }
-
- return aReduction;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShape
- * \brief 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
- GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh)
-{
- 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);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //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;
- }
-
- if (isTRL || isTRR || isTRI) {
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- 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);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., aSeq, gp_Trsf()))
- return NULL;
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, gp_Trsf())) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShape("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theHexMesh;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length).
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups..
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
-GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition
- (double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3)
-{
- SetErrorCode(KO);
- //Add a new object
- Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_TSHAPE);
- /////////////////
- // TSHAPE CODE
- /////////////////
- //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;
-
- // Check new position
- if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
- 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);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //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;
- }
-
- if (isTRL || isTRR || isTRI) {
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- TopoDS_Shape Te = aShape->GetValue();
-
- // Set Position
- gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
- BRepBuilderAPI_Transform aTransformation(Te, aTrsf, Standard_False);
- TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
- aFunction->SetValue(aTrsf_Shape);
-
- Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
- aSeq->Append(aShape);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., aSeq, aTrsf)) {
- return NULL;
- }
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, aTrsf)) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShape("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theHexMesh << ", " << theP1 << ", " << theP2 << ", " << theP3;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeChamfer
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of chamfer.
- * \param theW Width of chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
-GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer
- (double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theH, double theW,
- bool theHexMesh)
-{
- 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_CHAMFER);
- 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.SetH(theH);
- aData.SetW(theW);
- aData.SetHexMesh(theHexMesh);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //Compute the resulting value
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("TShape driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // BEGIN of chamfer
- TopoDS_Shape aShapeShape = aShape->GetValue();
- TopTools_IndexedMapOfShape anEdgesIndices;
- TopExp::MapShapes(aShapeShape, anEdgesIndices);
- // Common edges on external cylinders
- Handle(GEOM_Object) box_e;
- if (theHexMesh) {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
- }
- else {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
- }
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
- box_e->GetLastFunction()->SetDescription("");
-
- Handle(TColStd_HSequenceOfInteger) edges_e =
- myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- box_e->GetLastFunction()->SetDescription("");
-
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return NULL;
- }
- int nbEdgesInChamfer = 0;
- std::list<int> theEdges;
- for (int i=1; i<=edges_e->Length();i++) {
- int edgeID = edges_e->Value(i);
- TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
- TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
- int iv=0;
- while (Ex.More()) {
- iv ++;
- gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
- nbEdgesInChamfer ++;
- theEdges.push_back(edgeID);
- }
- Ex.Next();
- }
- if (theHexMesh && nbEdgesInChamfer == 1)
- break;
- }
- Handle(GEOM_Object) aChamfer;
- try {
- aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
- if (aChamfer.IsNull()) {
- SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
- return NULL;
- }
- aChamfer->GetLastFunction()->SetDescription("");
-
- TopoDS_Shape aChamferShape = aChamfer->GetValue();
- aFunction->SetValue(aChamferShape);
- // END of chamfer
-
- if (theHexMesh) {
- if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false))
- return NULL;
- if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
- return NULL;
- }
-
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (isTRL || isTRR || isTRI) {
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- 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);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2,
- theH, theW, 0., aSeq, gp_Trsf()))
- return NULL;
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, gp_Trsf())) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theH << ", " << theW << ", " << theHexMesh;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeChamferWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of chamfer.
- * \param theW Width of chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
-GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition
- (double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theH, double theW,
- bool theHexMesh,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3)
-{
- 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_CHAMFER);
- if (aFunction.IsNull()) return NULL;
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
-
- // Check new position
- if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
- 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.SetH(theH);
- aData.SetW(theW);
- aData.SetHexMesh(theHexMesh);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //Compute the resulting value
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("TShape driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // BEGIN of chamfer
- TopoDS_Shape aShapeShape = aShape->GetValue();
- TopTools_IndexedMapOfShape anEdgesIndices;
- TopExp::MapShapes(aShapeShape, anEdgesIndices);
- // Common edges on external cylinders
- Handle(GEOM_Object) box_e;
- if (theHexMesh) {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
- }
- else {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
- }
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
- box_e->GetLastFunction()->SetDescription("");
-
- Handle(TColStd_HSequenceOfInteger) edges_e =
- myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- box_e->GetLastFunction()->SetDescription("");
-
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return NULL;
- }
- int nbEdgesInChamfer = 0;
- std::list<int> theEdges;
- for (int i=1; i<=edges_e->Length();i++) {
- int edgeID = edges_e->Value(i);
- TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
- TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
- while (Ex.More()) {
- gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
- nbEdgesInChamfer ++;
- theEdges.push_back(edgeID);
- }
- Ex.Next();
- }
- if (theHexMesh && nbEdgesInChamfer == 1)
- break;
- }
- Handle(GEOM_Object) aChamfer;
- try {
- aChamfer = myLocalOperations->MakeChamferEdges(aShape, theW, theH, theEdges);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
- if (aChamfer.IsNull()) {
- SetErrorCode("Chamfer can not be computed on the given shape with the given parameters");
- return NULL;
- }
- aChamfer->GetLastFunction()->SetDescription("");
-
- TopoDS_Shape aChamferShape = aChamfer->GetValue();
- aFunction->SetValue(aChamferShape);
- // END of chamfer
-
- if (theHexMesh) {
- if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, 0, false))
- return NULL;
- if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
- return NULL;
- }
-
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (isTRL || isTRR || isTRI) {
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // Set Position
- gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
- BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), aTrsf, Standard_False);
- TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
- aFunction->SetValue(aTrsf_Shape);
-
- Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
- aSeq->Append(aShape);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2,
- theH, theW, 0., aSeq, aTrsf))
- return NULL;
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, aTrsf)) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeChamfer("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theH << ", " << theW << ", " << theHexMesh << ", "
- << theP1 << ", " << theP2 << ", " << theP3;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeFillet
- * 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.
- * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
-GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet
- (double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theRF, bool theHexMesh)
-{
- 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_FILLET);
- 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.SetRF(theRF);
- aData.SetHexMesh(theHexMesh);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //Compute the resulting value
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("TShape driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // BEGIN of fillet
- TopoDS_Shape aShapeShape = aShape->GetValue();
- TopTools_IndexedMapOfShape anEdgesIndices;
- TopExp::MapShapes(aShapeShape, anEdgesIndices);
- // Common edges on external cylinders
- Handle(GEOM_Object) box_e;
- if (theHexMesh) {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
- }
- else {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
- }
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
- box_e->GetLastFunction()->SetDescription("");
-
- Handle(TColStd_HSequenceOfInteger) edges_e =
- myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- box_e->GetLastFunction()->SetDescription("");
-
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return NULL;
- }
- int nbEdgesInFillet = 0;
- std::list<int> theEdges;
- for (int i=1; i<=edges_e->Length();i++) {
- int edgeID = edges_e->Value(i);
- TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
- TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
- while (Ex.More()) {
- gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
- nbEdgesInFillet ++;
- theEdges.push_back(edgeID);
- }
- Ex.Next();
- }
- if (theHexMesh && nbEdgesInFillet == 1)
- break;
- }
-
- Handle(GEOM_Object) aFillet;
- try {
- aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
- if (aFillet.IsNull()) {
- //SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
- SetErrorCode(myLocalOperations->GetErrorCode());
- return NULL;
- }
- aFillet->GetLastFunction()->SetDescription("");
-
- TopoDS_Shape aFilletShape = aFillet->GetValue();
- aFunction->SetValue(aFilletShape);
- // END of fillet
-
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (1)
-// the following block, when enabled, leads to partitioning problems
-#if 0
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (1)
- // BEGIN: Limit tolerances (debug)
- Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07);
- TopoDS_Shape aCorr1Shape = aCorr1->GetValue();
- aShape->GetLastFunction()->SetValue(aCorr1Shape);
- aCorr1->GetLastFunction()->SetDescription("");
- // END: Limit tolerances (debug)
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (2)
-#endif
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (2)
-
- if (theHexMesh) {
- if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
- return NULL;
- if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
- return NULL;
- }
-
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (isTRL || isTRR || isTRI) {
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- 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);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., theRF, aSeq, gp_Trsf()))
- return NULL;
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, gp_Trsf())) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theRF << ", " << theHexMesh;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeFilletWithPosition
- * \brief 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-Handle(TColStd_HSequenceOfTransient)
-GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition
- (double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theRF, bool theHexMesh,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3)
-{
- 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_FILLET);
- if (aFunction.IsNull()) return NULL;
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_PipeTShapeDriver::GetID()) return NULL;
-
- // Check new position
- if (!CheckCompatiblePosition(theL1, theL2, theP1, theP2, theP3, 0.01)) {
- 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.SetRF(theRF);
- aData.SetHexMesh(theHexMesh);
-
- bool isTRL = (theRL + theWL + theLtransL + theLthinL) > Precision::Confusion();
- bool isTRR = (theRR + theWR + theLtransR + theLthinR) > Precision::Confusion();
- bool isTRI = (theRI + theWI + theLtransI + theLthinI) > Precision::Confusion();
-
- //Compute the resulting value
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("TShape driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // BEGIN of fillet
- TopoDS_Shape aShapeShape = aShape->GetValue();
- TopTools_IndexedMapOfShape anEdgesIndices;
- TopExp::MapShapes(aShapeShape, anEdgesIndices);
- // Common edges on external cylinders
- Handle(GEOM_Object) box_e;
- if (theHexMesh) {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(theR2+theW2, theR2+theW2, theR1+theW1);
- }
- else {
- box_e = my3DPrimOperations->MakeBoxDXDYDZ(2*(theR2+theW2), 2*(theR2+theW2), theR1+theW1);
- }
- box_e->GetLastFunction()->SetDescription("");
- box_e = myTransformOperations->TranslateDXDYDZ(box_e, -(theR2+theW2), -(theR2+theW2), 0);
- box_e->GetLastFunction()->SetDescription("");
-
- Handle(TColStd_HSequenceOfInteger) edges_e =
- myShapesOperations->GetShapesOnBoxIDs(box_e, aShape, TopAbs_EDGE, GEOMAlgo_ST_IN);
- box_e->GetLastFunction()->SetDescription("");
-
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- SetErrorCode("External edges not found");
- return NULL;
- }
- int nbEdgesInFillet = 0;
- std::list<int> theEdges;
- for (int i=1; i<=edges_e->Length();i++) {
- int edgeID = edges_e->Value(i);
- TopoDS_Shape theEdge = anEdgesIndices.FindKey(edgeID);
- TopExp_Explorer Ex(theEdge,TopAbs_VERTEX);
- while (Ex.More()) {
- gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(Ex.Current()));
- if (Abs(aPt.Z() - (theR1+theW1)) <= Precision::Confusion()) {
- nbEdgesInFillet ++;
- theEdges.push_back(edgeID);
- }
- Ex.Next();
- }
- if (theHexMesh && nbEdgesInFillet == 1)
- break;
- }
-
- Handle(GEOM_Object) aFillet;
- try {
- aFillet = myLocalOperations->MakeFilletEdges(aShape, theRF, theEdges);
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
- if (aFillet.IsNull()) {
- SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
- return NULL;
- }
- aFillet->GetLastFunction()->SetDescription("");
-
- TopoDS_Shape aFilletShape = aFillet->GetValue();
- aFunction->SetValue(aFilletShape);
- // END of fillet
-
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (3)
-// the following block, when enabled, leads to partitioning problems
-#if 0
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (3)
- // BEGIN: Limit tolerances (debug)
- Handle(GEOM_Object) aCorr1 = myHealingOperations->LimitTolerance(aShape, 1e-07);
- TopoDS_Shape aCorr1Shape = aCorr1->GetValue();
- aShape->GetLastFunction()->SetValue(aCorr1Shape);
- aCorr1->GetLastFunction()->SetDescription("");
- // END: Limit tolerances (debug)
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - BEGIN (4)
-#endif
-// VSR: debug issues 0021568 and 0021550 (15/05/2012) - END (4)
-
- if (theHexMesh) {
- if (!MakePipeTShapePartition(aShape, theR1, theW1, theL1, theR2, theW2, theL2, 0, 0, theRF, false))
- return NULL;
- if (!MakePipeTShapeMirrorAndGlue(aShape, theR1, theW1, theL1, theR2, theW2, theL2))
- return NULL;
- }
-
- // Add thickness reduction elements
- // at the three extremities: Left, Right and Incident
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
- if (isTRL || isTRR || isTRI) {
- TopoDS_Shape aResShape =
- MakePipeTShapeThicknessReduction(aShape->GetValue(), theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- !theHexMesh);
- aFunction->SetValue(aResShape);
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- // Set Position
- gp_Trsf aTrsf = GetPositionTrsf(theL1, theL2, theP1, theP2, theP3);
- BRepBuilderAPI_Transform aTransformation (aShape->GetValue(), aTrsf, Standard_False);
- TopoDS_Shape aTrsf_Shape = aTransformation.Shape();
- aFunction->SetValue(aTrsf_Shape);
-
- Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
- aSeq->Append(aShape);
-
- try {
- if (theHexMesh) {
- // Get the groups
- if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., theRF, aSeq, aTrsf))
- return NULL;
- }
-
- // Get internal group.
- if (!MakeInternalGroup(aShape, theR1, theL1, theR2, theL2, theRL, theLtransL,
- theRR, theLtransR, theRI, theLtransI,
- aSeq, aTrsf)) {
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- TCollection_AsciiString anEntry, aListRes("[");
- // Iterate over the sequence aSeq
- Standard_Integer aNbGroups = aSeq->Length();
- Standard_Integer i = 1;
- 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);
-
- GEOM::TPythonDump pd (aFunction);
-
- pd << aListRes.ToCString() << "] = geompy.MakePipeTShapeFillet("
- << theR1 << ", " << theW1 << ", " << theL1 << ", "
- << theR2 << ", " << theW2 << ", " << theL2 << ", "
- << theRF << ", " << theHexMesh << ", "
- << theP1 << ", " << theP2 << ", " << theP3;
-
- // thickness reduction
- if (isTRL)
- pd << ", theRL=" << theRL << ", theWL=" << theWL
- << ", theLtransL=" << theLtransL << ", theLthinL=" << theLthinL;
- if (isTRR)
- pd << ", theRR=" << theRR << ", theWR=" << theWR
- << ", theLtransR=" << theLtransR << ", theLthinR=" << theLthinR;
- if (isTRI)
- pd << ", theRI=" << theRI << ", theWI=" << theWI
- << ", theLtransI=" << theLtransI << ", theLthinI=" << theLthinI;
-
- pd << ")";
-
- SetErrorCode(OK);
-
- return aSeq;
-}
-
-//=============================================================================
-/*!
- * This function allows to create a disk already divided into blocks. It can be
- * used to create divided pipes for later meshing in hexaedra.
- * \param theR Radius of the disk
- * \param theRatio Relative size of the central square diagonal against the disk diameter
- * \param theOrientation Plane on which the disk will be built
- * \param thePattern The division pattern of the disk (hexagon or square in the center)
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDisk (double theR, double theRatio,
- int theOrientation, int thePattern)
-{
- SetErrorCode(KO);
-
- if (theOrientation != 1 &&
- theOrientation != 2 &&
- theOrientation != 3)
- {
- SetErrorCode("theOrientation must be 1(=OXY), 2(=OYZ) or 3(=OZX)");
- return NULL;
- }
- //Add a new object
- Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
-
- //Add a new shape function with parameters
- Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_RATIO);
- if (aFunction.IsNull()) return NULL;
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
-
- GEOMImpl_IDividedDisk aData (aFunction);
-
- aData.SetR(theR);
- aData.SetRatio(theRatio);
- aData.SetOrientation(theOrientation);
- aData.SetType(thePattern);
-
- //Compute the resulting value
- try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("DividedDisk driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- std::string aPatternStr;
-
- switch(thePattern)
- {
- case 0:
- aPatternStr = "GEOM.SQUARE";
- break;
- case 1:
- aPatternStr = "GEOM.HEXAGON";
- break;
- }
-
- //Make a Python command
- GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDisk(" << theR << ", " << theOrientation << ", " << aPatternStr.c_str() << ")";
-
- SetErrorCode(OK);
-
- return aShape;
-}
-
-//=============================================================================
-/*!
- * This function allows to create a disk already divided into blocks. It can be
- * used to create divided pipes for later meshing in hexaedra.
- * \param theR Radius of the disk
- * \param theRatio Relative size of the central square diagonal against the disk diameter
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR,
- double theRatio,
- int thePattern)
-{
- SetErrorCode(KO);
-
- //Add a new object
- Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
-
- //Add a new shape function with parameters
- Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_DividedDiskDriver::GetID(), DIVIDEDDISK_R_VECTOR_PNT);
- if (aFunction.IsNull()) return NULL;
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_DividedDiskDriver::GetID()) return NULL;
-
- GEOMImpl_IDividedDisk aData (aFunction);
-
- Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
- Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
-
- if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
-
- aData.SetCenter(aRefPnt);
- aData.SetVector(aRefVec);
-
- aData.SetR(theR);
- aData.SetRatio(theRatio);
- aData.SetType(thePattern);
-
- //Compute the resulting value
- try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("DividedDisk driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- std::string aPatternStr;
-
- switch(thePattern)
- {
- case 0:
- aPatternStr = "GEOM.SQUARE";
- break;
- case 1:
- aPatternStr = "GEOM.HEXAGON";
- break;
- }
-
-
- //Make a Python command
- GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedDiskPntVecR(" << thePnt << ", " << theVec << ", " << theR << ", " << aPatternStr.c_str() << ")";
-
- SetErrorCode(OK);
-
- return aShape;
-}
-
-//=============================================================================
-/*!
- * Builds a cylinder prepared for hexa meshes
- * \param theR Radius of the cylinder
- * \param theH Height of the cylinder
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeDividedCylinder (double theR,
- double theH,
- int thePattern)
-{
- SetErrorCode(KO);
-
- //Add a new object
- Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDCYLINDER);
-
- Handle(GEOM_Object) aBaseShape = MakeDividedDisk(theR, 67.0, 1, thePattern);
- aBaseShape->GetLastFunction()->SetDescription(""); // Erase dump of MakeDividedDisk
-
- aShape = my3DPrimOperations->MakePrismDXDYDZ(aBaseShape,0.0,0.0,theH, -1.0);
-
- Handle(GEOM_Function) aFunction = aShape->GetLastFunction();
- aFunction->SetDescription(""); // Erase dump of MakePrismDXDYDZ
- aShape->SetType(GEOM_DIVIDEDCYLINDER);
-
- std::string aPatternStr;
-
- switch(thePattern)
- {
- case 0:
- aPatternStr = "GEOM.SQUARE";
- break;
- case 1:
- aPatternStr = "GEOM.HEXAGON";
- break;
- }
-
- //Make a Python command
- GEOM::TPythonDump(aFunction) << aShape << " = geompy.MakeDividedCylinder(" << theR << ", " << theH << ", " << aPatternStr.c_str() << ")";
-
- SetErrorCode(OK);
-
- return aShape;
-}
-//=============================================================================
-/*!
- * Create a smoothing surface from a set of points
- * \param thelPoints list of points
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-Handle(GEOM_Object) GEOMImpl_IAdvancedOperations::MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints)
-{
- SetErrorCode(KO);
-
- //Add a new object
- Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_SMOOTHINGSURFACE);
-
- //Add a new shape function with parameters
- Handle(GEOM_Function) aFunction = aShape->AddFunction(GEOMImpl_SmoothingSurfaceDriver::GetID(), SMOOTHINGSURFACE_LPOINTS);
- if (aFunction.IsNull()) return NULL;
-
- //Check if the function is set correctly
- if (aFunction->GetDriverGUID() != GEOMImpl_SmoothingSurfaceDriver::GetID()) return NULL;
-
- GEOMImpl_ISmoothingSurface aData (aFunction);
-
- int aLen = thelPoints.size();
- aData.SetLength(aLen);
- int ind = 1;
- std::list<Handle(GEOM_Object)>::iterator it = thelPoints.begin();
- for (; it != thelPoints.end(); it++, ind++) {
- Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
- if (aRefPnt.IsNull()) {
- SetErrorCode("NULL point for bSplineFaceShape");
- return NULL;
- }
- aData.SetPoint(ind, aRefPnt);
- }
-
-
- //Compute the resulting value
- try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
- OCC_CATCH_SIGNALS;
-#endif
- if (!GetSolver()->ComputeFunction(aFunction)) {
- SetErrorCode("SmoothingSurface driver failed");
- return NULL;
- }
- }
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
- return NULL;
- }
-
- //Make a Python command
- GEOM::TPythonDump pd (aFunction);
- pd << aShape << " = geompy.MakeSmoothingSurface([";
- it = thelPoints.begin();
- pd << (*it++);
- while (it != thelPoints.end()) {
- pd << ", " << (*it++);
- }
- pd << "])";
-
- SetErrorCode(OK);
-
- return aShape;
-}
-/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// File : GEOMImpl_IAdvancedOperations.hxx
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-#ifndef _GEOMImpl_IAdvancedOperations_HXX_
-#define _GEOMImpl_IAdvancedOperations_HXX_
-
-#include <Utils_SALOME_Exception.hxx>
-#include "GEOM_IOperations.hxx"
-#include "GEOM_Engine.hxx"
-#include "GEOM_Object.hxx"
-
-#include <list>
-#include <gp_Ax2.hxx>
-
-class GEOMImpl_IBasicOperations;
-class GEOMImpl_IBooleanOperations;
-class GEOMImpl_IShapesOperations;
-class GEOMImpl_ITransformOperations;
-class GEOMImpl_IBlocksOperations;
-class GEOMImpl_I3DPrimOperations;
-class GEOMImpl_ILocalOperations;
-class GEOMImpl_IHealingOperations;
-class GEOMImpl_IGroupOperations;
-class Handle_Geom_Surface;
-class TopTools_ListOfShape;
-
-class GEOMImpl_IAdvancedOperations: public GEOM_IOperations {
-private:
- bool MakePipeTShapePartition(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH = 0, double theW = 0,
- double theRF = 0, bool isNormal = true);
-
- bool MakePipeTShapeMirrorAndGlue(Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2);
-
- bool MakePipeTShapeThicknessReduction (Handle(GEOM_Object) theShape,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI);
-
- bool MakeGroups(Handle(GEOM_Object) theShape, int shapType,
- double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW, double theRF,
- Handle(TColStd_HSequenceOfTransient) theSeq,
- gp_Trsf aTrsf);
-
- bool GetFacesOnSurf(const TopoDS_Shape &theShape,
- const Handle_Geom_Surface& theSurface,
- const Standard_Real theTolerance,
- TopTools_ListOfShape &theFaces);
-
- TopoDS_Shape MakeConicalFace(const gp_Ax2 &theAxis,
- const double theRadius,
- const double theRadiusThin,
- const double theHeight,
- const gp_Trsf &theTrsf);
-
- bool MakeInternalGroup(const Handle(GEOM_Object) &theShape,
- const double theR1, const double theLen1,
- const double theR2, const double theLen2,
- const double theRL, const double theTransLenL,
- const double theRR, const double theTransLenR,
- const double theRI, const double theTransLenI,
- const Handle(TColStd_HSequenceOfTransient) &theSeq,
- const gp_Trsf &theTrsf);
-
- gp_Trsf GetPositionTrsf(double theL1, double theL2,
- Handle(GEOM_Object) P1 = 0,
- Handle(GEOM_Object) P2 = 0,
- Handle(GEOM_Object) P3 = 0);
-
- bool CheckCompatiblePosition(double& theL1, double& theL2,
- Handle(GEOM_Object) theP1,
- Handle(GEOM_Object) theP2,
- Handle(GEOM_Object) theP3,
- double theTolerance);
-
-private:
- GEOMImpl_IBasicOperations* myBasicOperations;
- GEOMImpl_IBooleanOperations* myBooleanOperations;
- GEOMImpl_IShapesOperations* myShapesOperations;
- GEOMImpl_ITransformOperations* myTransformOperations;
- GEOMImpl_IBlocksOperations* myBlocksOperations;
- GEOMImpl_I3DPrimOperations* my3DPrimOperations;
- GEOMImpl_ILocalOperations* myLocalOperations;
- GEOMImpl_IHealingOperations* myHealingOperations;
- GEOMImpl_IGroupOperations* myGroupOperations;
-
-public:
-
- /*!
- * \brief Add three thickness reductions at the open ends of the pipe T-Shape
- *
- * \param theShape - the pipe T-Shape
- * \param r1 - the internal radius of main pipe
- * \param w1 - the thickness of main pipe
- * \param l1 - the half-length of main pipe
- * \param r2 - the internal radius of incident pipe
- * \param w2 - the thickness of incident pipe
- * \param l2 - the half-length of main pipe
- * \param r*, w*, ltrans* and lthin* - internal radius, thickness, length of transition part
- * and length of thin part of left(L), right(R) and
- * incident(I) thickness reduction correspondingly
- * \param fuseReductions - boolean flag (use true to generate single solid,
- * false to obtain parts, useful for hexameshing)
- * \retval TopoDS_Shape - Resulting shape
- */
- Standard_EXPORT static TopoDS_Shape MakePipeTShapeThicknessReduction
- (TopoDS_Shape theShape,
- double r1, double w1, double l1,
- double r2, double w2, double l2,
- double rL, double wL, double ltransL, double lthinL,
- double rR, double wR, double ltransR, double lthinR,
- double rI, double wI, double ltransI, double lthinI,
- bool fuseReductions);
-
- /*!
- * \brief Create one thickness reduction element
- *
- * This method is called three times from MakePipeTShapeThicknessReduction
- * to create three thickness reductions (one per each open end of a pipe T-Shape)
- *
- * \param theAxes - the position
- * \param R - the internal radius of main pipe
- * \param W - the thickness of main pipe
- * \param Rthin - the internal radius of thin part
- * \param Wthin - the thickness of thin part
- * \param Ltrans - the length of transition part
- * \param Lthin - the length of thin part
- * \param fuse - boolean flag (use true to generate single solid,
- * false to obtain parts, useful for hexameshing)
- * \retval TopoDS_Shape - Resulting shape
- */
- Standard_EXPORT static TopoDS_Shape MakeThicknessReduction (gp_Ax2 theAxes,
- const double R, const double W,
- const double Rthin, const double Wthin,
- const double Ltrans, const double Lthin,
- bool fuse);
-
-public:
- Standard_EXPORT GEOMImpl_IAdvancedOperations(GEOM_Engine* theEngine, int theDocID);
- Standard_EXPORT ~GEOMImpl_IAdvancedOperations();
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShape(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh = true);
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShapeWithPosition(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh = true,
- Handle(GEOM_Object) P1 = 0,
- Handle(GEOM_Object) P2 = 0,
- Handle(GEOM_Object) P3 = 0);
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShapeChamfer(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theH, double theW,
- bool theHexMesh = true);
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShapeChamferWithPosition(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theH, double theW,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- bool theHexMesh = true,
- Handle(GEOM_Object) P1 = 0,
- Handle(GEOM_Object) P2 = 0,
- Handle(GEOM_Object) P3 = 0);
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShapeFillet(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theRF, bool theHexMesh = true);
-
- Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
- MakePipeTShapeFilletWithPosition(double theR1, double theW1, double theL1,
- double theR2, double theW2, double theL2,
- double theRL, double theWL, double theLtransL, double theLthinL,
- double theRR, double theWR, double theLtransR, double theLthinR,
- double theRI, double theWI, double theLtransI, double theLthinI,
- double theRF, bool theHexMesh = true,
- Handle(GEOM_Object) P1 = 0,
- Handle(GEOM_Object) P2 = 0,
- Handle(GEOM_Object) P3 = 0);
-
- Standard_EXPORT Handle(GEOM_Object) MakeDividedDisk (double theR, double theRatio,
- int theOrientation, int thePattern);
- Standard_EXPORT Handle(GEOM_Object) MakeDividedDiskPntVecR (Handle(GEOM_Object) thePnt,
- Handle(GEOM_Object) theVec,
- double theR,
- double theRatio,
- int thePattern);
-
- Standard_EXPORT Handle(GEOM_Object) MakeDividedCylinder (double theR,
- double theH,
- int thePattern);
-
- Standard_EXPORT Handle(GEOM_Object) MakeSmoothingSurface (std::list<Handle(GEOM_Object)> thelPoints);
- /*@@ insert new functions before this line @@ do not remove this line @@*/
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _GEOMImpl_IDividedDisk_HXX_
-#define _GEOMImpl_IDividedDisk_HXX_
-
-#include "GEOM_Function.hxx"
-
-#define DIVIDEDDISK_ARG_R 1
-#define DIVIDEDDISK_ARG_RATIO 2
-#define DIVIDEDDISK_ARG_ORIENT 3
-
-#define DIVIDEDDISK_ARG_CENTER 4
-#define DIVIDEDDISK_ARG_VECTOR 5
-
-#define DIVIDEDDISK_ARG_TYPE 6
-
-class GEOMImpl_IDividedDisk
-{
-public:
- GEOMImpl_IDividedDisk(Handle(GEOM_Function) theFunction): _func(theFunction) {}
-
- void SetR(double theR) { _func->SetReal(DIVIDEDDISK_ARG_R, theR); }
- double GetR() { return _func->GetReal(DIVIDEDDISK_ARG_R); }
-
- void SetRatio(double theRatio) { _func->SetReal(DIVIDEDDISK_ARG_RATIO, theRatio); }
- double GetRatio() { return _func->GetReal(DIVIDEDDISK_ARG_RATIO); }
-
- void SetOrientation(int theOrientation) { _func->SetInteger(DIVIDEDDISK_ARG_ORIENT, theOrientation); }
- int GetOrientation() { return _func->GetInteger(DIVIDEDDISK_ARG_ORIENT); }
-
- void SetType(int theType) { _func->SetInteger(DIVIDEDDISK_ARG_TYPE, theType); }
- int GetType() { return _func->GetInteger(DIVIDEDDISK_ARG_TYPE); }
-
- void SetCenter(Handle(GEOM_Function) theP) { _func->SetReference(DIVIDEDDISK_ARG_CENTER, theP); }
- void SetVector(Handle(GEOM_Function) theV) { _func->SetReference(DIVIDEDDISK_ARG_VECTOR, theV); }
-
- Handle(GEOM_Function) GetCenter() { return _func->GetReference(DIVIDEDDISK_ARG_CENTER); }
- Handle(GEOM_Function) GetVector() { return _func->GetReference(DIVIDEDDISK_ARG_VECTOR); }
-
-private:
- Handle(GEOM_Function) _func;
-};
-
-#endif // _GEOMImpl_IDividedDisk_HXX_
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _GEOMImpl_IPipeTShape_HXX_
-#define _GEOMImpl_IPipeTShape_HXX_
-
-#include "GEOM_Function.hxx"
-
-#include <TColStd_HArray1OfReal.hxx>
-
-class GEOMImpl_IPipeTShape
-{
-public:
- GEOMImpl_IPipeTShape(Handle(GEOM_Function) theFunction): _func(theFunction) {}
-
- void SetR1(double theR1) { _func->SetReal(TSHAPE_ARG_R1, theR1); }
- double GetR1() { return _func->GetReal(TSHAPE_ARG_R1); }
-
- void SetW1(double theW1) { _func->SetReal(TSHAPE_ARG_W1, theW1); }
- double GetW1() { return _func->GetReal(TSHAPE_ARG_W1); }
-
- void SetL1(double theL1) { _func->SetReal(TSHAPE_ARG_L1, theL1); }
- double GetL1() { return _func->GetReal(TSHAPE_ARG_L1); }
-
- void SetR2(double theR2) { _func->SetReal(TSHAPE_ARG_R2, theR2); }
- double GetR2() { return _func->GetReal(TSHAPE_ARG_R2); }
-
- void SetW2(double theW2) { _func->SetReal(TSHAPE_ARG_W2, theW2); }
- double GetW2() { return _func->GetReal(TSHAPE_ARG_W2); }
-
- void SetL2(double theL2) { _func->SetReal(TSHAPE_ARG_L2, theL2); }
- double GetL2() { return _func->GetReal(TSHAPE_ARG_L2); }
-
- void SetH(double theH) { _func->SetReal(TSHAPE_ARG_H, theH); }
- double GetH() { return _func->GetReal(TSHAPE_ARG_H); }
-
- void SetW(double theW) { _func->SetReal(TSHAPE_ARG_W, theW); }
- double GetW() { return _func->GetReal(TSHAPE_ARG_W); }
-
- void SetRF(double theRF) { _func->SetReal(TSHAPE_ARG_RF, theRF); }
- double GetRF() { return _func->GetReal(TSHAPE_ARG_RF); }
-
- void SetHexMesh(int theHexMesh) { _func->SetInteger(TSHAPE_ARG_HEXMESH, theHexMesh); }
- int GetHexMesh() { return _func->GetInteger(TSHAPE_ARG_HEXMESH); }
-
- void SetP1(const Handle(GEOM_Function)& theP1){_func->SetReference(TSHAPE_ARG_P1, theP1); }
- Handle(GEOM_Function) GetP1() { return _func->GetReference(TSHAPE_ARG_P1); }
-
- void SetP2(const Handle(GEOM_Function)& theP2){_func->SetReference(TSHAPE_ARG_P2, theP2); }
- Handle(GEOM_Function) GetP2() { return _func->GetReference(TSHAPE_ARG_P2); }
-
- void SetP3(const Handle(GEOM_Function)& theP3){_func->SetReference(TSHAPE_ARG_P3, theP3); }
- Handle(GEOM_Function) GetP3() { return _func->GetReference(TSHAPE_ARG_P3); }
-
-private:
- enum {
- // main pipe
- TSHAPE_ARG_R1 = 1,
- TSHAPE_ARG_W1 = 2,
- TSHAPE_ARG_L1 = 3,
-
- // incident pipe
- TSHAPE_ARG_R2 = 4,
- TSHAPE_ARG_W2 = 5,
- TSHAPE_ARG_L2 = 6,
-
- // chamfer
- TSHAPE_ARG_H = 7,
- TSHAPE_ARG_W = 8,
-
- // fillet
- TSHAPE_ARG_RF = 9,
-
- // partition
- TSHAPE_ARG_HEXMESH = 10,
-
- // junction points
- TSHAPE_ARG_P1 = 11,
- TSHAPE_ARG_P2 = 12,
- TSHAPE_ARG_P3 = 13
- };
-
-private:
- Handle(GEOM_Function) _func;
-};
-
-#endif // _GEOMImpl_IPipeTShape_HXX_
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _GEOMImpl_ISmoothingSurface_HXX_
-#define _GEOMImpl_ISmoothingSurface_HXX_
-
-#include "GEOM_Function.hxx"
-
-#define SMOOTHINGSURFACE_ARG_LENG 1
-#define SMOOTHINGSURFACE_ARG_LAST 2
-
-class GEOMImpl_ISmoothingSurface
-{
-public:
- GEOMImpl_ISmoothingSurface(Handle(GEOM_Function) theFunction): _func(theFunction) {}
-
- void SetLength(int theLen) { _func->SetInteger(SMOOTHINGSURFACE_ARG_LENG, theLen); }
- int GetLength() { return _func->GetInteger(SMOOTHINGSURFACE_ARG_LENG); }
-
- void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SMOOTHINGSURFACE_ARG_LAST + theId, theP); }
- Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SMOOTHINGSURFACE_ARG_LAST + theId); }
-
-private:
- Handle(GEOM_Function) _func;
-};
-
-#endif // _GEOMImpl_ISmoothingSurface_HXX_
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include <GEOMImpl_PipeTShapeDriver.hxx>
-
-#include <GEOMImpl_IPipeTShape.hxx>
-#include <GEOMImpl_Types.hxx>
-#include <GEOMImpl_Block6Explorer.hxx>
-#include <GEOMImpl_IAdvancedOperations.hxx>
-
-#include <GEOM_Function.hxx>
-#include <GEOM_IOperations.hxx>
-
-#include <GEOMUtils.hxx>
-
-#include <GEOMAlgo_FinderShapeOn1.hxx>
-#include <GEOMAlgo_FinderShapeOn2.hxx>
-#include <GEOMAlgo_ClsfBox.hxx>
-
-#include <TFunction_Logbook.hxx>
-#include <StdFail_NotDone.hxx>
-
-// Partition includes
-#include <GEOMAlgo_Splitter.hxx>
-#include <Geom_CylindricalSurface.hxx>
-
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Ax2.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Trsf.hxx>
-
-#include <BRepPrimAPI_MakeCone.hxx>
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
-#include <BRepFilletAPI_MakeFillet.hxx>
-#include <BRepFilletAPI_MakeChamfer.hxx>
-#include <BRep_Builder.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
-#include <TopoDS.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-#include <vector>
-//@@ include required header files here @@//
-
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-const Standard_GUID& GEOMImpl_PipeTShapeDriver::GetID()
-{
- static Standard_GUID aGUID("1C3A0F3F-729D-4E83-8232-78E74FC5637C");
- return aGUID;
-}
-
-//=======================================================================
-//function : GEOMImpl_PipeTShapeDriver
-//purpose :
-//=======================================================================
-GEOMImpl_PipeTShapeDriver::GEOMImpl_PipeTShapeDriver()
-{
-}
-
-//=======================================================================
-//function : getShapesOnBoxIDs
- /*!
- * \brief Find IDs of sub-shapes complying with given status about surface
- * \param theBox - the box to check state of sub-shapes against
- * \param theShape - the shape to explore
- * \param theShapeType - type of sub-shape of theShape
- * \param theState - required state
- * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
- */
-//=======================================================================
-Handle(TColStd_HSequenceOfInteger)
-GEOMImpl_PipeTShapeDriver::GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
- const TopoDS_Shape& aShape,
- const Standard_Integer theShapeType,
- GEOMAlgo_State theState) const
-{
- Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
-
- // Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(aShape)) {
- StdFail_NotDone::Raise("Cannot build triangulation on the shape");
- return aSeqOfIDs;
- }
-
- // Call algo
- GEOMAlgo_FinderShapeOn2 aFinder;
- Standard_Real aTol = 0.0001; // default value
-
- Handle(GEOMAlgo_ClsfBox) aClsfBox = new GEOMAlgo_ClsfBox;
- aClsfBox->SetBox(aBox);
-
- aFinder.SetShape(aShape);
- aFinder.SetTolerance(aTol);
- aFinder.SetClsf(aClsfBox);
- aFinder.SetShapeType( (TopAbs_ShapeEnum)theShapeType );
- aFinder.SetState(theState);
- aFinder.Perform();
-
- // Interprete results
- Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
- if (iErr) {
- TCollection_AsciiString aMsg (" iErr : ");
- aMsg += TCollection_AsciiString(iErr);
- StdFail_NotDone::Raise(aMsg.ToCString());
- return aSeqOfIDs;
- }
-
-
- const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
-
- if (listSS.Extent() < 1) {
- StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
- return aSeqOfIDs;
- }
-
- // Fill sequence of object IDs
- aSeqOfIDs = new TColStd_HSequenceOfInteger;
-
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aShape, anIndices);
-
- TopTools_ListIteratorOfListOfShape itSub (listSS);
- for (int index = 1; itSub.More(); itSub.Next(), ++index) {
- int id = anIndices.FindIndex(itSub.Value());
-// std::cerr << "Shape with ID " << id << " found" << std::endl;
- aSeqOfIDs->Append(id);
- }
-
- return aSeqOfIDs;
-}
-
-//=======================================================================
-//function : GetShapesOnSurfaceIDs
- /*!
- * \brief Find IDs of sub-shapes complying with given status about surface
- * \param theSurface - the surface to check state of sub-shapes against
- * \param theShape - the shape to explore
- * \param theShapeType - type of sub-shape of theShape
- * \param theState - required state
- * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
- */
-//=======================================================================
-Handle(TColStd_HSequenceOfInteger)
- GEOMImpl_PipeTShapeDriver::GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
- const TopoDS_Shape& theShape,
- TopAbs_ShapeEnum theShapeType,
- GEOMAlgo_State theState) const
-{
- Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
-
- // Check presence of triangulation, build if need
- if (!GEOMUtils::CheckTriangulation(theShape)) {
- StdFail_NotDone::Raise("Cannot build triangulation on the shape");
- return aSeqOfIDs;
- }
-
- // Call algo
- GEOMAlgo_FinderShapeOn1 aFinder;
- Standard_Real aTol = 1e-6;
-
- aFinder.SetShape(theShape);
- aFinder.SetTolerance(aTol);
- aFinder.SetSurface(theSurface);
- aFinder.SetShapeType(theShapeType);
- aFinder.SetState(theState);
-
- // Sets the minimal number of inner points for the faces that do not have own
- // inner points at all (for e.g. rectangular planar faces have just 2 triangles).
- // Default value=3
- aFinder.SetNbPntsMin(3);
- // Sets the maximal number of inner points for edges or faces.
- // It is usefull for the cases when this number is very big (e.g =2000) to improve
- // the performance. If this value =0, all inner points will be taken into account.
- // Default value=0
- aFinder.SetNbPntsMax(0);
-
- aFinder.Perform();
-
- // Interprete results
- Standard_Integer iErr = aFinder.ErrorStatus();
- // the detailed description of error codes is in GEOMAlgo_FinderShapeOn1.cxx
- if (iErr) {
-// MESSAGE(" iErr : " << iErr);
- TCollection_AsciiString aMsg (" iErr : ");
- aMsg += TCollection_AsciiString(iErr);
- StdFail_NotDone::Raise(aMsg.ToCString());
- return aSeqOfIDs;
- }
-// Standard_Integer iWrn = aFinder.WarningStatus();
- // the detailed description of warning codes is in GEOMAlgo_FinderShapeOn1.cxx
-// if (iWrn) {
-// MESSAGE(" *** iWrn : " << iWrn);
-// }
-
- const TopTools_ListOfShape& listSS = aFinder.Shapes(); // the result
-
- if (listSS.Extent() < 1) {
- //StdFail_NotDone::Raise("Not a single sub-shape of the requested type found on the given surface");
- StdFail_NotDone::Raise(NOT_FOUND_ANY); // NPAL18017
- return aSeqOfIDs;
- }
-
- // Fill sequence of object IDs
- aSeqOfIDs = new TColStd_HSequenceOfInteger;
-
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(theShape, anIndices);
-
- TopTools_ListIteratorOfListOfShape itSub (listSS);
- for (int index = 1; itSub.More(); itSub.Next(), ++index) {
- int id = anIndices.FindIndex(itSub.Value());
- aSeqOfIDs->Append(id);
- }
-
- return aSeqOfIDs;
-}
-
-//=======================================================================
-//function : GetCommonShapesOnCylinders
-//purpose : return the common shapes between 2 cylindrical surfaces
-// along OX and OZ
-//=======================================================================
-void GEOMImpl_PipeTShapeDriver::GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
- TopAbs_ShapeEnum theShapeType,
- double r1,
- double r2,
- Handle(TopTools_HSequenceOfShape)& commonShapes) const
-{
- gp_Pnt aP0 (0, 0, 0);
- gp_Vec aVX = gp::DX(), aVZ = gp::DZ();
- gp_Ax3 anAxis1 (aP0, aVX, aVZ), anAxis2 (aP0, aVZ, aVX);
-
- TopTools_IndexedMapOfShape aMapOfShapes;
- aMapOfShapes.Clear();
- TopExp::MapShapes(theShape, aMapOfShapes);
-
- commonShapes->Clear();
-
- int myID;
- bool found = false;
-
- // Create a cylinder surface
- Handle(Geom_Surface) aC1Ext = new Geom_CylindricalSurface(anAxis1, r1);
- if ( aC1Ext.IsNull() )
- StdFail_NotDone::Raise("Couldn't build main cylindrical surface");
- // Find object IDs
- Handle(TColStd_HSequenceOfInteger) aSeqExt1 = GetShapesOnSurfaceIDs( aC1Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
- // Create a cylinder surface
- Handle(Geom_Surface) aC2Ext = new Geom_CylindricalSurface(anAxis2, r2);
- if ( aC2Ext.IsNull() )
- StdFail_NotDone::Raise("Couldn't build incident cylindrical surface");
- // Find object IDs
- Handle(TColStd_HSequenceOfInteger) aSeqExt2 = GetShapesOnSurfaceIDs( aC2Ext, theShape, theShapeType, GEOMAlgo_ST_ON );
- // # Recherche (dans le quart de Te) de l'arete d'intersection des 2 cylindres
- // # Search in theShape for common shape of type theShapeType on the intersection of 2 pipes
- found = false;
- for (int i=1; i<=aSeqExt2->Length();i++) {
-// std::cerr << "aSeqExt2->Value(i): " << aSeqExt2->Value(i) << std::endl;
- for (int j=1; j<=aSeqExt1->Length();j++) {
-// std::cerr << "aSeqExt1->Value(j): " << aSeqExt1->Value(j) << std::endl;
- if (aSeqExt1->Value(j) == aSeqExt2->Value(i)) {
- myID = aSeqExt1->Value(j);
- commonShapes->Append(aMapOfShapes.FindKey(myID));
- found = true;
- }
- }
- }
- if (!found)
- StdFail_NotDone::Raise("Common shapes couldn't be found");
-}
-
-//=======================================================================
-//function : MakePipeTShape
-//purpose :
-//=======================================================================
-TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakePipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
-{
- double r1Ext = r1 + w1;
- double r2Ext = r2 + w2;
-
- gp_Pnt aP0 (0, 0, 0);
- gp_Pnt aP1 (-l1, 0, 0);
- gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
- gp_Ax2 anAxes1 (aP1, aVX, aVZ);
- gp_Ax2 anAxes2 (aP0, aVZ, aVX);
-
- // Build the initial pipes
- BRepPrimAPI_MakeCylinder C1Int (anAxes1, r1, Abs(2 * l1));
- BRepPrimAPI_MakeCylinder C1Ext (anAxes1, r1Ext, Abs(2 * l1));
- BRepPrimAPI_MakeCylinder C2Int (anAxes2, r2, Abs(l2));
- BRepPrimAPI_MakeCylinder C2Ext (anAxes2, r2Ext, Abs(l2));
- C1Int.Build();
- C1Ext.Build();
- C2Int.Build();
- C2Ext.Build();
- if (!C1Int.IsDone() || !C1Ext.IsDone() || !C2Int.IsDone() || !C2Ext.IsDone()) {
- StdFail_NotDone::Raise("Cannot build cylinders");
- }
-
- // Fuse the 2 pipes
- BRepAlgoAPI_Fuse fuse1 (C1Ext.Shape(), C2Ext.Shape());
- if (!fuse1.IsDone()) {
- StdFail_NotDone::Raise("Cannot fuse cylinders");
- }
-
- // Remove small radius main pipe
- BRepAlgoAPI_Cut cut1 (fuse1.Shape(), C1Int.Shape());
- if (!cut1.IsDone()) {
- StdFail_NotDone::Raise("Coudn't cut cylinders");
- }
-
- // Remove small radius incident pipe => Te
- BRepAlgoAPI_Cut Te (cut1.Shape(), C2Int.Shape());
- if (!Te.IsDone()) {
- StdFail_NotDone::Raise("Coudn't cut cylinders");
- }
-
- return Te.Shape();
-}
-
-//=======================================================================
-//function : MakeQuarterPipeTShape
-//purpose :
-//=======================================================================
-TopoDS_Shape GEOMImpl_PipeTShapeDriver::MakeQuarterPipeTShape (const double r1, const double w1, const double l1,
- const double r2, const double w2, const double l2) const
-{
- TopoDS_Shape Te = MakePipeTShape(r1, w1, l1, r2, w2, l2);
- if (Te.IsNull())
- StdFail_NotDone::Raise("Couldn't build Pipe TShape");
-
- // Get a quarter of shape => Te2
- double r1Ext = r1 + w1;
- BRepPrimAPI_MakeBox box1 (gp_Pnt(0, -2*r1Ext, -2*r1Ext), gp_Pnt( Abs(2 * l1), 2*r1Ext, Abs(2*l2)));
- BRepPrimAPI_MakeBox box2 (gp_Pnt(0, 2*r1Ext, -2*r1Ext), gp_Pnt(-Abs(2 * l1), 0, Abs(2*l2)));
- box1.Build();
- box2.Build();
- if (!box1.IsDone() || !box2.IsDone()) {
- StdFail_NotDone::Raise("Couldn't build boxes");
- }
- BRepAlgoAPI_Cut cut3 (Te, box1.Shape());
- if (!cut3.IsDone()) {
- StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
- }
- BRepAlgoAPI_Cut Te4 (cut3.Shape(), box2.Shape());
- if (!Te4.IsDone()) {
- StdFail_NotDone::Raise("Couldn't cut Pipe Tshape with box");
- }
-
- return Te4.Shape();
-}
-
-//=======================================================================
-//function : Execute
-//purpose :
-//=======================================================================
-Standard_Integer GEOMImpl_PipeTShapeDriver::Execute (TFunction_Logbook& log) const
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
-
- GEOMImpl_IPipeTShape aData (aFunction);
- Standard_Integer aType = aFunction->GetType();
-
- TopoDS_Shape aShape, Te4, Te4Part;
- //TopoDS_Edge arete_intersect_int;
- //Handle(TopTools_HSequenceOfShape) edges_e = new TopTools_HSequenceOfShape;
- Handle(TColStd_HSequenceOfInteger) edges_e;
- //Handle(TopTools_HSequenceOfShape) edges_i = new TopTools_HSequenceOfShape;
- //gp_Pnt aP0 (0, 0, 0);
- //gp_Vec aVX = gp::DX(), aVY = gp::DY(), aVZ = gp::DZ();
- bool hexMesh = (bool) aData.GetHexMesh();
-
- // Useful values
- //double aSize = 2*(aData.GetL1() + aData.GetL2());
- double epsilon = Precision::Approximation();
- double aR1Ext = aData.GetR1() + aData.GetW1();
- double aR2Ext = aData.GetR2() + aData.GetW2();
-
- if (aData.GetR2() > aData.GetR1() + epsilon) {
- StdFail_NotDone::Raise("TShape cannot be computed if R2 > R1");
- }
-
- if (aR2Ext > aR1Ext + epsilon) {
- StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 > R1+W1");
- }
-
- // external radius are equal
- if (fabs(aR2Ext - aR1Ext) < epsilon) {
- if (aType == TSHAPE_CHAMFER)
- StdFail_NotDone::Raise("TShape with chamfer cannot be computed if R2+W2 = R1+W1");
- if (aType == TSHAPE_FILLET)
- StdFail_NotDone::Raise("TShape with fillet cannot be computed if R2+W2 = R1+W1");
- // internal radius are different => not possible
- if (fabs(aData.GetR2() - aData.GetR1()) > epsilon) {
- StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 = R1+W1 and R2 != R1");
- }
- }
-
- if (aR1Ext >= aData.GetL2() + epsilon) {
- StdFail_NotDone::Raise("TShape cannot be computed if R1+W1 >= L2");
- }
- if (aR2Ext >= aData.GetL1() + epsilon) {
- StdFail_NotDone::Raise("TShape cannot be computed if R2+W2 >= L1");
- }
-
- if (aType == TSHAPE_CHAMFER) {
- if (aData.GetH() >= (aData.GetL2() - aR1Ext + epsilon)) {
- StdFail_NotDone::Raise("TShape cannot be computed: height of chamfer is too high");
- }
-
- if (aData.GetW() >= (aData.GetL1() - aR2Ext + epsilon))
- StdFail_NotDone::Raise("TShape cannot be computed: width of chamfer is too high");
- }
-
- if (aType == TSHAPE_FILLET) {
- if (aData.GetRF() >= (aData.GetL2() - aR1Ext + epsilon) ||
- aData.GetRF() >= (aData.GetL1() - aR2Ext + epsilon))
- StdFail_NotDone::Raise("TShape cannot be computed: radius of fillet is too high");
- }
-
- if (hexMesh) {
- // Create a quarter of a basic T-Shape pipe
- //std::cerr << "Create a quarter of a basic T-Shape pipe" << std::endl;
- Te4 = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
- aData.GetR2(), aData.GetW2(), aData.GetL2());
- }
- else {
- // No need to cut pipe t-shape
- //std::cerr << "Create a basic T-Shape pipe" << std::endl;
- Te4 = MakePipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
- aData.GetR2(), aData.GetW2(), aData.GetL2());
- }
- aShape = Te4;
-/*
- if (aType == TSHAPE_BASIC) {
- aShape = Te4;
-// aShape = MakeQuarterPipeTShape(aData.GetR1(), aData.GetW1(), aData.GetL1(),
-// aData.GetR2(), aData.GetW2(), aData.GetL2());
- }
- else if (aType == TSHAPE_CHAMFER) {
- // TShape with chamfer
-// BRep_Builder BB;
-// TopoDS_Compound CC;
-// BB.MakeCompound(CC);
- // Create chamfer on the edges edges_e
- BRepFilletAPI_MakeChamfer chamfer (Te4);
- TopTools_IndexedMapOfShape anEdgesIndices;
- TopExp::MapShapes(Te4, anEdgesIndices);
-
- TopoDS_Shape theBox;
- if (hexMesh) {
- BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
- aBox.Build();
- if (!aBox.IsDone()) {
- StdFail_NotDone::Raise("Couldn't build box");
- }
- theBox = aBox.Shape();
- }
- else {
- BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
- aBox.Build();
- if (!aBox.IsDone()) {
- StdFail_NotDone::Raise("Couldn't build box");
- }
- theBox = aBox.Shape();
- }
- Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
- edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- StdFail_NotDone::Raise("Common edges not found");
- }
-
- TopTools_IndexedDataMapOfShapeListOfShape M;
- GEOMImpl_Block6Explorer::MapShapesAndAncestors(Te4, TopAbs_EDGE, TopAbs_FACE, M);
-// std::cerr << "Number of IDs: " << edges_e->Length() << std::endl;
- int nbEdgesInChamfer = 0;
- for (int i=1;i<=edges_e->Length();i++) {
-// std::cerr << "Get Edge with ID #" << i << std::endl;
- int theId = edges_e->Value(i);
-// std::cerr << "ID #" << i << "= " << theId << std::endl;
-// std::cerr << "Search for edge in shape" << std::endl;
- TopoDS_Edge theEdge = TopoDS::Edge(anEdgesIndices.FindKey(theId));
-// std::cerr << "Found" << std::endl;
-// std::cerr << "Keep only edges with a vertex on (x, x, re1)" << std::endl;
- TopExp_Explorer ExVertices;
- for (ExVertices.Init(theEdge,TopAbs_VERTEX); ExVertices.More(); ExVertices.Next()) {
- gp_Pnt aPt = BRep_Tool::Pnt(TopoDS::Vertex(ExVertices.Current()));
- if (aPt.Z() - aR1Ext <= epsilon) {
-// std::cerr << "aPt.Z() = aR1Ext => keep this edge" << std::endl;
- nbEdgesInChamfer ++;
- const TopTools_ListOfShape& aFL = M.FindFromKey(theEdge);
- TopoDS_Face F = TopoDS::Face( aFL.First() );
- if (hexMesh)
- chamfer.Add(aData.GetH(), aData.GetW(), theEdge, F);
- else
- chamfer.Add(aData.GetW(), aData.GetH(), theEdge, F);
- break;
- }
- }
-// std::cerr << "Test if hexMesh: ";
- if (hexMesh && nbEdgesInChamfer == 1) {
-// std::cerr << "Yes => stop after 1 edge" << std::endl;
- break;
- }
-// std::cerr << "No => continue for other edges" << std::endl;
- // BB.Add(CC, edges_e->Value(i));
- // const TopTools_ListOfShape& aFL = M.FindFromKey(TopoDS::Edge(edges_e->Value(i)));
- // chamfer.Add(aData.GetW(), aData.GetH(), TopoDS::Edge(edges_e->Value(i)), F);
- }
-// std::cerr << "Build chamfer with " << nbEdgesInChamfer << " edges" << std::endl;
-// }
- chamfer.Build();
- if (!chamfer.IsDone()) {
- StdFail_NotDone::Raise("Chamfer can not be computed on the given shape with the given parameters");
- }
-
-// BB.Add(CC, chamfer.Shape());
-
-// aShape = CC;
- aShape = chamfer.Shape();
- }
- else if (aType == TSHAPE_FILLET) {
- // TShape with fillet
- // Create fillet on the edge arete_intersect_ext
- BRepFilletAPI_MakeFillet fill (Te4);
-
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(Te4, anIndices);
-
- TopoDS_Shape theBox;
- if (hexMesh) {
- BRepPrimAPI_MakeBox aBox (gp_Pnt(0,0,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
- aBox.Build();
- if (!aBox.IsDone()) {
- StdFail_NotDone::Raise("Couldn't build box");
- }
- theBox = aBox.Shape();
- }
- else {
- BRepPrimAPI_MakeBox aBox (gp_Pnt(aR2Ext,aR2Ext,0),gp_Pnt(-aR2Ext, -aR2Ext, aR1Ext));
- aBox.Build();
- if (!aBox.IsDone()) {
- StdFail_NotDone::Raise("Couldn't build box");
- }
- theBox = aBox.Shape();
- }
- Handle(TColStd_HSequenceOfInteger) edges_e = new TColStd_HSequenceOfInteger;
- edges_e = GetShapesOnBoxIDs(theBox, Te4, TopAbs_EDGE, GEOMAlgo_ST_IN);
- if (edges_e.IsNull() || edges_e->Length() == 0) {
- StdFail_NotDone::Raise("Common edges not found");
- }
-
-// fill.Add(TopoDS::Edge(edges_e->Value(1)));
-// if (!hexMesh) {
- for (int i=1;i<=edges_e->Length();i++) {
- if (hexMesh && (i > 1))
- break;
- TopoDS_Edge theEdge = TopoDS::Edge(anIndices.FindKey(edges_e->Value(i)));
- fill.Add(theEdge);
-// fill.Add(TopoDS::Edge(edges_e->Value(i)));
- }
-// }
- fill.SetRadius(aData.GetRF(), 1, 1);
- fill.Build();
- if (!fill.IsDone()) {
- StdFail_NotDone::Raise("Fillet can't be computed on the given shape with the given radius");
- }
-
- aShape = fill.Shape();
- }
- else {
- // other construction modes here
- }
-*/
- if (aShape.IsNull()) return 0;
-
- aFunction->SetValue(aShape);
-
- log.SetTouched(Label());
-
- return 1;
-}
-
-//================================================================================
-/*!
- * \brief Returns a name of creation operation and names and values of creation parameters
- */
-//================================================================================
-
-bool GEOMImpl_PipeTShapeDriver::
-GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& theParams)
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
-
- GEOMImpl_IPipeTShape aCI( function );
- Standard_Integer aType = function->GetType();
-
- theOperationName = "PIPETSHAPE";
-
- switch ( aType ) {
- case TSHAPE_BASIC:
- AddParam( theParams, "Main radius", aCI.GetR1() );
- AddParam( theParams, "Main width", aCI.GetW1() );
- AddParam( theParams, "Main half-length", aCI.GetL1() );
- AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
- AddParam( theParams, "Incident pipe width", aCI.GetW2() );
- AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
- AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
- break;
- case TSHAPE_CHAMFER:
- AddParam( theParams, "Main radius", aCI.GetR1() );
- AddParam( theParams, "Main width", aCI.GetW1() );
- AddParam( theParams, "Main half-length", aCI.GetL1() );
- AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
- AddParam( theParams, "Incident pipe width", aCI.GetW2() );
- AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
- AddParam( theParams, "Chamfer height", aCI.GetH() );
- AddParam( theParams, "Chamfer width", aCI.GetW() );
- AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
- break;
- case TSHAPE_FILLET:
- AddParam( theParams, "Main radius", aCI.GetR1() );
- AddParam( theParams, "Main width", aCI.GetW1() );
- AddParam( theParams, "Main half-length", aCI.GetL1() );
- AddParam( theParams, "Incident pipe radius", aCI.GetR2() );
- AddParam( theParams, "Incident pipe width", aCI.GetW2() );
- AddParam( theParams, "Incident pipe half-length", aCI.GetL2() );
- AddParam( theParams, "Fillet radius", aCI.GetRF() );
- AddParam( theParams, "For hex mesh", aCI.GetHexMesh() );
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver);
-IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_PipeTShapeDriver,GEOM_BaseDriver);
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _GEOMImpl_PipeTShapeDriver_HXX
-#define _GEOMImpl_PipeTShapeDriver_HXX
-
-#include <TFunction_Driver.hxx>
-
-#include "GEOMAlgo_State.hxx"
-
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-#include <gp_Ax2.hxx>
-
-#include <Handle_Geom_Surface.hxx>
-
-class Handle_Standard_Type;
-class GEOMImpl_PipeTShapeDriver;
-
-
-
-#include "GEOM_BaseDriver.hxx"
-
-DEFINE_STANDARD_HANDLE( GEOMImpl_PipeTShapeDriver, GEOM_BaseDriver );
-
-class GEOMImpl_PipeTShapeDriver : public GEOM_BaseDriver {
-public:
- // Methods PUBLIC
- //
- Standard_EXPORT GEOMImpl_PipeTShapeDriver();
- Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
- Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
- Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
- {
- return Standard_True;
- }
- Standard_EXPORT static const Standard_GUID& GetID();
- Standard_EXPORT ~GEOMImpl_PipeTShapeDriver() {};
-
- Standard_EXPORT virtual
- bool GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& params);
- // Type management
- //
-DEFINE_STANDARD_RTTI( GEOMImpl_PipeTShapeDriver )
-
-private:
-
- /*!
- * \brief Create a T-Shape based on pipes
- * \param r1 - the internal radius of main pipe
- * \param w1 - the thickness of main pipe
- * \param l1 - the half-length of main pipe
- * \param r2 - the internal radius of incident pipe
- * \param w2 - the thickness of incident pipe
- * \param l2 - the half-length of main pipe
- * \retval TopoDS_Shape - Resulting shape
- */
- TopoDS_Shape MakePipeTShape(double r1, double w1, double l1,
- double r2, double w2, double l2) const;
-
- /*!
- * \brief Create a quarter of a T-Shape based on pipes
- * \param r1 - the internal radius of main pipe
- * \param w1 - the thickness of main pipe
- * \param l1 - the half-length of main pipe
- * \param r2 - the internal radius of incident pipe
- * \param w2 - the thickness of incident pipe
- * \param l2 - the half-length of main pipe
- * \retval TopoDS_Shape - Resulting shape
- */
- TopoDS_Shape MakeQuarterPipeTShape(double r1, double w1, double l1,
- double r2, double w2, double l2) const;
-
- /*!
- * \brief Find IDs of sub-shapes complying with given status about surface
- * \param theSurface - the surface to check state of sub-shapes against
- * \param theShape - the shape to explore
- * \param theShapeType - type of sub-shape of theShape
- * \param theState - required state
- * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
- */
- Handle(TColStd_HSequenceOfInteger)
- GetShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
- const TopoDS_Shape& theShape,
- TopAbs_ShapeEnum theShapeType,
- GEOMAlgo_State theState) const;
-
- /*!
- * \brief Find IDs of sub-shapes complying with given status about surface
- * \param theBox - the box to check state of sub-shapes against
- * \param theShape - the shape to explore
- * \param theShapeType - type of sub-shape of theShape
- * \param theState - required state
- * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
- */
- Handle(TColStd_HSequenceOfInteger)
- GetShapesOnBoxIDs(const TopoDS_Shape& aBox,
- const TopoDS_Shape& aShape,
- const Standard_Integer theShapeType,
- GEOMAlgo_State theState) const;
-
- //=======================================================================
- //function : getCommonShapesOnCylinders
- //purpose : return the common edge between 2 cylindrical surfaces
- // along OX and OZ
- //=======================================================================
- void GetCommonShapesOnCylinders(const TopoDS_Shape& theShape,
- TopAbs_ShapeEnum theShapeType,
- double r, double r2,
- Handle(TopTools_HSequenceOfShape)& commonShapes) const;
-
-};
-
-#endif // _GEOMImpl_PipeTShapeDriver_HXX
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#include <Standard_Stream.hxx>
-
-#include <GEOMImpl_SmoothingSurfaceDriver.hxx>
-#include <GEOMImpl_ISmoothingSurface.hxx>
-#include <GEOMImpl_Types.hxx>
-#include <GEOM_Function.hxx>
-
-#include <TFunction_Logbook.hxx>
-#include <StdFail_NotDone.hxx>
-
-//@@ include required header files here @@//
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopoDS.hxx>
-
-#include <TColgp_SequenceOfPnt.hxx>
-#include <TColgp_Array2OfPnt.hxx>
-#include <TColgp_SequenceOfXY.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-
-#include <BRepAdaptor_HSurface.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRepGProp.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-
-#include <GeomPlate_Surface.hxx>
-#include <GeomPlate_BuildPlateSurface.hxx>
-#include <GeomPlate_PointConstraint.hxx>
-#include <GeomPlate_MakeApprox.hxx>
-#include <GeomPlate_PlateG0Criterion.hxx>
-#include <GeomPlate_BuildAveragePlane.hxx>
-
-#include <Geom_BSplineSurface.hxx>
-#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
-
-#include <GProp_GProps.hxx>
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-
-#include <gp_Pnt.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Ax3.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Vec.hxx>
-
-#include <GC_MakePlane.hxx>
-//=======================================================================
-//function : GetID
-//purpose :
-//=======================================================================
-const Standard_GUID& GEOMImpl_SmoothingSurfaceDriver::GetID()
-{
- static Standard_GUID aGUID("1C3A0F30-729D-4E83-8232-78E74FC5637C");
- return aGUID;
-}
-
-//=======================================================================
-//function : GEOMImpl_SmoothingSurfaceDriver
-//purpose :
-//=======================================================================
-GEOMImpl_SmoothingSurfaceDriver::GEOMImpl_SmoothingSurfaceDriver()
-{
-}
-
-//=======================================================================
-//function : MakeSmoothingSurfaceUnClosed
-//purpose :
-//=======================================================================
-TopoDS_Shape GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const
-{
- TopoDS_Face aInitShape;
-
- // Create an average Plane
- //Handle(TColgp_HArray1OfPnt) HAP = new TColgp_HArray1OfPnt(1,myListOfPoints.Length())
- GeomPlate_BuildAveragePlane gpbap(myListOfPoints,myListOfPoints->Length(),Precision::Confusion(),1,1);
- Handle(Geom_Plane) plane(gpbap.Plane());
- Standard_Real Umin, Umax, Vmin, Vmax;
- gpbap.MinMaxBox(Umin,Umax,Vmin,Vmax);
- // cout << "Vals : " << Umin << ", " << Umax << ", " << Vmin << ", " << Vmax << endl;
- BRepBuilderAPI_MakeFace mf(plane,Umin,Umax,Vmin,Vmax,Precision::Confusion());
- aInitShape = mf.Face();
- //return aInitShape;
-
- GeomPlate_BuildPlateSurface aBuilder(3,10);
- // ** Initialization of surface
- Handle(BRepAdaptor_HSurface) HSI = new BRepAdaptor_HSurface();
- HSI->ChangeSurface().Initialize(aInitShape);
- aBuilder.LoadInitSurface( BRep_Tool::Surface(HSI->ChangeSurface().Face()));
-
- Standard_Integer j, j1, j2;
- // cout << "Init surface" << endl;
- j1 = myListOfPoints->Lower();
- j2 = myListOfPoints->Upper();
- for (j=j1; j<=j2 ; j++)
- {
- gp_Pnt aPnt = myListOfPoints->Value(j);
- Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(aPnt,0);
- aBuilder.Add(PCont);
- }
- // cout << "avant Perform surface" << endl;
- aBuilder.Perform();
- // cout << "Perform surface" << endl;
-
- // A ce niveau : surface algo
- Handle(GeomPlate_Surface) gpPlate = aBuilder.Surface();
-
- Standard_Integer nbcarreau=2;
- Standard_Integer degmax=8;
- Standard_Real seuil;
- seuil = Max(0.0001,10*aBuilder.G0Error());
- GeomPlate_MakeApprox Mapp(gpPlate,0.0001,nbcarreau,degmax,seuil);
- // cout << "Approx surface" << endl;
-
- Handle (Geom_Surface) Surf (Mapp.Surface());
-
- aBuilder.Surface()->Bounds( Umin, Umax, Vmin, Vmax);
-
- BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax, Precision::Confusion());
- TopoDS_Shape aShape = MF.Shape();
-
- return aShape;
-}
-
-
-//=======================================================================
-//function : Execute
-//purpose :
-//=======================================================================
-Standard_Integer GEOMImpl_SmoothingSurfaceDriver::Execute(TFunction_Logbook& log) const
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
- if (aFunction.IsNull()) return 0;
-
- Standard_Integer aType = aFunction->GetType();
-
- if (aType != SMOOTHINGSURFACE_LPOINTS) return 0;
- // cout << "Youhou : " << aType << endl;
-
- GEOMImpl_ISmoothingSurface aData (aFunction);
-
- Standard_Integer nbPoints = aData.GetLength();
-
- Handle(TColgp_HArray1OfPnt) anArrayofPnt = new TColgp_HArray1OfPnt(1,nbPoints);
- for (int ind=1;ind<=nbPoints;ind++)
- {
- Handle(GEOM_Function) aPoint = aData.GetPoint(ind);
- TopoDS_Shape aShapePnt = aPoint->GetValue();
- TopoDS_Vertex dsPoint;
- dsPoint = TopoDS::Vertex( aShapePnt );
- gp_Pnt aPnt = BRep_Tool::Pnt( dsPoint );
- anArrayofPnt->SetValue(ind,aPnt);
- }
-
- TopoDS_Shape aShape;
- aShape = GEOMImpl_SmoothingSurfaceDriver::MakeSmoothingSurfaceUnClosed(anArrayofPnt);
-
- if (aShape.IsNull()) return 0;
-
- aFunction->SetValue(aShape);
-
- log.SetTouched(Label());
-
- return 1;
-}
-
-//================================================================================
-/*!
- * \brief Returns a name of creation operation and names and values of creation parameters
- */
-//================================================================================
-
-bool GEOMImpl_SmoothingSurfaceDriver::
-GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& theParams)
-{
- if (Label().IsNull()) return 0;
- Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label());
-
- GEOMImpl_ISmoothingSurface aCI( function );
- Standard_Integer aType = function->GetType();
-
- theOperationName = "SMOOTHINGSURFACE";
-
- switch ( aType ) {
- case SMOOTHINGSURFACE_LPOINTS:
- AddParam( theParams, "Points" );
- if ( aCI.GetLength() > 1 )
- theParams[0] << aCI.GetLength() << " points: ";
- for ( int i = 1, nb = aCI.GetLength(); i <= nb; ++i )
- theParams[0] << aCI.GetPoint( i ) << " ";
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-IMPLEMENT_STANDARD_HANDLE (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver);
-IMPLEMENT_STANDARD_RTTIEXT (GEOMImpl_SmoothingSurfaceDriver,GEOM_BaseDriver);
+++ /dev/null
-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-
-#ifndef _GEOMImpl_SmoothingSurfaceDriver_HXX
-#define _GEOMImpl_SmoothingSurfaceDriver_HXX
-
-#ifndef _TFunction_Driver_HeaderFile
-#include <TFunction_Driver.hxx>
-#endif
-#ifndef _TFunction_Logbook_HeaderFile
-#include <TFunction_Logbook.hxx>
-#endif
-#ifndef _Standard_CString_HeaderFile
-#include <Standard_CString.hxx>
-#endif
-#include <TColgp_HArray1OfPnt.hxx>
-#include <TopoDS_Shape.hxx>
-
-class Handle_Standard_Type;
-class GEOMImpl_SmoothingSurfaceDriver;
-
-
-
-#include "GEOM_BaseDriver.hxx"
-
-DEFINE_STANDARD_HANDLE( GEOMImpl_SmoothingSurfaceDriver, GEOM_BaseDriver );
-
-class GEOMImpl_SmoothingSurfaceDriver : public GEOM_BaseDriver {
-public:
- // Methods PUBLIC
- //
- Standard_EXPORT GEOMImpl_SmoothingSurfaceDriver();
- Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
- Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
- Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const
- {
- return Standard_True;
- }
- Standard_EXPORT static const Standard_GUID& GetID();
- Standard_EXPORT ~GEOMImpl_SmoothingSurfaceDriver() {};
-
- Standard_EXPORT virtual
- bool GetCreationInformation(std::string& theOperationName,
- std::vector<GEOM_Param>& params);
- // Type management
- //
-DEFINE_STANDARD_RTTI( GEOMImpl_SmoothingSurfaceDriver )
-
-private:
- TopoDS_Shape MakeSmoothingSurfaceUnClosed(Handle_TColgp_HArray1OfPnt myListOfPoints) const;
-};
-
-#endif // _GEOMImpl_SmoothingSurfaceDriver_HXX
#define GEOM_CIRC_ARC 19
#define GEOM_FILLET 20
-#define GEOM_FILLET_2D 45
-#define GEOM_FILLET_1D 46
#define GEOM_CHAMFER 21
#define GEOM_EDGE 22
#define GEOM_THICKENING 49
+#define GEOM_FILLET_2D 50
+#define GEOM_FILLET_1D 51
+
//GEOM_Function types
#define COPY_WITH_REF 1
// Advanced functions (base = 200)
#define ADVANCED_BASE 200 // NO OPERATION (advanced operations base)
-#define GEOM_TSHAPE 201
-#define GEOM_DIVIDEDDISK 202
-#define GEOM_DIVIDEDCYLINDER 203
-#define GEOM_SMOOTHINGSURFACE 204
-/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
-// Advanced functions sub-operations codes
-#define TSHAPE_BASIC 1
-#define TSHAPE_CHAMFER 2
-#define TSHAPE_FILLET 3
-#define DIVIDEDDISK_R_RATIO 1
-#define DIVIDEDDISK_R_VECTOR_PNT 2
-#define DIVIDEDCYLINDER_R_H 1
-#define SMOOTHINGSURFACE_LPOINTS 1
-/*@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@*/
GEOMImpl_IInsertOperations.hxx \
GEOMImpl_IMeasureOperations.hxx \
GEOMImpl_IGroupOperations.hxx \
- GEOMImpl_IAdvancedOperations.hxx \
GEOMImpl_IGlue.hxx \
GEOMImpl_PointDriver.hxx \
GEOMImpl_IPoint.hxx \
GEOMImpl_Types.hxx \
GEOM_GEOMImpl.hxx
-ADVANCED_INCLUDES =
-ADVANCED_INCLUDES += GEOMImpl_IPipeTShape.hxx GEOMImpl_PipeTShapeDriver.hxx
-ADVANCED_INCLUDES += GEOMImpl_IDividedDisk.hxx GEOMImpl_DividedDiskDriver.hxx
-##ADVANCED_INCLUDES += GEOMImpl_IDividedCylinder.hxx GEOMImpl_DividedCylinderDriver.hxx
-ADVANCED_INCLUDES += GEOMImpl_ISmoothingSurface.hxx GEOMImpl_SmoothingSurfaceDriver.hxx
-##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
-
-salomeinclude_HEADERS += $(ADVANCED_INCLUDES)
-
dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_IBasicOperations.cxx \
GEOMImpl_ITransformOperations.cxx \
GEOMImpl_IInsertOperations.cxx \
GEOMImpl_IMeasureOperations.cxx \
GEOMImpl_IGroupOperations.cxx \
- GEOMImpl_IAdvancedOperations.cxx \
GEOMImpl_Gen.cxx \
GEOMImpl_PointDriver.cxx \
GEOMImpl_VectorDriver.cxx \
GEOMImpl_FillingDriver.cxx \
GEOMImpl_GlueDriver.cxx
-ADVANCED_SOURCES =
-ADVANCED_SOURCES += GEOMImpl_PipeTShapeDriver.cxx
-ADVANCED_SOURCES += GEOMImpl_DividedDiskDriver.cxx
-##ADVANCED_SOURCES += GEOMImpl_DividedCylinderDriver.cxx
-ADVANCED_SOURCES += GEOMImpl_SmoothingSurfaceDriver.cxx
-##@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@##
-
-dist_libGEOMimpl_la_SOURCES += $(ADVANCED_SOURCES)
-
# additional information to compile and link file
libGEOMimpl_la_CPPFLAGS = \
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifdef WNT
#pragma warning( disable:4786 )
#include <SALOMEDS_Tool.hxx>
#include <SALOMEDS_wrap.hxx>
+#ifdef WNT
+ #include <windows.h>
+ #include <process.h>
+#else
+ #include <dlfcn.h>
+#endif
+
+#ifdef WNT
+ #define LibHandle HMODULE
+ #define LoadLib( name ) LoadLibrary( name )
+ #define GetProc GetProcAddress
+ #define UnLoadLib( handle ) FreeLibrary( handle );
+#else
+ #define LibHandle void*
+ #define LoadLib( name ) dlopen( name, RTLD_LAZY )
+ #define GetProc dlsym
+ #define UnLoadLib( handle ) dlclose( handle );
+#endif
+
//============================================================================
// function : GEOM_Gen_i()
// purpose : constructor to be called for servant creation.
} else {
GEOM::shape_type myshapetype=aShape->GetShapeType();
if ( myshapetype == GEOM::COMPOUND ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" );
- aShapeName = "Compound_";
- } else if ( myshapetype == GEOM::COMPSOLID ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID");
- aShapeName = "Compsolid_";
- } else if ( myshapetype == GEOM::SOLID ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID");
- aShapeName = "Solid_";
- } else if ( myshapetype == GEOM::SHELL ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL");
- aShapeName = "Shell_";
- } else if ( myshapetype == GEOM::FACE ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE");
- aShapeName = "Face_";
- } else if ( myshapetype == GEOM::WIRE ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE");
- aShapeName = "Wire_";
- } else if ( myshapetype == GEOM::EDGE ) {
- aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE");
- aShapeName = "Edge_";
- } else if ( myshapetype == GEOM::VERTEX ) {
- aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" );
- aShapeName = "Vertex_";
- }
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" );
+ aShapeName = "Compound_";
+ } else if ( myshapetype == GEOM::COMPSOLID ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID");
+ aShapeName = "Compsolid_";
+ } else if ( myshapetype == GEOM::SOLID ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID");
+ aShapeName = "Solid_";
+ } else if ( myshapetype == GEOM::SHELL ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL");
+ aShapeName = "Shell_";
+ } else if ( myshapetype == GEOM::FACE ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE");
+ aShapeName = "Face_";
+ } else if ( myshapetype == GEOM::WIRE ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE");
+ aShapeName = "Wire_";
+ } else if ( myshapetype == GEOM::EDGE ) {
+ aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE");
+ aShapeName = "Edge_";
+ } else if ( myshapetype == GEOM::VERTEX ) {
+ aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" );
+ aShapeName = "Vertex_";
+ }
}
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
//else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName));
}
//============================================================================
-// function : GetIAdvancedOperations
+// function : GetPluginOperations
// purpose :
//============================================================================
-GEOM::GEOM_IAdvancedOperations_ptr GEOM_Gen_i::GetIAdvancedOperations(CORBA::Long theStudyID)
+GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyID,
+ const char* theLibName)
throw ( SALOME::SALOME_Exception )
{
+ std::string aPlatformLibName;
+#ifdef WNT
+ aPlatformLibName = theLibName;
+ aPlatformLibName += ".dll" ;
+#else
+ aPlatformLibName = "lib";
+ aPlatformLibName += theLibName;
+ aPlatformLibName += ".so";
+#endif
+
Unexpect aCatch(SALOME_SalomeException);
- MESSAGE( "GEOM_Gen_i::GetIAdvancedOperations" );
+ MESSAGE( "GEOM_Gen_i::GetPluginOperations" );
GEOM::GEOM_Gen_ptr engine = _this();
- GEOM_IAdvancedOperations_i* aServant =
- new GEOM_IAdvancedOperations_i(_poa, engine, _impl->GetIAdvancedOperations(theStudyID));
+ GEOM_IOperations_i* aServant = 0;
+ GEOM::GEOM_IOperations_var operations;
+
+ try {
+ // check, if corresponding operations are already created
+ if (myOpCreatorMap.find(std::string(theLibName)) == myOpCreatorMap.end()) {
+ // load plugin library
+ LibHandle libHandle = LoadLib( aPlatformLibName.c_str()/*theLibName*/ );
+ if (!libHandle) {
+ // report any error, if occured
+#ifndef WNT
+ const char* anError = dlerror();
+ throw(SALOME_Exception(anError));
+#else
+ throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
+#endif
+ }
+
+ // get method, returning operations creator
+ typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
+ GetOperationsCreator procHandle =
+ (GetOperationsCreator)GetProc( libHandle, "GetOperationsCreator" );
+ if (!procHandle) {
+ throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
+ UnLoadLib(libHandle);
+ }
+
+ // get operations creator
+ GEOM_GenericOperationsCreator* aCreator = procHandle();
+ if (!aCreator) {
+ throw(SALOME_Exception(LOCALIZED("bad geometry plugin library implementation")));
+ }
+
+ // map operations creator to a plugin name
+ myOpCreatorMap[std::string(theLibName)] = aCreator;
+ }
+
+ // create a new operations object, store its ref. in engine
+ aServant = myOpCreatorMap[std::string(theLibName)]->Create(_poa, theStudyID, engine, _impl);
+ //??? aServant->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance
+ }
+ catch (SALOME_Exception& S_ex) {
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
+
+ if (!aServant)
+ return operations._retn();
// activate the CORBA servant
- GEOM::GEOM_IAdvancedOperations_var operations = aServant->_this();
+ operations = GEOM::GEOM_IOperations::_narrow( aServant->_this() );
return operations._retn();
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef __GEOM_GEN_I_H__
#define __GEOM_GEN_I_H__
#include "GEOM_IInsertOperations_i.hh"
#include "GEOM_IMeasureOperations_i.hh"
#include "GEOM_IGroupOperations_i.hh"
-#include "GEOM_IAdvancedOperations_i.hh"
#include <TopTools_IndexedMapOfShape.hxx>
+#include <map>
#include <set>
#include <string>
//#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+//=====================================================================
+// Generic operations creator (for plugins mechanism)
+//=====================================================================
+class GEOM_I_EXPORT GEOM_GenericOperationsCreator
+{
+public:
+ // Create operations
+ virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA,
+ int theStudyId,
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_Gen* theGenImpl) = 0;
+ // return the name of IDL module
+ //virtual std::string GetModuleName() = 0;
+};
+
//=====================================================================
// GEOM_Gen_i : class definition
//=====================================================================
virtual GEOM::GEOM_IGroupOperations_ptr GetIGroupOperations (CORBA::Long theStudyID)
throw (SALOME::SALOME_Exception);
- //Returns a pointer to AdvancedOperations interface
- virtual GEOM::GEOM_IAdvancedOperations_ptr GetIAdvancedOperations (CORBA::Long theStudyID)
+ //Returns a pointer to corresponding plugin operations interface
+ virtual GEOM::GEOM_IOperations_ptr GetPluginOperations (CORBA::Long theStudyID,
+ const char* theLibName)
throw (SALOME::SALOME_Exception);
//Adds a new sub-shape
::GEOMImpl_Gen* _impl;
SALOME_NamingService * name_service;
char * _name;
+
+ // plugin operations managing
+ std::map<std::string, GEOM_GenericOperationsCreator*> myOpCreatorMap;
};
#endif
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GEOM_IAdvancedOperations.cc
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-#include <Standard_Stream.hxx>
-
-#include "GEOM_IAdvancedOperations_i.hh"
-
-#include <utilities.h>
-#include <OpUtil.hxx>
-#include <Utils_ExceptHandlers.hxx>
-
-#include "GEOM_Engine.hxx"
-#include "GEOM_Object.hxx"
-
-//=============================================================================
-/*!
- * constructor:
- */
-//=============================================================================
-GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IAdvancedOperations* theImpl)
-:GEOM_IOperations_i(thePOA, theEngine, theImpl)
-{
- MESSAGE("GEOM_IAdvancedOperations_i::GEOM_IAdvancedOperations_i");
-}
-
-//=============================================================================
-/*!
- * destructor
- */
-//=============================================================================
-GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i()
-{
- MESSAGE("GEOM_IAdvancedOperations_i::~GEOM_IAdvancedOperations_i");
-}
-
-//=============================================================================
-/*!
- * MakePipeTShape
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShape
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length).
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
- if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull())return aSeq._retn();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeChamfer
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of chamfer.
- * \param theW Width of chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamfer
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theH, theW, theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeChamferWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of the chamfer.
- * \param theW Width of the chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeChamferWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theH, theW, theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeFillet
- * 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.
- * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFillet
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRF, CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theRF, theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeFilletWithPosition
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeFilletWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRF, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
- theRF, theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTR
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTR
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTRWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length).
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
- if (aP1.IsNull() || aP2.IsNull() || aP3.IsNull()) return aSeq._retn();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTRChamfer
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of chamfer.
- * \param theW Width of chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamfer
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theH, theW, theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTRChamferWithPosition
- * Create a T-shape object with specified caracteristics for the main and
- * the incident pipes (radius, width, half-length). 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theH Height of the chamfer.
- * \param theW Width of the chamfer.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRChamferWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeChamferWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theH, theW, theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTRFillet
- * 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.
- * Center of the shape is (0,0,0). The main plane of the T-shape is XOY.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet.
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFillet
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theRF, CORBA::Boolean theHexMesh)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theRF, theHexMesh);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * MakePipeTShapeTRFilletWithPosition
- * 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.
- * \param theR1 Internal radius of main pipe
- * \param theW1 Width of main pipe
- * \param theL1 Half-length of main pipe
- * \param theR2 Internal radius of incident pipe (R2 < R1)
- * \param theW2 Width of incident pipe (R2+W2 < R1+W1)
- * \param theL2 Half-length of incident pipe
- * \param theRF Radius of curvature of fillet
- * \param theHexMesh Boolean indicating if shape is prepared for hex mesh
- * \param theP1 1st junction point of main pipe
- * \param theP2 2nd junction point of main pipe
- * \param theP3 Junction point of incident pipe
- * \return List of GEOM_Objects, containing the created shape and propagation groups.
- */
-//=============================================================================
-GEOM::ListOfGO* GEOM_IAdvancedOperations_i::MakePipeTShapeTRFilletWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theRF, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3)
-{
- GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference vertices
- Handle(GEOM_Object) aP1 = GetObjectImpl(theP1);
- Handle(GEOM_Object) aP2 = GetObjectImpl(theP2);
- Handle(GEOM_Object) aP3 = GetObjectImpl(theP3);
-
- //Create the TShape
- Handle(TColStd_HSequenceOfTransient) aHSeq =
- GetOperations()->MakePipeTShapeFilletWithPosition(theR1, theW1, theL1, theR2, theW2, theL2,
- theRL, theWL, theLtransL, theLthinL,
- theRR, theWR, theLtransR, theLthinR,
- theRI, theWI, theLtransI, theLthinI,
- theRF, theHexMesh, aP1, aP2, aP3);
- if (!GetOperations()->IsDone() || aHSeq.IsNull())
- return aSeq._retn();
-
- Standard_Integer aLength = aHSeq->Length();
- aSeq->length(aLength);
- for (Standard_Integer i = 1; i <= aLength; i++)
- aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
-
- return aSeq._retn();
-}
-
-//=============================================================================
-/*!
- * This function allows to create a disk already divided into blocks. It can be
- * use to create divided pipes for later meshing in hexaedra.
- * \param theR Radius of the disk
- * \param theRatio Relative size of the central square diagonal against the disk diameter
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDisk (CORBA::Double theR,
- CORBA::Double theRatio,
- CORBA::Short theOrientation,
- GEOM::pattern thePattern)
-{
- GEOM::GEOM_Object_var aGEOMObject;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the DividedDisk
- Handle(GEOM_Object) anObject = GetOperations()->MakeDividedDisk(theR, theRatio, theOrientation, thePattern);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
-}
-
-//=============================================================================
-/*!
- * MakeDividedDiskPntVecR
- */
-//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr thePnt,
- GEOM::GEOM_Object_ptr theVec,
- CORBA::Double theR,
- CORBA::Double theRatio,
- GEOM::pattern thePattern)
-{
- GEOM::GEOM_Object_var aGEOMObject;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference points
- Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
- Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
-
- if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
-
- // Make DividedDisk
- Handle(GEOM_Object) anObject =
- GetOperations()->MakeDividedDiskPntVecR(aPnt, aVec, theR, theRatio, thePattern);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
-}
-
-//=============================================================================
-/*!
- * Builds a cylinder prepared for hexa meshes
- * \param theR Radius of the cylinder
- * \param theH Height of the cylinder
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeDividedCylinder (CORBA::Double theR,
- CORBA::Double theH,
- GEOM::pattern thePattern)
-{
- GEOM::GEOM_Object_var aGEOMObject;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Create the DividedCylinder
- Handle(GEOM_Object) anObject = GetOperations()->MakeDividedCylinder(theR, theH, thePattern);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
-}
-
-//=============================================================================
-/*!
- *
- * \param thelPoints list of points
- * \return New GEOM_Object, containing the created shape.
- */
-//=============================================================================
-GEOM::GEOM_Object_ptr GEOM_IAdvancedOperations_i::MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints)
-{
- GEOM::GEOM_Object_var aGEOMObject;
-
- //Set a not done flag
- GetOperations()->SetNotDone();
-
- //Get the reference point
- int ind = 0;
- int aLen = thelPoints.length();
- std::list<Handle(GEOM_Object)> aPoints;
- for (; ind < aLen; ind++) {
- Handle(GEOM_Object) aPnt = GetObjectImpl(thelPoints[ind]);
- if (aPnt.IsNull()) return aGEOMObject._retn();
- aPoints.push_back(aPnt);
- }
- //Create the SmoothingSurface
- Handle(GEOM_Object) anObject = GetOperations()->MakeSmoothingSurface(aPoints);
- if (!GetOperations()->IsDone() || anObject.IsNull())
- return aGEOMObject._retn();
-
- return GetObject(anObject);
-}
-
-/*@@ insert new functions before this line @@ do not remove this line @@*/
+++ /dev/null
-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-// File : GEOM_IAdvancedOperations.hh
-// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-
-#ifndef _GEOM_IAdvancedOperations_i_HeaderFile
-#define _GEOM_IAdvancedOperations_i_HeaderFile
-
-#include "GEOMImpl_Gen.hxx"
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include "GEOM_IOperations_i.hh"
-#include "GEOM_Object_i.hh"
-
-#include "GEOMImpl_IAdvancedOperations.hxx"
-
-class GEOM_I_EXPORT GEOM_IAdvancedOperations_i :
- public virtual POA_GEOM::GEOM_IAdvancedOperations,
- public virtual GEOM_IOperations_i
-{
- public:
- GEOM_IAdvancedOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
- ::GEOMImpl_IAdvancedOperations* theImpl);
- ~GEOM_IAdvancedOperations_i();
-
- // PipeTShape without thickness reduction
- GEOM::ListOfGO* MakePipeTShape (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
- GEOM::ListOfGO* MakePipeTShapeChamfer (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeChamferWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
- GEOM::ListOfGO* MakePipeTShapeFillet (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRF, CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeFilletWithPosition (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRF, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
-
- // PipeTShape with thickness reduction
- GEOM::ListOfGO* MakePipeTShapeTR
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeTRWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
- GEOM::ListOfGO* MakePipeTShapeTRChamfer
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeTRChamferWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theH, CORBA::Double theW, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
- GEOM::ListOfGO* MakePipeTShapeTRFillet
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theRF, CORBA::Boolean theHexMesh);
- GEOM::ListOfGO* MakePipeTShapeTRFilletWithPosition
- (CORBA::Double theR1, CORBA::Double theW1, CORBA::Double theL1,
- CORBA::Double theR2, CORBA::Double theW2, CORBA::Double theL2,
- CORBA::Double theRL, CORBA::Double theWL, CORBA::Double theLtransL, CORBA::Double theLthinL,
- CORBA::Double theRR, CORBA::Double theWR, CORBA::Double theLtransR, CORBA::Double theLthinR,
- CORBA::Double theRI, CORBA::Double theWI, CORBA::Double theLtransI, CORBA::Double theLthinI,
- CORBA::Double theRF, CORBA::Boolean theHexMesh,
- GEOM::GEOM_Object_ptr theP1, GEOM::GEOM_Object_ptr theP2, GEOM::GEOM_Object_ptr theP3);
-
- GEOM::GEOM_Object_ptr MakeDividedDisk (CORBA::Double theR,
- CORBA::Double theRatio,
- CORBA::Short theOrientation,
- GEOM::pattern thePattern);
-
- GEOM::GEOM_Object_ptr MakeDividedDiskPntVecR (GEOM::GEOM_Object_ptr theCenter,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Double theR,
- CORBA::Double theRatio,
- GEOM::pattern thePattern);
-
- GEOM::GEOM_Object_ptr MakeDividedCylinder (CORBA::Double theR,
- CORBA::Double theH,
- GEOM::pattern thePattern);
- GEOM::GEOM_Object_ptr MakeSmoothingSurface (const GEOM::ListOfGO& thelPoints);
- /*@@ insert new functions before this line @@ do not remove this line @@*/
-
- ::GEOMImpl_IAdvancedOperations* GetOperations()
- { return (::GEOMImpl_IAdvancedOperations*)GetImpl(); }
-};
-
-#endif
GEOM_ITransformOperations_i.hh \
GEOM_IMeasureOperations_i.hh \
GEOM_IGroupOperations_i.hh \
- GEOM_IAdvancedOperations_i.hh \
GEOM_Gen_i.hh \
GEOM_GEOM_I.hxx \
GEOM_wrap.hxx
GEOM_ITransformOperations_i.cc \
GEOM_IMeasureOperations_i.cc \
GEOM_IGroupOperations_i.cc \
- GEOM_IAdvancedOperations_i.cc \
GEOM_Gen_i.cc \
GEOM_DumpPython.cc
if (CORBA::is_nil(myAdvancedOp) || isNewStudy(myLastStudyID,myStudyID)) {
//rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS"
// Try to get id of the study from the SALOME Session
- if(myStudyID < 0 ) SetStudyID(-1);
- myAdvancedOp = myGeomEngine->GetIAdvancedOperations(myStudyID);
+ if(myStudyID < 0 ) SetStudyID(-1);
+ //myAdvancedOp = myGeomEngine->GetIAdvancedOperations(myStudyID);
+ myAdvancedOp = GEOM::GEOM_IAdvancedOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "AdvancedEngine"));
}
}
CLOSED = 1
UNCLOSED = 2
+##! Private class used to bind calls of plugin operations to geomBuilder
+class PluginOperation:
+ def __init__(self, operation, function):
+ self.operation = operation
+ self.function = function
+ pass
+
+ def __call__(self, *args):
+ res = self.function(self.operation, *args)
+ RaiseIfFailed(self.function.__name__, self.operation)
+ return res
+
# Warning: geom is a singleton
geom = None
engine = None
self.MeasuOp = self.GetIMeasureOperations (self.myStudyId)
self.BlocksOp = self.GetIBlocksOperations (self.myStudyId)
self.GroupOp = self.GetIGroupOperations (self.myStudyId)
- self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
+ #self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
+ self.AdvOp = self.GetPluginOperations (self.myStudyId, "AdvancedEngine")
# set GEOM as root in the use case tree
self.myUseCaseBuilder = self.myStudy.GetUseCaseBuilder()
self.myUseCaseBuilder.SetRootCurrent()
self.myUseCaseBuilder.Append(self.father)
pass
+ def GetPluginOperations(self, studyID, libraryName):
+ op = GEOM._objref_GEOM_Gen.GetPluginOperations(self, studyID, libraryName)
+ if op:
+ # bind methods of operations to self
+ methods = op.__class__.__dict__['__methods__']
+ avoid_methods = self.BasicOp.__class__.__dict__['__methods__']
+ for meth_name in methods:
+ if not meth_name in avoid_methods: # avoid basic methods
+ function = getattr(op.__class__, meth_name)
+ if callable(function):
+ #self.__dict__[meth_name] = self.__PluginOperation(op, function)
+ self.__dict__[meth_name] = PluginOperation(op, function)
+ return op
+
## Enable / disable results auto-publishing
#
# The automatic publishing is managed in the following way:
SUBDIRS += OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \
GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \
EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \
- RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM
+ RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI AdvancedEngine \
+ GEOM_SWIG_WITHIHM
endif
DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER \
GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \
EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \
RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \
- GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition
+ AdvancedEngine GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition