# Author : Marc Tajchman - CEA
# Date : 10/10/2002
# Modified by : Alexander BORODIN (OCN) - autotools usage
-# $Header$
# 13/03/2007: Alexander BORODIN - OCN
# Reorganization for usage of autotools
#
doc/docutils/Makefile \
doc/docutils/conf.py \
doc/salome/Makefile \
+ doc/salome/examples/Makefile \
doc/salome/gui/Makefile \
doc/salome/gui/GEOM/Makefile \
doc/salome/gui/GEOM/doxyfile \
src/DlgRef/Makefile \
src/EntityGUI/Makefile \
src/GEOM/Makefile \
+ src/BlockFix/Makefile \
src/GEOMAlgo/Makefile \
src/GEOMBase/Makefile \
src/GEOMClient/Makefile \
src/GEOMFiltersSelection/Makefile \
src/Material/Makefile \
src/GEOMGUI/Makefile \
+ src/GEOMUtils/Makefile \
src/GEOMImpl/Makefile \
src/GEOMToolsGUI/Makefile \
src/GEOM_I/Makefile \
# -* Makefile *-
# Author : Patrick GOLDBRONN (CEA)
# Date : 30/11/2001
-# Modified by : Alexander BORODIN (OCN) - autotools usage
-# $Header:
+# Modified by : Alexander BORODIN (OCN) - autotools usage
#
-SUBDIRS = tui gui
+SUBDIRS = tui gui examples
SUBDIRSTUI = tui
SUBDIRSGUI = gui
--- /dev/null
+# 3D Sketcher
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# Create a 3D sketcher (wire) on the given points coordinates
+sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
+
+# add object in the study
+id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher1)
+
+# Create a 3D sketcher (wire) with Sketcher3D interface
+
+# get the interface instance
+sk = geompy.Sketcher3D()
+
+# add three points with absolute coordinates
+# the first point will be the start point of sketcher
+# two segments will be added by this command
+sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
+
+# add one segment, defined by two angles in "OXY" coordinate system and length
+sk.addPointAnglesLength("OXY", 45, 0, 100)
+
+# add three points with relative coordinates
+# three segments will be added by this command
+sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
+
+# set to close the sketcher
+sk.close()
+
+# obtain the sketcher result
+sketcher2 = sk.wire()
+
+# add object in the study
+id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher2)
--- /dev/null
+# Copyright (C) 2007-2012 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 : Makefile
+# Author : Alexander KOVALEV (Open Cascade NN)
+# Modified by :
+# Module : doc
+#
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+pyexamplesdir = $(docdir)/examples/GEOM
+
+BAD_TESTS =
+
+GOOD_TESTS = \
+ 3dsketcher.py \
+ advanced_geom_objs_ex01.py \
+ advanced_geom_objs_ex02.py \
+ advanced_geom_objs_ex03.py \
+ angle.py \
+ basic_geom_objs_ex01.py \
+ basic_geom_objs_ex02.py \
+ basic_geom_objs_ex03.py \
+ basic_geom_objs_ex04.py \
+ basic_geom_objs_ex05.py \
+ basic_geom_objs_ex06.py \
+ basic_geom_objs_ex07.py \
+ basic_geom_objs_ex08.py \
+ basic_geom_objs_ex09.py \
+ basic_operations_ex01.py \
+ basic_operations_ex02.py \
+ basic_operations_ex03.py \
+ basic_properties.py \
+ blocks_operations_ex01.py \
+ blocks_operations_ex02.py \
+ blocks_operations_ex03.py \
+ boolean_operations_ex01.py \
+ boolean_operations_ex02.py \
+ boolean_operations_ex03.py \
+ boolean_operations_ex04.py \
+ bounding_box.py \
+ building_by_blocks_ex01.py \
+ building_by_blocks_ex02.py \
+ center_of_mass.py \
+ check_compound_of_blocks.py \
+ check_self_intersections.py \
+ check_shape.py \
+ complex_objs_ex01.py \
+ complex_objs_ex02.py \
+ complex_objs_ex03.py \
+ complex_objs_ex04.py \
+ complex_objs_ex05.py \
+ complex_objs_ex06.py \
+ complex_objs_ex07.py \
+ complex_objs_ex08.py \
+ complex_objs_ex09.py \
+ complex_objs_ex10.py \
+ free_boundaries.py \
+ free_faces.py \
+ get_non_blocks.py \
+ import_export.py \
+ inertia.py \
+ min_distance.py \
+ normal_face.py \
+ notebook_geom.py \
+ point_coordinates.py \
+ primitives_ex01.py \
+ primitives_ex02.py \
+ primitives_ex03.py \
+ primitives_ex04.py \
+ primitives_ex05.py \
+ primitives_ex06.py \
+ primitives_ex07.py \
+ repairing_operations_ex01.py \
+ repairing_operations_ex02.py \
+ repairing_operations_ex03.py \
+ repairing_operations_ex04.py \
+ repairing_operations_ex05.py \
+ repairing_operations_ex06.py \
+ repairing_operations_ex07.py \
+ repairing_operations_ex08.py \
+ repairing_operations_ex09.py \
+ repairing_operations_ex10.py \
+ repairing_operations_ex11.py \
+ sketcher.py \
+ tolerance.py \
+ topological_geom_objs_ex01.py \
+ topological_geom_objs_ex02.py \
+ topological_geom_objs_ex03.py \
+ topological_geom_objs_ex04.py \
+ topological_geom_objs_ex05.py \
+ topological_geom_objs_ex06.py \
+ transformation_operations_ex01.py \
+ transformation_operations_ex02.py \
+ transformation_operations_ex03.py \
+ transformation_operations_ex04.py \
+ transformation_operations_ex05.py \
+ transformation_operations_ex06.py \
+ transformation_operations_ex07.py \
+ transformation_operations_ex08.py \
+ transformation_operations_ex09.py \
+ transformation_operations_ex10.py \
+ transformation_operations_ex11.py \
+ transformation_operations_ex12.py \
+ transformation_operations_ex13.py \
+ viewing_geom_objs_ex01.py \
+ viewing_geom_objs_ex02.py \
+ viewing_geom_objs_ex03.py \
+ viewing_geom_objs_ex04.py \
+ whatis.py \
+ working_with_groups_ex01.py \
+ working_with_groups_ex02.py \
+ working_with_groups_ex03.py \
+ working_with_groups_ex04.py \
+ working_with_groups_ex05.py \
+ working_with_groups_ex06.py
+
+pyexamples_SCRIPTS = $(BAD_TESTS) $(GOOD_TESTS)
+
+EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py
+
+check-local:
+ @for f in $(GOOD_TESTS) ; do \
+ python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
+ done
--- /dev/null
+# Creation of PipeTShape
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create PipeTShape object
+pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
+
+# add object in the study
+id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
+# add groups in the study
+for g in pipetshape[1:]:
+ geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
+
+# Create junction vertices
+P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
+P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
+P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
+
+# create PipeTShape object with position
+pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
+# add groups in the study
+for g in pipetshape_position[1:]:
+ geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
+
+# create PipeTShape with chamfer object
+pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
+
+# add object in the study
+id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
+# add groups in the study
+for g in pipetshapechamfer[1:]:
+ geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
+
+# create PipeTShape with chamfer object with position
+pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
+# add groups in the study
+for g in pipetshapechamfer_position[1:]:
+ geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
+
+# create PipeTShape with fillet object
+pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
+
+# add object in the study
+id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
+# add groups in the study
+for g in pipetshapefillet[1:]:
+ geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
+
+# create PipeTShape with fillet object with position
+pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
+
+# add object in the study
+id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
+# add groups in the study
+for g in pipetshapefillet_position[1:]:
+ geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
+
+
+# display pipetshapes
+gg.createAndDisplayGO(id_pipetshape)
+gg.createAndDisplayGO(id_pipetshape_position)
+gg.createAndDisplayGO(id_pipetshapechamfer)
+gg.createAndDisplayGO(id_pipetshapechamfer_position)
+gg.createAndDisplayGO(id_pipetshapefillet)
+gg.createAndDisplayGO(id_pipetshapefillet_position)
--- /dev/null
+# Creation of DividedDisk
+
+import geompy
+import salome
+import GEOM
+gg = salome.ImportComponentGUI("GEOM")
+
+# create DividedDisk object
+divideddisk = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
+
+# add object in the study
+id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
+
+# display divideddisk
+gg.createAndDisplayGO(id_divideddisk)
--- /dev/null
+# Creation of DividedCylinder
+
+import geompy
+import salome
+import GEOM
+gg = salome.ImportComponentGUI("GEOM")
+
+# create DividedCylinder object
+dividedcylinder = geompy.MakeDividedCylinder(100, 300, GEOM.SQUARE)
+
+# add object in the study
+id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder")
+
+# display dividedcylinder
+gg.createAndDisplayGO(id_dividedcylinder)
--- /dev/null
+# Angle
+
+import salome
+salome.salome_init()
+
+import math
+import geompy
+geompy.init_geom(salome.myStudy)
+
+OX = geompy.MakeVectorDXDYDZ(10, 0,0)
+OXY = geompy.MakeVectorDXDYDZ(10,10,0)
+
+# in one plane
+Angle = geompy.GetAngle(OX, OXY)
+
+print "\nAngle between OX and OXY = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+ print " Error: returned angle is", Angle, "while must be 45.0"
+ pass
+
+Angle = geompy.GetAngleRadians(OX, OXY)
+
+print "\nAngle between OX and OXY in radians = ", Angle
+if math.fabs(Angle - math.pi/4) > 1e-05:
+ print " Error: returned angle is", Angle, "while must be pi/4"
+ pass
+
+Angle = geompy.GetAngleVectors(OX, OXY, True)
+
+print "\nAngle between vectors OX and OXY = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+ print " Error: returned angle is", Angle, "while must be 45.0"
+ pass
+
+Angle = geompy.GetAngleRadiansVectors(OX, OXY, False)
+
+print "\nBig angle between vectors OX and OXY in radians = ", Angle
+if math.fabs(Angle - math.pi*7./4.) > 1e-05:
+ print " Error: returned angle is", Angle, "while must be 7*pi/4"
+ pass
+
+# not in one plane
+OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
+Angle = geompy.GetAngle(OX, OXY_shift)
+
+print "\nAngle between OX and OXY_shift = ", Angle
+if math.fabs(Angle - 45.0) > 1e-05:
+ print " Error: returned angle is", Angle, "while must be 45.0"
+ pass
+
+# not linear
+pnt1 = geompy.MakeVertex(0, 0, 0)
+pnt2 = geompy.MakeVertex(10, 0, 0)
+pnt3 = geompy.MakeVertex(20, 10, 0)
+arc = geompy.MakeArc(pnt1, pnt2, pnt3)
+Angle = geompy.GetAngle(OX, arc)
+
+if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()):
+ print "Error. Angle must not be computed on curvilinear edges"
+ pass
--- /dev/null
+# Creation of a Point
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex(0., 100., 0.)
+pz = geompy.MakeVertex(0., 0., 100.)
+p1 = geompy.MakeVertex(50., 50., 30.)
+
+# create a curve and vertices on it
+Arc = geompy.MakeArc(py, pz, px)
+# create a vertex by parameter
+p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
+# create a vertex by length
+p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None)
+#create a vertex by point projection
+p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
+
+# create 2 lines and make a point on its intersection
+line_1 = geompy.MakeLineTwoPnt(p0, p100)
+line_2 = geompy.MakeLineTwoPnt(p1, pz)
+p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2)
+
+# create a face and vertices on it
+Add_line = geompy.MakeLineTwoPnt(px, py)
+arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
+p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
+p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
+p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
+
+
+# add objects in the study
+id_p0 = geompy.addToStudy(p0, "Vertex 0")
+id_p100 = geompy.addToStudy(p100, "Vertex 100")
+id_px = geompy.addToStudy(px, "Vertex X")
+id_py = geompy.addToStudy(py, "Vertex Y")
+id_pz = geompy.addToStudy(pz, "Vertex Z")
+id_Arc = geompy.addToStudy(Arc, "Arc")
+id_line_1 = geompy.addToStudy(line_1, "Line 1")
+id_line_2 = geompy.addToStudy(line_2, "Line 2")
+id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
+id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length")
+id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection")
+id_p_inter = geompy.addToStudy(p_inter, "Vertex on Lines Intersection")
+id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
+id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
+id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
+
+# display vertices
+gg.createAndDisplayGO(id_p0)
+gg.createAndDisplayGO(id_p100)
+gg.createAndDisplayGO(id_Arc)
+gg.createAndDisplayGO(id_p_inter)
+gg.createAndDisplayGO(id_p_on_arc)
+gg.createAndDisplayGO(id_p_on_arc2)
+gg.createAndDisplayGO(id_p_on_arc3)
--- /dev/null
+# Creation of a Line
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create a line from a point and a vector
+line1 = geompy.MakeLine(pz, vxy)
+
+#create a line from two points
+line2 = geompy.MakeLineTwoPnt(p0, p100)
+
+# add objects in the study
+id_vxy = geompy.addToStudy(vxy, "Vector")
+id_line1 = geompy.addToStudy(line1,"Line1")
+id_line2 = geompy.addToStudy(line2,"Line2")
+
+# display lines
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_line1)
+gg.createAndDisplayGO(id_line2)
--- /dev/null
+# Creation of a Circle
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+
+# create a vector on two points
+vxy = geompy.MakeVector(px, py)
+
+# create a circle from a point, a vector and a radius
+circle1 = geompy.MakeCircle(pz, vxy, 30)
+
+#create a circle from three points
+circle2 = geompy.MakeCircleThreePnt(p0, px, py)
+
+# add objects in the study
+id_vxy = geompy.addToStudy(vxy, "Vector")
+id_circle1 = geompy.addToStudy(circle1,"Circle1")
+id_circle2 = geompy.addToStudy(circle2,"Circle2")
+
+# display circles
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_circle1)
+gg.createAndDisplayGO(id_circle2)
--- /dev/null
+# Creation of an Ellipse
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p1 = geompy.MakeVertex(50., 50., 50.)
+p2 = geompy.MakeVertex(0., 50., 0.)
+
+# create a normal vector from two points
+normal = geompy.MakeVector(p0, p1)
+
+# create a major axis vector from two points
+major = geompy.MakeVector(p0, p2)
+
+# create an ellipse from a point, a vector and radiuses
+ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
+
+# create an ellipse from a point, a normal vector, radiuses and a major axis vector
+ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
+
+# add objects in the study
+id_normal = geompy.addToStudy(normal, "Normal")
+id_major = geompy.addToStudy(major, "Major Axis")
+id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
+id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
+
+# display the ellipse and its normal vector
+gg.createAndDisplayGO(id_normal)
+gg.createAndDisplayGO(id_major)
+gg.createAndDisplayGO(id_ellipse1)
+gg.createAndDisplayGO(id_ellipse2)
--- /dev/null
+# Creation of an Arc
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+p1 = geompy.MakeVertex(100., 0., 0.)
+p2 = geompy.MakeVertex(50., 0., 50.)
+
+# create an arc from a three points
+arc1 = geompy.MakeArc(p0, p1, p2)
+
+# create an arc from a center point, a start point and end point
+arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
+
+# create an arc from a center point, a major point and minor point
+arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
+
+# add objects in the study
+id_arc1 = geompy.addToStudy(arc1, "Arc 1")
+id_arc2 = geompy.addToStudy(arc2, "Arc 2")
+id_arc3 = geompy.addToStudy(arc3, "Arc 3")
+
+# display the arcs
+gg.createAndDisplayGO(id_arc1)
+gg.createAndDisplayGO(id_arc2)
+gg.createAndDisplayGO(id_arc3)
--- /dev/null
+# Creation of a Curve
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+p1 = geompy.MakeVertex(50. , 100., 200.)
+p2 = geompy.MakeVertex(150., 50., 100.)
+p3 = geompy.MakeVertex(100., 150., 170.)
+p4 = geompy.MakeVertex(200., 200., 150.)
+
+v1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+v2 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+
+# create a polyline from a list of points
+polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
+
+# create a bezier curve from a list of points
+bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
+
+#create a b-spline curve from a list of points
+interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
+
+#create a b-spline curve with defined directions at the ends
+interpol_tangents = geompy.MakeInterpolWithTangents([p0, p1, p2, p3, p4], v1, v2)
+
+#create a polyline using parametric definition of the basic points
+param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
+
+# create a bezier curve using parametric definition of the basic points
+param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 20, geompy.GEOM.Bezier, theNewMethod=True)
+
+#create a b-spline curve using parametric definition of the basic points
+param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True)
+
+
+# add objects in the study
+id_p0 = geompy.addToStudy(p0, "Point1")
+id_p1 = geompy.addToStudy(p1, "Point2")
+id_p2 = geompy.addToStudy(p2, "Point3")
+id_p3 = geompy.addToStudy(p3, "Point4")
+id_p4 = geompy.addToStudy(p4, "Point5")
+id_v1 = geompy.addToStudy(v1, "Vector1")
+id_v2 = geompy.addToStudy(v2, "Vector2")
+id_polyline = geompy.addToStudy(polyline, "Polyline")
+id_bezier = geompy.addToStudy(bezier, "Bezier")
+id_interpol = geompy.addToStudy(interpol, "Interpol")
+id_interpol_tangents = geompy.addToStudy(interpol_tangents, "Interpol Tangents")
+id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
+id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
+id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
+
+
+# display the points and the curves
+gg.createAndDisplayGO(id_p0)
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_p3)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_polyline)
+gg.createAndDisplayGO(id_bezier)
+gg.createAndDisplayGO(id_interpol)
+gg.createAndDisplayGO(id_interpol_tangents)
+gg.createAndDisplayGO(id_param_polyline)
+gg.createAndDisplayGO(id_param_bezier)
+gg.createAndDisplayGO(id_param_interpol)
--- /dev/null
+# Creation of a Vector
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(10., 50., 20.)
+p2 = geompy.MakeVertex(70., 70., 70.)
+
+# create a vector from two points
+vector1 = geompy.MakeVector(p1, p2)
+
+# create a vector from the given components
+vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
+
+# add objects in the study
+id_p1 = geompy.addToStudy(p1, "Point1")
+id_p2 = geompy.addToStudy(p2, "Point2")
+id_vector1 = geompy.addToStudy(vector1,"Vector1")
+id_vector2 = geompy.addToStudy(vector2,"Vector2")
+
+# display the points and the vectors
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_vector1)
+gg.createAndDisplayGO(id_vector2)
--- /dev/null
+# Creation of a Plane
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex( 0., 0., 100.)
+p2 = geompy.MakeVertex(100., 0., 0.)
+p3 = geompy.MakeVertex(200., 200., 200.)
+p4 = geompy.MakeVertex(100., 100., 0.)
+p5 = geompy.MakeVertex(0. , 100., 0.)
+
+# create a vectors from the given components
+vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
+
+# create a vector from two points
+vector_arc = geompy.MakeVector(p2, p5)
+
+# create an arc from three points
+arc = geompy.MakeArc(p2, p4, p5)
+
+# create a wire
+wire = geompy.MakeWire([vector_arc, arc])
+
+# create a face
+isPlanarWanted = 1
+face = geompy.MakeFace(wire, isPlanarWanted)
+trimsize = 1000.
+
+# create a Local Coordinate System
+
+LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
+
+# create a plane from a point, a vector and a trimsize
+plane1 = geompy.MakePlane(p1, vector1, trimsize)
+
+# create a plane from three points and a trimsize
+plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
+
+# create a plane from the given face
+plane3 = geompy.MakePlaneFace(face, trimsize)
+
+# create a plane from two vectors and a trimsize
+plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
+
+# create a plane with the Local Coordinate System and a trimsize
+plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
+
+# add objects in the study
+id_face = geompy.addToStudy(face, "Face")
+id_plane1 = geompy.addToStudy(plane1,"Plane1")
+id_plane2 = geompy.addToStudy(plane2,"Plane2")
+id_plane3 = geompy.addToStudy(plane3,"Plane3")
+id_plane4 = geompy.addToStudy(plane4,"Plane4")
+id_plane5 = geompy.addToStudy(plane5,"Plane5")
+
+# display the points and the vectors
+gg.createAndDisplayGO(id_face)
+gg.createAndDisplayGO(id_plane1)
+gg.createAndDisplayGO(id_plane2)
+gg.createAndDisplayGO(id_plane3)
+gg.createAndDisplayGO(id_plane4)
+gg.createAndDisplayGO(id_plane5)
+gg.setDisplayMode(id_plane1,1)
+gg.setTransparency(id_plane1,0.5)
+gg.setDisplayMode(id_plane2,1)
+gg.setTransparency(id_plane2,0.5)
+gg.setDisplayMode(id_plane3,1)
+gg.setTransparency(id_plane3,0.5)
+gg.setDisplayMode(id_plane4,1)
+gg.setTransparency(id_plane4,0.5)
+gg.setDisplayMode(id_plane5,1)
+gg.setTransparency(id_plane5,0.5)
--- /dev/null
+# Creation of a Local Coordinate System
+
+import GEOM
+import geompy
+import math
+import SALOMEDS
+
+#Create vertexes, vectors and shapes to construct local CS
+Vertex_1 = geompy.MakeVertex(50, 50, 50)
+Vertex_2 = geompy.MakeVertex(70, 70, 70)
+Vertex_3 = geompy.MakeVertex(0, 0, 0)
+Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
+Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
+Face_1 = geompy.MakeFaceHW(100, 100, 1)
+Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
+
+#Construct local CS by manual definition
+LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
+
+#Construct local CS by center point and two vectors (X and Y directions)
+LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
+
+#Construct local CS from shape orientation
+LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
+LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
+
+#Add created object to study
+geompy.addToStudy( Face_1, "Face_1" )
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Box_1, "Box_1" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vector_X, "Vector_X" )
+geompy.addToStudy( Vector_Y, "Vector_Y" )
+geompy.addToStudy( LocalCS_1, "LocalCS_1" )
+geompy.addToStudy( LocalCS_2, "LocalCS_3" )
+geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
+geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )
--- /dev/null
+# Partition
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p0 = geompy.MakeVertex( 0., 0., 0.)
+p200 = geompy.MakeVertex(200., 200., 200.)
+pz = geompy.MakeVertex( 0., 0., 100.)
+
+# create a vector
+vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+
+# create a box from two points
+box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a plane
+trimsize = 500.
+plane = geompy.MakePlane(pz, vxyz, trimsize)
+
+# create partition objects
+partition1 = geompy.MakePartition([box], [plane])
+partition2 = geompy.Partition([box], [plane])
+partition3 = geompy.MakeHalfPartition(box, plane)
+
+# add objects in the study
+id_box = geompy.addToStudy(box,"Box")
+id_plane = geompy.addToStudy(plane,"Plane")
+id_partition1 = geompy.addToStudy(partition1,"MakePartition")
+id_partition2 = geompy.addToStudy(partition2,"Partition")
+id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
+
+# display the partition objects and the plane
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_plane)
+gg.setDisplayMode(id_plane,1)
+gg.createAndDisplayGO(id_partition1)
+gg.createAndDisplayGO(id_partition2)
+gg.createAndDisplayGO(id_partition3)
--- /dev/null
+# Archimede
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p0 = geompy.MakeVertex( 0., 0., 0.)
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# perform an Archimede operation on the selected shape with selected parameters
+weight = 1000000.
+waterdensity = 1.
+meshingdeflection = 0.01
+archimede = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
+
+# add objects in the study
+id_box = geompy.addToStudy(box,"Box")
+id_archimede = geompy.addToStudy(archimede,"Archimede")
+
+# display the box and the result of Archimede operation
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_archimede)
+gg.setDisplayMode(id_archimede,1)
--- /dev/null
+# Restore presentation parameters and sub-shapes
+
+import geompy
+import GEOM
+import SALOMEDS
+
+# create a box and a cylinder
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+cyl = geompy.MakeCylinderRH(100, 300)
+
+# create translated box
+vec = geompy.MakeVectorDXDYDZ(100, 50, 0)
+tra = geompy.MakeTranslationVector(box, vec)
+
+# create partition objects
+partition1 = geompy.MakePartition([box, cyl])
+partition2 = geompy.MakePartition([box], [cyl])
+partition3 = geompy.MakePartition([box], [tra])
+
+# set colours
+box.SetColor(SALOMEDS.Color(1,0,0))
+cyl.SetColor(SALOMEDS.Color(0,1,0))
+
+# add objects in the study
+geompy.addToStudy(box, "Box")
+geompy.addToStudy(cyl, "Cylinder")
+geompy.addToStudy(vec, "Vector")
+geompy.addToStudy(tra, "Translation")
+geompy.addToStudy(partition1, "Partition_1")
+geompy.addToStudy(partition2, "Partition_2")
+geompy.addToStudy(partition3, "Partition_3")
+
+# Restore presentation parameters and sub-shapes
+# different methods can be used to find the sub-shapes in the result:
+# GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape.
+# By default, GetInPlace method is used (GEOM.FSM_GetInPlace)
+geompy.RestoreSubShapes(partition1)
+
+geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace)
+
+# The list of arguments can be used to avoid restoring all arguments,
+# but restore only the passed.
+geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory)
+
+# To find sub-shapes in a transformed shape only one method could be
+# used: pass GEOM.FSM_Transformed for that.
+# True passed for the last argument, means that the transformed shape
+# will inherit colour and sub-shapes from its first argument (see above
+# MakeTranslation).
+geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True)
+
+# Also we could do this directly with method addToStudy:
+partition4 = geompy.MakePartition([box, tra])
+geompy.addToStudy(partition4, "Partition_4", True, [],
+ GEOM.FSM_GetInPlaceByHistory, False)
--- /dev/null
+# Basic Properties
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+props = geompy.BasicProperties(box)
+print "\nBox 100x30x100 Basic Properties:"
+print " Wires length: ", props[0]
+print " Surface area: ", props[1]
+print " Volume : ", props[2]
+length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
+area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
+volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
+if length > 1e-7 or area > 1e-7 or volume > 1e-7:
+ print "While must be:"
+ print " Wires length: ", 1840
+ print " Surface area: ", 32000
+ print " Volume : ", 300000.
--- /dev/null
+# Multi Transformation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p_25_25_50 = geompy.MakeVertex(25., 25., 50.)
+p_50_25_25 = geompy.MakeVertex(50., 25., 25.)
+p_25_50_25 = geompy.MakeVertex(25., 50., 25.)
+
+box = geompy.MakeBoxDXDYDZ(50, 50, 50)
+
+top_face = geompy.GetFaceNearPoint(box, p_25_25_50)
+yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)
+xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)
+
+top_face_ind = geompy.GetSubShapeID(box, top_face)
+yz_face_ind = geompy.GetSubShapeID(box, yz_face)
+xz_face_ind = geompy.GetSubShapeID(box, xz_face)
+
+# Multi-transformate block and glue the result
+box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)
+box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")
+id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_box_tr1)
+gg.createAndDisplayGO(id_box_tr2)
--- /dev/null
+# Explode on Blocks
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+sphere = geompy.MakeSphereR(100)
+
+# make a compound
+compound = geompy.MakeCompound([box, sphere])
+
+# get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
+min_nb_faces = 6
+max_nb_faces = 6
+make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
+
+# add objects in the study
+id_compound = geompy.addToStudy(compound, "Compound")
+id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
+
+# display the results
+gg.createAndDisplayGO(id_compound)
+gg.createAndDisplayGO(id_make_block_explode)
+gg.setDisplayMode(id_make_block_explode,1)
--- /dev/null
+# Propagate
+
+import geompy
+import salome
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# build all possible propagation groups
+listChains = geompy.Propagate(check_box)
+
+# add objects in the study
+geompy.addToStudy(check_box, "Box")
+ii = 1
+for chain in listChains:
+ geompy.addToStudyInFather(check_box, chain, "propagation chain " + `ii`)
+ ii = ii + 1
+ pass
+
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Fuse
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0, 0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# fuse
+fuse1 = geompy.MakeFuse(cylinder, sphere)
+fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
+
+# add objects in the study
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_sphere = geompy.addToStudy(sphere, "Sphere")
+id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
+id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
+
+# display results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_sphere)
+gg.setDisplayMode(id_sphere,1)
+gg.createAndDisplayGO(id_fuse1)
+gg.setDisplayMode(id_fuse1,1)
+gg.createAndDisplayGO(id_fuse2)
+gg.setDisplayMode(id_fuse2,1)
--- /dev/null
+# Common
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0, 0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# make common
+common = geompy.MakeCommon(cylinder, sphere)
+
+# add objects in the study
+id_common = geompy.addToStudy(common, "Common")
+
+# display the results
+gg.createAndDisplayGO(id_common)
+gg.setDisplayMode(id_common,1)
--- /dev/null
+# Cut
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0, 0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+#cut
+cut = geompy.MakeCut(cylinder, sphere)
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1)
--- /dev/null
+# Section
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 55, 0)
+p2 = geompy.MakeVertex( 0, 0, 0)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a sphere
+sphere = geompy.MakeSphereR(40)
+
+# make a section
+section = geompy.MakeSection(cylinder, sphere)
+
+# add objects in the study
+id_section = geompy.addToStudy(section, "Section")
+
+# display the results
+gg.createAndDisplayGO(id_section)
+gg.setDisplayMode(id_section,1)
--- /dev/null
+# Bounding Box
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+
+bb = geompy.BoundingBox(box)
+print "\nBounding Box of box 100x30x100:"
+print " Xmin = ", bb[0], ", Xmax = ", bb[1]
+print " Ymin = ", bb[2], ", Ymax = ", bb[3]
+print " Zmin = ", bb[4], ", Zmax = ", bb[5]
+
+aBB = geompy.MakeBoundingBox(box)
+
+geompy.addToStudy(box, "box 100x30x100")
+geompy.addToStudy(aBB, "Bounding box of box 100x30x100")
--- /dev/null
+# Quadrangle Face
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex( 0., 0., 0.)
+p2 = geompy.MakeVertex(150., 30., 0.)
+p3 = geompy.MakeVertex( 0., 120., 50.)
+p4 = geompy.MakeVertex( 0., 40., 70.)
+
+# create edges
+edge1 = geompy.MakeEdge(p1, p2)
+edge2 = geompy.MakeEdge(p2, p3)
+edge3 = geompy.MakeEdge(p3, p4)
+edge4 = geompy.MakeEdge(p4, p1)
+
+# create a quadrangle face from four edges
+qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
+
+# create a quadrangle face from two edges
+qface2 = geompy.MakeQuad2Edges(edge1, edge3)
+
+# create a quadrangle from four points in its corners
+qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
+
+# add objects in the study
+id_p1 = geompy.addToStudy(p1,"Point1")
+id_p2 = geompy.addToStudy(p2,"Point2")
+id_p3 = geompy.addToStudy(p3,"Point3")
+id_p4 = geompy.addToStudy(p4,"Point4")
+id_edge1 = geompy.addToStudy(edge1,"Edge1")
+id_edge2 = geompy.addToStudy(edge2,"Edge2")
+id_edge3 = geompy.addToStudy(edge3,"Edge3")
+id_edge4 = geompy.addToStudy(edge4,"Edge4")
+id_qface1 = geompy.addToStudy(qface1,"Qface1")
+id_qface2 = geompy.addToStudy(qface2,"Qface2")
+id_qface3 = geompy.addToStudy(qface3,"Qface3")
+
+# display the vertices, the edges and the quadrangle faces
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_p3)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_edge1)
+gg.createAndDisplayGO(id_edge2)
+gg.createAndDisplayGO(id_edge3)
+gg.createAndDisplayGO(id_edge4)
+gg.createAndDisplayGO(id_qface1)
+gg.setDisplayMode(id_qface1,1)
+gg.createAndDisplayGO(id_qface2)
+gg.setDisplayMode(id_qface2,1)
+gg.createAndDisplayGO(id_qface3)
+gg.setDisplayMode(id_qface3,1)
--- /dev/null
+# Hexagonal Solid
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex( 0., 0., 0.)
+p1 = geompy.MakeVertex( 0., 0., 40.)
+p2 = geompy.MakeVertex( 70., -15., 0.)
+p3 = geompy.MakeVertex( 70., -15., 70.)
+
+p4 = geompy.MakeVertex( 0., 70., 0.)
+p5 = geompy.MakeVertex( 0., 70., 40.)
+p6 = geompy.MakeVertex( 70., 70., 0.)
+p7 = geompy.MakeVertex( 70., 70., 70.)
+
+p8 = geompy.MakeVertex( 0., -50., 0.)
+p9 = geompy.MakeVertex( 0., -50., 40.)
+p10 = geompy.MakeVertex( 70., -35., 0.)
+p11 = geompy.MakeVertex( 70., -35., 70.)
+
+# create faces
+qface1 = geompy.MakeQuad4Vertices(p0, p1, p2, p3)
+qface2 = geompy.MakeQuad4Vertices(p4, p5, p6, p7)
+qface3 = geompy.MakeQuad4Vertices(p0, p1, p4, p5)
+qface4 = geompy.MakeQuad4Vertices(p2, p3, p6, p7)
+qface5 = geompy.MakeQuad4Vertices(p0, p2, p4, p6)
+qface6 = geompy.MakeQuad4Vertices(p1, p3, p5, p7)
+qface7 = geompy.MakeQuad4Vertices(p8, p9, p10, p11)
+
+# create a hexahedral solid between two given faces
+solid1 = geompy.MakeHexa2Faces(qface1, qface7)
+
+# create a hexahedral solid, bounded by six given faces
+solid2 = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
+
+# add objects in the study
+geompy.addToStudy(qface1,"qface1")
+geompy.addToStudy(qface2,"qface2")
+geompy.addToStudy(qface3,"qface3")
+geompy.addToStudy(qface4,"qface4")
+geompy.addToStudy(qface5,"qface5")
+geompy.addToStudy(qface6,"qface6")
+geompy.addToStudy(qface7,"qface7")
+
+id_solid1 = geompy.addToStudy(solid1,"Solid1")
+id_solid2 = geompy.addToStudy(solid2,"Solid2")
+
+# display solids
+gg.createAndDisplayGO(id_solid1)
+gg.setDisplayMode(id_solid1, 1)
+gg.createAndDisplayGO(id_solid2)
+gg.setDisplayMode(id_solid2, 1)
--- /dev/null
+# Center of masses
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+cm = geompy.MakeCDG(box)
+if cm is None:
+ raise RuntimeError, "MakeCDG(box) failed"
+else:
+ print "\nCentre of gravity of box has been successfully obtained:"
+ coords = geompy.PointCoordinates(cm)
+ print "(", coords[0], ", ", coords[1], ", ", coords[2], ")"
+ dx = math.sqrt((coords[0] - 50)*(coords[0] - 50))
+ dy = math.sqrt((coords[1] - 15)*(coords[1] - 15))
+ dz = math.sqrt((coords[2] - 50)*(coords[2] - 50))
+ if dx > 1e-7 or dy > 1e-7 or dz > 1e-7:
+ print "But must be (50, 15, 50)"
--- /dev/null
+# Check Compound of Blocks
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make a compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue the faces of the compound
+tolerance = 1e-5
+glue = geompy.MakeGlueFaces(compound, tolerance)
+IsValid = geompy.CheckCompoundOfBlocks(glue)
+if IsValid == 0:
+ raise RuntimeError, "Invalid compound created"
+else:
+ print "\nCompound is valid"
--- /dev/null
+# Detect Self-intersections
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+IsValid = geompy.CheckSelfIntersections(box)
+if IsValid == 0:
+ raise RuntimeError, "Box with self-intersections created"
+else:
+ print "\nBox is valid"
--- /dev/null
+# Check Shape
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+IsValid = geompy.CheckShape(box)
+if IsValid == 0:
+ raise RuntimeError, "Invalid box created"
+else:
+ print "\nBox is valid"
--- /dev/null
+# Creation of a Prism
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex( 0., 0., 0.)
+p2 = geompy.MakeVertex( 100., 0., 0.)
+p3 = geompy.MakeVertex( 100., 100., 0.)
+p4 = geompy.MakeVertex( 0., 100., 0.)
+p5 = geompy.MakeVertex( 0., 0., 60.)
+p6 = geompy.MakeVertex(-100., 0., 0.)
+p7 = geompy.MakeVertex(-100.,-100., 0.)
+p8 = geompy.MakeVertex( 0.,-100., 0.)
+
+# create a vector from the given components
+vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
+
+#create vectors from two points
+vector1_arc1 = geompy.MakeVector(p1, p2)
+vector2_arc1 = geompy.MakeVector(p1, p4)
+vector1_arc2 = geompy.MakeVector(p1, p6)
+vector2_arc2 = geompy.MakeVector(p1, p8)
+
+# create arcs from three points
+arc1 = geompy.MakeArc(p2, p3, p4)
+arc2 = geompy.MakeArc(p6, p7, p8)
+
+# create wires
+wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
+wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
+
+# create faces
+isPlanarWanted = 1
+face1 = geompy.MakeFace(wire1, isPlanarWanted)
+face2 = geompy.MakeFace(wire2, isPlanarWanted)
+
+# create prisms
+prism1 = geompy.MakePrism(face2, p1, p5)
+prism2 = geompy.MakePrismVecH(face1, vector, 50)
+prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
+
+# add objects in the study
+id_face1 = geompy.addToStudy(face1,"Face1")
+id_face2 = geompy.addToStudy(face2,"Face2")
+id_prism1 = geompy.addToStudy(prism1,"Prism1")
+id_prism2 = geompy.addToStudy(prism2,"Prism2")
+id_prism3 = geompy.addToStudy(prism3,"Prism3")
+
+# display cylinders
+gg.createAndDisplayGO(id_face1)
+gg.setDisplayMode(id_face1,1)
+gg.createAndDisplayGO(id_face2)
+gg.setDisplayMode(id_face2,1)
+gg.createAndDisplayGO(id_prism1)
+gg.setDisplayMode(id_prism1,1)
+gg.createAndDisplayGO(id_prism2)
+gg.setDisplayMode(id_prism2,1)
+gg.createAndDisplayGO(id_prism3)
+gg.setDisplayMode(id_prism3,1)
--- /dev/null
+# Creation of a Revolution
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex( 10., 10., 10.)
+p2 = geompy.MakeVertex( 15., 15., 50.)
+p3 = geompy.MakeVertex( 40., 40., 0.)
+
+#create vectors from two points
+vector1 = geompy.MakeVector(p1, p2)
+vector2 = geompy.MakeVector(p1, p3)
+
+# create a vector from the given components
+vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
+
+# create a wire
+wire = geompy.MakeWire([vector1, vector2])
+
+# create a revolution
+revolution = geompy.MakeRevolution(wire, vector3, 2.3)
+
+# add objects in the study
+id_vector3 = geompy.addToStudy(vector3,"Axis")
+id_wire = geompy.addToStudy(wire,"Wire")
+id_revolution = geompy.addToStudy(revolution,"Revolution")
+
+# display the vector, the wire and the revolution
+gg.createAndDisplayGO(id_vector3)
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_revolution)
+gg.setDisplayMode(id_revolution,1)
--- /dev/null
+# Creation of a Filling
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+mindeg = 2
+maxdeg = 5
+tol3d = 0.0001
+tol2d = 0.0001
+nbiter = 5
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex( -30., -30., 50.)
+p2 = geompy.MakeVertex( -60., -60., 30.)
+p3 = geompy.MakeVertex( -30., -30., 10.)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+ShapeListCompound = []
+i = 0
+while i <= 3 :
+ S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
+ ShapeListCompound.append(S)
+ i = i + 1
+
+compound = geompy.MakeCompound(ShapeListCompound)
+
+# create a filling
+filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
+
+# add objects in the study
+id_compound = geompy.addToStudy(compound,"Compound")
+id_filling = geompy.addToStudy(filling,"Filling")
+
+# display the compound and the filling
+gg.createAndDisplayGO(id_compound)
+gg.createAndDisplayGO(id_filling)
+gg.setDisplayMode(id_filling,1)
--- /dev/null
+# Creation of a Pipe
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create an edge
+edge = geompy.MakeEdge(p0, pxyz)
+
+# create a pipe
+pipe = geompy.MakePipe(wire, edge)
+
+# add objects in the study
+id_wire = geompy.addToStudy(wire,"Wire")
+id_edge = geompy.addToStudy(edge,"Edge")
+id_pipe = geompy.addToStudy(pipe,"Pipe")
+
+# display the wire, the edge (path) and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_edge)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
--- /dev/null
+# Creation of a PipeWithDifferentSections
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+Wire_1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
+edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
+vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
+
+# create sections
+circles=[]
+circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
+circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
+circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
+circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
+
+# create pipe
+Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
+
+# add objects in the study
+geompy.addToStudy(circles[0], "circles1")
+geompy.addToStudy(circles[1], "circles2")
+geompy.addToStudy(circles[2], "circles3")
+geompy.addToStudy(circles[3], "circles4")
+id_wire = geompy.addToStudy(Wire_1, "Path")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path) and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
--- /dev/null
+# Creation of a PipeWithShellSections
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create path
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
+
+#=======================================================
+# Create shell sections
+#=======================================================
+ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
+theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
+VC = geompy.MakeCompound(theLocations)
+geompy.addToStudy(VC,"VC")
+vs = [Edge_1,Edge_1,Edge_3,Edge_3]
+hs = [20,40,30,20]
+shells = []
+subbases = []
+
+# 1 section
+c0 = geompy.PointCoordinates(ps[0])
+c1 = geompy.PointCoordinates(ps[1])
+nx = c1[0] - c0[0]
+ny = c1[1] - c0[1]
+nz = c1[2] - c0[2]
+
+faces = []
+f1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:TT 20 20:TT 0 20:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 20:TT -20 20:TT -20 0:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f3 = geompy.MakeSketcher("Sketcher:F 0 0:TT -20 0:TT -20 -20:TT 0 -20:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+f4 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 -20:TT 20 -20:TT 20 0:WF",
+ [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 2 section
+faces = []
+
+w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
+ [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,-1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[0])
+
+# 3 section
+faces = []
+c2 = geompy.PointCoordinates(ps[2])
+c3 = geompy.PointCoordinates(ps[3])
+nx = c3[0] - c2[0]
+ny = c3[1] - c2[1]
+nz = c3[2] - c2[2]
+
+w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f1 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f2 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f3 = geompy.MakeFace(w,1)
+
+w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
+ [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
+[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
+arc = MakeArc(w,3,1)
+w = geompy.MakeWire([e1,e2,e3,arc])
+f4 = geompy.MakeFace(w,1)
+
+faces.append(f1)
+faces.append(f2)
+faces.append(f3)
+faces.append(f4)
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+subbases.append(faces[2])
+
+# 4 section
+faces = []
+
+kk = 4
+dx = c3[0] - nx/kk
+dy = c3[1] - ny/kk
+dz = c3[2] - nz/kk
+rad = math.sqrt(nx*nx+ny*ny+nz*nz)
+vc = geompy.MakeVertex(dx,dy,dz)
+sph = geompy.MakeSpherePntR(vc,rad/kk)
+shellsph = geompy.SubShapeAll(sph, geompy.ShapeType["SHELL"])
+
+fs = []
+vec = geompy.MakeVectorDXDYDZ(0,0,1)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]+20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0],c3[1],c3[2]-20)
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vec = geompy.MakeVectorDXDYDZ(1,0,0)
+ff = geompy.MakePlane(ps[3],vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]+20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
+ff = geompy.MakePlane(vp,vec,40)
+fs.append(ff)
+aPartition = geompy.MakePartition(shellsph,fs)
+fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
+
+faces.append(fs[0])
+faces.append(fs[1])
+faces.append(fs[2])
+faces.append(fs[3])
+shell = geompy.MakeSewing(faces,1.e-6)
+shells.append(shell)
+faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
+
+
+#===========================================================
+# Create Pipe
+#===========================================================
+subbases = []
+Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
+ theWithContact=0, theWithCorrection=0)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+id_wire = geompy.addToStudy(WirePath,"WirePath")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the wire(path), sections and the pipe
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
--- /dev/null
+# Creation of a PipeShellsWithoutPath
+
+import geompy
+import math
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# Add a section based on quadrangles
+# ----------------------------------
+def section(s, p1, p2=None, p3=None, p4=None):
+ if p2==None:
+ q = p1
+ else:
+ q = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
+ pass
+ s.append(q)
+ publish(q, "section")
+ return q
+
+
+# find distance between two points
+# -------------------------------
+def Dist(p1,p2):
+ c1 = geompy.PointCoordinates(p1)
+ c2 = geompy.PointCoordinates(p2)
+ return math.sqrt( (c2[0]-c1[0])*(c2[0]-c1[0]) +
+ (c2[1]-c1[1])*(c2[1]-c1[1]) +
+ (c2[2]-c1[2])*(c2[2]-c1[2]) )
+
+
+# return middle point
+# -------------------------------
+def MiddleVert(p1,p2):
+ c1 = geompy.PointCoordinates(p1)
+ c2 = geompy.PointCoordinates(p2)
+ return geompy.MakeVertex( (c2[0]+c1[0])/2, (c2[1]+c1[1])/2, (c2[2]+c1[2])/2 )
+
+
+# Complex section
+# result - 16 quads from lines
+# pnt - point from path
+# vec - direction from path
+def MakeComplexSect(pnt,vec,rmax,rmin,nb):
+ dang = 1.0/nb/2
+ cmax = geompy.MakeCircle(pnt,vec,rmax)
+ cmin = geompy.MakeCircle(pnt,vec,rmin)
+ faces = []
+ for i in range(0,2*nb,2):
+ p1 = geompy.MakeVertexOnCurve(cmin,dang*i)
+ p2 = geompy.MakeVertexOnCurve(cmax,dang*(i+1))
+ p3 = geompy.MakeVertexOnCurve(cmin,dang*(i+2))
+ f = geompy.MakeQuad4Vertices(pnt,p1,p2,p3)
+ faces.append(f)
+ pass
+ shell = geompy.MakeSewing(faces,1.e-6)
+ return shell
+
+
+#=======================================================
+# Create simple path and recieve points
+# for section creation
+#=======================================================
+WirePath = geompy.MakeSketcher("Sketcher:F 0 0:T 60 0:T 40 0:R 0:C 100 90:",
+ [0, 0, 0, 0, 0, 1, 1, 0, 0])
+vs = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
+
+#=======================================================
+# Create shell sections
+#=======================================================
+shells = []
+subbases = []
+locs = []
+
+# 1 section
+shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs1[17])
+
+# 2 section
+shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
+shells.append(shell)
+vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs2[17])
+
+# 3 section
+shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
+shells.append(shell)
+vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs3[17])
+
+# 4 section
+shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
+shells.append(shell)
+vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
+locs.append(vs4[17])
+
+
+#===========================================================
+# Create Pipe
+#===========================================================
+
+Pipe = geompy.MakePipeShellsWithoutPath(shells,locs)
+
+# add objects in the study
+resc = geompy.MakeCompound(shells)
+id_sec = geompy.addToStudy(resc,"sections")
+resl = geompy.MakeCompound(locs)
+id_loc = geompy.addToStudy(resl,"locations")
+id_pipe = geompy.addToStudy(Pipe, "Pipe")
+
+# display the sections, locations and pipe
+gg.createAndDisplayGO(id_sec)
+gg.createAndDisplayGO(id_loc)
+gg.createAndDisplayGO(id_pipe)
+gg.setDisplayMode(id_pipe,1)
--- /dev/null
+# Creation of a PipeBiNormalAlongVector
+
+def MakeHelix(radius, height, rotation, direction):
+ # - create a helix -
+ radius = 1.0 * radius
+ height = 1.0 * height
+ rotation = 1.0 * rotation
+ if direction > 0:
+ direction = +1
+ else:
+ direction = -1
+ pass
+ from math import sqrt
+ length_z = height
+ length_xy = radius*rotation
+ length = sqrt(length_z*length_z + length_xy*length_xy)
+ import geompy
+ nb_steps = 1
+ epsilon = 1.0e-6
+ while 1:
+ z_step = height / nb_steps
+ angle_step = rotation / nb_steps
+ z = 0.0
+ angle = 0.0
+ helix_points = []
+ for n in range(nb_steps+1):
+ from math import cos, sin
+ x = radius * cos(angle)
+ y = radius * sin(angle)
+ p = geompy.MakeVertex(x, y, z)
+ helix_points.append( p )
+ z += z_step
+ angle += direction * angle_step
+ pass
+ helix = geompy.MakeInterpol(helix_points)
+ length_test = geompy.BasicProperties(helix)[0]
+ prec = abs(length-length_test)/length
+ # print nb_steps, length_test, prec
+ if prec < epsilon:
+ break
+ nb_steps *= 2
+ pass
+ return helix
+
+def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0):
+ # - create a pipe -
+ thread_radius = 1.0 * thread_radius
+ # create a helix
+ helix = MakeHelix(radius, height, rotation, direction)
+ # base in the (Ox, Oz) plane
+ import geompy
+ p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius)
+ p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius)
+ p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius)
+ p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius)
+ e0 = geompy.MakeEdge(p0, p1)
+ e1 = geompy.MakeEdge(p1, p2)
+ e2 = geompy.MakeEdge(p2, p3)
+ e3 = geompy.MakeEdge(p3, p0)
+ w = geompy.MakeWire([e0, e1, e2, e3])
+ # create a base face
+ base = geompy.MakeFace(w, True)
+ # create a binormal vector
+ binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0)
+ # create a pipe
+ spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal)
+ # Publish in the study
+ geompy.addToStudy(base, "base")
+ geompy.addToStudy(helix, "helix")
+ geompy.addToStudy(binormal, "binormal")
+ geompy.addToStudy(spring, "spring")
+ return spring
+
+from math import pi
+
+spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2)
--- /dev/null
+# Creation of a Middle Path
+
+import salome
+import geompy
+
+# Create a box
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# Get two opposite faces
+[Face_1,Face_2] = geompy.SubShapes(Box_1, [31, 33])
+
+# Get edges
+Box_1_edge_12 = geompy.GetSubShape(Box_1, [12])
+Box_1_edge_22 = geompy.GetSubShape(Box_1, [22])
+Box_1_edge_25 = geompy.GetSubShape(Box_1, [25])
+Box_1_edge_29 = geompy.GetSubShape(Box_1, [29])
+Box_1_edge_8 = geompy.GetSubShape(Box_1, [8])
+Box_1_edge_18 = geompy.GetSubShape(Box_1, [18])
+Box_1_edge_26 = geompy.GetSubShape(Box_1, [26])
+Box_1_edge_30 = geompy.GetSubShape(Box_1, [30])
+
+# These three calls to RestorePath return the same result
+Path_1 = geompy.RestorePath(Box_1, Face_1, Face_2)
+Path_2 = geompy.RestorePathEdges(Box_1, [Face_1], [Face_2])
+Path_3 = geompy.RestorePathEdges(Box_1,
+ [Box_1_edge_12, Box_1_edge_22, Box_1_edge_25, Box_1_edge_29],
+ [Box_1_edge_8, Box_1_edge_18, Box_1_edge_26, Box_1_edge_30])
+
+# Publish created objects
+geompy.addToStudy( Box_1, 'Box_1' )
+geompy.addToStudyInFather( Box_1, Face_1, 'Face_1' )
+geompy.addToStudyInFather( Box_1, Face_2, 'Face_2' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_25, 'Box_1:edge_25' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_22, 'Box_1:edge_22' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_12, 'Box_1:edge_12' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_29, 'Box_1:edge_29' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_18, 'Box_1:edge_18' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_26, 'Box_1:edge_26' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_8, 'Box_1:edge_8' )
+geompy.addToStudyInFather( Box_1, Box_1_edge_30, 'Box_1:edge_30' )
+geompy.addToStudy( Path_1, 'Path_1' )
+geompy.addToStudy( Path_2, 'Path_2' )
+geompy.addToStudy( Path_3, 'Path_3' )
--- /dev/null
+# Creation of Tangent Plane On Face
+
+import salome
+import geompy
+
+# Create Vertexes for curve
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(0, 90, 30)
+Vertex_3 = geompy.MakeVertex(100, 90, 0)
+Vertex_4 = geompy.MakeVertex(-100, 90, 0)
+# Create curve
+Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1])
+# Create Face by Extrusion of the Curve
+Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60)
+# Make Tangent on this Extrusion (Face)
+Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150)
+# Publish in the study
+geompy.addToStudy( Vertex_1, "Vertex_1" )
+geompy.addToStudy( Vertex_2, "Vertex_2" )
+geompy.addToStudy( Vertex_3, "Vertex_3" )
+geompy.addToStudy( Vertex_4, "Vertex_4" )
+geompy.addToStudy( Curve_1, "Curve_1" )
+geompy.addToStudy( Extrusion_1, "Extrusion_1" )
+geompy.addToStudy( Tangent_1, "Tangent_1" )
--- /dev/null
+# Check Free Boundaries
+
+import os
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make a compound
+compound = geompy.MakeCompound([box1, box2])
+
+# import from *.brep
+ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
+
+# get a face
+faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
+
+# get the free boundary for face 32
+Res = geompy.GetFreeBoundary(faces[32])
+isSuccess = Res[0]
+ClosedWires = Res[1]
+OpenWires = Res[2]
+
+if isSuccess == 1 :
+ print "Checking free boudaries is OK."
+else :
+ print "Checking free boudaries is KO!"
+print "len(ClosedWires) = ", len(ClosedWires)
+
+i = 0
+for wire in ClosedWires :
+ wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1)
+ geompy.addToStudy(ClosedWires[i], wire_name)
+ if i < len(ClosedWires) :
+ i = i+ 1
+
+print "len(OpenWires) = ", len(OpenWires)
+
+i = 0
+for wire in OpenWires :
+ wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1)
+ geompy.addToStudy(OpenWires[i], wire_name)
+ if i < len(OpenWires) :
+ i = i+ 1
+
+# get the free boundary for face 41
+Res = geompy.GetFreeBoundary(faces[41])
+isSuccess = Res[0]
+ClosedWires = Res[1]
+OpenWires = Res[2]
+
+if isSuccess == 1 :
+ print "Checking free boudaries is OK."
+else :
+ print "Checking free boudaries is KO!"
+print "len(ClosedWires) = ", len(ClosedWires)
+
+i = 0
+for wire in ClosedWires :
+ wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1)
+ geompy.addToStudy(ClosedWires[i], wire_name)
+ if i < len(ClosedWires) :
+ i = i+ 1
+
+print "len(OpenWires) = ", len(OpenWires)
+
+i = 0
+for wire in OpenWires :
+ wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1)
+ geompy.addToStudy(OpenWires[i], wire_name)
+ if i < len(OpenWires) :
+ i = i+ 1
+
+# add the imported object to the study
+id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP")
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Check Free Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+cylinder = geompy.MakeCone(p1, v, 30, 20, 20)
+
+# create a cone
+cone = geompy.MakeCone(p1, v, 70, 40, 60)
+
+# make cut
+cut = geompy.MakeCut(cone, cylinder)
+
+# get faces as sub-shapes
+faces = []
+faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
+f_2 = geompy.GetSubShapeID(cut, faces[0])
+
+# remove one face from the shape
+cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
+
+# suppress the specified wire
+result = geompy.GetFreeFacesIDs(cut_without_f_2)
+print "A number of free faces is ", len(result)
+
+# add objects in the study
+all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
+for face in all_faces :
+ sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
+ if result.count(sub_shape_id) > 0 :
+ face_name = "Free face %d"%(sub_shape_id)
+ geompy.addToStudy(face, face_name)
+
+# in this example all faces from cut_without_f_2 are free
+id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
+
+# display the results
+gg.createAndDisplayGO(id_cut_without_f_2)
+gg.setDisplayMode(id_cut_without_f_2,1)
--- /dev/null
+# Get Non Blocks
+
+import geompy
+import salome
+
+# create solids
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+cyl = geompy.MakeCylinderRH(100, 200)
+
+geompy.addToStudy(box, 'box')
+geompy.addToStudy(cyl, 'cyl')
+
+# make a compound
+compound = geompy.MakeCompound([box, cyl])
+geompy.addToStudy(compound, 'compound')
+
+# explore the compound
+pair = geompy.GetNonBlocks(compound)
+
+if pair[0] is not None:
+ geompy.addToStudyInFather(compound, pair[0], "GrNonBlocks")
+ pass
+
+if pair[1] is not None:
+ geompy.addToStudyInFather(compound, pair[1], "GrNonQuads")
+ pass
--- /dev/null
+# Import/Export
+
+import geompy
+import salome
+
+# Example of import from IGES using various formats
+
+# get a path to SAMPLES_SRC
+import os
+thePath = os.getenv("DATA_DIR")
+# create filenames
+theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs"
+theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs"
+#print "thePath = ", thePath
+
+# get units from files
+UnitName1 = geompy.GetIGESUnit(theFileName1)
+UnitName2 = geompy.GetIGESUnit(theFileName2)
+print "UnitName1 = ", UnitName1
+print "UnitName2 = ", UnitName2
+
+# import shapes
+Shape1 = geompy.ImportIGES(theFileName1)
+Shape2 = geompy.ImportIGES(theFileName2)
+Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE")
+[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
+[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
+[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)
+geompy.addToStudy(Shape1, "3Dipsos_m")
+geompy.addToStudy(Shape2, "3Dipsos_mm")
+geompy.addToStudy(Shape3, "3Dipsos_mm_scaled")
+d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1)
+d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2)
+d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3)
+import math
+dd32 = math.sqrt(d3/d2)
+dd12 = math.sqrt(d1/d2)
+dd31 = math.sqrt(d3/d1)
+# values dd31, dd12 and dd31 can be using for checking
+print "dd32 = ",dd32," dd12 = ",dd12," dd31 = ",dd31
--- /dev/null
+# Inertia
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+In = geompy.Inertia(box)
+print "\nInertia matrix of box 100x30x100:"
+print " (", In[0], ", ", In[1], ", ", In[2], ")"
+print " (", In[3], ", ", In[4], ", ", In[5], ")"
+print " (", In[6], ", ", In[7], ", ", In[8], ")"
+print "Main moments of inertia of box 100x30x100:"
+print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11]
--- /dev/null
+# Minimal Distance
+
+import geompy
+
+# Create two curves with three closest points
+Vertex_1 = geompy.MakeVertex(0, 0, 0)
+Vertex_2 = geompy.MakeVertex(0, 70, 0)
+Vertex_3 = geompy.MakeVertex(30, 100, 0)
+Vertex_4 = geompy.MakeVertex(60, 70, 0)
+Vertex_5 = geompy.MakeVertex(90, 100, 0)
+Vertex_6 = geompy.MakeVertex(120, 70, 0)
+Vertex_7 = geompy.MakeVertex(120, 0, 0)
+Vertex_8 = geompy.MakeVertex(90, -30, 0)
+Vertex_9 = geompy.MakeVertex(60, 0, 0)
+Vertex_10 = geompy.MakeVertex(30, -30, 0)
+
+geompy.addToStudy( Vertex_1, 'Vertex_1' )
+geompy.addToStudy( Vertex_2, 'Vertex_2' )
+geompy.addToStudy( Vertex_3, 'Vertex_3' )
+geompy.addToStudy( Vertex_4, 'Vertex_4' )
+geompy.addToStudy( Vertex_5, 'Vertex_5' )
+geompy.addToStudy( Vertex_6, 'Vertex_6' )
+geompy.addToStudy( Vertex_7, 'Vertex_7' )
+geompy.addToStudy( Vertex_8, 'Vertex_8' )
+geompy.addToStudy( Vertex_9, 'Vertex_9' )
+geompy.addToStudy( Vertex_10, 'Vertex_10' )
+
+Curve_a = geompy.MakeInterpol([Vertex_2, Vertex_3, Vertex_4, Vertex_5, Vertex_6], False, True)
+Curve_b = geompy.MakeInterpol([Vertex_1, Vertex_7, Vertex_8, Vertex_9, Vertex_10], False, True)
+
+geompy.addToStudy( Curve_a, 'Curve_a' )
+geompy.addToStudy( Curve_b, 'Curve_b' )
+
+# Get all closest points
+[nbSols, listCoords] = geompy.ClosestPoints(Curve_a, Curve_b)
+
+for i in range(nbSols):
+ v1 = geompy.MakeVertex(listCoords[i*6 + 0], listCoords[i*6 + 1], listCoords[i*6 + 2])
+ v2 = geompy.MakeVertex(listCoords[i*6 + 3], listCoords[i*6 + 4], listCoords[i*6 + 5])
+
+ geompy.addToStudy(v1, 'MinDist_%d_Curve_a'%(i+1))
+ geompy.addToStudy(v2, 'MinDist_%d_Curve_b'%(i+1))
+
+# Get minimum distance
+print "Minimal distance between Curve_a and Curve_b is", geompy.MinDistance(Curve_a, Curve_b)
+
+# Get minimum distance with components along axes
+[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Curve_a, Curve_b)
+print "Minimal distance between Curve_a and Curve_b is (", DX, ",", DY, ",", DZ, ")"
--- /dev/null
+# Normal to a Face
+
+import geompy
+import math
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+
+faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
+face0 = faces[0]
+vnorm = geompy.GetNormal(face0)
+if vnorm is None:
+ raise RuntimeError, "GetNormal(face0) failed"
+else:
+ geompy.addToStudy(face0, "Face0")
+ geompy.addToStudy(vnorm, "Normale to Face0")
+ print "\nNormale of face has been successfully obtained"
--- /dev/null
+# Using SALOME NoteBook
+
+import geompy
+import salome
+import salome_notebook
+gg = salome.ImportComponentGUI("GEOM")
+
+# set variables
+notebook = salome_notebook.notebook
+notebook.set("Length", 150)
+notebook.set("Width", 100)
+
+# create box
+box = geompy.MakeBoxDXDYDZ("Length", "Width", 200)
+
+# add object in the study
+id_box = geompy.addToStudy(box,"Box")
+
+# display the boxes
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
--- /dev/null
+# Point Coordinates
+
+import math
+import geompy
+
+# create a point
+point = geompy.MakeVertex(15., 23., 80.)
+
+# get the coordinates of the point and check its values
+coords = geompy.PointCoordinates(point)
+
+# check the obtained coordinate values
+tolerance = 1.e-07
+def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance)
+
+if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
+ print "All values are OK."
+else :
+ print "Coordinates of point must be (15, 23, 80), but returned (",
+ print coords[0], ", ", coords[1], ", ", coords[2], ")"
+ pass
--- /dev/null
+# Creation of a Box
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(15, 25, 35)
+p70 = geompy.MakeVertex(70, 70, 70)
+
+# create boxes
+box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)
+box2 = geompy.MakeBox(10,20,30, 15,25,35)
+box3 = geompy.MakeBoxTwoPnt(p0, p70)
+
+# add objects in the study
+id_box1 = geompy.addToStudy(box1,"Box1")
+id_box2 = geompy.addToStudy(box2,"Box2")
+id_box3 = geompy.addToStudy(box3,"Box3")
+
+# display the boxes
+gg.createAndDisplayGO(id_box1)
+gg.setDisplayMode(id_box1,1)
+gg.createAndDisplayGO(id_box2)
+gg.setDisplayMode(id_box2,1)
+gg.createAndDisplayGO(id_box3)
+gg.setDisplayMode(id_box3,1)
--- /dev/null
+# Creation of a Cylinder
+
+import geompy
+import salome
+
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(25, 35, 45)
+p2 = geompy.MakeVertex(70, 70, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create cylinders
+height = 40
+
+radius1 = 15
+cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
+
+radius2 = 30
+cylinder2 = geompy.MakeCylinderRH(radius2, height)
+
+# add objects in the study
+id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
+id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
+
+# display the cylinders
+gg.createAndDisplayGO(id_cylinder1)
+gg.setDisplayMode(id_cylinder1,1)
+gg.createAndDisplayGO(id_cylinder2)
+gg.setDisplayMode(id_cylinder2,1)
--- /dev/null
+# Creation of a Sphere
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex
+p = geompy.MakeVertex(55, 45, 25)
+
+# create spheres
+radius1 = 20
+sphere1 = geompy.MakeSpherePntR(p, radius1)
+radius2 = 15
+sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
+radius3 = 30
+sphere3 = geompy.MakeSphereR(radius3)
+
+# add objects in the study
+id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
+id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
+id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
+
+# display spheres
+gg.createAndDisplayGO(id_sphere1)
+gg.setDisplayMode(id_sphere1,1)
+gg.createAndDisplayGO(id_sphere2)
+gg.setDisplayMode(id_sphere2,1)
+gg.createAndDisplayGO(id_sphere3)
+gg.setDisplayMode(id_sphere3,1)
--- /dev/null
+# Creation of a Torus
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 40, 45)
+p2 = geompy.MakeVertex(35, 45, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create toruses
+torus1 = geompy.MakeTorus(p1, v, 20, 10)
+torus2 = geompy.MakeTorusRR(30, 15)
+
+# add objects in the study
+id_torus1 = geompy.addToStudy(torus1,"Torus1")
+id_torus2 = geompy.addToStudy(torus2,"Torus2")
+
+# display toruses
+gg.createAndDisplayGO(id_torus1)
+gg.setDisplayMode(id_torus1,1)
+gg.createAndDisplayGO(id_torus2)
+gg.setDisplayMode(id_torus2,1)
--- /dev/null
+# Creation of a Cone
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 70)
+v = geompy.MakeVector(p1, p2)
+
+# create cones
+cone1 = geompy.MakeCone(p1, v, 17, 1, 20)
+cone2 = geompy.MakeConeR1R2H(30, 10, 30)
+
+# add objects in the study
+id_cone1 = geompy.addToStudy(cone1,"Cone1")
+id_cone2 = geompy.addToStudy(cone2,"Cone2")
+
+# display cones
+gg.createAndDisplayGO(id_cone1)
+gg.setDisplayMode(id_cone1,1)
+gg.createAndDisplayGO(id_cone2)
+gg.setDisplayMode(id_cone2,1)
--- /dev/null
+# Creation of a Disk
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0., 0., 0.)
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+
+# create a vector on two points
+vxy = geompy.MakeVector(px, py)
+
+# create a disk in OXY plane
+disk1 = geompy.MakeDiskR(100, 1)
+
+# create a disk from a point, a vector and a radius
+disk2 = geompy.MakeDiskPntVecR(pz, vxy, 30)
+
+#create a circle from three points
+disk3 = geompy.MakeDiskThreePnt(p0, px, py)
+
+# add objects in the study
+id_vxy = geompy.addToStudy(vxy, "Vector")
+id_disk1 = geompy.addToStudy(disk1,"Disk1")
+id_disk2 = geompy.addToStudy(disk2,"Disk2")
+id_disk3 = geompy.addToStudy(disk3,"Disk3")
+
+# display disks
+gg.createAndDisplayGO(id_vxy)
+gg.createAndDisplayGO(id_disk1)
+gg.createAndDisplayGO(id_diks2)
+gg.createAndDisplayGO(id_diks3)
--- /dev/null
+# Creation of a Rectangle
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+
+# create a vector on two points
+vxy = geompy.MakeVector(px, py)
+
+# create a rectangle in OXY plane
+face1 = geompy.MakeFaceHW(100, 100, 1)
+
+# create a rectangle using normal vector
+face2 = geompy.MakeFaceObjHW(vxy, 50, 150)
+
+# create a rectangle from other face
+face3 = geompy.MakeFaceObjHW(face2, 150, 50)
+
+# add objects in the study
+id_face1 = geompy.addToStudy(face1,"Face1")
+id_face2 = geompy.addToStudy(face2,"Face2")
+id_face3 = geompy.addToStudy(face3,"Face3")
+
+# display rectangles
+gg.createAndDisplayGO(id_face1)
+gg.createAndDisplayGO(id_face2)
+gg.createAndDisplayGO(id_face3)
--- /dev/null
+# Shape Processing
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices, an edge, an arc, a wire, a face and a prism
+p1 = geompy.MakeVertex(0,0,0)
+p2 = geompy.MakeVertex(200,0,0)
+p3 = geompy.MakeVertex(100,150,0)
+edge = geompy.MakeEdge(p1,p2)
+arc = geompy.MakeArc(p1,p3,p2)
+wire = geompy.MakeWire([edge,arc])
+face = geompy.MakeFace(wire, 1)
+theShape = geompy.MakePrismVecH(face, edge, 130)
+
+# check the shape at the beginning
+print "Before ProcessShape:"
+isValid = geompy.CheckShape(theShape)
+if isValid == 0:
+ print "The shape is not valid"
+else:
+ print "The shape seems to be valid"
+
+# process the Shape
+Operators = ["FixShape"]
+Parameters = ["FixShape.Tolerance3d"]
+Values = ["1e-7"]
+PS = geompy.ProcessShape(theShape, Operators, Parameters, Values)
+
+# check the shape at the end
+print "After ProcessShape:"
+isValid = geompy.CheckShape(PS)
+if isValid == 0:
+ print "The shape is not valid"
+ raise RuntimeError, "It seems, that the ProcessShape() has failed"
+else:
+ print "The shape seems to be valid"
+
+# add in the study and display
+Id_Shape = geompy.addToStudy(theShape, "Invalid Shape")
+Id_PS = geompy.addToStudy(PS, "Processed Shape")
+gg.createAndDisplayGO(Id_Shape)
+gg.setDisplayMode(Id_Shape,1)
+gg.createAndDisplayGO(Id_PS)
+gg.setDisplayMode(Id_PS,1)
--- /dev/null
+# Suppress Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# The list of IDs (IDList) for suppress faces
+sup_faces = []
+sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
+
+# get indices of the sub-shape
+f1_id = geompy.GetSubShapeID(box, sup_faces[3])
+
+# remove faces from the given object (shape)
+result = geompy.SuppressFaces(box, [f1_id])
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1)
--- /dev/null
+# Close Contour
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0 = geompy.MakeVertex( 0., 0., 0.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex( 0., 100., 0.)
+py1 = geompy.MakeVertex( 0., 140., 0.)
+pz = geompy.MakeVertex( 0., 0., 100.)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py1, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# close an open wire by creation of an edge between ends
+wire_close = geompy.CloseContour(wire, [1], 0)
+
+# add objects in the study
+id_wire = geompy.addToStudy(wire, "Wire")
+id_wire_close = geompy.addToStudy(wire_close, "Wire close")
+
+# display the results
+gg.createAndDisplayGO(id_wire)
+gg.createAndDisplayGO(id_wire_close)
--- /dev/null
+# Suppress Internal Wires
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(55, 65, 50)
+p2 = geompy.MakeVertex(55, 0, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 100
+radius1 = 40
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+
+# make a cut
+cut = geompy.MakeCut(box, cylinder)
+
+# suppress all internal wires
+result = geompy.SuppressInternalWires(cut, [])
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1)
--- /dev/null
+# Suppress Holes
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(35, 35, 0)
+p2 = geompy.MakeVertex(35, 35, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 20
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# create a cone
+cone = geompy.MakeCone(p1, v, 70, 0, 80)
+
+# make a cut
+cut = geompy.MakeCut(cone, cylinder)
+
+# get faces as sub-shapes
+faces = []
+faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
+f_2 = geompy.GetSubShapeID(cut, faces[2])
+
+# remove one face from the shape
+cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
+
+# get wires as sub-shapes
+wires = []
+wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"])
+w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0])
+
+# suppress the selected wire
+result = geompy.SuppressHoles(cut_without_f_2, [w_0])
+
+# add objects in the study
+id_cut = geompy.addToStudy(cut, "Cut")
+id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
+id_result = geompy.addToStudy(result, "Result")
+
+# display the results
+gg.createAndDisplayGO(id_cut)
+gg.setDisplayMode(id_cut,1)
+gg.createAndDisplayGO(id_cut_without_f_2)
+gg.setDisplayMode(id_cut_without_f_2,1)
+gg.createAndDisplayGO(id_result)
+gg.setDisplayMode(id_result,1)
--- /dev/null
+# Sewing
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create base points
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex(0., 100., 0.)
+pz = geompy.MakeVertex(0., 0., 100.)
+
+# create base geometry 2D & 3D
+vector = geompy.MakeVector(px, py)
+arc = geompy.MakeArc(py, pz, px)
+
+# create base objects
+angle = 45. * math.pi / 180
+WantPlanarFace = 1 #True
+wire = geompy.MakeWire([vector, arc])
+face = geompy.MakeFace(wire, WantPlanarFace)
+face_rot = geompy.MakeRotation(face, vector, angle)
+
+# make sewing
+precision = 0.00001
+sewing = geompy.MakeSewing([face, face_rot], precision)
+
+# add objects in the study
+id_face = geompy.addToStudy(face, "Face")
+id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
+id_sewing = geompy.addToStudy(sewing, "Sewing")
+
+# display the results
+gg.createAndDisplayGO(id_face)
+gg.setDisplayMode(id_face,1)
+gg.createAndDisplayGO(id_face_rot)
+gg.setDisplayMode(id_face_rot,1)
+gg.createAndDisplayGO(id_sewing)
+gg.setDisplayMode(id_sewing,1)
--- /dev/null
+# Glue Faces
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue compound's faces
+tolerance = 1e-5
+glue = geompy.MakeGlueFaces(compound, tolerance)
+
+# add objects in study
+id_box1 = geompy.addToStudy(box1, "Box1")
+id_box2 = geompy.addToStudy(box2, "Box2")
+id_compound = geompy.addToStudy(compound, "Compound")
+id_glue = geompy.addToStudy(glue, "Glue faces")
+
+# display results
+gg.createAndDisplayGO(id_box1)
+gg.setDisplayMode(id_box1,1)
+gg.createAndDisplayGO(id_box2)
+gg.setDisplayMode(id_box2,1)
+gg.createAndDisplayGO(id_compound)
+gg.setDisplayMode(id_compound,1)
+gg.createAndDisplayGO(id_glue)
+gg.setDisplayMode(id_glue,1)
--- /dev/null
+# Glue Edges
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create boxes
+box1 = geompy.MakeBox(0,0,0,100,50,100)
+box2 = geompy.MakeBox(100,0,0,250,50,100)
+
+# make compound
+compound = geompy.MakeCompound([box1, box2])
+
+# glue all compound's edges
+tolerance = 1e-5
+glue1 = geompy.MakeGlueEdges(compound, tolerance)
+
+# glue some compound's edges
+list_edges = geompy.GetGlueEdges(compound, tolerance)
+glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]])
+
+# add objects in study
+geompy.addToStudy(box1, "Box1")
+geompy.addToStudy(box2, "Box2")
+geompy.addToStudy(compound, "Compound")
+geompy.addToStudy(glue1, "Glue all edges")
+geompy.addToStudy(glue2, "Glue two edges")
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# Limit Tolerance
+
+import geompy
+gg = salome.ImportComponentGUI("GEOM")
+
+# import initial topology
+shape1 = geompy.ImportBREP("my_shape_1.brep")
+shape2 = geompy.ImportBREP("my_shape_2.brep")
+
+geompy.addToStudy(shape1, "Shape 1")
+geompy.addToStudy(shape2, "Shape 2")
+
+# perform partition
+try:
+ part = geompy.MakePartition([shape1, shape2])
+except:
+ # limit tolerance
+ tolerance = 1e-07
+ shape1_lt = geompy.LimitTolerance(shape1, tolerance)
+ shape2_lt = geompy.LimitTolerance(shape2, tolerance)
+
+ # process shape
+ good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+ good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+
+ geompy.addToStudy(good_shape1, "Shape 1 corrected")
+ geompy.addToStudy(good_shape2, "Shape 2 corrected")
+
+ # perform partition on corrected shapes
+ part = geompy.MakePartition([good_shape1, good_shape2])
+ pass
+
+geompy.addToStudy(part, "Partition")
--- /dev/null
+# Add Point on Edge
+
+import geompy
+import salome
+
+# create vertices
+p1 = geompy.MakeVertex(0,0,50)
+p2 = geompy.MakeVertex(60,0,50)
+
+# make an edge
+edge = geompy.MakeEdge(p1, p2) #geompy.GetSubShape(box, edge_ind)
+
+# divide an edge
+divide = geompy.DivideEdge(edge, -1, 0.5, 0)
+
+# add objects in the study
+id_edge = geompy.addToStudy(edge, "Edge")
+edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"])
+for point in edge_points:
+ geompy.addToStudyInFather(edge, point, "Edge's point")
+
+id_divide = geompy.addToStudy(divide, "Divided edge")
+edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"])
+for point in edge_points:
+ geompy.addToStudyInFather(divide, point, "Edge's point after divide")
+
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Fuse Collinear Edges within a Wire
+
+import geompy
+import salome
+
+# create vertices
+p1 = geompy.MakeVertex(0, 0, 0)
+p2 = geompy.MakeVertex(70, 0, 0)
+p3 = geompy.MakeVertex(70, 50, 0)
+p4 = geompy.MakeVertex(70, 80, 0)
+p5 = geompy.MakeVertex(50, 80, 0)
+p6 = geompy.MakeVertex(20, 80, 0)
+p7 = geompy.MakeVertex(0, 80, 0)
+p8 = geompy.MakeVertex(0, 30, 0)
+
+points = [p1, p2, p3, p4, p5, p6, p7, p8]
+
+# make a wire
+wire_1 = geompy.MakePolyline(points, True)
+
+# suppress some vertices in the wire
+wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3])
+wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6])
+
+# suppress all suitable vertices in the wire
+wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, [])
+
+wires = [wire_1, wire_2, wire_3, wire_4]
+
+# add objects in the study
+ii = 1
+for point in points:
+ geompy.addToStudy(point, "p%d"%ii)
+ ii = ii + 1
+ pass
+
+ii = 1
+for wire in wires:
+ geompy.addToStudy(wire, "wire_%d"%ii)
+ wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"])
+ jj = 1
+ for point in wire_points:
+ geompy.addToStudyInFather(wire, point, "point_%d"%jj)
+ jj = jj + 1
+ pass
+ ii = ii + 1
+ pass
+
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# 2D Sketcher
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p1 = geompy.MakeVertex(70., 0., 0.)
+p2 = geompy.MakeVertex(70., 70., 80.)
+p3 = geompy.MakeVertex( 0., 70., 0.)
+
+#create a vector from two points
+vector_arc = geompy.MakeVector(p1, p3)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+
+# create a wire
+wire = geompy.MakeWire([vector_arc, arc])
+
+# create a planar face
+isPlanarWanted = 1
+face = geompy.MakeFace(wire, isPlanarWanted)
+
+# create a sketcher (face), following the textual description
+sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WF",
+ [100,0,0, 1,1,1, -1,1,0])
+
+# create a sketcher (wire) on the given face
+sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F 10 -30:R 10:C 20 180:R 15:L 50:WW", face)
+
+# add objects in the study
+id_face = geompy.addToStudy(face,"Face")
+id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
+id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")
+
+# display the first sketcher and the second sketcher with its planar face
+gg.createAndDisplayGO(id_face)
+gg.setDisplayMode(id_face,1)
+gg.setTransparency(id_face,0.5)
+gg.createAndDisplayGO(id_sketcher1)
+gg.createAndDisplayGO(id_sketcher2)
--- /dev/null
+#!/usr/bin/env python
+
+import unittest, sys
+
+class SalomeSession(object):
+ def __init__(self, script):
+ import runSalome
+ sys.argv = ["runSalome.py"]
+ sys.argv += ["--terminal"]
+ sys.argv += ["--modules=GEOM"]
+ sys.argv += ["--execute=%s" % script]
+ clt, d = runSalome.main()
+ self.port = d['port']
+ return
+
+ def __del__(self):
+ port = self.port
+ import killSalomeWithPort
+ killSalomeWithPort.killMyPort(port)
+ return
+ pass
+
+class MyTest(unittest.TestCase):
+ def testFunction(self):
+ SalomeSession(sys.argv[1])
+ pass
+
+unittest.main(argv=sys.argv[:1])
--- /dev/null
+# Tolerance
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+Toler = geompy.Tolerance(box)
+print "\nBox 100x30x100 tolerance:"
+print " Face min. tolerance: ", Toler[0]
+print " Face max. tolerance: ", Toler[1]
+print " Edge min. tolerance: ", Toler[2]
+print " Edge max. tolerance: ", Toler[3]
+print " Vertex min. tolerance: ", Toler[4]
+print " Vertex max. tolerance: ", Toler[5]
--- /dev/null
+# Creation of an Edge
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#
+# create edge by two points
+#
+
+# create vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create an edge
+edge = geompy.MakeEdge(p0, pxyz)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_1")
+
+# display an edge
+gg.createAndDisplayGO(id_edge)
+
+#
+# create edge from wire
+#
+
+# create a circle
+c = geompy.MakeCircle(None, None, 100)
+
+# create a wire
+w = geompy.MakeWire([c], 1e-07)
+
+# create an edge from wire
+edge = geompy.MakeEdgeWire(w)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_2")
+
+# display an edge
+gg.createAndDisplayGO(id_edge)
+
+#
+# create edge from existing curve and a length
+#
+
+# create a circle
+c = geompy.MakeCircle(None, None, 100)
+
+# create an edge of length 25.0 from the circle
+edge = geompy.MakeEdgeOnCurveByLength(c, 25.0)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_3")
+
+# display an edge
+gg.createAndDisplayGO(id_edge)
--- /dev/null
+# Creation of a Wire
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# add an object in the study
+id_wire = geompy.addToStudy(wire,"Wire")
+
+# display the wire
+gg.createAndDisplayGO(id_wire)
--- /dev/null
+# Creation of a Face
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+px = geompy.MakeVertex(100., 0. , 0. )
+py = geompy.MakeVertex(0. , 100., 0. )
+pz = geompy.MakeVertex(0. , 0. , 100.)
+pxyz = geompy.MakeVertex(100., 100., 100.)
+
+# create a vector from two points
+vxy = geompy.MakeVector(px, py)
+
+# create an arc from three points
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
+ [100,0,0, 1,1,1, -1,1,0])
+sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+isPlanarFace = 1
+
+# create a face from the wire
+face1 = geompy.MakeFace(wire, isPlanarFace)
+
+# create faces from two wires
+face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
+face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
+
+# add objects in the study
+id_face1 = geompy.addToStudy(face1,"Face1")
+id_face2 = geompy.addToStudy(face2,"Face2")
+id_face3 = geompy.addToStudy(face3,"Face3")
+
+# display the faces
+gg.createAndDisplayGO(id_face1)
+gg.setDisplayMode(id_face1,1)
+gg.setTransparency(id_face1,0.2)
+gg.createAndDisplayGO(id_face2)
+gg.setDisplayMode(id_face2,1)
+gg.setTransparency(id_face2,0.2)
+gg.createAndDisplayGO(id_face3)
+gg.setDisplayMode(id_face3,1)
+gg.setTransparency(id_face3,0.2)
--- /dev/null
+# Creation of a Shell
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#create vertices
+p0 = geompy.MakeVertex( 0., 0., 0.)
+pxyz = geompy.MakeVertex( 5., 5., 40.)
+
+# create sketchers
+sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
+sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
+isPlanarFace = 1
+
+# create a face from two wires
+face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
+
+# create a prism
+prism = geompy.MakePrism(face, p0, pxyz)
+
+# explode the prism into faces
+prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
+
+# create a shell from a set of faces
+shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
+ prism_faces[7], prism_faces[9]])
+
+# add objects in the study
+id_shell = geompy.addToStudy(shell,"Shell")
+
+# display the shell
+gg.createAndDisplayGO(id_shell)
+gg.setDisplayMode(id_shell,1)
--- /dev/null
+# Creation of a Solid
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+#create vertices
+p0 = geompy.MakeVertex( 0., 0., 0.)
+pz = geompy.MakeVertex( 0., 0., 40.)
+
+# create sketchers
+sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")
+
+# create faces from two wires
+face = geompy.MakeFace(sketcher,1)
+
+# create a prism
+prism = geompy.MakePrism(face, p0, pz)
+
+# explode the prism into faces
+prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
+
+# create a shell from a set of faces
+shell = geompy.MakeShell([prism_faces[0], prism_faces[1],
+ prism_faces[3], prism_faces[4],
+ prism_faces[5], prism_faces[2]])
+
+# create a solid, bounded by the given shells
+solid = geompy.MakeSolid([shell])
+
+# add objects in the study
+id_solid = geompy.addToStudy(solid,"Solid")
+
+# display the solid
+gg.createAndDisplayGO(id_solid)
+gg.setDisplayMode(id_solid,1)
--- /dev/null
+# Creation of a Compound
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex( -30., -30., 50.)
+p2 = geompy.MakeVertex( -60., -60., 30.)
+p3 = geompy.MakeVertex( -30., -30., 10.)
+
+# create an arc from three points
+arc = geompy.MakeArc(p1, p2, p3)
+ShapeListCompound = []
+i = 0
+while i <= 3 :
+ S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
+ ShapeListCompound.append(S)
+ i = i + 1
+
+# create a compund of the given shapes
+compound = geompy.MakeCompound(ShapeListCompound)
+
+# add object in the study
+id_compound = geompy.addToStudy(compound,"Compound")
+
+# display the compound
+gg.createAndDisplayGO(id_compound)
--- /dev/null
+# Translation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40, 0)
+p2 = geompy.MakeVertex( 0, 0, 50)
+p3 = geompy.MakeVertex(50, 80, 0)
+v = geompy.MakeVector(p1, p2)
+vt = geompy.MakeVector(p1, p3)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# translate the given object along the vector, specified by its end points
+# (all three functions produce the same result)
+translation1 = geompy.MakeTranslationTwoPoints(cylinder, p1, p3)
+translation2 = geompy.MakeTranslation(cylinder, 40, 40, 0)
+translation3 = geompy.MakeTranslationVector(cylinder, vt)
+translation4 = geompy.MakeTranslationVectorDistance(cylinder, vt, 200)
+
+# add objects in the study
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_translation1 = geompy.addToStudy(translation1, "Translation1")
+id_translation2 = geompy.addToStudy(translation2, "Translation2")
+id_translation3 = geompy.addToStudy(translation3, "Translation3")
+id_translation4 = geompy.addToStudy(translation4, "Translation4")
+
+# display the results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_translation1)
+gg.setDisplayMode(id_translation1,1)
+gg.createAndDisplayGO(id_translation2)
+gg.setDisplayMode(id_translation2,1)
+gg.createAndDisplayGO(id_translation3)
+gg.setDisplayMode(id_translation3,1)
+gg.createAndDisplayGO(id_translation4)
+gg.setDisplayMode(id_translation4,1)
--- /dev/null
+# Rotation
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40, 0)
+p2 = geompy.MakeVertex( 0, 0, 50)
+p3 = geompy.MakeVertex(10, 50,-20)
+p4 = geompy.MakeVertex(10, 50, 60)
+v = geompy.MakeVector(p1, p2)
+vr = geompy.MakeVector(p3, p4)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+
+# rotate the given object around the given axis by the given angle
+rotation1 = geompy.MakeRotation(cylinder, vr, math.pi)
+rotation2 = geompy.MakeRotationThreePoints(cylinder, p4, p1, p2)
+
+# add objects in the study
+id_vr = geompy.addToStudy(vr, "Rotation 1 axis")
+id_p4 = geompy.addToStudy(p4, "Rotation 2 center")
+id_p1 = geompy.addToStudy(p1, "Rotation 2 point 1")
+id_p2 = geompy.addToStudy(p2, "Rotation 2 point 2")
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_rotation1 = geompy.addToStudy(rotation1, "Rotation 1")
+id_rotation2 = geompy.addToStudy(rotation2, "Rotation 2")
+
+# display the results
+gg.createAndDisplayGO(id_vr)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_p1)
+gg.createAndDisplayGO(id_p2)
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_rotation1)
+gg.createAndDisplayGO(id_rotation2)
+gg.setDisplayMode(id_rotation1,1)
+gg.setDisplayMode(id_rotation2,1)
--- /dev/null
+# Modify Location
+
+import geompy
+import salome
+import math
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a vertex and a vector
+p1 = geompy.MakeVertex(10, 40, 0)
+p2 = geompy.MakeVertex( 0, 0, 50)
+v = geompy.MakeVector(p1, p2)
+
+# create a cylinder
+height = 35
+radius1 = 20
+cylinder = geompy.MakeCylinder(p1, v, radius1, height)
+circle = geompy.MakeCircle(p2, v, radius1)
+
+# create local coordinate systems
+cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
+cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
+
+# modify the location of the given object
+position = geompy.MakePosition(cylinder, cs1, cs2)
+position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
+
+# add objects in the study
+id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
+id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
+id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
+id_circle = geompy.addToStudy(circle, "Circle")
+id_position = geompy.addToStudy(position, "Position")
+id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
+
+# display the results
+gg.createAndDisplayGO(id_cylinder)
+gg.setDisplayMode(id_cylinder,1)
+gg.createAndDisplayGO(id_position)
+gg.setDisplayMode(id_position,1)
+gg.createAndDisplayGO(id_circle)
+gg.setDisplayMode(id_circle,1)
+gg.createAndDisplayGO(id_position2)
+gg.setDisplayMode(id_position2,1)
--- /dev/null
+# Mirror Image
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# create an object, symmetrical to another object through the given plane
+p1 = geompy.MakeVertex( 0, 25, 0)
+p2 = geompy.MakeVertex( 5, 25, 0)
+p3 = geompy.MakeVertex( 0,-30, 40)
+plane = geompy.MakePlaneThreePnt(p1, p2, p3, 1000.)
+mirror1 = geompy.MakeMirrorByPlane(box, plane)
+
+# create an object, symmetrical to another object through the given axis
+p4 = geompy.MakeVertex( 210, 210, -20)
+p5 = geompy.MakeVertex( 210, 210, 220)
+axis = geompy.MakeVector(p4, p5)
+mirror2 = geompy.MakeMirrorByAxis(box, axis)
+
+# create an object, symmetrical to another object through the given point
+mirror3 = geompy.MakeMirrorByPoint(box, p4)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_plane = geompy.addToStudy(plane, "Plane")
+id_mirror1 = geompy.addToStudy(mirror1, "Mirror plane")
+id_axis = geompy.addToStudy(axis, "Axis")
+id_mirror2 = geompy.addToStudy(mirror2, "Mirror axis")
+id_p4 = geompy.addToStudy(p4, "Point")
+id_mirror3 = geompy.addToStudy(mirror3, "Mirror point")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_plane)
+gg.createAndDisplayGO(id_mirror1)
+gg.setDisplayMode(id_mirror1,1)
+gg.createAndDisplayGO(id_axis)
+gg.createAndDisplayGO(id_mirror2)
+gg.setDisplayMode(id_mirror2,1)
+gg.createAndDisplayGO(id_p4)
+gg.createAndDisplayGO(id_mirror3)
+gg.setDisplayMode(id_mirror3,1)
--- /dev/null
+# Scale Transform
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+
+# scale the given object by the factor
+p0 = geompy.MakeVertex(100, 100, 100)
+factor = 0.5
+scale = geompy.MakeScaleTransform(box, p0, factor)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_scale = geompy.addToStudy(scale, "Scale")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.setTransparency(id_box,0.5)
+gg.createAndDisplayGO(id_scale)
+gg.setDisplayMode(id_scale,1)
--- /dev/null
+# Offset Surface
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a box and a sphere
+box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
+
+# create a new object as offset of the given object
+offset = geompy.MakeOffset(box, 70.)
+
+# add objects in the study
+id_box = geompy.addToStudy(box, "Box")
+id_offset = geompy.addToStudy(offset, "Offset")
+
+# display the results
+gg.createAndDisplayGO(id_box)
+gg.setDisplayMode(id_box,1)
+gg.createAndDisplayGO(id_offset)
--- /dev/null
+# Projection
+
+import geompy
+import salome
+
+# create a cylindric face and a curve(edge)
+cylinder = geompy.MakeCylinderRH(100, 300)
+[face_cyl] = geompy.SubShapes(cylinder, [3])
+
+p1 = geompy.MakeVertex(200, 0, 100)
+p2 = geompy.MakeVertex(200, 80, 100)
+p3 = geompy.MakeVertex(200, 80, 180)
+p4 = geompy.MakeVertex(130, 80, 180)
+p5 = geompy.MakeVertex(90, 80, 240)
+
+curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False)
+
+# create a new object as projection of the
+# given curve on the given cylindric face
+projection = geompy.MakeProjection(curve, face_cyl)
+
+# add objects in the study
+geompy.addToStudy(cylinder, "cylinder")
+geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
+geompy.addToStudy(p1, "p1")
+geompy.addToStudy(p2, "p2")
+geompy.addToStudy(p3, "p3")
+geompy.addToStudy(p4, "p4")
+geompy.addToStudy(p5, "p5")
+geompy.addToStudy(curve, "curve")
+geompy.addToStudy(projection, "projection")
--- /dev/null
+# Multi Translation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create vertices and vectors
+p0 = geompy.MakeVertex( 0., 0., 0.)
+px = geompy.MakeVertex(20., 0., 0.)
+py = geompy.MakeVertex( 0., 20., 0.)
+pz = geompy.MakeVertex( 0., 0., 20.)
+pxy = geompy.MakeVertex( 50., 0., 0.)
+pxyz = geompy.MakeVertex( 50., 50., 50.)
+vz = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+vtr1d = geompy.MakeVector(p0, pxyz)
+vtr2d = geompy.MakeVector(p0, pxy)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 20.0)
+
+# translate the given object along the given vector a given number of times
+tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
+
+# consequently apply two specified translations to the object a given number of times
+tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_tr1d = geompy.addToStudy(tr1d,"Translation 1D")
+id_tr2d = geompy.addToStudy(tr2d,"Translation 2D")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_tr1d)
+gg.setDisplayMode(id_tr1d,1)
+gg.createAndDisplayGO(id_tr2d)
+gg.setDisplayMode(id_tr2d,1)
--- /dev/null
+# Multi Rotation
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+import math
+
+# create vertices and vectors
+p0 = geompy.MakeVertex( 0., 0., 0.)
+px = geompy.MakeVertex(20., 0., 0.)
+py = geompy.MakeVertex( 0., 20., 0.)
+pz = geompy.MakeVertex( 0., 0., 20.)
+pxyz = geompy.MakeVertex( 50., 50., 10.)
+vz = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+vrot = geompy.MakeVector(p0, pxyz)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 20.0)
+
+# 1. Rotate the prism around the axis vrot 4 times
+
+# rotation angle = 2 * PI / 4
+rot1da = geompy.MultiRotate1DNbTimes(prism, vrot, 4)
+
+# by the given angle of 30 degrees
+rot1db = geompy.MultiRotate1DByStep(prism, vrot, math.pi/6., 4)
+
+# 2. Rotate the prism around the axis vrot 4 times
+# and translate the result of each rotation 5 times on distance 50
+
+# rotation angle = 2 * PI / 4
+rot2da = geompy.MultiRotate2DNbTimes(prism, vrot, 4, 50, 5)
+
+# by the given angle of 60 degrees
+rot2db = geompy.MultiRotate2DByStep(prism, vrot, math.pi/3., 4, 50, 5)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_rot1da = geompy.addToStudy(rot1da,"Rotation 1D Nb.Times")
+id_rot1db = geompy.addToStudy(rot1db,"Rotation 1D By Step")
+id_rot2da = geompy.addToStudy(rot2da,"Rotation 2D Nb.Times")
+id_rot2db = geompy.addToStudy(rot2db,"Rotation 2D By Step")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_rot1da)
+gg.setDisplayMode(id_rot1da,1)
+gg.createAndDisplayGO(id_rot1db)
+gg.setDisplayMode(id_rot1db,1)
+gg.createAndDisplayGO(id_rot2da)
+gg.setDisplayMode(id_rot2da,1)
+gg.createAndDisplayGO(id_rot2db)
+gg.setDisplayMode(id_rot2db,1)
--- /dev/null
+# Fillet 2D
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a face in OXY plane
+face = geompy.MakeFaceHW(100, 100, 1)
+fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
+
+# add objects in the study
+id_face = geompy.addToStudy(face,"Face_1")
+id_fillet2d = geompy.addToStudy(fillet2d,"Fillet 2D_1")
+
+# display disks
+gg.createAndDisplayGO(id_face)
+gg.createAndDisplayGO(id_fillet2d)
--- /dev/null
+# Fillet 1D
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create box
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+# take box edges to create custom complex wire
+[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"])
+# create wire
+Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
+# make fillet at given wire vertices with giver radius
+Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
+
+
+# display disks
+gg.createAndDisplayGO(Wire_1)
+gg.createAndDisplayGO(Fillet_1D_1)
--- /dev/null
+# Fillet
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+radius = 10.
+ShapeTypeEdge = geompy.ShapeType["EDGE"]
+
+# create vertices and vectors
+p0 = geompy.MakeVertex( 0., 0., 0.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex( 0., 100., 0.)
+pz = geompy.MakeVertex( 0., 0., 100.)
+vz = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 100.0)
+
+# get the list of IDs (IDList) for the fillet
+prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
+IDlist_e = []
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
+IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
+
+# make a fillet on the specified edges of the given shape
+fillet = geompy.MakeFillet(prism, radius, ShapeTypeEdge, IDlist_e)
+
+# make a fillet on all edges of the given shape
+filletall = geompy.MakeFilletAll(prism, radius)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_fillet = geompy.addToStudy(fillet,"Fillet")
+id_filletall = geompy.addToStudy(filletall,"Fillet all")
+
+# display the prism and the results of fillet operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_fillet)
+gg.setDisplayMode(id_fillet,1)
+gg.createAndDisplayGO(id_filletall)
+gg.setDisplayMode(id_filletall,1)
--- /dev/null
+# Chamfer
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+d1 = 10.
+d2 = 10.
+ShapeTypeFace = geompy.ShapeType["FACE"]
+
+# create vertices and vectors
+p0 = geompy.MakeVertex( 0., 0., 0.)
+px = geompy.MakeVertex(100., 0., 0.)
+py = geompy.MakeVertex( 0., 100., 0.)
+pz = geompy.MakeVertex( 0., 0., 100.)
+vz = geompy.MakeVector(p0, pz)
+vxy = geompy.MakeVector(px, py)
+
+# create an arc
+arc = geompy.MakeArc(py, pz, px)
+
+# create a wire
+wire = geompy.MakeWire([vxy, arc])
+
+# create a planar face
+face = geompy.MakeFace(wire, 1)
+
+# create a prism
+prism = geompy.MakePrismVecH(face, vz, 100.0)
+
+# get the list of IDs (IDList) for the chamfer
+prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
+f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
+f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
+IDlist_f = [f_ind_1, f_ind_2]
+
+# perform a chamfer on the edges common to the specified faces
+chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
+
+# perform a chamfer on all edges of the specified faces
+chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
+chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
+
+# perform a symmetric chamfer on all edges of the given shape
+chamfer_all = geompy.MakeChamferAll(prism, d1)
+
+# add objects in the study
+id_prism = geompy.addToStudy(prism,"Prism")
+id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer edge")
+id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer faces")
+id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer faces 1")
+id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer all")
+
+# display the prism and the results of chamfer operation
+gg.createAndDisplayGO(id_prism)
+gg.setDisplayMode(id_prism,1)
+gg.createAndDisplayGO(id_chamfer_e)
+gg.setDisplayMode(id_chamfer_e,1)
+gg.createAndDisplayGO(id_chamfer_f)
+gg.setDisplayMode(id_chamfer_f,1)
+gg.createAndDisplayGO(id_chamfer_f1)
+gg.setDisplayMode(id_chamfer_f1,1)
+gg.createAndDisplayGO(id_chamfer_all)
+gg.setDisplayMode(id_chamfer_all,1)
--- /dev/null
+# Changing Display Mode
+
+import salome
+import geompy
+box = geompy.MakeBox(0,0,0, 50,50,50)
+box2 = geompy.MakeBox(-50,-50,-50, 0,0,0)
+
+sphere = geompy.MakeSphere(50,50,50, 30)
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+box_id = geompy.addToStudy(box2, "Box")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.createAndDisplayGO(box_id)
+gg.setVectorsMode(box_id, 1)
--- /dev/null
+# Changing Color
+
+import salome
+import geompy
+box = geompy.MakeBox(0,0,0, 50,50,50)
+
+sphere = geompy.MakeSphere(50,50,50, 30)
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.setColor(fuse_id,218,165,31)
--- /dev/null
+# Changing Transparency
+
+import salome
+import geompy
+
+box = geompy.MakeBox(0,0,0, 50,50,50)
+sphere = geompy.MakeSphere(50,50,50, 30)
+
+fuse = geompy.MakeBoolean(box,sphere,3)
+fuse_id = geompy.addToStudy(fuse,"Fuse")
+
+gg = salome.ImportComponentGUI("GEOM")
+gg.createAndDisplayGO(fuse_id)
+gg.setDisplayMode(fuse_id,1)
+gg.setColor(fuse_id,218,165,31)
+gg.setTransparency(fuse_id,0.5)
--- /dev/null
+# Set Point Marker
+
+import salome
+import geompy
+
+texture = geompy.LoadTexture("/users/user/mytexture.dat")
+
+v1 = geompy.MakeVertex(0, 0, 0)
+v2 = geompy.MakeVertex(100, 0, 0)
+v3 = geompy.MakeVertex(0, 100, 0)
+
+v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25)
+v2.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40)
+v3.SetMarkerTexture(texture)
--- /dev/null
+# What Is
+
+import geompy
+
+# create a box
+box = geompy.MakeBoxDXDYDZ(100,30,100)
+Descr = geompy.WhatIs(box)
+print "\nBox 100x30x100 description:"
+print Descr
--- /dev/null
+# Creation of a group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+ FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+ geompy.AddObject(group, FaceID)
+
+# add all selected shapes from the list to the group
+# (the program doesn't raise error, if some shapes are already included)
+geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
+
+# remove an object from the group
+geompy.RemoveObject(group, FaceID)
+
+# remove all selected shapes from the group
+# (the program doesn't raise error, if some shapes are not included)
+geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Adding an object to the group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+ FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+ geompy.AddObject(group, FaceID)
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Removing an object from the group
+
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create two vertices
+p0 = geompy.MakeVertex(0. , 0. , 0. )
+p200 = geompy.MakeVertex(200., 200., 200.)
+
+# create a box from two points
+Box = geompy.MakeBoxTwoPnt(p0, p200)
+
+# create a group from the faces of the box
+group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
+
+# add objects to the group
+SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
+for i in [0, 3, 5] :
+ FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
+ geompy.AddObject(group, FaceID)
+
+# add all selected shapes from the list to the group
+# (the program doesn't raise errors, if some shapes are already included)
+geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
+
+# remove an object from the group
+geompy.RemoveObject(group, FaceID)
+id_group1 = geompy.addToStudy(group, "Group1")
+
+# display the contents of the group
+gg.createAndDisplayGO(id_group1)
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Union Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# union groups
+Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
+Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
+geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Intersect Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# intersect groups
+Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
+Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
+geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
+salome.sg.updateObjBrowser(1)
--- /dev/null
+# Cut Groups
+
+import geompy
+import salome
+
+# create a box and some groups of faces on it
+Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
+Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_1, [13, 23])
+Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_2, [3, 27])
+Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_3, [33, 23])
+Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
+geompy.UnionIDs(Group_4, [31, 27])
+
+# cut groups
+Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
+Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
+
+# publish shapes
+geompy.addToStudy(Box_1, 'Box_1')
+geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
+geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
+geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
+geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
+geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
+geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
+salome.sg.updateObjBrowser(1)
EXCLUDE_PATTERNS = creating_adv_obj.doc
EXCLUDE =
IMAGE_PATH = @srcdir@/images
-EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG
+EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG @top_srcdir@/doc/salome/examples
#---------------------------------------------------------------------------
#HTML related options
\page boundaries_page Check Free Boundaries
-Detects and highlights wires and edges that are not shared between
+Detects and highlights wires and edges that are not shared between
two faces and are considered a shape's boundary.
+<br>Creates corresponding objects and publishes them into the study on
+"Apply" or "Apply and Close".
<b>TUI Command:</b> <em>(NoError, ClosedWires, OpenWires) =
geompy.GetFreeBoundary(Shape),</em> where \em Shape is a shape to be
\image html repair9.png
-*/
\ No newline at end of file
+*/
\page bounding_box_page Bounding Box
-Returns the dimensions of the bounding box for the selected
-geometrical object.
+Shows the dimensions of the bounding box for the selected
+geometrical object. Creates corresponding shape (box) on "Apply".
+
+\image html measures5.png
\note To take into account any possible shape distortion
that affects the resulting bounding box, the algorithm enlarges
This functionallity is implemented in such a way to have
a satisfactory performance.
-<b>Result:</b> Displays the bounding box dimensions of a
-geometrical object in form of a Python Tuple (Xmin, Xmax, Ymin,
-Ymax, Zmin, Zmax).
-\n <b>TUI Command:</b> <em>geompy.BoundingBox(Shape),</em> where \em Shape
+\n <b>TUI Commands:</b> <em>[Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] = geompy.BoundingBox(Shape)</em>,
+<em>BBox = geompy.MakeBoundingBox(Shape)</em>, where \em Shape
is the shape for which a bounding box is computed.
See also a \ref tui_bounding_box_page "TUI example".
-\image html measures5.png
-
*/
<li> If <b>Reorder vertices taking into account distances</b> is
checked, the interpolation algorithm does not follow the order of
vertices but searches for the closest vertex.</li>
+<li><b>Tangents</b> are two vectors, defining direction of curve at
+its ends. Both or none vectors must be set. This option available only
+if two above check boxes are not checked.
+</li>
</ul>
\n <b>TUI Command:</b>
-<em>geompy.MakeInterpol(ListOfShapes,isClosed,doReordering)</em>
+<br><em>geompy.MakeInterpol(ListOfShapes,isClosed,doReordering)</em>
+<br><em>geompy.MakeInterpolWithTangents(ListOfShapes,Vector1,Vector2)</em>
<b>Analytical Definition</b>
<li><b>Deflection coefficient</b> - allows to define default deflection
coefficient for lines and surfaces. A smaller coefficient provides
better quality of a shape in the viewer.</li>
-<li><b>Default front material</b> - allows to define default front face material.</li>
-<li><b>Default back material</b> - allows to define default back face material.</li>
+<li><b>Show predefined materials in popup menu</b> - allows to customize the displaying of popup menu with list of
+predefined materials.</li>
+<li><b>Default material</b> - allows to define default material.</li>
+<li><b>Subshapes color for editing a group</b> - allows to select default color for subshapes in a group.</li>
<li><b>Edges width</b> - allows to define default width of the edges.</li>
<li><b>Isolines width</b> - allows to define default width of the isolines.</li>
<li><b>Preview edges width</b> - allows to define width of the edges for preview.</li>
<li>\ref tui_test_others_page</li>
<li>\ref tui_test_spanner_page</li>
<li>\ref tui_test_all_page</li>
+ <li>\ref tui_test_measures_page</li>
</ul>
</ul>
\n You can change the material properties of the selected shape(s) in
the dedicated dialog box. This dialog box can be invoked from the
-context popup menu using "Material properties" item:
+context popup menu.
+
+\n Appearance of popup menu can be customizable via
+"Show predefined materials in popup menu" option from preferences.
+If this option is switched off, only "Material properties" item will
+be shown in popup menu. If this option is on (by default), "Material
+properties" item in popup menu will open submenu listing predefined
+materials and additionally "Custom..." item.
+
+\n "Show predefined materials in popup menu" option is switched off:
+\image html hide_predef_material.PNG
+\n "Show predefined materials in popup menu" option is switched on
+\image html show_predef_material.PNG
+
+\n"Custom..." or "Material properties" item will open dialog box:
\image html material.png
- assign one of predefined global materials to the shape;
- create a custom material model and apply it to the shape.
+\n You also can work with custom materials in the "Materials library" dialog box.
+This dialog box can be invoked from the "Tools" main menu using
+"Materials library" item:
+
+\image html materials_library.png
+
\note This functionality is available in both OCC and VTK 3D
viewers. However, note that due to the differencies between underlying API
of OCC and VTK libraries the behaviour of the functionality related to
objects is white. OpenGL allows you to set the red, green, and blue
values for each component of light independently.
-\section material Material properties dialog box
-
+\section material_lib Materials library dialog box
The dialog box consists of two parts:
- The list box at the left shows all available material models, both
predefined by the application and custom one specified by the user.
- \b Shininess
- \b Type of material model: \em physical or \em artificial.
-If the material model is specified as a \em physical one (like \em Gold,
-for instance), this means that the color of the shape (more precisely
-its \em ambient color) can not be modified. If you assign a physical
-material model to the shape, the "Color" menu item will not be
-available in the popup menu.
-
-If the model is non-physical (\em artificial), the color can be changed
-to any appopriate one, only other attributes will be constant. In the
-dialog box you will be able to modify the color of the shape via the
-"Color" button. "Ambient color" button becomes disabled to signalize
-that this attribute of the model is ignored. Also, it will be possible
-to modify the color of the shape via the
-\ref color_page "corresponding popup menu command".
-
All available predefined material models are shown in the list box of
-the <b>Color and Material Properties</b> dialog:
+the <b>Materials dialog</b> dialog:
- <b>[Current]</b> item in the list corresponds to the material model
currently assigned to the selected shape(s). This model can be
freely modified by the user.
box. An additional "Rename material" command, available in popup menu,
can be used to change the name of material model.
+\section material Material properties dialog box
+
+The dialog box looks like "Materials library" dialog box but has
+some additions in the form of selection objects mechanizm and "Color"
+property.
+
+If the material model is specified as a \em physical one (like \em Gold,
+for instance), this means that the color of the shape (more precisely
+its \em ambient color) can not be modified. If you assign a physical
+material model to the shape, the "Color" menu item will not be
+available in the popup menu.
+
+If the model is non-physical (\em artificial), the color can be changed
+to any appopriate one, only other attributes will be constant. In the
+dialog box you will be able to modify the color of the shape via the
+"Color" button. "Ambient color" button becomes disabled to signalize
+that this attribute of the model is ignored. Also, it will be possible
+to modify the color of the shape via the
+\ref color_page "corresponding popup menu command".
+
<b>Examples:</b>
\image html material_OCC.png
\page min_distance_page Min. Distance
Returns the minimum distance between two geometrical objects and
-the coordinates of the vector of distance and shows the vector in the viewer.
+the coordinates of the vector of distance and shows the distance in
+the viewer.
-<b>TUI Command:</b> <em>geompy.MinDistance(Shape1, Shape2),</em>
-where \em Shape1 and \em Shape2 are shapes between which the minimal
+\note The minimal distance searching task can have one or more
+solutions, and also it can have an infinite set of solutions. All
+found solutions are listed in dedicated combobox. When the user
+selects any one of found solutions, presentation is displayed in the
+OCC viewer and fields "Length", "DX", "DY" and "DZ" are filled with
+corresponding values. If there are no solutions found, text "No
+solution found" will be shown instead of solutions list; this could
+mean what the task has an infinite number of solutions.
+
+\n \note Currently used OCCT functionality finds finite number of
+solutions even in cases, where an infinite set of solutions exists.
+
+\n On \b Apply or <b>Apply and Close</b> it creates a set of closest
+points of the shapes, corresponding to all found solutions.
+
+<b>TUI Commands:</b>
+\n<em>aDist = geompy.MinDistance(Shape1, Shape2),</em>
+\n<em>[aDist, DX, DY, DZ] = geompy.MinDistanceComponents(Shape1, Shape2),</em>
+\n<em>[nbSols, (x11, y11, z11, x21, y21, z21, ...)] = geompy.ClosestPoints(Shape1, Shape2),</em>
+\n where \em Shape1 and \em Shape2 are shapes between which the minimal
distance is computed.
See also a \ref tui_min_distance_page "TUI example".
\image html distance.png
-*/
\ No newline at end of file
+*/
\n To produce a <b>Multi Rotation</b> in the <b>Main Menu</b> select
<b>Operations - > Transformation - > Multi Rotation</b>
-\n This operation creates several geometrical objects rotated in one
-or two dimensions basing on the initial geometrical object.
-\n The \b Result will be one or several \b GEOM_Objects (compound).
+\n This operation creates a compound of several shapes rotated in one
+or two dimensions basing on the initial shape.
+\n The \b Result will be one \b GEOM_Object (compound).
\n To produce a <b>Simple Multi Rotation</b> (in one dimension) you
-need to define a \b Shape to be rotated, an \b Axis of rotation and a
-<b>Number of Times</b> the shape must be rotated. <b>Rotation Angle</b> will
-be 2 * \a PI / \a NbTimes. Number of shapes in the resulting compound will be equal
-to \a NbTimes (if \a NbTimes = 1, the result will contain only the initial
-non-transformed shape).
-\n <b>TUI Command:</b> <em>geompy.MultiRotate1D(Shape, Axis, NbTimes)</em>
-\n <b>Arguments:</b> Name + 1 shape + 1 vector for direction + 1 value
-(repetition).
+need to define a \b Shape to be rotated, an \b Axis of rotation (DZ by
+default), Angle of rotation (optionally) and a <b>Number of Times</b>
+the shape must be rotated. If <b>Angular step</b> is not defined
+(checkbox is not checked), it will be 2 * \a PI / \a NbTimes. Number
+of shape's copies in the resulting compound will be equal to
+\a NbTimes (if \a NbTimes = 1, the result will contain only the
+initial non-transformed shape).
+
+\n <b>TUI Commands:</b>
+\n <em>geompy.MultiRotate1DNbTimes(Shape, Axis, NbTimes)</em>
+\n <em>geompy.MultiRotate1DByStep(Shape, Axis, AngleStep, NbTimes)</em>
\b <b>NB!</b> There is another way to execute a Multi-rotation
operation, which is currently accessible only via TUI commands:
-<em>geompy.MakeMultiRotation1D(Shape, Dir, Point, NbTimes)</em> which works in
-the same way, but the Axis is defined by direction and point.
+<em>geompy.MakeMultiRotation1DNbTimes(Shape, Dir, Point, NbTimes)</em>,
+<em>geompy.MakeMultiRotation1DByStep(Shape, Dir, Point, AngleStep, NbTimes)</em>,
+which works in the same way, but the Axis is defined by direction and point.
\image html neo-mrot1.png
\image html multi_rotation1d2.png "The result of a simple multi-rotation"
\n <b>Double Multi Rotation</b> (in two dimensions) rotates the given
-\b Object around the given \b Axis on the given \b Angle a given
-<b>Number of Times</b> and multi-translates each rotation
-result. Translation direction passes through the center of gravity of
-the rotated shape and its projection on the rotation axis. Number of
-shapes in the resulting compound will be equal to \a NbTimes1 x \a NbTimes2 (if
-both \a NbTimes1 and \a NbTimes2 are equal to 1, the result will contain
+\b Object around the given \b Axis (DZ by default) on the given
+\b Angle (optional) a given <b>Number of Times</b> and
+multi-translates each rotation result.
+If <b>Angular step</b> is not defined (checkbox is not checked), it
+will be 2 * \a PI / \a NbTimes.
+Translation direction passes through the center of gravity of the
+initial shape and its projection on the rotation axis. Number of
+shape's copies in the resulting compound will be equal to \a NbTimes1 x \a NbTimes2
+(if both \a NbTimes1 and \a NbTimes2 are equal to 1, the result will contain
only the initial non-transformed shape).
\b Reverse checkbox allows to set the direction of rotation.
-\n <b>TUI Command:</b> <em>geompy.MultiRotate2D(Shape, Axis, Angle, NbTimes1, Step, NbTimes2)</em>
-\n <b>Arguments:</b> Name + 1 shape + 1 vector for direction + 1 angle
-+ 1 value (repetition) + 1 step value + 1 value (repetition).
+
+\n <b>TUI Commands:</b>
+\n <em>geompy.MultiRotate2DNbTimes(Shape, Axis, NbTimes1, RadialStep, NbTimes2)</em>
+\n <em>geompy.MultiRotate2DByStep(Shape, Axis, AngleStep, NbTimes1, RadialStep, NbTimes2)</em>
<b>NB!</b> There is another way to execute a Double Multi-rotation
operation, which is currently accessible only via TUI commands:
-<em>geompy.MakeMultiRotation2D(Shape, Dir, Point, Angle, nbtimes1, Step,nbtimes2)</em>
-which works in the same way,
-but the Axis is defined by direction and point.
+<em>geompy.MakeMultiRotation2DNbTimes(Shape, Dir, Point, NbTimes1, RadialStep, NbTimes2)</em>,
+<em>geompy.MakeMultiRotation2DByStep(Shape, Dir, Point, AngleStep, NbTimes1, RadialStep, NbTimes2)</em>,
+which works in the same way, but the Axis is defined by direction and point.
\image html neo-mrot2.png
\n This operation makes several translations of a shape in \b one or \b
two directions.
-\n The \b Result will be one or several \b GEOM_Objects
-(compound). The total number of shapes in the resulting compound (for
-a single initial selected shape) will be equal to:
+\n The \b Result will be one \b GEOM_Object (compound). The total
+number of shape copies in the resulting compound will be equal to:
- in case of \ref single_multi_translation "Single multi translation":
\a NbTimes (if \a NbTimes parameter is equal to 1, the result will
contain only the initial non-translated shape).
\anchor single_multi_translation
\n To produce a <b>Simple Multi Translation</b> (in one direction) you
need to indicate an \b Object to be translated, a \b Vector of
-translation, a \b Step of translation and a <b>Number of Times</b> the
-Object should be duplicated. If a curve has been selected instead of
-the Vector, only its first and last vertices will be used to get the vector direction
-and the dialog preview will display the vector along which the object will be translated.
-\n <b>TUI Command:</b> <em>geompy.MakeMultiTranslation1D(Shape, Dir,
-Step, NbTimes)</em>
-\n <b>Arguments:</b> Name + 1 shape + 1 vector (for direction) + 1
-step value + 1 value (repetition).
+translation (DX by default), a \b Step of translation and a <b>Number
+of Times</b> the Object should be duplicated. If a curve has been
+selected instead of the Vector, only its first and last vertices will
+be used to get the vector direction and the dialog preview will
+display the vector along which the object will be translated.
\image html mtrans1.png
\image html multi_translation1dsn.png "The result of a simple multi-translation"
+\n <b>TUI Command:</b> <em>geompy.MakeMultiTranslation1D(Shape, Dir,
+Step, NbTimes)</em>
+\n <b>Arguments:</b> Name + 1 shape + 1 vector (for direction) + 1
+step value + 1 value (repetition).
+
\anchor double_multi_translation
\n To produce a <b>Double Multi Translation</b> (in two directions) you need to
indicate an \b Object to be translated, and, for both axes, a \b
-Vector of translation, a \b Step of translation and a <b>Number of Times</b> the shape must be duplicated.
-If a curve has been selected instead of the Vector, only its first and last vertices will be used to get the vector direction
-and the dialog preview will display the vector along which the object will be translated.
+Vector of translation (DX and DY by default), a \b Step of translation
+and a <b>Number of Times</b> the shape must be duplicated.
+If a curve has been selected instead of the Vector, only its first and
+last vertices will be used to get the vector direction and the dialog
+preview will display the vector along which the object will be
+translated.
+
+\image html mtrans2.png
+
+\image html multi_translation_initialsn.png "The initial object"
+
+\image html multi_translation2dsn.png "The result of a double multi-translation"
\n <b>TUI Command:</b> <em>geompy.MakeMultiTranslation2D(Shape, Dir1,
Step1, NbTimes1, Dir2, Step2, NbTimes2),</em> where \em Shape is a shape
\n <b>Arguments:</b> Name + 1 shape + 2 vectors defining the direction
+ 2 step values + 2 values (repetitions).
-\image html mtrans2.png
-
-\image html multi_translation_initialsn.png "The initial object"
-
-\image html multi_translation2dsn.png "The result of a double multi-translation"
-
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_multi_translation "Transformation Operations".
/*!
\page tui_3dsketcher_page 3D Sketcher
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# Create a 3D sketcher (wire) on the given points coordinates
-sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
-
-# add object in the study
-id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
-
-# display the sketcher
-gg.createAndDisplayGO(id_sketcher1)
-
-# Create a 3D sketcher (wire) with Sketcher3D interface
-
-# get the interface instance
-sk = geompy.Sketcher3D()
-
-# add three points with absolute coordinates
-# the first point will be the start point of sketcher
-# two segments will be added by this command
-sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11)
-
-# add one segment, defined by two angles in "OXY" coordinate system and length
-sk.addPointAnglesLength("OXY", 45, 0, 100)
-
-# add three points with relative coordinates
-# three segments will be added by this command
-sk.addPointsRelative(20,0,0, 20,0,100, -40,0,-50)
-
-# set to close the sketcher
-sk.close()
-
-# obtain the sketcher result
-sketcher2 = sk.wire()
-
-# add object in the study
-id_sketcher2 = geompy.addToStudy(sketcher2, "Sketcher2")
-
-# display the sketcher
-gg.createAndDisplayGO(id_sketcher2)
-\endcode
+\include 3dsketcher.py
+<a href="../../examples/GEOM/3dsketcher.py">Download this script</a>
*/
\anchor tui_creation_pipetshape
<br><h2>Creation of PipeTShape</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create PipeTShape object
-pipetshape = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0)
-
-# add object in the study
-id_pipetshape = geompy.addToStudy(pipetshape[0],"PipeTShape")
-# add groups in the study
-for g in pipetshape[1:]:
- geompy.addToStudyInFather(pipetshape[0], g, g.GetName())
-
-# Create junction vertices
-P1 = geompy.MakeVertex(0.0, 0.0, 0.0)
-P2 = geompy.MakeVertex(400.0, 0.0, 0.0)
-P3 = geompy.MakeVertex(200.0, 0.0, 200.0)
-
-# create PipeTShape object with position
-pipetshape_position = geompy.MakePipeTShape(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshape_position = geompy.addToStudy(pipetshape_position[0],"PipeTShape_position")
-# add groups in the study
-for g in pipetshape_position[1:]:
- geompy.addToStudyInFather(pipetshape_position[0], g, g.GetName())
-
-# create PipeTShape with chamfer object
-pipetshapechamfer = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0)
-
-# add object in the study
-id_pipetshapechamfer = geompy.addToStudy(pipetshapechamfer[0],"PipeTShapeChamfer")
-# add groups in the study
-for g in pipetshapechamfer[1:]:
- geompy.addToStudyInFather(pipetshapechamfer[0], g, g.GetName())
-
-# create PipeTShape with chamfer object with position
-pipetshapechamfer_position = geompy.MakePipeTShapeChamfer(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 20.0, 20.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshapechamfer_position = geompy.addToStudy(pipetshapechamfer_position[0],"PipeTShapeChamfer_position")
-# add groups in the study
-for g in pipetshapechamfer_position[1:]:
- geompy.addToStudyInFather(pipetshapechamfer_position[0], g, g.GetName())
-
-# create PipeTShape with fillet object
-pipetshapefillet = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0)
-
-# add object in the study
-id_pipetshapefillet = geompy.addToStudy(pipetshapefillet[0],"PipeTShapeFillet")
-# add groups in the study
-for g in pipetshapefillet[1:]:
- geompy.addToStudyInFather(pipetshapefillet[0], g, g.GetName())
-
-# create PipeTShape with fillet object with position
-pipetshapefillet_position = geompy.MakePipeTShapeFillet(80.0, 20.0, 200.0, 50.0, 20.0, 200.0, 5.0, True, P1, P2, P3)
-
-# add object in the study
-id_pipetshapefillet_position = geompy.addToStudy(pipetshapefillet_position[0],"PipeTShapeFillet_position")
-# add groups in the study
-for g in pipetshapefillet_position[1:]:
- geompy.addToStudyInFather(pipetshapefillet_position[0], g, g.GetName())
-
-
-# display pipetshapes
-gg.createAndDisplayGO(id_pipetshape)
-gg.createAndDisplayGO(id_pipetshape_position)
-gg.createAndDisplayGO(id_pipetshapechamfer)
-gg.createAndDisplayGO(id_pipetshapechamfer_position)
-gg.createAndDisplayGO(id_pipetshapefillet)
-gg.createAndDisplayGO(id_pipetshapefillet_position)
-
-\endcode
+\include advanced_geom_objs_ex01.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex01.py">Download this script</a>
\anchor tui_creation_divideddisk
<br><h2>Creation of DividedDisk</h2>
-
-\code
-import geompy
-import salome
-import GEOM
-gg = salome.ImportComponentGUI("GEOM")
-
-# create DividedDisk object
-divideddisk = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
-
-# add object in the study
-id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
-
-# display divideddisk
-gg.createAndDisplayGO(id_divideddisk)
-\endcode
+\include advanced_geom_objs_ex02.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex02.py">Download this script</a>
\anchor tui_creation_dividedcylinder
<br><h2>Creation of DividedCylinder</h2>
-
-\code
-import geompy
-import salome
-import GEOM
-gg = salome.ImportComponentGUI("GEOM")
-
-# create DividedCylinder object
-dividedcylinder = geompy.MakeDividedCylinder(100, 300, GEOM.SQUARE)
-
-# add object in the study
-id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder")
-
-# display dividedcylinder
-gg.createAndDisplayGO(id_dividedcylinder)
-\endcode
+\include advanced_geom_objs_ex03.py
+<a href="../../examples/GEOM/advanced_geom_objs_ex03.py">Download this script</a>
<!--@@ insert new functions before this line @@ do not remove this line @@-->
*/
/*!
\page tui_angle_page Angle
-
-\code
-import salome
-salome.salome_init()
-
-import math
-import geompy
-geompy.init_geom(salome.myStudy)
-
-OX = geompy.MakeVectorDXDYDZ(10, 0,0)
-OXY = geompy.MakeVectorDXDYDZ(10,10,0)
-
-# in one plane
-Angle = geompy.GetAngle(OX, OXY)
-
-print "\nAngle between OX and OXY = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
- print " Error: returned angle is", Angle, "while must be 45.0"
- pass
-
-Angle = geompy.GetAngleRadians(OX, OXY)
-
-print "\nAngle between OX and OXY in radians = ", Angle
-if math.fabs(Angle - math.pi/4) > 1e-05:
- print " Error: returned angle is", Angle, "while must be pi/4"
- pass
-
-Angle = geompy.GetAngleVectors(OX, OXY, True)
-
-print "\nAngle between vectors OX and OXY = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
- print " Error: returned angle is", Angle, "while must be 45.0"
- pass
-
-Angle = geompy.GetAngleRadiansVectors(OX, OXY, False)
-
-print "\nBig angle between vectors OX and OXY in radians = ", Angle
-if math.fabs(Angle - math.pi*7./4.) > 1e-05:
- print " Error: returned angle is", Angle, "while must be 7*pi/4"
- pass
-
-# not in one plane
-OXY_shift = geompy.MakeTranslation(OXY,10,-10,20)
-Angle = geompy.GetAngle(OX, OXY_shift)
-
-print "\nAngle between OX and OXY_shift = ", Angle
-if math.fabs(Angle - 45.0) > 1e-05:
- print " Error: returned angle is", Angle, "while must be 45.0"
- pass
-
-# not linear
-pnt1 = geompy.MakeVertex(0, 0, 0)
-pnt2 = geompy.MakeVertex(10, 0, 0)
-pnt3 = geompy.MakeVertex(20, 10, 0)
-arc = geompy.MakeArc(pnt1, pnt2, pnt3)
-Angle = geompy.GetAngle(OX, arc)
-
-if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()):
- print "Error. Angle must not be computed on curvilinear edges"
- pass
-
-\endcode
+\include angle.py
+<a href="../../examples/GEOM/angle.py">Download this script</a>
*/
\anchor tui_creation_point
<br><h2>Creation of a Point</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex(0., 100., 0.)
-pz = geompy.MakeVertex(0., 0., 100.)
-p1 = geompy.MakeVertex(50., 50., 30.)
-
-# create a curve and vertices on it
-Arc = geompy.MakeArc(py, pz, px)
-# create a vertex by parameter
-p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25)
-# create a vertex by length
-p_on_arc2 = geompy.MakeVertexOnCurveByLength(Arc, 50., None)
-#create a vertex by point projection
-p_on_arc3 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10)
-
-# create 2 lines and make a point on its intersection
-line_1 = geompy.MakeLineTwoPnt(p0, p100)
-line_2 = geompy.MakeLineTwoPnt(p1, pz)
-p_inter = geompy.MakeVertexOnLinesIntersection(line_1, line_2)
-
-# create a face and vertices on it
-Add_line = geompy.MakeLineTwoPnt(px, py)
-arc_face = geompy.MakeFaceWires([Arc, Add_line], 1)
-p_on_face1 = geompy.MakeVertexOnSurface(arc_face, 0.5, 0.5)
-p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(arc_face, 35, 35, 35)
-p_on_face3 = geompy.MakeVertexInsideFace(arc_face)
-
-
-# add objects in the study
-id_p0 = geompy.addToStudy(p0, "Vertex 0")
-id_p100 = geompy.addToStudy(p100, "Vertex 100")
-id_px = geompy.addToStudy(px, "Vertex X")
-id_py = geompy.addToStudy(py, "Vertex Y")
-id_pz = geompy.addToStudy(pz, "Vertex Z")
-id_Arc = geompy.addToStudy(Arc, "Arc")
-id_line_1 = geompy.addToStudy(line_1, "Line 1")
-id_line_2 = geompy.addToStudy(line_2, "Line 2")
-id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc by parameter")
-id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc by length")
-id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc by point projection")
-id_p_inter = geompy.addToStudy(p_inter, "Vertex on Lines Intersection")
-id_p_on_face1 = geompy.addToStudy(p_on_face1, "Vertex on face by parameter")
-id_p_on_face2 = geompy.addToStudy(p_on_face2, "Vertex on face by point projection")
-id_p_on_face3 = geompy.addToStudy(p_on_face3, "Vertex inside face")
-
-# display vertices
-gg.createAndDisplayGO(id_p0)
-gg.createAndDisplayGO(id_p100)
-gg.createAndDisplayGO(id_Arc)
-gg.createAndDisplayGO(id_p_inter)
-gg.createAndDisplayGO(id_p_on_arc)
-gg.createAndDisplayGO(id_p_on_arc2)
-gg.createAndDisplayGO(id_p_on_arc3)
-\endcode
+\include basic_geom_objs_ex01.py
+<a href="../../examples/GEOM/basic_geom_objs_ex01.py">Download this script</a>
\anchor tui_creation_line
<br><h2>Creation of a Line</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p100 = geompy.MakeVertexWithRef(p0, 100., 100., 100.)
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create a line from a point and a vector
-line1 = geompy.MakeLine(pz, vxy)
-
-#create a line from two points
-line2 = geompy.MakeLineTwoPnt(p0, p100)
-
-# add objects in the study
-id_vxy = geompy.addToStudy(vxy, "Vector")
-id_line1 = geompy.addToStudy(line1,"Line1")
-id_line2 = geompy.addToStudy(line2,"Line2")
-
-# display lines
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_line1)
-gg.createAndDisplayGO(id_line2)
-\endcode
+\include basic_geom_objs_ex02.py
+<a href="../../examples/GEOM/basic_geom_objs_ex02.py">Download this script</a>
\anchor tui_creation_circle
<br><h2>Creation of a Circle</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-
-# create a vector on two points
-vxy = geompy.MakeVector(px, py)
-
-# create a circle from a point, a vector and a radius
-circle1 = geompy.MakeCircle(pz, vxy, 30)
-
-#create a circle from three points
-circle2 = geompy.MakeCircleThreePnt(p0, px, py)
-
-# add objects in the study
-id_vxy = geompy.addToStudy(vxy, "Vector")
-id_circle1 = geompy.addToStudy(circle1,"Circle1")
-id_circle2 = geompy.addToStudy(circle2,"Circle2")
-
-# display circles
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_circle1)
-gg.createAndDisplayGO(id_circle2)
-\endcode
+\include basic_geom_objs_ex03.py
+<a href="../../examples/GEOM/basic_geom_objs_ex03.py">Download this script</a>
\anchor tui_creation_ellipse
<br><h2>Creation of an Ellipse</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p1 = geompy.MakeVertex(50., 50., 50.)
-p2 = geompy.MakeVertex(0., 50., 0.)
-
-# create a normal vector from two points
-normal = geompy.MakeVector(p0, p1)
-
-# create a major axis vector from two points
-major = geompy.MakeVector(p0, p2)
-
-# create an ellipse from a point, a vector and radiuses
-ellipse1 = geompy.MakeEllipse(p1, normal, 50, 25)
-
-# create an ellipse from a point, a normal vector, radiuses and a major axis vector
-ellipse2 = geompy.MakeEllipse(p1, normal, 50, 25, major)
-
-# add objects in the study
-id_normal = geompy.addToStudy(normal, "Normal")
-id_major = geompy.addToStudy(major, "Major Axis")
-id_ellipse1 = geompy.addToStudy(ellipse1, "Ellipse 1")
-id_ellipse2 = geompy.addToStudy(ellipse2, "Ellipse 2")
-
-# display the ellipse and its normal vector
-gg.createAndDisplayGO(id_normal)
-gg.createAndDisplayGO(id_major)
-gg.createAndDisplayGO(id_ellipse1)
-gg.createAndDisplayGO(id_ellipse2)
-\endcode
+\include basic_geom_objs_ex04.py
+<a href="../../examples/GEOM/basic_geom_objs_ex04.py">Download this script</a>
\anchor tui_creation_arc
<br><h2>Creation of an Arc</h2>
+\include basic_geom_objs_ex05.py
+<a href="../../examples/GEOM/basic_geom_objs_ex05.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-p1 = geompy.MakeVertex(100., 0., 0.)
-p2 = geompy.MakeVertex(50., 0., 50.)
-
-# create an arc from a three points
-arc1 = geompy.MakeArc(p0, p1, p2)
-
-# create an arc from a center point, a start point and end point
-arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
-
-# create an arc from a center point, a major point and minor point
-arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
-
-# add objects in the study
-id_arc1 = geompy.addToStudy(arc1, "Arc 1")
-id_arc2 = geompy.addToStudy(arc2, "Arc 2")
-id_arc3 = geompy.addToStudy(arc3, "Arc 3")
-
-# display the arcs
-gg.createAndDisplayGO(id_arc1)
-gg.createAndDisplayGO(id_arc2)
-gg.createAndDisplayGO(id_arc3)
-\endcode
-
\anchor tui_creation_curve
<br><h2>Creation of a Curve</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-p1 = geompy.MakeVertex(50. , 100., 200.)
-p2 = geompy.MakeVertex(150., 50., 100.)
-p3 = geompy.MakeVertex(100., 150., 170.)
-p4 = geompy.MakeVertex(200., 200., 150.)
-
-# create a polyline from a list of points
-polyline = geompy.MakePolyline([p0, p1, p2, p3, p4])
-
-# create a bezier curve from a list of points
-bezier = geompy.MakeBezier([p0, p1, p2, p3, p4])
-
-#create a b-spline curve from a list of points
-interpol = geompy.MakeInterpol([p0, p1, p2, p3, p4], False)
-
-#create a polyline using parametric definition of the basic points
-param_polyline = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Polyline, theNewMethod=True)
-
-# create a bezier curve using parametric definition of the basic points
-param_bezier = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Bezier, theNewMethod=True)
-
-#create a b-spline curve using parametric definition of the basic points
-param_interpol = geompy.MakeCurveParametric("t", "sin(t)", "cos(t)", 0., 100., 100, geompy.GEOM.Interpolation, theNewMethod=True)
-
-
-
-# add objects in the study
-id_p0 = geompy.addToStudy(p0, "Point1")
-id_p1 = geompy.addToStudy(p1, "Point2")
-id_p2 = geompy.addToStudy(p2, "Point3")
-id_p3 = geompy.addToStudy(p3, "Point4")
-id_p4 = geompy.addToStudy(p4, "Point5")
-id_polyline = geompy.addToStudy(polyline, "Polyline")
-id_bezier = geompy.addToStudy(bezier, "Bezier")
-id_interpol = geompy.addToStudy(interpol, "Interpol")
-id_param_polyline = geompy.addToStudy(param_polyline, "Polyline Parametric")
-id_param_bezier = geompy.addToStudy(param_bezier, "Bezier Parametric")
-id_param_interpol = geompy.addToStudy(param_interpol, "Interpol Parametric")
-
-
-
-# display the points and the curves
-gg.createAndDisplayGO(id_p0)
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_p3)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_polyline)
-gg.createAndDisplayGO(id_bezier)
-gg.createAndDisplayGO(id_interpol)
-gg.createAndDisplayGO(id_param_polyline)
-gg.createAndDisplayGO(id_param_bezier)
-gg.createAndDisplayGO(id_param_interpol)
-
-\endcode
+\include basic_geom_objs_ex06.py
+<a href="../../examples/GEOM/basic_geom_objs_ex06.py">Download this script</a>
\anchor tui_creation_vector
<br><h2>Creation of a Vector</h2>
-
-\code
-mport geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(10., 50., 20.)
-p2 = geompy.MakeVertex(70., 70., 70.)
-
-# create a vector from two points
-vector1 = geompy.MakeVector(p1, p2)
-
-# create a vector from the given components
-vector2 = geompy.MakeVectorDXDYDZ(30, 30, 100)
-
-# add objects in the study
-id_p1 = geompy.addToStudy(p1, "Point1")
-id_p2 = geompy.addToStudy(p2, "Point2")
-id_vector1 = geompy.addToStudy(vector1,"Vector1")
-id_vector2 = geompy.addToStudy(vector2,"Vector2")
-
-# display the points and the vectors
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_vector1)
-gg.createAndDisplayGO(id_vector2)
-\endcode
+\include basic_geom_objs_ex07.py
+<a href="../../examples/GEOM/basic_geom_objs_ex07.py">Download this script</a>
\anchor tui_creation_plane
<br><h2>Creation of a Plane</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex( 0., 0., 100.)
-p2 = geompy.MakeVertex(100., 0., 0.)
-p3 = geompy.MakeVertex(200., 200., 200.)
-p4 = geompy.MakeVertex(100., 100., 0.)
-p5 = geompy.MakeVertex(0. , 100., 0.)
-
-# create a vectors from the given components
-vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
-vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
-
-# create a vector from two points
-vector_arc = geompy.MakeVector(p2, p5)
-
-# create an arc from three points
-arc = geompy.MakeArc(p2, p4, p5)
-
-# create a wire
-wire = geompy.MakeWire([vector_arc, arc])
-
-# create a face
-isPlanarWanted = 1
-face = geompy.MakeFace(wire, isPlanarWanted)
-trimsize = 1000.
-
-# create a Local Coordinate System
-
-LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
-
-# create a plane from a point, a vector and a trimsize
-plane1 = geompy.MakePlane(p1, vector1, trimsize)
-
-# create a plane from three points and a trimsize
-plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
-
-# create a plane from the given face
-plane3 = geompy.MakePlaneFace(face, trimsize)
-
-# create a plane from two vectors and a trimsize
-plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
-
-# create a plane with the Local Coordinate System and a trimsize
-plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
-
-# add objects in the study
-id_face = geompy.addToStudy(face, "Face")
-id_plane1 = geompy.addToStudy(plane1,"Plane1")
-id_plane2 = geompy.addToStudy(plane2,"Plane2")
-id_plane3 = geompy.addToStudy(plane3,"Plane3")
-id_plane4 = geompy.addToStudy(plane4,"Plane4")
-id_plane5 = geompy.addToStudy(plane5,"Plane5")
-
-# display the points and the vectors
-gg.createAndDisplayGO(id_face)
-gg.createAndDisplayGO(id_plane1)
-gg.createAndDisplayGO(id_plane2)
-gg.createAndDisplayGO(id_plane3)
-gg.createAndDisplayGO(id_plane4)
-gg.createAndDisplayGO(id_plane5)
-gg.setDisplayMode(id_plane1,1)
-gg.setTransparency(id_plane1,0.5)
-gg.setDisplayMode(id_plane2,1)
-gg.setTransparency(id_plane2,0.5)
-gg.setDisplayMode(id_plane3,1)
-gg.setTransparency(id_plane3,0.5)
-gg.setDisplayMode(id_plane4,1)
-gg.setTransparency(id_plane4,0.5)
-gg.setDisplayMode(id_plane5,1)
-gg.setTransparency(id_plane5,0.5)
-\endcode
+\include basic_geom_objs_ex08.py
+<a href="../../examples/GEOM/basic_geom_objs_ex08.py">Download this script</a>
\anchor tui_creation_lcs
<br><h2>Creation of a Local Coordinate System</h2>
-\code
-import GEOM
-import geompy
-import math
-import SALOMEDS
-
-#Create vertexes, vectors and shapes to construct local CS
-Vertex_1 = geompy.MakeVertex(50, 50, 50)
-Vertex_2 = geompy.MakeVertex(70, 70, 70)
-Vertex_3 = geompy.MakeVertex(0, 0, 0)
-Vector_X = geompy.MakeVectorDXDYDZ(50, 0, 0)
-Vector_Y = geompy.MakeVectorDXDYDZ(0, 50, 0)
-Face_1 = geompy.MakeFaceHW(100, 100, 1)
-Box_1 = geompy.MakeBoxTwoPnt(Vertex_1, Vertex_2)
-
-#Construct local CS by manual definition
-LocalCS_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
-
-#Construct local CS by center point and two vectors (X and Y directions)
-LocalCS_2 = geompy.MakeMarkerPntTwoVec(Vertex_3, Vector_X, Vector_Y)
-
-#Construct local CS from shape orientation
-LocalCS_FACE = geompy.MakeMarkerFromShape(Face_1)
-LocalCS_BOX = geompy.MakeMarkerFromShape(Box_1)
-
-#Add created object to study
-geompy.addToStudy( Face_1, "Face_1" )
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Box_1, "Box_1" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vector_X, "Vector_X" )
-geompy.addToStudy( Vector_Y, "Vector_Y" )
-geompy.addToStudy( LocalCS_1, "LocalCS_1" )
-geompy.addToStudy( LocalCS_2, "LocalCS_3" )
-geompy.addToStudy( LocalCS_FACE, "LocalCS_FACE" )
-geompy.addToStudy( LocalCS_BOX, "LocalCS_BOX" )
-\endcode
+\include basic_geom_objs_ex09.py
+<a href="../../examples/GEOM/basic_geom_objs_ex09.py">Download this script</a>
*/
\anchor tui_partition
<br><h2>Partition</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p0 = geompy.MakeVertex( 0., 0., 0.)
-p200 = geompy.MakeVertex(200., 200., 200.)
-pz = geompy.MakeVertex( 0., 0., 100.)
-
-# create a vector
-vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.)
-
-# create a box from two points
-box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a plane
-trimsize = 500.
-plane = geompy.MakePlane(pz, vxyz, trimsize)
-
-# create partition objects
-partition1 = geompy.MakePartition([box], [plane])
-partition2 = geompy.Partition([box], [plane])
-partition3 = geompy.MakeHalfPartition(box, plane)
-
-# add objects in the study
-id_box = geompy.addToStudy(box,"Box")
-id_plane = geompy.addToStudy(plane,"Plane")
-id_partition1 = geompy.addToStudy(partition1,"MakePartition")
-id_partition2 = geompy.addToStudy(partition2,"Partition")
-id_partition3 = geompy.addToStudy(partition3,"MakeHalfPartition")
-
-# display the partition objects and the plane
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_plane)
-gg.setDisplayMode(id_plane,1)
-gg.createAndDisplayGO(id_partition1)
-gg.createAndDisplayGO(id_partition2)
-gg.createAndDisplayGO(id_partition3)
-\endcode
+\include basic_operations_ex01.py
+<a href="../../examples/GEOM/basic_operations_ex01.py">Download this script</a>
\anchor tui_archimede
<br><h2>Archimede</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p0 = geompy.MakeVertex( 0., 0., 0.)
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# perform an Archimede operation on the selected shape with selected parameters
-weight = 1000000.
-waterdensity = 1.
-meshingdeflection = 0.01
-archimede = geompy.Archimede(box, weight, waterdensity, meshingdeflection)
-
-# add objects in the study
-id_box = geompy.addToStudy(box,"Box")
-id_archimede = geompy.addToStudy(archimede,"Archimede")
-
-# display the box and the result of Archimede operation
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_archimede)
-gg.setDisplayMode(id_archimede,1)
-\endcode
+\include basic_operations_ex02.py
+<a href="../../examples/GEOM/basic_operations_ex02.py">Download this script</a>
\anchor tui_restore_prs_params
<br><h2>Restore presentation parameters and sub-shapes</h2>
-
-\code
-import geompy
-import GEOM
-import SALOMEDS
-
-# create a box and a cylinder
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-cyl = geompy.MakeCylinderRH(100, 300)
-
-# create translated box
-vec = geompy.MakeVectorDXDYDZ(100, 50, 0)
-tra = geompy.MakeTranslationVector(box, vec)
-
-# create partition objects
-partition1 = geompy.MakePartition([box, cyl])
-partition2 = geompy.MakePartition([box], [cyl])
-partition3 = geompy.MakePartition([box], [tra])
-
-# set colours
-box.SetColor(SALOMEDS.Color(1,0,0))
-cyl.SetColor(SALOMEDS.Color(0,1,0))
-
-# add objects in the study
-geompy.addToStudy(box, "Box")
-geompy.addToStudy(cyl, "Cylinder")
-geompy.addToStudy(vec, "Vector")
-geompy.addToStudy(tra, "Translation")
-geompy.addToStudy(partition1, "Partition_1")
-geompy.addToStudy(partition2, "Partition_2")
-geompy.addToStudy(partition3, "Partition_3")
-
-# Restore presentation parameters and sub-shapes
-# different methods can be used to find the sub-shapes in the result:
-# GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape.
-# By default, GetInPlace method is used (GEOM.FSM_GetInPlace)
-geompy.RestoreSubShapes(partition1)
-
-geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace)
-
-# The list of arguments can be used to avoid restoring all arguments,
-# but restore only the passed.
-geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory)
-
-# To find sub-shapes in a transformed shape only one method could be
-# used: pass GEOM.FSM_Transformed for that.
-# True passed for the last argument, means that the transformed shape
-# will inherit colour and sub-shapes from its first argument (see above
-# MakeTranslation).
-geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True)
-
-# Also we could do this directly with method addToStudy:
-partition4 = geompy.MakePartition([box, tra])
-geompy.addToStudy(partition4, "Partition_4", True, [],
- GEOM.FSM_GetInPlaceByHistory, False)
-\endcode
+\include basic_operations_ex03.py
+<a href="../../examples/GEOM/basic_operations_ex03.py">Download this script</a>
*/
/*!
\page tui_basic_properties_page Basic Properties
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-props = geompy.BasicProperties(box)
-print "\nBox 100x30x100 Basic Properties:"
-print " Wires length: ", props[0]
-print " Surface area: ", props[1]
-print " Volume : ", props[2]
-length = math.sqrt((props[0] - 1840)*(props[0] - 1840))
-area = math.sqrt((props[1] - 32000)*(props[1] - 32000))
-volume = math.sqrt((props[2] - 300000)*(props[2] - 300000))
-if length > 1e-7 or area > 1e-7 or volume > 1e-7:
- print "While must be:"
- print " Wires length: ", 1840
- print " Surface area: ", 32000
- print " Volume : ", 300000.
-\endcode
+\include basic_properties.py
+<a href="../../examples/GEOM/basic_properties.py">Download this script</a>
*/
\anchor tui_multi_transformation
<br><h2>Multi Transformation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p_25_25_50 = geompy.MakeVertex(25., 25., 50.)
-p_50_25_25 = geompy.MakeVertex(50., 25., 25.)
-p_25_50_25 = geompy.MakeVertex(25., 50., 25.)
-
-box = geompy.MakeBoxDXDYDZ(50, 50, 50)
-
-top_face = geompy.GetFaceNearPoint(box, p_25_25_50)
-yz_face = geompy.GetFaceNearPoint(box, p_50_25_25)
-xz_face = geompy.GetFaceNearPoint(box, p_25_50_25)
-
-top_face_ind = geompy.GetSubShapeID(box, top_face)
-yz_face_ind = geompy.GetSubShapeID(box, yz_face)
-xz_face_ind = geompy.GetSubShapeID(box, xz_face)
-
-# Multi-transformate block and glue the result
-box_tr1 = geompy.MakeMultiTransformation1D(box, yz_face_ind, top_face_ind, 3)
-box_tr2 = geompy.MakeMultiTransformation2D(box, xz_face_ind, yz_face_ind, 3, top_face_ind, 0, 2)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_box_tr1 = geompy.addToStudy(box_tr1, "Multi-transformed Block 1D")
-id_box_tr2 = geompy.addToStudy(box_tr2, "Multi-transformed Block 2D")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_box_tr1)
-gg.createAndDisplayGO(id_box_tr2)
-\endcode
+\include blocks_operations_ex01.py
+<a href="../../examples/GEOM/blocks_operations_ex01.py">Download this script</a>
\anchor tui_explode_on_blocks
<br><h2>Explode on Blocks</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-sphere = geompy.MakeSphereR(100)
-
-# make a compound
-compound = geompy.MakeCompound([box, sphere])
-
-# get all the blocks of the given compound, by criteria: min_nb_faces <= nb. of faces <= max_nb_faces
-min_nb_faces = 6
-max_nb_faces = 6
-make_block_explode = geompy.MakeBlockExplode(compound, min_nb_faces, max_nb_faces)
-
-# add objects in the study
-id_compound = geompy.addToStudy(compound, "Compound")
-id_make_block_explode = geompy.addToStudyInFather(compound, make_block_explode[0], "MakeBlockExplode")
-
-# display the results
-gg.createAndDisplayGO(id_compound)
-gg.createAndDisplayGO(id_make_block_explode)
-gg.setDisplayMode(id_make_block_explode,1)
-\endcode
+\include blocks_operations_ex02.py
+<a href="../../examples/GEOM/blocks_operations_ex02.py">Download this script</a>
\anchor tui_propagate
<br><h2>Propagate</h2>
+\include blocks_operations_ex03.py
+<a href="../../examples/GEOM/blocks_operations_ex03.py">Download this script</a>
-\code
-import geompy
-import salome
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# build all possible propagation groups
-listChains = geompy.Propagate(check_box)
-
-# add objects in the study
-geompy.addToStudy(check_box, "Box")
-ii = 1
-for chain in listChains:
- geompy.addToStudyInFather(check_box, chain, "propagation chain " + `ii`)
- ii = ii + 1
- pass
-
-salome.sg.updateObjBrowser(1)
-\endcode
-
-*/
\ No newline at end of file
+*/
\anchor tui_fuse
<br><h2>Fuse</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0, 0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# fuse
-fuse1 = geompy.MakeFuse(cylinder, sphere)
-fuse2 = geompy.MakeBoolean(cylinder, sphere, 3)
-
-# add objects in the study
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_sphere = geompy.addToStudy(sphere, "Sphere")
-id_fuse1 = geompy.addToStudy(fuse1, "Fuse_1")
-id_fuse2 = geompy.addToStudy(fuse2, "Fuse_2")
-
-# display results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_sphere)
-gg.setDisplayMode(id_sphere,1)
-gg.createAndDisplayGO(id_fuse1)
-gg.setDisplayMode(id_fuse1,1)
-gg.createAndDisplayGO(id_fuse2)
-gg.setDisplayMode(id_fuse2,1)
-\endcode
+\include boolean_operations_ex01.py
+<a href="../../examples/GEOM/boolean_operations_ex01.py">Download this script</a>
\anchor tui_common
<br><h2>Common</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0, 0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# make common
-common = geompy.MakeCommon(cylinder, sphere)
-
-# add objects in the study
-id_common = geompy.addToStudy(common, "Common")
-
-# display the results
-gg.createAndDisplayGO(id_common)
-gg.setDisplayMode(id_common,1)
-\endcode
+\include boolean_operations_ex02.py
+<a href="../../examples/GEOM/boolean_operations_ex02.py">Download this script</a>
\anchor tui_cut
<br><h2>Cut</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0, 0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-#cut
-cut = geompy.MakeCut(cylinder, sphere)
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1)
-\endcode
+\include boolean_operations_ex03.py
+<a href="../../examples/GEOM/boolean_operations_ex03.py">Download this script</a>
\anchor tui_section
<br><h2>Section</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 55, 0)
-p2 = geompy.MakeVertex( 0, 0, 0)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a sphere
-sphere = geompy.MakeSphereR(40)
-
-# make a section
-section = geompy.MakeSection(cylinder, sphere)
-
-# add objects in the study
-id_section = geompy.addToStudy(section, "Section")
-
-# display the results
-gg.createAndDisplayGO(id_section)
-gg.setDisplayMode(id_section,1)
-\endcode
+\include boolean_operations_ex04.py
+<a href="../../examples/GEOM/boolean_operations_ex04.py">Download this script</a>
*/
/*!
\page tui_bounding_box_page Bounding Box
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-bb = geompy.BoundingBox(box)
-print "\nBounding Box of box 100x30x100:"
-print " Xmin = ", bb[0], ", Xmax = ", bb[1]
-print " Ymin = ", bb[2], ", Ymax = ", bb[3]
-print " Zmin = ", bb[4], ", Zmax = ", bb[5]
-\endcode
+\include bounding_box.py
+<a href="../../examples/GEOM/bounding_box.py">Download this script</a>
*/
\page tui_building_by_blocks_page Building by Blocks
<br><h2>Quadrangle Face</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex( 0., 0., 0.)
-p2 = geompy.MakeVertex(150., 30., 0.)
-p3 = geompy.MakeVertex( 0., 120., 50.)
-p4 = geompy.MakeVertex( 0., 40., 70.)
-
-# create edges
-edge1 = geompy.MakeEdge(p1, p2)
-edge2 = geompy.MakeEdge(p2, p3)
-edge3 = geompy.MakeEdge(p3, p4)
-edge4 = geompy.MakeEdge(p4, p1)
-
-# create a quadrangle face from four edges
-qface1 = geompy.MakeQuad(edge1, edge2, edge3, edge4)
-
-# create a quadrangle face from two edges
-qface2 = geompy.MakeQuad2Edges(edge1, edge3)
-
-# create a quadrangle from four points in its corners
-qface3 = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
-
-# add objects in the study
-id_p1 = geompy.addToStudy(p1,"Point1")
-id_p2 = geompy.addToStudy(p2,"Point2")
-id_p3 = geompy.addToStudy(p3,"Point3")
-id_p4 = geompy.addToStudy(p4,"Point4")
-id_edge1 = geompy.addToStudy(edge1,"Edge1")
-id_edge2 = geompy.addToStudy(edge2,"Edge2")
-id_edge3 = geompy.addToStudy(edge3,"Edge3")
-id_edge4 = geompy.addToStudy(edge4,"Edge4")
-id_qface1 = geompy.addToStudy(qface1,"Qface1")
-id_qface2 = geompy.addToStudy(qface2,"Qface2")
-id_qface3 = geompy.addToStudy(qface3,"Qface3")
-
-# display the vertices, the edges and the quadrangle faces
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_p3)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_edge1)
-gg.createAndDisplayGO(id_edge2)
-gg.createAndDisplayGO(id_edge3)
-gg.createAndDisplayGO(id_edge4)
-gg.createAndDisplayGO(id_qface1)
-gg.setDisplayMode(id_qface1,1)
-gg.createAndDisplayGO(id_qface2)
-gg.setDisplayMode(id_qface2,1)
-gg.createAndDisplayGO(id_qface3)
-gg.setDisplayMode(id_qface3,1)
-\endcode
+\include building_by_blocks_ex01.py
+<a href="../../examples/GEOM/building_by_blocks_ex01.py">Download this script</a>
<br><h2>Hexagonal Solid</h2>
+\include building_by_blocks_ex02.py
+<a href="../../examples/GEOM/building_by_blocks_ex02.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex( 0., 0., 0.)
-p1 = geompy.MakeVertex( 0., 0., 40.)
-p2 = geompy.MakeVertex( 70., -15., 0.)
-p3 = geompy.MakeVertex( 70., -15., 70.)
-
-p4 = geompy.MakeVertex( 0., 70., 0.)
-p5 = geompy.MakeVertex( 0., 70., 40.)
-p6 = geompy.MakeVertex( 70., 70., 0.)
-p7 = geompy.MakeVertex( 70., 70., 70.)
-
-p8 = geompy.MakeVertex( 0., -50., 0.)
-p9 = geompy.MakeVertex( 0., -50., 40.)
-p10 = geompy.MakeVertex( 70., -35., 0.)
-p11 = geompy.MakeVertex( 70., -35., 70.)
-
-# create faces
-qface1 = geompy.MakeQuad4Vertices(p0, p1, p2, p3)
-qface2 = geompy.MakeQuad4Vertices(p4, p5, p6, p7)
-qface3 = geompy.MakeQuad4Vertices(p0, p1, p4, p5)
-qface4 = geompy.MakeQuad4Vertices(p2, p3, p6, p7)
-qface5 = geompy.MakeQuad4Vertices(p0, p2, p4, p6)
-qface6 = geompy.MakeQuad4Vertices(p1, p3, p5, p7)
-qface7 = geompy.MakeQuad4Vertices(p8, p9, p10, p11)
-
-# create a hexahedral solid between two given faces
-solid1 = geompy.MakeHexa2Faces(qface1, qface7)
-
-# create a hexahedral solid, bounded by six given faces
-solid2 = geompy.MakeHexa(qface1, qface2, qface3, qface4, qface5, qface6)
-
-# add objects in the study
-geompy.addToStudy(qface1,"qface1")
-geompy.addToStudy(qface2,"qface2")
-geompy.addToStudy(qface3,"qface3")
-geompy.addToStudy(qface4,"qface4")
-geompy.addToStudy(qface5,"qface5")
-geompy.addToStudy(qface6,"qface6")
-geompy.addToStudy(qface7,"qface7")
-
-id_solid1 = geompy.addToStudy(solid1,"Solid1")
-id_solid2 = geompy.addToStudy(solid2,"Solid2")
-
-# display solids
-gg.createAndDisplayGO(id_solid1)
-gg.setDisplayMode(id_solid1, 1)
-gg.createAndDisplayGO(id_solid2)
-gg.setDisplayMode(id_solid2, 1)
-\endcode
-
-*/
\ No newline at end of file
+*/
/*!
\page tui_center_of_mass_page Center of masses
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-cm = geompy.MakeCDG(box)
-if cm is None:
- raise RuntimeError, "MakeCDG(box) failed"
-else:
- print "\nCentre of gravity of box has been successfully obtained:"
- coords = geompy.PointCoordinates(cm)
- print "(", coords[0], ", ", coords[1], ", ", coords[2], ")"
- dx = math.sqrt((coords[0] - 50)*(coords[0] - 50))
- dy = math.sqrt((coords[1] - 15)*(coords[1] - 15))
- dz = math.sqrt((coords[2] - 50)*(coords[2] - 50))
- if dx > 1e-7 or dy > 1e-7 or dz > 1e-7:
- print "But must be (50, 15, 50)"
-\endcode
+\include center_of_mass.py
+<a href="../../examples/GEOM/center_of_mass.py">Download this script</a>
*/
/*!
\page tui_check_compound_of_blocks_page Check Compound of Blocks
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make a compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue the faces of the compound
-tolerance = 1e-5
-glue = geompy.MakeGlueFaces(compound, tolerance)
-IsValid = geompy.CheckCompoundOfBlocks(glue)
-if IsValid == 0:
- raise RuntimeError, "Invalid compound created"
-else:
- print "\nCompound is valid"
-\endcode
+\include check_compound_of_blocks.py
+<a href="../../examples/GEOM/check_compound_of_blocks.py">Download this script</a>
*/
/*!
\page tui_check_self_intersections_page Detect Self-intersections
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckSelfIntersections(box)
-if IsValid == 0:
- raise RuntimeError, "Box with self-intersections created"
-else:
- print "\nBox is valid"
-\endcode
+\include check_self_intersections.py
+<a href="../../examples/GEOM/check_self_intersections.py">Download this script</a>
*/
/*!
\page tui_check_shape_page Check Shape
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-IsValid = geompy.CheckShape(box)
-if IsValid == 0:
- raise RuntimeError, "Invalid box created"
-else:
- print "\nBox is valid"
-\endcode
+\include check_shape.py
+<a href="../../examples/GEOM/check_shape.py">Download this script</a>
*/
\anchor tui_creation_prism
<br><h2>Creation of a Prism</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex( 0., 0., 0.)
-p2 = geompy.MakeVertex( 100., 0., 0.)
-p3 = geompy.MakeVertex( 100., 100., 0.)
-p4 = geompy.MakeVertex( 0., 100., 0.)
-p5 = geompy.MakeVertex( 0., 0., 60.)
-p6 = geompy.MakeVertex(-100., 0., 0.)
-p7 = geompy.MakeVertex(-100.,-100., 0.)
-p8 = geompy.MakeVertex( 0.,-100., 0.)
-
-# create a vector from the given components
-vector = geompy.MakeVectorDXDYDZ(50., 50., 50.)
-
-#create vectors from two points
-vector1_arc1 = geompy.MakeVector(p1, p2)
-vector2_arc1 = geompy.MakeVector(p1, p4)
-vector1_arc2 = geompy.MakeVector(p1, p6)
-vector2_arc2 = geompy.MakeVector(p1, p8)
-
-# create arcs from three points
-arc1 = geompy.MakeArc(p2, p3, p4)
-arc2 = geompy.MakeArc(p6, p7, p8)
-
-# create wires
-wire1 = geompy.MakeWire([vector1_arc1, arc1, vector2_arc1])
-wire2 = geompy.MakeWire([vector1_arc2, arc2, vector2_arc2])
-
-# create faces
-isPlanarWanted = 1
-face1 = geompy.MakeFace(wire1, isPlanarWanted)
-face2 = geompy.MakeFace(wire2, isPlanarWanted)
-
-# create prisms
-prism1 = geompy.MakePrism(face2, p1, p5)
-prism2 = geompy.MakePrismVecH(face1, vector, 50)
-prism3 = geompy.MakePrismVecH2Ways(face1, vector, 50)
-
-# add objects in the study
-id_face1 = geompy.addToStudy(face1,"Face1")
-id_face2 = geompy.addToStudy(face2,"Face2")
-id_prism1 = geompy.addToStudy(prism1,"Prism1")
-id_prism2 = geompy.addToStudy(prism2,"Prism2")
-id_prism3 = geompy.addToStudy(prism3,"Prism3")
-
-# display cylinders
-gg.createAndDisplayGO(id_face1)
-gg.setDisplayMode(id_face1,1)
-gg.createAndDisplayGO(id_face2)
-gg.setDisplayMode(id_face2,1)
-gg.createAndDisplayGO(id_prism1)
-gg.setDisplayMode(id_prism1,1)
-gg.createAndDisplayGO(id_prism2)
-gg.setDisplayMode(id_prism2,1)
-gg.createAndDisplayGO(id_prism3)
-gg.setDisplayMode(id_prism3,1)
-\endcode
+\include complex_objs_ex01.py
+<a href="../../examples/GEOM/complex_objs_ex01.py">Download this script</a>
\anchor tui_creation_revolution
<br><h2>Creation of a Revolution</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex( 10., 10., 10.)
-p2 = geompy.MakeVertex( 15., 15., 50.)
-p3 = geompy.MakeVertex( 40., 40., 0.)
-
-#create vectors from two points
-vector1 = geompy.MakeVector(p1, p2)
-vector2 = geompy.MakeVector(p1, p3)
-
-# create a vector from the given components
-vector3 = geompy.MakeVectorDXDYDZ(-20., -20., 100.)
-
-# create a wire
-wire = geompy.MakeWire([vector1, vector2])
-
-# create a revolution
-revolution = geompy.MakeRevolution(wire, vector3, 2.3)
-
-# add objects in the study
-id_vector3 = geompy.addToStudy(vector3,"Axis")
-id_wire = geompy.addToStudy(wire,"Wire")
-id_revolution = geompy.addToStudy(revolution,"Revolution")
-
-# display the vector, the wire and the revolution
-gg.createAndDisplayGO(id_vector3)
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_revolution)
-gg.setDisplayMode(id_revolution,1)
-\endcode
+\include complex_objs_ex02.py
+<a href="../../examples/GEOM/complex_objs_ex02.py">Download this script</a>
\anchor tui_creation_filling
<br><h2>Creation of a Filling</h2>
+\include complex_objs_ex03.py
+<a href="../../examples/GEOM/complex_objs_ex03.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-mindeg = 2
-maxdeg = 5
-tol3d = 0.0001
-tol2d = 0.0001
-nbiter = 5
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex( -30., -30., 50.)
-p2 = geompy.MakeVertex( -60., -60., 30.)
-p3 = geompy.MakeVertex( -30., -30., 10.)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-ShapeListCompound = []
-i = 0
-while i <= 3 :
- S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
- ShapeListCompound.append(S)
- i = i + 1
-
-compound = geompy.MakeCompound(ShapeListCompound)
-
-# create a filling
-filling = geompy.MakeFilling(compound, mindeg, maxdeg, tol3d, tol2d, nbiter)
-
-# add objects in the study
-id_compound = geompy.addToStudy(compound,"Compound")
-id_filling = geompy.addToStudy(filling,"Filling")
-
-# display the compound and the filling
-gg.createAndDisplayGO(id_compound)
-gg.createAndDisplayGO(id_filling)
-gg.setDisplayMode(id_filling,1)
-\endcode
-
\anchor tui_creation_pipe
<br><h2>Creation of a Pipe</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create an edge
-edge = geompy.MakeEdge(p0, pxyz)
-
-# create a pipe
-pipe = geompy.MakePipe(wire, edge)
-
-# add objects in the study
-id_wire = geompy.addToStudy(wire,"Wire")
-id_edge = geompy.addToStudy(edge,"Edge")
-id_pipe = geompy.addToStudy(pipe,"Pipe")
-
-# display the wire, the edge (path) and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_edge)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1)
-\endcode
+\include complex_objs_ex04.py
+<a href="../../examples/GEOM/complex_objs_ex04.py">Download this script</a>
\anchor tui_creation_pipe_with_diff_sec
<br><h2>Creation of a PipeWithDifferentSections</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-Wire_1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
-edges = geompy.SubShapeAll(Wire_1, geompy.ShapeType["EDGE"])
-vertices = geompy.SubShapeAll(Wire_1, geompy.ShapeType["VERTEX"])
-
-# create sections
-circles=[]
-circles.append(geompy.MakeCircle(vertices[0], edges[0], 20))
-circles.append(geompy.MakeCircle(vertices[1], edges[0], 40))
-circles.append(geompy.MakeCircle(vertices[2], edges[2], 30))
-circles.append(geompy.MakeCircle(vertices[3], edges[2], 20))
-
-# create pipe
-Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0)
-
-# add objects in the study
-geompy.addToStudy(circles[0], "circles1")
-geompy.addToStudy(circles[1], "circles2")
-geompy.addToStudy(circles[2], "circles3")
-geompy.addToStudy(circles[3], "circles4")
-id_wire = geompy.addToStudy(Wire_1, "Path")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the wire(path) and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1)
-\endcode
+\include complex_objs_ex05.py
+<a href="../../examples/GEOM/complex_objs_ex05.py">Download this script</a>
\anchor tui_creation_pipe_with_shell_sec
<br><h2>Creation of a PipeWithShellSections</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create path
-WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0])
-
-#=======================================================
-# Create shell sections
-#=======================================================
-ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
-theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
-VC = geompy.MakeCompound(theLocations)
-geompy.addToStudy(VC,"VC")
-vs = [Edge_1,Edge_1,Edge_3,Edge_3]
-hs = [20,40,30,20]
-shells = []
-subbases = []
-
-# 1 section
-c0 = geompy.PointCoordinates(ps[0])
-c1 = geompy.PointCoordinates(ps[1])
-nx = c1[0] - c0[0]
-ny = c1[1] - c0[1]
-nz = c1[2] - c0[2]
-
-faces = []
-f1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 20 0:TT 20 20:TT 0 20:WF",
- [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 20:TT -20 20:TT -20 0:WF",
- [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f3 = geompy.MakeSketcher("Sketcher:F 0 0:TT -20 0:TT -20 -20:TT 0 -20:WF",
- [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-f4 = geompy.MakeSketcher("Sketcher:F 0 0:TT 0 -20:TT 20 -20:TT 20 0:WF",
- [c0[0], c0[1], c0[2], nx, ny, nz, 0, 0, 1])
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[0])
-
-# 2 section
-faces = []
-
-w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
- [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,-1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f1 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
- [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,-1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f2 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
- [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,-1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f3 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
- [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,-1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f4 = geompy.MakeFace(w,1)
-
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[0])
-
-# 3 section
-faces = []
-c2 = geompy.PointCoordinates(ps[2])
-c3 = geompy.PointCoordinates(ps[3])
-nx = c3[0] - c2[0]
-ny = c3[1] - c2[1]
-nz = c3[2] - c2[2]
-
-w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0",
- [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f1 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20",
- [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f2 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20",
- [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f3 = geompy.MakeFace(w,1)
-
-w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0",
- [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1])
-[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"])
-arc = MakeArc(w,3,1)
-w = geompy.MakeWire([e1,e2,e3,arc])
-f4 = geompy.MakeFace(w,1)
-
-faces.append(f1)
-faces.append(f2)
-faces.append(f3)
-faces.append(f4)
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-subbases.append(faces[2])
-
-# 4 section
-faces = []
-
-kk = 4
-dx = c3[0] - nx/kk
-dy = c3[1] - ny/kk
-dz = c3[2] - nz/kk
-rad = math.sqrt(nx*nx+ny*ny+nz*nz)
-vc = geompy.MakeVertex(dx,dy,dz)
-sph = geompy.MakeSpherePntR(vc,rad/kk)
-shellsph = geompy.SubShapeAll(sph, geompy.ShapeType["SHELL"])
-
-fs = []
-vec = geompy.MakeVectorDXDYDZ(0,0,1)
-ff = geompy.MakePlane(ps[3],vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0],c3[1],c3[2]+20)
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0],c3[1],c3[2]-20)
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vec = geompy.MakeVectorDXDYDZ(1,0,0)
-ff = geompy.MakePlane(ps[3],vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0]+20,c3[1],c3[2])
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-vp = geompy.MakeVertex(c3[0]-20,c3[1],c3[2])
-ff = geompy.MakePlane(vp,vec,40)
-fs.append(ff)
-aPartition = geompy.MakePartition(shellsph,fs)
-fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"])
-
-faces.append(fs[0])
-faces.append(fs[1])
-faces.append(fs[2])
-faces.append(fs[3])
-shell = geompy.MakeSewing(faces,1.e-6)
-shells.append(shell)
-faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-
-
-#===========================================================
-# Create Pipe
-#===========================================================
-subbases = []
-Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
- theWithContact=0, theWithCorrection=0)
-
-# add objects in the study
-resc = geompy.MakeCompound(shells)
-id_sec = geompy.addToStudy(resc,"sections")
-id_wire = geompy.addToStudy(WirePath,"WirePath")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the wire(path), sections and the pipe
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_sec)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1)
-\endcode
-
+\include complex_objs_ex06.py
+<a href="../../examples/GEOM/complex_objs_ex06.py">Download this script</a>
\anchor tui_creation_pipe_without_path
<br><h2>Creation of a PipeShellsWithoutPath</h2>
-
-\code
-import geompy
-import math
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# Add a section based on quadrangles
-# ----------------------------------
-def section(s, p1, p2=None, p3=None, p4=None):
- if p2==None:
- q = p1
- else:
- q = geompy.MakeQuad4Vertices(p1, p2, p3, p4)
- pass
- s.append(q)
- publish(q, "section")
- return q
-
-
-# find distance between two points
-# -------------------------------
-def Dist(p1,p2):
- c1 = geompy.PointCoordinates(p1)
- c2 = geompy.PointCoordinates(p2)
- return math.sqrt( (c2[0]-c1[0])*(c2[0]-c1[0]) +
- (c2[1]-c1[1])*(c2[1]-c1[1]) +
- (c2[2]-c1[2])*(c2[2]-c1[2]) )
-
-
-# return middle point
-# -------------------------------
-def MiddleVert(p1,p2):
- c1 = geompy.PointCoordinates(p1)
- c2 = geompy.PointCoordinates(p2)
- return geompy.MakeVertex( (c2[0]+c1[0])/2, (c2[1]+c1[1])/2, (c2[2]+c1[2])/2 )
-
-
-# Complex section
-# result - 16 quads from lines
-# pnt - point from path
-# vec - direction from path
-def MakeComplexSect(pnt,vec,rmax,rmin,nb):
- dang = 1.0/nb/2
- cmax = geompy.MakeCircle(pnt,vec,rmax)
- cmin = geompy.MakeCircle(pnt,vec,rmin)
- faces = []
- for i in range(0,2*nb,2):
- p1 = geompy.MakeVertexOnCurve(cmin,dang*i)
- p2 = geompy.MakeVertexOnCurve(cmax,dang*(i+1))
- p3 = geompy.MakeVertexOnCurve(cmin,dang*(i+2))
- f = geompy.MakeQuad4Vertices(pnt,p1,p2,p3)
- faces.append(f)
- pass
- shell = geompy.MakeSewing(faces,1.e-6)
- return shell
-
-
-#=======================================================
-# Create simple path and recieve points
-# for section creation
-#=======================================================
-WirePath = geompy.MakeSketcher("Sketcher:F 0 0:T 60 0:T 40 0:R 0:C 100 90:",
- [0, 0, 0, 0, 0, 1, 1, 0, 0])
-vs = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
-
-#=======================================================
-# Create shell sections
-#=======================================================
-shells = []
-subbases = []
-locs = []
-
-# 1 section
-shell = MakeComplexSect(vs[0], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
-shells.append(shell)
-vs1 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs1[17])
-
-# 2 section
-shell = MakeComplexSect(vs[1], geompy.MakeVectorDXDYDZ(1,0,0), 80, 30, 16)
-shells.append(shell)
-vs2 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs2[17])
-
-# 3 section
-shell = MakeComplexSect(vs[2], geompy.MakeVectorDXDYDZ(1,0,0), 60, 40, 16)
-shells.append(shell)
-vs3 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs3[17])
-
-# 4 section
-shell = MakeComplexSect(vs[3], geompy.MakeVectorDXDYDZ(0,1,0), 40, 35, 16)
-shells.append(shell)
-vs4 = geompy.SubShapeAllSortedCentres(shell,geompy.ShapeType["VERTEX"])
-locs.append(vs4[17])
-
-
-#===========================================================
-# Create Pipe
-#===========================================================
-
-Pipe = geompy.MakePipeShellsWithoutPath(shells,locs)
-
-# add objects in the study
-resc = geompy.MakeCompound(shells)
-id_sec = geompy.addToStudy(resc,"sections")
-resl = geompy.MakeCompound(locs)
-id_loc = geompy.addToStudy(resl,"locations")
-id_pipe = geompy.addToStudy(Pipe, "Pipe")
-
-# display the sections, locations and pipe
-gg.createAndDisplayGO(id_sec)
-gg.createAndDisplayGO(id_loc)
-gg.createAndDisplayGO(id_pipe)
-gg.setDisplayMode(id_pipe,1)
-\endcode
+\include complex_objs_ex07.py
+<a href="../../examples/GEOM/complex_objs_ex07.py">Download this script</a>
\anchor tui_creation_pipe_binormal_along_vector
<br><h2>Creation of a PipeBiNormalAlongVector</h2>
-
-\code
-def MakeHelix(radius, height, rotation, direction):
- # - create a helix -
- radius = 1.0 * radius
- height = 1.0 * height
- rotation = 1.0 * rotation
- if direction > 0:
- direction = +1
- else:
- direction = -1
- pass
- from math import sqrt
- length_z = height
- length_xy = radius*rotation
- length = sqrt(length_z*length_z + length_xy*length_xy)
- import geompy
- nb_steps = 1
- epsilon = 1.0e-6
- while 1:
- z_step = height / nb_steps
- angle_step = rotation / nb_steps
- z = 0.0
- angle = 0.0
- helix_points = []
- for n in range(nb_steps+1):
- from math import cos, sin
- x = radius * cos(angle)
- y = radius * sin(angle)
- p = geompy.MakeVertex(x, y, z)
- helix_points.append( p )
- z += z_step
- angle += direction * angle_step
- pass
- helix = geompy.MakeInterpol(helix_points)
- length_test = geompy.BasicProperties(helix)[0]
- prec = abs(length-length_test)/length
- # print nb_steps, length_test, prec
- if prec < epsilon:
- break
- nb_steps *= 2
- pass
- return helix
-
-def MakeSpring(radius, height, rotation, direction, thread_radius, base_rotation=0.0):
- # - create a pipe -
- thread_radius = 1.0 * thread_radius
- # create a helix
- helix = MakeHelix(radius, height, rotation, direction)
- # base in the (Ox, Oz) plane
- import geompy
- p0 = geompy.MakeVertex(radius-3*thread_radius, 0.0, -thread_radius)
- p1 = geompy.MakeVertex(radius+3*thread_radius, 0.0, -thread_radius)
- p2 = geompy.MakeVertex(radius+3*thread_radius, 0.0, +thread_radius)
- p3 = geompy.MakeVertex(radius-3*thread_radius, 0.0, +thread_radius)
- e0 = geompy.MakeEdge(p0, p1)
- e1 = geompy.MakeEdge(p1, p2)
- e2 = geompy.MakeEdge(p2, p3)
- e3 = geompy.MakeEdge(p3, p0)
- w = geompy.MakeWire([e0, e1, e2, e3])
- # create a base face
- base = geompy.MakeFace(w, True)
- # create a binormal vector
- binormal = geompy.MakeVectorDXDYDZ(0.0, 0.0, 10.0)
- # create a pipe
- spring = geompy.MakePipeBiNormalAlongVector(base, helix, binormal)
- # Publish in the study
- geompy.addToStudy(base, "base")
- geompy.addToStudy(helix, "helix")
- geompy.addToStudy(binormal, "binormal")
- geompy.addToStudy(spring, "spring")
- return spring
-
-from math import pi
-
-spring = MakeSpring(50, 100, 2*pi, 1, 5, pi/2)
-\endcode
-
+\include complex_objs_ex08.py
+<a href="../../examples/GEOM/complex_objs_ex08.py">Download this script</a>
\anchor tui_creation_pipe_path
<br><h2>Creation of a Middle Path</h2>
-
-\code
-import salome
-import geompy
-
-# Create a box
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# Get two opposite faces
-[Face_1,Face_2] = geompy.SubShapes(Box_1, [31, 33])
-
-# Get edges
-Box_1_edge_12 = geompy.GetSubShape(Box_1, [12])
-Box_1_edge_22 = geompy.GetSubShape(Box_1, [22])
-Box_1_edge_25 = geompy.GetSubShape(Box_1, [25])
-Box_1_edge_29 = geompy.GetSubShape(Box_1, [29])
-Box_1_edge_8 = geompy.GetSubShape(Box_1, [8])
-Box_1_edge_18 = geompy.GetSubShape(Box_1, [18])
-Box_1_edge_26 = geompy.GetSubShape(Box_1, [26])
-Box_1_edge_30 = geompy.GetSubShape(Box_1, [30])
-
-# These three calls to RestorePath return the same result
-Path_1 = geompy.RestorePath(Box_1, Face_1, Face_2)
-Path_2 = geompy.RestorePathEdges(Box_1, [Face_1], [Face_2])
-Path_3 = geompy.RestorePathEdges(Box_1,
- [Box_1_edge_12, Box_1_edge_22, Box_1_edge_25, Box_1_edge_29],
- [Box_1_edge_8, Box_1_edge_18, Box_1_edge_26, Box_1_edge_30])
-
-# Publish created objects
-geompy.addToStudy( Box_1, 'Box_1' )
-geompy.addToStudyInFather( Box_1, Face_1, 'Face_1' )
-geompy.addToStudyInFather( Box_1, Face_2, 'Face_2' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_25, 'Box_1:edge_25' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_22, 'Box_1:edge_22' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_12, 'Box_1:edge_12' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_29, 'Box_1:edge_29' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_18, 'Box_1:edge_18' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_26, 'Box_1:edge_26' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_8, 'Box_1:edge_8' )
-geompy.addToStudyInFather( Box_1, Box_1_edge_30, 'Box_1:edge_30' )
-geompy.addToStudy( Path_1, 'Path_1' )
-geompy.addToStudy( Path_2, 'Path_2' )
-geompy.addToStudy( Path_3, 'Path_3' )
-\endcode
+\include complex_objs_ex09.py
+<a href="../../examples/GEOM/complex_objs_ex09.py">Download this script</a>
<br><h2>Creation of Tangent Plane On Face</h2>
-\code
-import salome
-import geompy
-
-# Create Vertexes for curve
-Vertex_1 = geompy.MakeVertex(0, 0, 0)
-Vertex_2 = geompy.MakeVertex(0, 90, 30)
-Vertex_3 = geompy.MakeVertex(100, 90, 0)
-Vertex_4 = geompy.MakeVertex(-100, 90, 0)
-# Create curve
-Curve_1 = geompy.MakeInterpol([Vertex_4, Vertex_2, Vertex_3, Vertex_1])
-# Create Face by Extrusion of the Curve
-Extrusion_1 = geompy.MakePrismDXDYDZ(Curve_1, 0, 30, -60)
-# Make Tangent on this Extrusion (Face)
-Tangent_1 = geompy.MakeTangentPlaneOnFace(Extrusion_1, 0.7, 0.5, 150)
-# Publish in the study
-geompy.addToStudy( Vertex_1, "Vertex_1" )
-geompy.addToStudy( Vertex_2, "Vertex_2" )
-geompy.addToStudy( Vertex_3, "Vertex_3" )
-geompy.addToStudy( Vertex_4, "Vertex_4" )
-geompy.addToStudy( Curve_1, "Curve_1" )
-geompy.addToStudy( Extrusion_1, "Extrusion_1" )
-geompy.addToStudy( Tangent_1, "Tangent_1" )
-\endcode
+\include complex_objs_ex10.py
+<a href="../../examples/GEOM/complex_objs_ex10.py">Download this script</a>
*/
/*!
\page tui_free_boundaries_page Check Free Boundaries
-
-\code
-import os
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make a compound
-compound = geompy.MakeCompound([box1, box2])
-
-# import from *.brep
-ImportFromBREP = geompy.ImportBREP(os.getenv("DATA_DIR")+"/Shapes/Brep/flight_solid.brep")
-
-# get a face
-faces = geompy.SubShapeAllSortedCentres(ImportFromBREP, geompy.ShapeType["FACE"])
-
-# get the free boundary for face 32
-Res = geompy.GetFreeBoundary(faces[32])
-isSuccess = Res[0]
-ClosedWires = Res[1]
-OpenWires = Res[2]
-
-if isSuccess == 1 :
- print "Checking free boudaries is OK."
-else :
- print "Checking free boudaries is KO!"
-print "len(ClosedWires) = ", len(ClosedWires)
-
-i = 0
-for wire in ClosedWires :
- wire_name = "Face 32 -> Close wires : WIRE %d"%(i+1)
- geompy.addToStudy(ClosedWires[i], wire_name)
- if i < len(ClosedWires) :
- i = i+ 1
-
-print "len(OpenWires) = ", len(OpenWires)
-
-i = 0
-for wire in OpenWires :
- wire_name = "Face 32 -> Open wires : WIRE %d"%(i+1)
- geompy.addToStudy(OpenWires[i], wire_name)
- if i < len(OpenWires) :
- i = i+ 1
-
-# get the free boundary for face 41
-Res = geompy.GetFreeBoundary(faces[41])
-isSuccess = Res[0]
-ClosedWires = Res[1]
-OpenWires = Res[2]
-
-if isSuccess == 1 :
- print "Checking free boudaries is OK."
-else :
- print "Checking free boudaries is KO!"
-print "len(ClosedWires) = ", len(ClosedWires)
-
-i = 0
-for wire in ClosedWires :
- wire_name = "Face 41 -> Close wires : WIRE %d"%(i+1)
- geompy.addToStudy(ClosedWires[i], wire_name)
- if i < len(ClosedWires) :
- i = i+ 1
-
-print "len(OpenWires) = ", len(OpenWires)
-
-i = 0
-for wire in OpenWires :
- wire_name = "Face 41 -> Open wires : WIRE %d"%(i+1)
- geompy.addToStudy(OpenWires[i], wire_name)
- if i < len(OpenWires) :
- i = i+ 1
-
-# add the imported object to the study
-id_ImportFromBREP = geompy.addToStudy(ImportFromBREP, "ImportFromBREP")
-salome.sg.updateObjBrowser(1)
-\endcode
+\include free_boundaries.py
+<a href="../../examples/GEOM/free_boundaries.py">Download this script</a>
*/
/*!
\page tui_free_faces_page Check Free Faces
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-cylinder = geompy.MakeCone(p1, v, 30, 20, 20)
-
-# create a cone
-cone = geompy.MakeCone(p1, v, 70, 40, 60)
-
-# make cut
-cut = geompy.MakeCut(cone, cylinder)
-
-# get faces as sub-shapes
-faces = []
-faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
-f_2 = geompy.GetSubShapeID(cut, faces[0])
-
-# remove one face from the shape
-cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
-
-# suppress the specified wire
-result = geompy.GetFreeFacesIDs(cut_without_f_2)
-print "A number of free faces is ", len(result)
-
-# add objects in the study
-all_faces = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["FACE"])
-for face in all_faces :
- sub_shape_id = geompy.GetSubShapeID(cut_without_f_2, face)
- if result.count(sub_shape_id) > 0 :
- face_name = "Free face %d"%(sub_shape_id)
- geompy.addToStudy(face, face_name)
-
-# in this example all faces from cut_without_f_2 are free
-id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
-
-# display the results
-gg.createAndDisplayGO(id_cut_without_f_2)
-gg.setDisplayMode(id_cut_without_f_2,1)
-\endcode
+\include free_faces.py
+<a href="../../examples/GEOM/free_faces.py">Download this script</a>
*/
/*!
\page tui_get_non_blocks_page Get Non Blocks
-
-\code
-import geompy
-import salome
-
-# create solids
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-cyl = geompy.MakeCylinderRH(100, 200)
-
-geompy.addToStudy(box, 'box')
-geompy.addToStudy(cyl, 'cyl')
-
-# make a compound
-compound = geompy.MakeCompound([box, cyl])
-geompy.addToStudy(compound, 'compound')
-
-# explore the compound
-pair = geompy.GetNonBlocks(compound)
-
-if pair[0] is not None:
- geompy.addToStudyInFather(compound, pair[0], "GrNonBlocks")
- pass
-
-if pair[1] is not None:
- geompy.addToStudyInFather(compound, pair[1], "GrNonQuads")
- pass
-\endcode
+\include get_non_blocks.py
+<a href="../../examples/GEOM/get_non_blocks.py">Download this script</a>
*/
/*!
\page tui_import_export_page Import/Export
-\code
-import geompy
-import salome
-
-# Example of import from IGES using various formats
-
-# get a path to SAMPLES_SRC
-import os
-thePath = os.getenv("DATA_DIR")
-# create filenames
-theFileName1 = thePath + "/Shapes/Iges/boite-3Dipsos_m.igs"
-theFileName2 = thePath + "/Shapes/Iges/boite-3Dipsos_mm.igs"
-#print "thePath = ", thePath
-
-# get units from files
-UnitName1 = geompy.GetIGESUnit(theFileName1)
-UnitName2 = geompy.GetIGESUnit(theFileName2)
-print "UnitName1 = ", UnitName1
-print "UnitName2 = ", UnitName2
-
-# import shapes
-Shape1 = geompy.ImportIGES(theFileName1)
-Shape2 = geompy.ImportIGES(theFileName2)
-Shape3 = geompy.ImportFile(theFileName2,"IGES_SCALE")
-[Xmin1,Xmax1, Ymin1,Ymax1, Zmin1,Zmax1] = geompy.BoundingBox(Shape1)
-[Xmin2,Xmax2, Ymin2,Ymax2, Zmin2,Zmax2] = geompy.BoundingBox(Shape2)
-[Xmin3,Xmax3, Ymin3,Ymax3, Zmin3,Zmax3] = geompy.BoundingBox(Shape3)
-geompy.addToStudy(Shape1, "3Dipsos_m")
-geompy.addToStudy(Shape2, "3Dipsos_mm")
-geompy.addToStudy(Shape3, "3Dipsos_mm_scaled")
-d1 = (Xmax1-Xmin1)*(Xmax1-Xmin1) + (Ymax1-Ymin1)*(Ymax1-Ymin1) + (Zmax1-Zmin1)*(Zmax1-Zmin1)
-d2 = (Xmax2-Xmin2)*(Xmax2-Xmin2) + (Ymax2-Ymin2)*(Ymax2-Ymin2) + (Zmax2-Zmin2)*(Zmax2-Zmin2)
-d3 = (Xmax3-Xmin3)*(Xmax3-Xmin3) + (Ymax3-Ymin3)*(Ymax3-Ymin3) + (Zmax3-Zmin3)*(Zmax3-Zmin3)
-import math
-dd32 = math.sqrt(d3/d2)
-dd12 = math.sqrt(d1/d2)
-dd31 = math.sqrt(d3/d1)
-# values dd31, dd12 and dd31 can be using for checking
-print "dd32 = ",dd32," dd12 = ",dd12," dd31 = ",dd31
-\endcode
+\include import_export.py
+<a href="../../examples/GEOM/import_export.py">Download this script</a>
*/
/*!
\page tui_inertia_page Inertia
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-In = geompy.Inertia(box)
-print "\nInertia matrix of box 100x30x100:"
-print " (", In[0], ", ", In[1], ", ", In[2], ")"
-print " (", In[3], ", ", In[4], ", ", In[5], ")"
-print " (", In[6], ", ", In[7], ", ", In[8], ")"
-print "Main moments of inertia of box 100x30x100:"
-print " Ix = ", In[9], ", Iy = ", In[10], ", Iz = ", In[11]
-\endcode
+\include inertia.py
+<a href="../../examples/GEOM/inertia.py">Download this script</a>
*/
/*!
\page tui_min_distance_page Minimal Distance
-
-\code
-import geompy
-
-# create boxes
-box1 = geompy.MakeBoxDXDYDZ(100,30,100)
-box2 = geompy.MakeBox(105,0,0,200,30,100)
-min_dist = geompy.MinDistance(box1,box2)
-print "\nMinimal distance between box1 and box2 = ", min_dist
-\endcode
+\include min_distance.py
+<a href="../../examples/GEOM/min_distance.py">Download this script</a>
*/
/*!
\page tui_normal_face_page Normal to a Face
-
-\code
-import geompy
-import math
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-
-faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
-face0 = faces[0]
-vnorm = geompy.GetNormal(face0)
-if vnorm is None:
- raise RuntimeError, "GetNormal(face0) failed"
-else:
- geompy.addToStudy(face0, "Face0")
- geompy.addToStudy(vnorm, "Normale to Face0")
- print "\nNormale of face has been successfully obtained"
-\endcode
+\include normal_face.py
+<a href="../../examples/GEOM/normal_face.py">Download this script</a>
*/
\page tui_notebook_geom_page Using SALOME NoteBook
\anchor tui_notebook_geom
-
-\code
-import geompy
-import salome
-import salome_notebook
-gg = salome.ImportComponentGUI("GEOM")
-
-# set variables
-notebook = salome_notebook.notebook
-notebook.set("Length", 150)
-notebook.set("Width", 100)
-
-# create box
-box = geompy.MakeBoxDXDYDZ("Length", "Width", 200)
-
-# add object in the study
-id_box = geompy.addToStudy(box,"Box")
-
-# display the boxes
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-\endcode
+\include notebook_geom.py
+<a href="../../examples/GEOM/notebook_geom.py">Download this script</a>
*/
/*!
\page tui_point_coordinates_page Point Coordinates
+\include point_coordinates.py
+<a href="../../examples/GEOM/point_coordinates.py">Download this script</a>
-\code
-import math
-import geompy
-
-# create a point
-point = geompy.MakeVertex(15., 23., 80.)
-
-# get the coordinates of the point and check its values
-coords = geompy.PointCoordinates(point)
-
-# check the obtained coordinate values
-tolerance = 1.e-07
-def IsEqual(val1, val2): return (math.fabs(val1 - val2) < tolerance)
-
-if IsEqual(coords[0], 15.) and IsEqual(coords[1], 23.) and IsEqual(coords[2], 80.):
- print "All values are OK."
-else :
- print "Coordinates of point must be (15, 23, 80), but returned (",
- print coords[0], ", ", coords[1], ", ", coords[2], ")"
- pass
-\endcode
-
-*/
\ No newline at end of file
+*/
\anchor tui_creation_box
<br><h2>Creation of a Box</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(15, 25, 35)
-p70 = geompy.MakeVertex(70, 70, 70)
-
-# create boxes
-box1 = geompy.MakeBoxDXDYDZ(10, 20, 30)
-box2 = geompy.MakeBox(10,20,30, 15,25,35)
-box3 = geompy.MakeBoxTwoPnt(p0, p70)
-
-# add objects in the study
-id_box1 = geompy.addToStudy(box1,"Box1")
-id_box2 = geompy.addToStudy(box2,"Box2")
-id_box3 = geompy.addToStudy(box3,"Box3")
-
-# display the boxes
-gg.createAndDisplayGO(id_box1)
-gg.setDisplayMode(id_box1,1)
-gg.createAndDisplayGO(id_box2)
-gg.setDisplayMode(id_box2,1)
-gg.createAndDisplayGO(id_box3)
-gg.setDisplayMode(id_box3,1)
-\endcode
+\include primitives_ex01.py
+<a href="../../examples/GEOM/primitives_ex01.py">Download this script</a>
\anchor tui_creation_cylinder
<br><h2>Creation of a Cylinder</h2>
-
-\code
-import geompy
-import salome
-
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(25, 35, 45)
-p2 = geompy.MakeVertex(70, 70, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create cylinders
-height = 40
-
-radius1 = 15
-cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
-
-radius2 = 30
-cylinder2 = geompy.MakeCylinderRH(radius2, height)
-
-# add objects in the study
-id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
-id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
-
-# display the cylinders
-gg.createAndDisplayGO(id_cylinder1)
-gg.setDisplayMode(id_cylinder1,1)
-gg.createAndDisplayGO(id_cylinder2)
-gg.setDisplayMode(id_cylinder2,1)
-\endcode
+\include primitives_ex02.py
+<a href="../../examples/GEOM/primitives_ex02.py">Download this script</a>
\anchor tui_creation_sphere
<br><h2>Creation of a Sphere</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex
-p = geompy.MakeVertex(55, 45, 25)
-
-# create spheres
-radius1 = 20
-sphere1 = geompy.MakeSpherePntR(p, radius1)
-radius2 = 15
-sphere2 = geompy.MakeSphere(0, 0, 45, radius2)
-radius3 = 30
-sphere3 = geompy.MakeSphereR(radius3)
-
-# add objects in the study
-id_sphere1 = geompy.addToStudy(sphere1,"Sphere1")
-id_sphere2 = geompy.addToStudy(sphere2,"Sphere2")
-id_sphere3 = geompy.addToStudy(sphere3,"Sphere3")
-
-# display spheres
-gg.createAndDisplayGO(id_sphere1)
-gg.setDisplayMode(id_sphere1,1)
-gg.createAndDisplayGO(id_sphere2)
-gg.setDisplayMode(id_sphere2,1)
-gg.createAndDisplayGO(id_sphere3)
-gg.setDisplayMode(id_sphere3,1)
-\endcode
+\include primitives_ex03.py
+<a href="../../examples/GEOM/primitives_ex03.py">Download this script</a>
\anchor tui_creation_torus
<br><h2>Creation of a Torus</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 40, 45)
-p2 = geompy.MakeVertex(35, 45, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create toruses
-torus1 = geompy.MakeTorus(p1, v, 20, 10)
-torus2 = geompy.MakeTorusRR(30, 15)
-
-# add objects in the study
-id_torus1 = geompy.addToStudy(torus1,"Torus1")
-id_torus2 = geompy.addToStudy(torus2,"Torus2")
-
-# display toruses
-gg.createAndDisplayGO(id_torus1)
-gg.setDisplayMode(id_torus1,1)
-gg.createAndDisplayGO(id_torus2)
-gg.setDisplayMode(id_torus2,1)
-\endcode
+\include primitives_ex04.py
+<a href="../../examples/GEOM/primitives_ex04.py">Download this script</a>
\anchor tui_creation_cone
<br><h2>Creation of a Cone</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 70)
-v = geompy.MakeVector(p1, p2)
-
-# create cones
-cone1 = geompy.MakeCone(p1, v, 17, 1, 20)
-cone2 = geompy.MakeConeR1R2H(30, 10, 30)
-
-# add objects in the study
-id_cone1 = geompy.addToStudy(cone1,"Cone1")
-id_cone2 = geompy.addToStudy(cone2,"Cone2")
-
-# display cones
-gg.createAndDisplayGO(id_cone1)
-gg.setDisplayMode(id_cone1,1)
-gg.createAndDisplayGO(id_cone2)
-gg.setDisplayMode(id_cone2,1)
-\endcode
+\include primitives_ex05.py
+<a href="../../examples/GEOM/primitives_ex05.py">Download this script</a>
\anchor tui_creation_disk
<br><h2>Creation of a Disk</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0., 0., 0.)
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-
-# create a vector on two points
-vxy = geompy.MakeVector(px, py)
-
-# create a disk in OXY plane
-disk1 = geompy.MakeDiskR(100, 1)
-
-# create a disk from a point, a vector and a radius
-disk2 = geompy.MakeDiskPntVecR(pz, vxy, 30)
-
-#create a circle from three points
-disk3 = geompy.MakeDiskThreePnt(p0, px, py)
-
-# add objects in the study
-id_vxy = geompy.addToStudy(vxy, "Vector")
-id_disk1 = geompy.addToStudy(disk1,"Disk1")
-id_disk2 = geompy.addToStudy(disk2,"Disk2")
-id_disk3 = geompy.addToStudy(disk3,"Disk3")
-
-# display disks
-gg.createAndDisplayGO(id_vxy)
-gg.createAndDisplayGO(id_disk1)
-gg.createAndDisplayGO(id_diks2)
-gg.createAndDisplayGO(id_diks3)
-\endcode
+\include primitives_ex06.py
+<a href="../../examples/GEOM/primitives_ex06.py">Download this script</a>
\anchor tui_creation_squareface
<br><h2>Creation of a Rectangle</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-
-# create a vector on two points
-vxy = geompy.MakeVector(px, py)
-
-# create a rectangle in OXY plane
-face1 = geompy.MakeFaceHW(100, 100, 1)
-
-# create a rectangle using normal vector
-face2 = geompy.MakeFaceObjHW(vxy, 50, 150)
-
-# create a rectangle from other face
-face3 = geompy.MakeFaceObjHW(face2, 150, 50)
-
-# add objects in the study
-id_face1 = geompy.addToStudy(face1,"Face1")
-id_face2 = geompy.addToStudy(face2,"Face2")
-id_face3 = geompy.addToStudy(face3,"Face3")
-
-# display rectangles
-gg.createAndDisplayGO(id_face1)
-gg.createAndDisplayGO(id_face2)
-gg.createAndDisplayGO(id_face3)
-\endcode
+\include primitives_ex07.py
+<a href="../../examples/GEOM/primitives_ex07.py">Download this script</a>
*/
\anchor tui_shape_processing
<br><h2>Shape Processing</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices, an edge, an arc, a wire, a face and a prism
-p1 = geompy.MakeVertex(0,0,0)
-p2 = geompy.MakeVertex(200,0,0)
-p3 = geompy.MakeVertex(100,150,0)
-edge = geompy.MakeEdge(p1,p2)
-arc = geompy.MakeArc(p1,p3,p2)
-wire = geompy.MakeWire([edge,arc])
-face = geompy.MakeFace(wire, 1)
-theShape = geompy.MakePrismVecH(face, edge, 130)
-
-# check the shape at the beginning
-print "Before ProcessShape:"
-isValid = geompy.CheckShape(theShape)
-if isValid == 0:
- print "The shape is not valid"
-else:
- print "The shape seems to be valid"
-
-# process the Shape
-Operators = ["FixShape"]
-Parameters = ["FixShape.Tolerance3d"]
-Values = ["1e-7"]
-PS = geompy.ProcessShape(theShape, Operators, Parameters, Values)
-
-# check the shape at the end
-print "After ProcessShape:"
-isValid = geompy.CheckShape(PS)
-if isValid == 0:
- print "The shape is not valid"
- raise RuntimeError, "It seems, that the ProcessShape() has failed"
-else:
- print "The shape seems to be valid"
-
-# add in the study and display
-Id_Shape = geompy.addToStudy(theShape, "Invalid Shape")
-Id_PS = geompy.addToStudy(PS, "Processed Shape")
-gg.createAndDisplayGO(Id_Shape)
-gg.setDisplayMode(Id_Shape,1)
-gg.createAndDisplayGO(Id_PS)
-gg.setDisplayMode(Id_PS,1)
-\endcode
+\include repairing_operations_ex01.py
+<a href="../../examples/GEOM/repairing_operations_ex01.py">Download this script</a>
\anchor tui_suppress_faces
<br><h2>Suppress Faces</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# The list of IDs (IDList) for suppress faces
-sup_faces = []
-sup_faces = geompy.SubShapeAllSortedCentres(box, geompy.ShapeType["FACE"])
-
-# get indices of the sub-shape
-f1_id = geompy.GetSubShapeID(box, sup_faces[3])
-
-# remove faces from the given object (shape)
-result = geompy.SuppressFaces(box, [f1_id])
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1)
-\endcode
+\include repairing_operations_ex02.py
+<a href="../../examples/GEOM/repairing_operations_ex02.py">Download this script</a>
\anchor tui_close_contour
<br><h2>Close Contour</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0 = geompy.MakeVertex( 0., 0., 0.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex( 0., 100., 0.)
-py1 = geompy.MakeVertex( 0., 140., 0.)
-pz = geompy.MakeVertex( 0., 0., 100.)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py1, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# close an open wire by creation of an edge between ends
-wire_close = geompy.CloseContour(wire, [1], 0)
-
-# add objects in the study
-id_wire = geompy.addToStudy(wire, "Wire")
-id_wire_close = geompy.addToStudy(wire_close, "Wire close")
-
-# display the results
-gg.createAndDisplayGO(id_wire)
-gg.createAndDisplayGO(id_wire_close)
-\endcode
+\include repairing_operations_ex03.py
+<a href="../../examples/GEOM/repairing_operations_ex03.py">Download this script</a>
\anchor tui_suppress_internal_wires
<br><h2>Suppress Internal Wires</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(55, 65, 50)
-p2 = geompy.MakeVertex(55, 0, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 100
-radius1 = 40
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100, 100, 100)
-
-# make a cut
-cut = geompy.MakeCut(box, cylinder)
-
-# suppress all internal wires
-result = geompy.SuppressInternalWires(cut, [])
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1)
-\endcode
+\include repairing_operations_ex04.py
+<a href="../../examples/GEOM/repairing_operations_ex04.py">Download this script</a>
\anchor tui_suppress_holes
<br><h2>Suppress Holes</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(35, 35, 0)
-p2 = geompy.MakeVertex(35, 35, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 20
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# create a cone
-cone = geompy.MakeCone(p1, v, 70, 0, 80)
-
-# make a cut
-cut = geompy.MakeCut(cone, cylinder)
-
-# get faces as sub-shapes
-faces = []
-faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"])
-f_2 = geompy.GetSubShapeID(cut, faces[2])
-
-# remove one face from the shape
-cut_without_f_2 = geompy.SuppressFaces(cut, [f_2])
-
-# get wires as sub-shapes
-wires = []
-wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"])
-w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0])
-
-# suppress the selected wire
-result = geompy.SuppressHoles(cut_without_f_2, [w_0])
-
-# add objects in the study
-id_cut = geompy.addToStudy(cut, "Cut")
-id_cut_without_f_2 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")
-id_result = geompy.addToStudy(result, "Result")
-
-# display the results
-gg.createAndDisplayGO(id_cut)
-gg.setDisplayMode(id_cut,1)
-gg.createAndDisplayGO(id_cut_without_f_2)
-gg.setDisplayMode(id_cut_without_f_2,1)
-gg.createAndDisplayGO(id_result)
-gg.setDisplayMode(id_result,1)
-\endcode
+\include repairing_operations_ex05.py
+<a href="../../examples/GEOM/repairing_operations_ex05.py">Download this script</a>
\anchor tui_sewing
<br><h2>Sewing</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create base points
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex(0., 100., 0.)
-pz = geompy.MakeVertex(0., 0., 100.)
-
-# create base geometry 2D & 3D
-vector = geompy.MakeVector(px, py)
-arc = geompy.MakeArc(py, pz, px)
-
-# create base objects
-angle = 45. * math.pi / 180
-WantPlanarFace = 1 #True
-wire = geompy.MakeWire([vector, arc])
-face = geompy.MakeFace(wire, WantPlanarFace)
-face_rot = geompy.MakeRotation(face, vector, angle)
-
-# make sewing
-precision = 0.00001
-sewing = geompy.MakeSewing([face, face_rot], precision)
-
-# add objects in the study
-id_face = geompy.addToStudy(face, "Face")
-id_face_rot = geompy.addToStudy(face_rot, "Face rotation")
-id_sewing = geompy.addToStudy(sewing, "Sewing")
-
-# display the results
-gg.createAndDisplayGO(id_face)
-gg.setDisplayMode(id_face,1)
-gg.createAndDisplayGO(id_face_rot)
-gg.setDisplayMode(id_face_rot,1)
-gg.createAndDisplayGO(id_sewing)
-gg.setDisplayMode(id_sewing,1)
-\endcode
+\include repairing_operations_ex06.py
+<a href="../../examples/GEOM/repairing_operations_ex06.py">Download this script</a>
\anchor tui_glue_faces
<br><h2>Glue Faces</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue compound's faces
-tolerance = 1e-5
-glue = geompy.MakeGlueFaces(compound, tolerance)
-
-# add objects in study
-id_box1 = geompy.addToStudy(box1, "Box1")
-id_box2 = geompy.addToStudy(box2, "Box2")
-id_compound = geompy.addToStudy(compound, "Compound")
-id_glue = geompy.addToStudy(glue, "Glue faces")
-
-# display results
-gg.createAndDisplayGO(id_box1)
-gg.setDisplayMode(id_box1,1)
-gg.createAndDisplayGO(id_box2)
-gg.setDisplayMode(id_box2,1)
-gg.createAndDisplayGO(id_compound)
-gg.setDisplayMode(id_compound,1)
-gg.createAndDisplayGO(id_glue)
-gg.setDisplayMode(id_glue,1)
-\endcode
+\include repairing_operations_ex07.py
+<a href="../../examples/GEOM/repairing_operations_ex07.py">Download this script</a>
\anchor tui_glue_edges
<br><h2>Glue Edges</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create boxes
-box1 = geompy.MakeBox(0,0,0,100,50,100)
-box2 = geompy.MakeBox(100,0,0,250,50,100)
-
-# make compound
-compound = geompy.MakeCompound([box1, box2])
-
-# glue all compound's edges
-tolerance = 1e-5
-glue1 = geompy.MakeGlueEdges(compound, tolerance)
-
-# glue some compound's edges
-list_edges = geompy.GetGlueEdges(compound, tolerance)
-glue2 = geompy.MakeGlueEdgesByList(compound, tolerance, [list_edges[0], list_edges[2]])
-
-# add objects in study
-geompy.addToStudy(box1, "Box1")
-geompy.addToStudy(box2, "Box2")
-geompy.addToStudy(compound, "Compound")
-geompy.addToStudy(glue1, "Glue all edges")
-geompy.addToStudy(glue2, "Glue two edges")
-
-if salome.sg.hasDesktop():
- salome.sg.updateObjBrowser(1)
-\endcode
+\include repairing_operations_ex08.py
+<a href="../../examples/GEOM/repairing_operations_ex08.py">Download this script</a>
\anchor tui_limit_tolerance
<br><h2>Limit Tolerance</h2>
-
-\code
-import geompy
-gg = salome.ImportComponentGUI("GEOM")
-
-# import initial topology
-shape1 = geompy.ImportBREP("my_shape_1.brep")
-shape2 = geompy.ImportBREP("my_shape_2.brep")
-
-geompy.addToStudy(shape1, "Shape 1")
-geompy.addToStudy(shape2, "Shape 2")
-
-# perform partition
-try:
- part = geompy.MakePartition([shape1, shape2])
-except:
- # limit tolerance
- tolerance = 1e-07
- shape1_lt = geompy.LimitTolerance(shape1, tolerance)
- shape2_lt = geompy.LimitTolerance(shape2, tolerance)
-
- # process shape
- good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
- good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
-
- geompy.addToStudy(good_shape1, "Shape 1 corrected")
- geompy.addToStudy(good_shape2, "Shape 2 corrected")
-
- # perform partition on corrected shapes
- part = geompy.MakePartition([good_shape1, good_shape2])
- pass
-
-geompy.addToStudy(part, "Partition")
-\endcode
+\include repairing_operations_ex09.py
+<a href="../../examples/GEOM/repairing_operations_ex09.py">Download this script</a>
\anchor tui_add_point_on_edge
<br><h2>Add Point on Edge</h2>
-
-\code
-import geompy
-import salome
-
-# create vertices
-p1 = geompy.MakeVertex(0,0,50)
-p2 = geompy.MakeVertex(60,0,50)
-
-# make an edge
-edge = geompy.MakeEdge(p1, p2) #geompy.GetSubShape(box, edge_ind)
-
-# divide an edge
-divide = geompy.DivideEdge(edge, -1, 0.5, 0)
-
-# add objects in the study
-id_edge = geompy.addToStudy(edge, "Edge")
-edge_points = geompy.SubShapeAllSortedCentres(edge, geompy.ShapeType["VERTEX"])
-for point in edge_points:
- geompy.addToStudyInFather(edge, point, "Edge's point")
-
-id_divide = geompy.addToStudy(divide, "Divided edge")
-edge_points = geompy.SubShapeAllSortedCentres(divide, geompy.ShapeType["VERTEX"])
-for point in edge_points:
- geompy.addToStudyInFather(divide, point, "Edge's point after divide")
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include repairing_operations_ex10.py
+<a href="../../examples/GEOM/repairing_operations_ex10.py">Download this script</a>
\anchor tui_fuse_collinear_edges
<br><h2>Fuse Collinear Edges within a Wire</h2>
-
-\code
-import geompy
-import salome
-
-# create vertices
-p1 = geompy.MakeVertex(0, 0, 0)
-p2 = geompy.MakeVertex(70, 0, 0)
-p3 = geompy.MakeVertex(70, 50, 0)
-p4 = geompy.MakeVertex(70, 80, 0)
-p5 = geompy.MakeVertex(50, 80, 0)
-p6 = geompy.MakeVertex(20, 80, 0)
-p7 = geompy.MakeVertex(0, 80, 0)
-p8 = geompy.MakeVertex(0, 30, 0)
-
-points = [p1, p2, p3, p4, p5, p6, p7, p8]
-
-# make a wire
-wire_1 = geompy.MakePolyline(points, True)
-
-# suppress some vertices in the wire
-wire_2 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p3])
-wire_3 = geompy.FuseCollinearEdgesWithinWire(wire_1, [p5, p6])
-
-# suppress all suitable vertices in the wire
-wire_4 = geompy.FuseCollinearEdgesWithinWire(wire_1, [])
-
-wires = [wire_1, wire_2, wire_3, wire_4]
-
-# add objects in the study
-ii = 1
-for point in points:
- geompy.addToStudy(point, "p%d"%ii)
- ii = ii + 1
- pass
-
-ii = 1
-for wire in wires:
- geompy.addToStudy(wire, "wire_%d"%ii)
- wire_points = geompy.SubShapeAllSortedCentres(wire, geompy.ShapeType["VERTEX"])
- jj = 1
- for point in wire_points:
- geompy.addToStudyInFather(wire, point, "point_%d"%jj)
- jj = jj + 1
- pass
- ii = ii + 1
- pass
-
-salome.sg.updateObjBrowser(1)
-\endcode
+\include repairing_operations_ex11.py
+<a href="../../examples/GEOM/repairing_operations_ex11.py">Download this script</a>
*/
/*!
\page tui_sketcher_page 2D Sketcher
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p1 = geompy.MakeVertex(70., 0., 0.)
-p2 = geompy.MakeVertex(70., 70., 80.)
-p3 = geompy.MakeVertex( 0., 70., 0.)
-
-#create a vector from two points
-vector_arc = geompy.MakeVector(p1, p3)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-
-# create a wire
-wire = geompy.MakeWire([vector_arc, arc])
-
-# create a planar face
-isPlanarWanted = 1
-face = geompy.MakeFace(wire, isPlanarWanted)
-
-# create a sketcher (face), following the textual description
-sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WF",
- [100,0,0, 1,1,1, -1,1,0])
-
-# create a sketcher (wire) on the given face
-sketcher2 = geompy.MakeSketcherOnPlane("Sketcher:F 10 -30:R 10:C 20 180:R 15:L 50:WW", face)
-
-# add objects in the study
-id_face = geompy.addToStudy(face,"Face")
-id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
-id_sketcher2 = geompy.addToStudy(sketcher2,"Sketcher2")
-
-# display the first sketcher and the second sketcher with its planar face
-gg.createAndDisplayGO(id_face)
-gg.setDisplayMode(id_face,1)
-gg.setTransparency(id_face,0.5)
-gg.createAndDisplayGO(id_sketcher1)
-gg.createAndDisplayGO(id_sketcher2)
-\endcode
+\include sketcher.py
+<a href="../../examples/GEOM/sketcher.py">Download this script</a>
*/
/*!
\page tui_tolerance_page Tolerance
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-Toler = geompy.Tolerance(box)
-print "\nBox 100x30x100 tolerance:"
-print " Face min. tolerance: ", Toler[0]
-print " Face max. tolerance: ", Toler[1]
-print " Edge min. tolerance: ", Toler[2]
-print " Edge max. tolerance: ", Toler[3]
-print " Vertex min. tolerance: ", Toler[4]
-print " Vertex max. tolerance: ", Toler[5]
-\endcode
+\include tolerance.py
+<a href="../../examples/GEOM/tolerance.py">Download this script</a>
*/
\anchor tui_creation_edge
<br><h2>Creation of an Edge</h2>
+\include topological_geom_objs_ex01.py
+<a href="../../examples/GEOM/topological_geom_objs_ex01.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#
-# create edge by two points
-#
-
-# create vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create an edge
-edge = geompy.MakeEdge(p0, pxyz)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_1")
-
-# display an edge
-gg.createAndDisplayGO(id_edge)
-
-#
-# create edge from wire
-#
-
-# create a circle
-c = geompy.MakeCircle(None, None, 100)
-
-# create a wire
-w = geompy.MakeWire([c], 1e-07)
-
-# create an edge from wire
-edge = geompy.MakeEdgeWire(w)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_2")
-
-# display an edge
-gg.createAndDisplayGO(id_edge)
-
-#
-# create edge from existing curve and a length
-#
-
-# create a circle
-c = geompy.MakeCircle(None, None, 100)
-
-# create an edge of length 25.0 from the circle
-edge = geompy.MakeEdgeOnCurveByLength(c, 25.0)
-
-# add object in the study
-id_edge = geompy.addToStudy(edge,"Edge_3")
-
-# display an edge
-gg.createAndDisplayGO(id_edge)
-
-\endcode
-
\anchor tui_creation_wire
<br><h2>Creation of a Wire</h2>
+\include topological_geom_objs_ex02.py
+<a href="../../examples/GEOM/topological_geom_objs_ex02.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# add an object in the study
-id_wire = geompy.addToStudy(wire,"Wire")
-
-# display the wire
-gg.createAndDisplayGO(id_wire)
-\endcode
-
\anchor tui_creation_face
<br><h2>Creation of a Face</h2>
+\include topological_geom_objs_ex03.py
+<a href="../../examples/GEOM/topological_geom_objs_ex03.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-px = geompy.MakeVertex(100., 0. , 0. )
-py = geompy.MakeVertex(0. , 100., 0. )
-pz = geompy.MakeVertex(0. , 0. , 100.)
-pxyz = geompy.MakeVertex(100., 100., 100.)
-
-# create a vector from two points
-vxy = geompy.MakeVector(px, py)
-
-# create an arc from three points
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
- [100,0,0, 1,1,1, -1,1,0])
-sketcher2 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher3 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-isPlanarFace = 1
-
-# create a face from the wire
-face1 = geompy.MakeFace(wire, isPlanarFace)
-
-# create faces from two wires
-face2 = geompy.MakeFaceWires([wire, sketcher1],isPlanarFace)
-face3 = geompy.MakeFaces([sketcher2, sketcher3],isPlanarFace)
-
-# add objects in the study
-id_face1 = geompy.addToStudy(face1,"Face1")
-id_face2 = geompy.addToStudy(face2,"Face2")
-id_face3 = geompy.addToStudy(face3,"Face3")
-
-# display the faces
-gg.createAndDisplayGO(id_face1)
-gg.setDisplayMode(id_face1,1)
-gg.setTransparency(id_face1,0.2)
-gg.createAndDisplayGO(id_face2)
-gg.setDisplayMode(id_face2,1)
-gg.setTransparency(id_face2,0.2)
-gg.createAndDisplayGO(id_face3)
-gg.setDisplayMode(id_face3,1)
-gg.setTransparency(id_face3,0.2)
-\endcode
-
\anchor tui_creation_shell
<br><h2>Creation of a Shell</h2>
+\include topological_geom_objs_ex04.py
+<a href="../../examples/GEOM/topological_geom_objs_ex04.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#create vertices
-p0 = geompy.MakeVertex( 0., 0., 0.)
-pxyz = geompy.MakeVertex( 5., 5., 40.)
-
-# create sketchers
-sketcher1 = geompy.MakeSketcher("Sketcher:F 0 0:TT 70 0:TT 70 70:TT 0 70:WW")
-sketcher2 = geompy.MakeSketcher("Sketcher:F 20 20:TT 50 20:TT 50 50:TT 20 50:WW")
-isPlanarFace = 1
-
-# create a face from two wires
-face = geompy.MakeFaces([sketcher1, sketcher2],isPlanarFace)
-
-# create a prism
-prism = geompy.MakePrism(face, p0, pxyz)
-
-# explode the prism into faces
-prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
-
-# create a shell from a set of faces
-shell = geompy.MakeShell([prism_faces[0], prism_faces[2], prism_faces[3],
- prism_faces[7], prism_faces[9]])
-
-# add objects in the study
-id_shell = geompy.addToStudy(shell,"Shell")
-
-# display the shell
-gg.createAndDisplayGO(id_shell)
-gg.setDisplayMode(id_shell,1)
-\endcode
-
\anchor tui_creation_solid
<br><h2>Creation of a Solid</h2>
+\include topological_geom_objs_ex05.py
+<a href="../../examples/GEOM/topological_geom_objs_ex05.py">Download this script</a>
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-#create vertices
-p0 = geompy.MakeVertex( 0., 0., 0.)
-pz = geompy.MakeVertex( 0., 0., 40.)
-
-# create sketchers
-sketcher = geompy.MakeSketcher("Sketcher:F -50 -50:TT 100 -50:R 0:C 50 70:R 0:L 100:WW")
-
-# create faces from two wires
-face = geompy.MakeFace(sketcher,1)
-
-# create a prism
-prism = geompy.MakePrism(face, p0, pz)
-
-# explode the prism into faces
-prism_faces = geompy.SubShapeAllSortedCentres(prism, geompy.ShapeType["FACE"])
-
-# create a shell from a set of faces
-shell = geompy.MakeShell([prism_faces[0], prism_faces[1],
- prism_faces[3], prism_faces[4],
- prism_faces[5], prism_faces[2]])
-
-# create a solid, bounded by the given shells
-solid = geompy.MakeSolid([shell])
-
-# add objects in the study
-id_solid = geompy.addToStudy(solid,"Solid")
-
-# display the solid
-gg.createAndDisplayGO(id_solid)
-gg.setDisplayMode(id_solid,1)
-\endcode
-
\anchor tui_creation_compound
<br><h2>Creation of a Compound</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex( -30., -30., 50.)
-p2 = geompy.MakeVertex( -60., -60., 30.)
-p3 = geompy.MakeVertex( -30., -30., 10.)
-
-# create an arc from three points
-arc = geompy.MakeArc(p1, p2, p3)
-ShapeListCompound = []
-i = 0
-while i <= 3 :
- S = geompy.MakeTranslation(arc, i * 50., 0., 0.)
- ShapeListCompound.append(S)
- i = i + 1
-
-# create a compund of the given shapes
-compound = geompy.MakeCompound(ShapeListCompound)
-
-# add object in the study
-id_compound = geompy.addToStudy(compound,"Compound")
-
-# display the compound
-gg.createAndDisplayGO(id_compound)
-\endcode
+\include topological_geom_objs_ex06.py
+<a href="../../examples/GEOM/topological_geom_objs_ex06.py">Download this script</a>
*/
\anchor tui_translation
<br><h2>Translation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40, 0)
-p2 = geompy.MakeVertex( 0, 0, 50)
-p3 = geompy.MakeVertex(50, 80, 0)
-v = geompy.MakeVector(p1, p2)
-vt = geompy.MakeVector(p1, p3)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# translate the given object along the vector, specified by its end points
-# (all three functions produce the same result)
-translation1 = geompy.MakeTranslationTwoPoints(cylinder, p1, p3)
-translation2 = geompy.MakeTranslation(cylinder, 40, 40, 0)
-translation3 = geompy.MakeTranslationVector(cylinder, vt)
-translation4 = geompy.MakeTranslationVectorDistance(cylinder, vt, 200)
-
-# add objects in the study
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_translation1 = geompy.addToStudy(translation1, "Translation1")
-id_translation2 = geompy.addToStudy(translation2, "Translation2")
-id_translation3 = geompy.addToStudy(translation3, "Translation3")
-id_translation4 = geompy.addToStudy(translation4, "Translation4")
-
-# display the results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_translation1)
-gg.setDisplayMode(id_translation1,1)
-gg.createAndDisplayGO(id_translation2)
-gg.setDisplayMode(id_translation2,1)
-gg.createAndDisplayGO(id_translation3)
-gg.setDisplayMode(id_translation3,1)
-gg.createAndDisplayGO(id_translation4)
-gg.setDisplayMode(id_translation4,1)
-\endcode
+\include transformation_operations_ex01.py
+<a href="../../examples/GEOM/transformation_operations_ex01.py">Download this script</a>
\anchor tui_rotation
<br><h2>Rotation</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40, 0)
-p2 = geompy.MakeVertex( 0, 0, 50)
-p3 = geompy.MakeVertex(10, 50,-20)
-p4 = geompy.MakeVertex(10, 50, 60)
-v = geompy.MakeVector(p1, p2)
-vr = geompy.MakeVector(p3, p4)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-
-# rotate the given object around the given axis by the given angle
-rotation1 = geompy.MakeRotation(cylinder, vr, math.pi)
-rotation2 = geompy.MakeRotationThreePoints(cylinder, p4, p1, p2)
-
-# add objects in the study
-id_vr = geompy.addToStudy(vr, "Rotation 1 axis")
-id_p4 = geompy.addToStudy(p4, "Rotation 2 center")
-id_p1 = geompy.addToStudy(p1, "Rotation 2 point 1")
-id_p2 = geompy.addToStudy(p2, "Rotation 2 point 2")
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_rotation1 = geompy.addToStudy(rotation1, "Rotation 1")
-id_rotation2 = geompy.addToStudy(rotation2, "Rotation 2")
-
-# display the results
-gg.createAndDisplayGO(id_vr)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_p1)
-gg.createAndDisplayGO(id_p2)
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_rotation1)
-gg.createAndDisplayGO(id_rotation2)
-gg.setDisplayMode(id_rotation1,1)
-gg.setDisplayMode(id_rotation2,1)
-\endcode
+\include transformation_operations_ex02.py
+<a href="../../examples/GEOM/transformation_operations_ex02.py">Download this script</a>
\anchor tui_modify_location
<br><h2>Modify Location</h2>
-
-\code
-import geompy
-import salome
-import math
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a vertex and a vector
-p1 = geompy.MakeVertex(10, 40, 0)
-p2 = geompy.MakeVertex( 0, 0, 50)
-v = geompy.MakeVector(p1, p2)
-
-# create a cylinder
-height = 35
-radius1 = 20
-cylinder = geompy.MakeCylinder(p1, v, radius1, height)
-circle = geompy.MakeCircle(p2, v, radius1)
-
-# create local coordinate systems
-cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
-cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
-
-# modify the location of the given object
-position = geompy.MakePosition(cylinder, cs1, cs2)
-position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
-
-# add objects in the study
-id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
-id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
-id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
-id_circle = geompy.addToStudy(circle, "Circle")
-id_position = geompy.addToStudy(position, "Position")
-id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
-
-# display the results
-gg.createAndDisplayGO(id_cylinder)
-gg.setDisplayMode(id_cylinder,1)
-gg.createAndDisplayGO(id_position)
-gg.setDisplayMode(id_position,1)
-gg.createAndDisplayGO(id_circle)
-gg.setDisplayMode(id_circle,1)
-gg.createAndDisplayGO(id_position2)
-gg.setDisplayMode(id_position2,1)
-\endcode
+\include transformation_operations_ex03.py
+<a href="../../examples/GEOM/transformation_operations_ex03.py">Download this script</a>
\anchor tui_mirror
<br><h2>Mirror Image</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# create an object, symmetrical to another object through the given plane
-p1 = geompy.MakeVertex( 0, 25, 0)
-p2 = geompy.MakeVertex( 5, 25, 0)
-p3 = geompy.MakeVertex( 0,-30, 40)
-plane = geompy.MakePlaneThreePnt(p1, p2, p3, 1000.)
-mirror1 = geompy.MakeMirrorByPlane(box, plane)
-
-# create an object, symmetrical to another object through the given axis
-p4 = geompy.MakeVertex( 210, 210, -20)
-p5 = geompy.MakeVertex( 210, 210, 220)
-axis = geompy.MakeVector(p4, p5)
-mirror2 = geompy.MakeMirrorByAxis(box, axis)
-
-# create an object, symmetrical to another object through the given point
-mirror3 = geompy.MakeMirrorByPoint(box, p4)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_plane = geompy.addToStudy(plane, "Plane")
-id_mirror1 = geompy.addToStudy(mirror1, "Mirror plane")
-id_axis = geompy.addToStudy(axis, "Axis")
-id_mirror2 = geompy.addToStudy(mirror2, "Mirror axis")
-id_p4 = geompy.addToStudy(p4, "Point")
-id_mirror3 = geompy.addToStudy(mirror3, "Mirror point")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_plane)
-gg.createAndDisplayGO(id_mirror1)
-gg.setDisplayMode(id_mirror1,1)
-gg.createAndDisplayGO(id_axis)
-gg.createAndDisplayGO(id_mirror2)
-gg.setDisplayMode(id_mirror2,1)
-gg.createAndDisplayGO(id_p4)
-gg.createAndDisplayGO(id_mirror3)
-gg.setDisplayMode(id_mirror3,1)
-\endcode
+\include transformation_operations_ex04.py
+<a href="../../examples/GEOM/transformation_operations_ex04.py">Download this script</a>
\anchor tui_scale
<br><h2>Scale Transform</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
-
-# scale the given object by the factor
-p0 = geompy.MakeVertex(100, 100, 100)
-factor = 0.5
-scale = geompy.MakeScaleTransform(box, p0, factor)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_scale = geompy.addToStudy(scale, "Scale")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.setTransparency(id_box,0.5)
-gg.createAndDisplayGO(id_scale)
-gg.setDisplayMode(id_scale,1)
-\endcode
+\include transformation_operations_ex05.py
+<a href="../../examples/GEOM/transformation_operations_ex05.py">Download this script</a>
\anchor tui_offset
<br><h2>Offset Surface</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a box and a sphere
-box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
-
-# create a new object as offset of the given object
-offset = geompy.MakeOffset(box, 70.)
-
-# add objects in the study
-id_box = geompy.addToStudy(box, "Box")
-id_offset = geompy.addToStudy(offset, "Offset")
-
-# display the results
-gg.createAndDisplayGO(id_box)
-gg.setDisplayMode(id_box,1)
-gg.createAndDisplayGO(id_offset)
-\endcode
+\include transformation_operations_ex06.py
+<a href="../../examples/GEOM/transformation_operations_ex06.py">Download this script</a>
\anchor tui_projection
<br><h2>Projection</h2>
-
-\code
-import geompy
-import salome
-
-# create a cylindric face and a curve(edge)
-cylinder = geompy.MakeCylinderRH(100, 300)
-[face_cyl] = geompy.SubShapes(cylinder, [3])
-
-p1 = geompy.MakeVertex(200, 0, 100)
-p2 = geompy.MakeVertex(200, 80, 100)
-p3 = geompy.MakeVertex(200, 80, 180)
-p4 = geompy.MakeVertex(130, 80, 180)
-p5 = geompy.MakeVertex(90, 80, 240)
-
-curve = geompy.MakeInterpol([p1, p2, p3, p4, p5], False, False)
-
-# create a new object as projection of the
-# given curve on the given cylindric face
-projection = geompy.MakeProjection(curve, face_cyl)
-
-# add objects in the study
-geompy.addToStudy(cylinder, "cylinder")
-geompy.addToStudyInFather(cylinder, face_cyl, "face_cyl")
-geompy.addToStudy(p1, "p1")
-geompy.addToStudy(p2, "p2")
-geompy.addToStudy(p3, "p3")
-geompy.addToStudy(p4, "p4")
-geompy.addToStudy(p5, "p5")
-geompy.addToStudy(curve, "curve")
-geompy.addToStudy(projection, "projection")
-\endcode
+\include transformation_operations_ex07.py
+<a href="../../examples/GEOM/transformation_operations_ex07.py">Download this script</a>
\anchor tui_multi_translation
<br><h2>Multi Translation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0 = geompy.MakeVertex( 0., 0., 0.)
-px = geompy.MakeVertex(20., 0., 0.)
-py = geompy.MakeVertex( 0., 20., 0.)
-pz = geompy.MakeVertex( 0., 0., 20.)
-pxy = geompy.MakeVertex( 50., 0., 0.)
-pxyz = geompy.MakeVertex( 50., 50., 50.)
-vz = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-vtr1d = geompy.MakeVector(p0, pxyz)
-vtr2d = geompy.MakeVector(p0, pxy)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 20.0)
-
-# translate the given object along the given vector a given number of times
-tr1d = geompy.MakeMultiTranslation1D(prism, vtr1d, 20, 4)
-
-# consequently apply two specified translations to the object a given number of times
-tr2d = geompy.MakeMultiTranslation2D(prism, vtr1d, 20, 4, vtr2d, 80, 3)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_tr1d = geompy.addToStudy(tr1d,"Translation 1D")
-id_tr2d = geompy.addToStudy(tr2d,"Translation 2D")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_tr1d)
-gg.setDisplayMode(id_tr1d,1)
-gg.createAndDisplayGO(id_tr2d)
-gg.setDisplayMode(id_tr2d,1)
-\endcode
+\include transformation_operations_ex08.py
+<a href="../../examples/GEOM/transformation_operations_ex08.py">Download this script</a>
\anchor tui_multi_rotation
<br><h2>Multi Rotation</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create vertices and vectors
-p0 = geompy.MakeVertex( 0., 0., 0.)
-px = geompy.MakeVertex(20., 0., 0.)
-py = geompy.MakeVertex( 0., 20., 0.)
-pz = geompy.MakeVertex( 0., 0., 20.)
-pxyz = geompy.MakeVertex( 50., 50., 10.)
-vz = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-vrot1d = geompy.MakeVector(p0, pxyz)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 20.0)
-
-# rotate the given object around the given axis by the given angle a given number of times
-rot1d = geompy.MultiRotate1D(prism, vrot1d, 4)
-
-# rotate the given object around the given axis by the given angle a given number of times
-# and multi-translate the result of each rotation
-rot2d = geompy.MultiRotate2D(prism, vrot1d, 60, 4, 50, 5)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_rot1d = geompy.addToStudy(rot1d,"Rotation 1D")
-id_rot2d = geompy.addToStudy(rot2d,"Rotation 2D")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_rot1d)
-gg.setDisplayMode(id_rot1d,1)
-gg.createAndDisplayGO(id_rot2d)
-gg.setDisplayMode(id_rot2d,1)
-\endcode
+\include transformation_operations_ex09.py
+<a href="../../examples/GEOM/transformation_operations_ex09.py">Download this script</a>
\anchor tui_fillet2d
<br><h2>Fillet 2D</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create a face in OXY plane
-face = geompy.MakeFaceHW(100, 100, 1)
-fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
-
-# add objects in the study
-id_face = geompy.addToStudy(face,"Face_1")
-id_fillet2d = geompy.addToStudy(fillet2d,"Fillet 2D_1")
-
-# display disks
-gg.createAndDisplayGO(id_face)
-gg.createAndDisplayGO(id_fillet2d)
-\endcode
+\include transformation_operations_ex10.py
+<a href="../../examples/GEOM/transformation_operations_ex10.py">Download this script</a>
\anchor tui_fillet1d
<br><h2>Fillet 1D</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create box
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-# take box edges to create custom complex wire
-[Edge_1,Edge_2,Edge_3,Edge_4,Edge_5,Edge_6,Edge_7,Edge_8,Edge_9,Edge_10,Edge_11,Edge_12] = geompy.SubShapeAllSortedCentres(Box_1, geompy.ShapeType["EDGE"])
-# create wire
-Wire_1 = geompy.MakeWire([Edge_12, Edge_7, Edge_11, Edge_6, Edge_1,Edge_4])
-# make fillet at given wire vertices with giver radius
-Fillet_1D_1 = geompy.MakeFillet1D(Wire_1, 55, [3, 4, 6, 8, 10])
-
-
-# display disks
-gg.createAndDisplayGO(Wire_1)
-gg.createAndDisplayGO(Fillet_1D_1)
-\endcode
+\include transformation_operations_ex11.py
+<a href="../../examples/GEOM/transformation_operations_ex11.py">Download this script</a>
\anchor tui_fillet
<br><h2>Fillet</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-radius = 10.
-ShapeTypeEdge = geompy.ShapeType["EDGE"]
-
-# create vertices and vectors
-p0 = geompy.MakeVertex( 0., 0., 0.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex( 0., 100., 0.)
-pz = geompy.MakeVertex( 0., 0., 100.)
-vz = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 100.0)
-
-# get the list of IDs (IDList) for the fillet
-prism_edges = geompy.SubShapeAllSortedCentres(prism, ShapeTypeEdge)
-IDlist_e = []
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[0]))
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[1]))
-IDlist_e.append(geompy.GetSubShapeID(prism, prism_edges[2]))
-
-# make a fillet on the specified edges of the given shape
-fillet = geompy.MakeFillet(prism, radius, ShapeTypeEdge, IDlist_e)
-
-# make a fillet on all edges of the given shape
-filletall = geompy.MakeFilletAll(prism, radius)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_fillet = geompy.addToStudy(fillet,"Fillet")
-id_filletall = geompy.addToStudy(filletall,"Fillet all")
-
-# display the prism and the results of fillet operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_fillet)
-gg.setDisplayMode(id_fillet,1)
-gg.createAndDisplayGO(id_filletall)
-gg.setDisplayMode(id_filletall,1)
-\endcode
+\include transformation_operations_ex12.py
+<a href="../../examples/GEOM/transformation_operations_ex12.py">Download this script</a>
\anchor tui_chamfer
<br><h2>Chamfer</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-d1 = 10.
-d2 = 10.
-ShapeTypeFace = geompy.ShapeType["FACE"]
-
-# create vertices and vectors
-p0 = geompy.MakeVertex( 0., 0., 0.)
-px = geompy.MakeVertex(100., 0., 0.)
-py = geompy.MakeVertex( 0., 100., 0.)
-pz = geompy.MakeVertex( 0., 0., 100.)
-vz = geompy.MakeVector(p0, pz)
-vxy = geompy.MakeVector(px, py)
-
-# create an arc
-arc = geompy.MakeArc(py, pz, px)
-
-# create a wire
-wire = geompy.MakeWire([vxy, arc])
-
-# create a planar face
-face = geompy.MakeFace(wire, 1)
-
-# create a prism
-prism = geompy.MakePrismVecH(face, vz, 100.0)
-
-# get the list of IDs (IDList) for the chamfer
-prism_faces = geompy.SubShapeAllSortedCentres(prism, ShapeTypeFace)
-f_ind_1 = geompy.GetSubShapeID(prism, prism_faces[0])
-f_ind_2 = geompy.GetSubShapeID(prism, prism_faces[1])
-IDlist_f = [f_ind_1, f_ind_2]
-
-# perform a chamfer on the edges common to the specified faces
-chamfer_e = geompy.MakeChamferEdge(prism, d1, d2, f_ind_1, f_ind_2)
-
-# perform a chamfer on all edges of the specified faces
-chamfer_f = geompy.MakeChamferFaces(prism, d1, d2, IDlist_f)
-chamfer_f1 = geompy.MakeChamfer(prism, d1, d2, ShapeTypeFace, IDlist_f)
-
-# perform a symmetric chamfer on all edges of the given shape
-chamfer_all = geompy.MakeChamferAll(prism, d1)
-
-# add objects in the study
-id_prism = geompy.addToStudy(prism,"Prism")
-id_chamfer_e = geompy.addToStudy(chamfer_e,"Chamfer edge")
-id_chamfer_f = geompy.addToStudy(chamfer_f,"Chamfer faces")
-id_chamfer_f1 = geompy.addToStudy(chamfer_f1,"Chamfer faces 1")
-id_chamfer_all = geompy.addToStudy(chamfer_all,"Chamfer all")
-
-# display the prism and the results of chamfer operation
-gg.createAndDisplayGO(id_prism)
-gg.setDisplayMode(id_prism,1)
-gg.createAndDisplayGO(id_chamfer_e)
-gg.setDisplayMode(id_chamfer_e,1)
-gg.createAndDisplayGO(id_chamfer_f)
-gg.setDisplayMode(id_chamfer_f,1)
-gg.createAndDisplayGO(id_chamfer_f1)
-gg.setDisplayMode(id_chamfer_f1,1)
-gg.createAndDisplayGO(id_chamfer_all)
-gg.setDisplayMode(id_chamfer_all,1)
-\endcode
+\include transformation_operations_ex13.py
+<a href="../../examples/GEOM/transformation_operations_ex13.py">Download this script</a>
*/
\anchor tui_change_disp_mode
<br><h2>Changing Display Mode</h2>
-
-\code
-import salome
-import geompy
-box = geompy.MakeBox(0,0,0, 50,50,50)
-box2 = geompy.MakeBox(-50,-50,-50, 0,0,0)
-
-sphere = geompy.MakeSphere(50,50,50, 30)
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-box_id = geompy.addToStudy(box2, "Box")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.createAndDisplayGO(box_id)
-gg.setVectorsMode(box_id, 1)
-\endcode
+\include viewing_geom_objs_ex01.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex01.py">Download this script</a>
\anchor tui_change_color
<br><h2> Changing Color</h2>
-
-\code
-import salome
-import geompy
-box = geompy.MakeBox(0,0,0, 50,50,50)
-
-sphere = geompy.MakeSphere(50,50,50, 30)
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.setColor(fuse_id,218,165,31)
-\endcode
+\include viewing_geom_objs_ex02.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex02.py">Download this script</a>
\anchor tui_change_transparency
<br><h2>Changing Transparency</h2>
-
-\code
-import salome
-import geompy
-
-box = geompy.MakeBox(0,0,0, 50,50,50)
-sphere = geompy.MakeSphere(50,50,50, 30)
-
-fuse = geompy.MakeBoolean(box,sphere,3)
-fuse_id = geompy.addToStudy(fuse,"Fuse")
-
-gg = salome.ImportComponentGUI("GEOM")
-gg.createAndDisplayGO(fuse_id)
-gg.setDisplayMode(fuse_id,1)
-gg.setColor(fuse_id,218,165,31)
-gg.setTransparency(fuse_id,0.5)
-\endcode
+\include viewing_geom_objs_ex03.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex03.py">Download this script</a>
\anchor tui_point_marker
<br><h2>Set Point Marker</h2>
+\include viewing_geom_objs_ex04.py
+<a href="../../examples/GEOM/viewing_geom_objs_ex04.py">Download this script</a>
-\code
-import salome
-import geompy
-
-texture = geompy.LoadTexture("/users/user/mytexture.dat")
-
-v1 = geompy.MakeVertex(0, 0, 0)
-v2 = geompy.MakeVertex(100, 0, 0)
-v3 = geompy.MakeVertex(0, 100, 0)
-
-v1.SetMarkerStd(GEOM.MT_O_PLUS, GEOM.MS_25)
-v2.SetMarkerStd(GEOM.MT_BALL, GEOM.MS_40)
-v3.SetMarkerTexture(texture)
-\endcode
*/
/*!
\page tui_whatis_page What Is
-
-\code
-import geompy
-
-# create a box
-box = geompy.MakeBoxDXDYDZ(100,30,100)
-Descr = geompy.WhatIs(box)
-print "\nBox 100x30x100 description:"
-print Descr
-\endcode
+\include whatis.py
+<a href="../../examples/GEOM/whatis.py">Download this script</a>
*/
<br>
\anchor tui_create_groups_anchor
<h2>Creation of a group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
- FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
- geompy.AddObject(group, FaceID)
-
-# add all selected shapes from the list to the group
-# (the program doesn't raise error, if some shapes are already included)
-geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
-
-# remove an object from the group
-geompy.RemoveObject(group, FaceID)
-
-# remove all selected shapes from the group
-# (the program doesn't raise error, if some shapes are not included)
-geompy.DifferenceList(group, [SubFaceList[2], SubFaceList[3], SubFaceList[4]])
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1)
-\endcode
+\include working_with_groups_ex01.py
+<a href="../../examples/GEOM/working_with_groups_ex01.py">Download this script</a>
\anchor tui_edit_groups_anchor
<br><h2>Adding an object to the group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
- FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
- geompy.AddObject(group, FaceID)
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1)
-\endcode
+\include working_with_groups_ex02.py
+<a href="../../examples/GEOM/working_with_groups_ex02.py">Download this script</a>
<br><h2>Removing an object from the group</h2>
-
-\code
-import geompy
-import salome
-gg = salome.ImportComponentGUI("GEOM")
-
-# create two vertices
-p0 = geompy.MakeVertex(0. , 0. , 0. )
-p200 = geompy.MakeVertex(200., 200., 200.)
-
-# create a box from two points
-Box = geompy.MakeBoxTwoPnt(p0, p200)
-
-# create a group from the faces of the box
-group = geompy.CreateGroup(Box, geompy.ShapeType["FACE"])
-
-# add objects to the group
-SubFaceList = geompy.SubShapeAllSortedCentres(Box, geompy.ShapeType["FACE"])
-for i in [0, 3, 5] :
- FaceID = geompy.GetSubShapeID(Box, SubFaceList[i])
- geompy.AddObject(group, FaceID)
-
-# add all selected shapes from the list to the group
-# (the program doesn't raise errors, if some shapes are already included)
-geompy.UnionList(group, [SubFaceList[0], SubFaceList[2], SubFaceList[5]])
-
-# remove an object from the group
-geompy.RemoveObject(group, FaceID)
-id_group1 = geompy.addToStudy(group, "Group1")
-
-# display the contents of the group
-gg.createAndDisplayGO(id_group1)
-salome.sg.updateObjBrowser(1)
-\endcode
+\include working_with_groups_ex03.py
+<a href="../../examples/GEOM/working_with_groups_ex03.py">Download this script</a>
<br>
\anchor tui_union_groups_anchor
<h2>Union Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# union groups
-Group_U_1_2 = geompy.UnionGroups(Group_1, Group_2)
-Group_UL_3_4 = geompy.UnionListOfGroups([Group_3, Group_4])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_U_1_2, 'Group_U_1_2')
-geompy.addToStudyInFather(Box_1, Group_UL_3_4, 'Group_UL_3_4')
-salome.sg.updateObjBrowser(1)
-\endcode
+\include working_with_groups_ex04.py
+<a href="../../examples/GEOM/working_with_groups_ex04.py">Download this script</a>
<br>
\anchor tui_intersect_groups_anchor
<h2>Intersect Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# intersect groups
-Group_I_1_3 = geompy.IntersectGroups(Group_1, Group_3)
-Group_IL_1_3 = geompy.IntersectListOfGroups([Group_1, Group_3])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_I_1_3, 'Group_I_1_3')
-geompy.addToStudyInFather(Box_1, Group_IL_1_3, 'Group_IL_1_3')
-salome.sg.updateObjBrowser(1)
-
-\endcode
+\include working_with_groups_ex05.py
+<a href="../../examples/GEOM/working_with_groups_ex05.py">Download this script</a>
<br>
\anchor tui_cut_groups_anchor
<h2>Cut Groups</h2>
-
-\code
-import geompy
-import salome
-
-# create a box and some groups of faces on it
-Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
-Group_1 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_1, [13, 23])
-Group_2 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_2, [3, 27])
-Group_3 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_3, [33, 23])
-Group_4 = geompy.CreateGroup(Box_1, geompy.ShapeType["FACE"])
-geompy.UnionIDs(Group_4, [31, 27])
-
-# cut groups
-Group_C_2_4 = geompy.CutGroups(Group_2, Group_4)
-Group_CL_2_4 = geompy.CutListOfGroups([Group_2], [Group_4])
-
-# publish shapes
-geompy.addToStudy(Box_1, 'Box_1')
-geompy.addToStudyInFather(Box_1, Group_1, 'Group_1')
-geompy.addToStudyInFather(Box_1, Group_2, 'Group_2')
-geompy.addToStudyInFather(Box_1, Group_3, 'Group_3')
-geompy.addToStudyInFather(Box_1, Group_4, 'Group_4')
-geompy.addToStudyInFather(Box_1, Group_C_2_4, 'Group_C_2_4')
-geompy.addToStudyInFather(Box_1, Group_CL_2_4, 'Group_CL_2_4')
-salome.sg.updateObjBrowser(1)
-
-\endcode
+\include working_with_groups_ex06.py
+<a href="../../examples/GEOM/working_with_groups_ex06.py">Download this script</a>
*/
Group > Edit</b>. This menu is designed in the same way as the
<b>Create a group</b> menu.
-\n <b>Dialog Box:</b>
+\n When a GEOM group is edited, the main shape appears in the 3D viewer in the same mode
+as it is displayed in the viewer. If the main shape was not displayed in the viewer, then
+the default mode defined in the preferences will be used.
+
+\n <b>Working with Dialog Box:</b>
\image html editgroup.png
+\n The subshapes already in the group are displayed in the 3D viewer with a specific color,
+defined via preferences. The IDs of the subshapes already in the group also are displayed in
+a specific color in the dialog box. When user adds some subshapes, the new IDs are
+displayed in the other color.
+
\n The \b Result of the operation will be a \b GEOM_Object.
\n <b>TUI Command:</b>
# -* Makefile *-
# Author : Patrick GOLDBRONN (CEA)
# Date : 30/11/2001
-# Modified by : Alexander BORODIN (OCN) - autotools usage
-# $Header:
+# Modified by : Alexander BORODIN (OCN) - autotools usage
#
SUBDIRS = GEOM
/*!
* \brief Translate the given object along the given vector a given number times
* \param theObject The object to be translated.
- * \param theVector Direction of the translation.
+ * \param theVector Direction of the translation. DX if None.
* \param theStep Distance to translate on.
* \param theNbTimes Quantity of translations to be done.
* \return New GEOM_Object, containing compound of all
/*!
* \brief Conseqently apply two specified translations to theObject specified number of times.
* \param theObject The object to be translated.
- * \param theVector1 Direction of the first translation.
+ * \param theVector1 Direction of the first translation. DX if None.
* \param theStep1 Step of the first translation.
* \param theNbTimes1 Quantity of translations to be done along theVector1.
- * \param theVector2 Direction of the second translation.
+ * \param theVector2 Direction of the second translation. DY if None.
* \param theStep2 Step of the second translation.
* \param theNbTimes2 Quantity of translations to be done along theVector2.
* \return New GEOM_Object, containing compound of all
in GEOM_Object theAxis,
in double theAngle);
-
/*!
* \brief Rotate the given object around the given axis a given number times.
*
- * Rotation angle will be 2*PI/theNbTimes.
+ * Rotation angle will be 2*PI/theNbObjects.
* \param theObject The object to be rotated.
- * \param theAxis The rotation axis.
- * \param theNbTimes Quantity of rotations to be done.
+ * \param theAxis The rotation axis. DZ if None.
+ * \param theNbObjects Quantity of rotations to be done.
* \return New GEOM_Object, containing compound of all the
* shapes, obtained after each rotation.
*/
GEOM_Object MultiRotate1D (in GEOM_Object theObject,
in GEOM_Object theAxis,
- in long theNbTimes);
+ in long theNbObjects);
+
+ /*!
+ * \brief Rotate the given object around the given axis
+ * a given number times on the given angle.
+ *
+ * \param theObject The object to be rotated.
+ * \param theAxis The rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in radians.
+ * \param theNbSteps Quantity of rotations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each rotation.
+ */
+ GEOM_Object MultiRotate1DByStep (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in double theAngleStep,
+ in long theNbSteps);
+
+ /*!
+ * \brief Rotate the given object around the given axis
+ * a given number times and multi-translate each rotation result.
+ *
+ * Rotation angle will be 2*PI/theNbObjects.
+ * Translation direction passes through center of gravity
+ * of rotated shape and its projection on the rotation axis.
+ * \param theObject The object to be rotated.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theNbObjects Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps Quantity of translations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each transformation.
+ */
+ GEOM_Object MultiRotate2DNbTimes (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in long theNbObjects,
+ in double theRadialStep,
+ in long theNbSteps);
/*!
* \brief Rotate the given object around the
* Translation direction passes through center of gravity
* of rotated shape and its projection on the rotation axis.
* \param theObject The object to be rotated.
- * \param theAxis Rotation axis.
- * \param theAngle Rotation angle in graduces.
- * \param theNbTimes1 Quantity of rotations to be done.
- * \param theStep Translation distance.
- * \param theNbTimes2 Quantity of translations to be done.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in radians.
+ * \param theNbSteps1 Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps2 Quantity of translations to be done.
+ * \return New GEOM_Object, containing compound of all the
+ * shapes, obtained after each transformation.
+ */
+ GEOM_Object MultiRotate2DByStep (in GEOM_Object theObject,
+ in GEOM_Object theAxis,
+ in double theAngleStep,
+ in long theNbSteps1,
+ in double theRadialStep,
+ in long theNbSteps2);
+
+ /*!
+ * \brief Rotate the given object around the
+ * given axis on the given angle a given number
+ * times and multi-translate each rotation result.
+ *
+ * Translation direction passes through center of gravity
+ * of rotated shape and its projection on the rotation axis.
+ * \param theObject The object to be rotated.
+ * \param theAxis Rotation axis. DZ if None.
+ * \param theAngleStep Rotation angle in degrees.
+ * \param theNbSteps1 Quantity of rotations to be done.
+ * \param theRadialStep Translation distance.
+ * \param theNbSteps2 Quantity of translations to be done.
* \return New GEOM_Object, containing compound of all the
* shapes, obtained after each transformation.
*/
GEOM_Object MultiRotate2D (in GEOM_Object theObject,
in GEOM_Object theAxis,
- in double theAngle,
- in long theNbTimes1,
- in double theStep,
- in long theNbTimes2);
+ in double theAngleStep,
+ in long theNbSteps1,
+ in double theRadialStep,
+ in long theNbSteps2);
/*!
* \brief Replace the given object by an object,
in boolean theCopy,
in boolean theReverse);
- /*!
- * \brief Transform the shape in the same way what was used for the sample shape creation.
- * \param theObject The object to be transformed.
- * \param theSample The object containing information about required transformation.
- * \note Implementation of this method is limited by multi-transformations now.
- * \note Internal method.
- * \return New GEOM_Object, containing the transformed shape.
- */
- GEOM_Object TransformLikeOtherCopy (in GEOM_Object theObject,
- in GEOM_Object theSample);
-
/*!
* \brief Recompute the shape from its arguments.
* \param theObject The object to be recomputed.
*/
long GetSubShapeIndex (in GEOM_Object theMainShape, in GEOM_Object theSubShape);
+ /*!
+ * Get global indices of \a theSubShapes in \a theMainShape.
+ * \param theMainShape Main shape.
+ * \param theSubShapes List of sub-shapes of the main shape.
+ * \return list of global indices of \a theSubShapes in \a theMainShape.
+ */
+ ListOfLong GetSubShapesIndices (in GEOM_Object theMainShape, in ListOfGO theSubShapes);
+
/*!
* \brief Get index of \a theSubShape in \a theMainShape, unique among sub-shapes of the same type.
*
in boolean theIsClosed,
in boolean theDoReordering);
+ /*!
+ * \brief Create B-Spline curve on the set of points.
+ * \param thePoints Sequence of points for the B-Spline curve.
+ * \param theFirstVec Vector object, defining the curve direction at its first point.
+ * \param theLastVec Vector object, defining the curve direction at its last point.
+ * \return New GEOM_Object, containing the created B-Spline curve.
+ */
+ GEOM_Object MakeSplineInterpolWithTangents (in ListOfGO thePoints,
+ in GEOM_Object theFirstVec,
+ in GEOM_Object theLastVec);
+
/*!
* \brief Creates a curve using the parametric definition of the basic points.
* \param thexExpr parametric equation of the coordinates X.
out double Ymin, out double Ymax,
out double Zmin, out double Zmax);
+ /*!
+ * \brief Get bounding box of the given shape
+ * \param theShape Shape to obtain bounding box of.
+ * \return New GEOM_Object, containing the created bounding box.
+ */
+ GEOM_Object MakeBoundingBox (in GEOM_Object theShape);
+
/*!
* \brief Get min and max tolerances of sub-shapes of theShape
* \param theShape Shape, to get tolerances of.
out double X1, out double Y1, out double Z1,
out double X2, out double Y2, out double Z2);
+ /*!
+ * \brief Get closest points of the given shapes.
+ * \param theShape1,theShape2 Shapes to find closest points of.
+ * \param theCoords Output. List of (X, Y, Z) coordinates for all couples of points.
+ * \return The number of found solutions (-1 in case of infinite number of solutions).
+ */
+ long ClosestPoints (in GEOM_Object theShape1,
+ in GEOM_Object theShape2,
+ out ListOfDouble theCoords);
+
/*!
* \brief Get angle between the given lines or linear edges.
* \param theShape1,theShape2 Shapes to find angle between. Lines or linear edges.
<parameter name="isos_color" value="200, 200, 200" />
<parameter name="toplevel_color" value="170, 85, 0" />
<parameter name="toplevel_dm" value="0" />
+ <parameter name="editgroup_color" value="170, 85, 0" />
<parameter name="type_of_marker" value="1" />
<parameter name="deflection_coeff" value="0.001" />
<parameter name="auto_create_base_objects" value="false" />
<parameter name="marker_scale" value="1" />
<parameter name="geom_preview" value="false" />
<parameter name="material" value="Plastic" />
+ <parameter name="predef_materials" value="true" />
<parameter name="edge_width" value="1" />
<parameter name="isolines_width" value="1" />
<parameter name="preview_edge_width" value="1" />
<parameter name="measures_line_width" value="1" />
+ <parameter name="iso_number_u" value="1" />
+ <parameter name="iso_number_v" value="1" />
<!-- Input field precisions -->
<parameter name="def_precision" value="3" />
// File : Archimede_VolumeSection.cxx
// Author : Nicolas REJNERI
// Module : GEOM
-// $Header$
//
#include "Archimede_VolumeSection.hxx"
#include "utilities.h"
// File : Archimede_VolumeSection.hxx
// Author : Nicolas REJNERI
// Module : GEOM
-// $Header$
//
#ifndef ARCHIMEDE_VOLUMESECTION_HXX
#define ARCHIMEDE_VOLUMESECTION_HXX
# Author : Nicolas REJNERI
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
extern "C"
{
-BREPEXPORT_EXPORT
- int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
+ BREPEXPORT_EXPORT int Export (const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/)
{
MESSAGE("Export BREP into file " << theFileName.ToCString());
# Author : Pavel TELKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# Author : Pavel TELKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
qApp->processEvents();
updateGeometry();
resize( minimumSizeHint() );
- SelectionIntoArgument();
myEditCurrentArgument->setFocus();
globalSelection(); // close local contexts, if any
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
- displayPreview(true);
+ SelectionIntoArgument();
}
//=================================================================================
// 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 : BasicGUI_CurveDlg.cxx
bool modal, Qt::WindowFlags fl )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POLYLINE" ) ) );
- QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SPLINE" ) ) );
- QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BEZIER" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_POLYLINE")));
+ QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_SPLINE")));
+ QPixmap image3 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BEZIER")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_CURVE_TITLE" ) );
+ setWindowTitle(tr("GEOM_CURVE_TITLE"));
/***************************************************************/
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setIcon( image3 );
- mainFrame()->RadioButton3->setIcon( image2 );
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setIcon(image3);
+ mainFrame()->RadioButton3->setIcon(image2);
- QGroupBox* creationModeCroup = new QGroupBox(this);
- QButtonGroup* bg = new QButtonGroup(this);
+ // Creation mode
+ QGroupBox* creationModeGroup = new QGroupBox (this);
+ QButtonGroup* bg = new QButtonGroup (this);
- creationModeCroup->setTitle( tr( "GEOM_CURVE_CRMODE" ) );
- QHBoxLayout * creationModeLayout = new QHBoxLayout(creationModeCroup);
- myBySelectionBtn = new QRadioButton( tr( "GEOM_CURVE_SELECTION" ) ,creationModeCroup );
- myAnaliticalBtn = new QRadioButton( tr( "GEOM_CURVE_ANALITICAL" ) ,creationModeCroup );
+ creationModeGroup->setTitle(tr("GEOM_CURVE_CRMODE"));
+ QHBoxLayout * creationModeLayout = new QHBoxLayout (creationModeGroup);
+ myBySelectionBtn = new QRadioButton (tr("GEOM_CURVE_SELECTION") ,creationModeGroup);
+ myAnaliticalBtn = new QRadioButton (tr("GEOM_CURVE_ANALITICAL") ,creationModeGroup);
bg->addButton(myBySelectionBtn);
bg->addButton(myAnaliticalBtn);
-
+
creationModeLayout->addWidget(myBySelectionBtn);
creationModeLayout->addWidget(myAnaliticalBtn);
- GroupPoints = new DlgRef_1Sel3Check( centralWidget() );
-
- GroupPoints->GroupBox1->setTitle( tr( "GEOM_NODES" ) );
- GroupPoints->TextLabel1->setText( tr( "GEOM_POINTS" ) );
- GroupPoints->PushButton1->setIcon( image1 );
- GroupPoints->PushButton1->setDown( true );
-
- GroupPoints->LineEdit1->setReadOnly( true );
-
- GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
- GroupPoints->CheckButton1->setChecked(false);
- //GroupPoints->CheckButton1->hide();
-
- GroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) );
- GroupPoints->CheckButton2->setChecked(false);
- GroupPoints->CheckButton2->hide();
-
- GroupPoints->CheckButton3->hide();
-
- myParams = new BasicGUI_ParamCurveWidget( centralWidget() );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( creationModeCroup );
- layout->addWidget( GroupPoints );
- layout->addWidget( myParams );
+ // Points and flags
+ myGroupPoints = new DlgRef_1Sel3Check (centralWidget());
+
+ myGroupPoints->GroupBox1->setTitle(tr("GEOM_NODES"));
+ myGroupPoints->TextLabel1->setText(tr("GEOM_POINTS"));
+ myGroupPoints->PushButton1->setIcon(image1);
+ myGroupPoints->PushButton1->setDown(true);
+
+ myGroupPoints->LineEdit1->setReadOnly( true );
+
+ myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
+ myGroupPoints->CheckButton1->setChecked(false);
+ //myGroupPoints->CheckButton1->hide();
+
+ myGroupPoints->CheckButton2->setText( tr( "GEOM_IS_REORDER" ) );
+ myGroupPoints->CheckButton2->setChecked(false);
+ myGroupPoints->CheckButton2->hide();
+
+ myGroupPoints->CheckButton3->hide();
+
+ // Parametrical mode
+ myGroupParams = new BasicGUI_ParamCurveWidget( centralWidget() );
+
+ // Tangents (only for Interpolation constructor and only not closed and no reordering)
+ myGroupTangents = new QGroupBox (this);
+ myGroupTangents->setCheckable(true);
+ myGroupTangents->setChecked(false);
+ myGroupTangents->setTitle(tr("GEOM_INTERPOL_TANGENTS"));
+
+ QGridLayout* tangentsLayout = new QGridLayout (myGroupTangents);
+
+ myPushBtnV1 = new QPushButton (myGroupTangents);
+ myPushBtnV2 = new QPushButton (myGroupTangents);
+ myPushBtnV1->setIcon(image1);
+ myPushBtnV2->setIcon(image1);
+
+ myLineEditV1 = new QLineEdit (myGroupTangents);
+ myLineEditV2 = new QLineEdit (myGroupTangents);
+ myLineEditV1->setReadOnly(true);
+ myLineEditV2->setReadOnly(true);
+
+ QLabel* aTextLabelV1 = new QLabel (myGroupTangents);
+ QLabel* aTextLabelV2 = new QLabel (myGroupTangents);
+ aTextLabelV1->setText(tr("GEOM_INTERPOL_FIRST_VEC"));
+ aTextLabelV2->setText(tr("GEOM_INTERPOL_LAST_VEC"));
+
+ tangentsLayout->addWidget(aTextLabelV1, 0, 0);
+ tangentsLayout->addWidget(myPushBtnV1 , 0, 1);
+ tangentsLayout->addWidget(myLineEditV1, 0, 2);
+ tangentsLayout->addWidget(aTextLabelV2, 1, 0);
+ tangentsLayout->addWidget(myPushBtnV2 , 1, 1);
+ tangentsLayout->addWidget(myLineEditV2, 1, 2);
+
+ // Layout
+ QVBoxLayout* layout = new QVBoxLayout (centralWidget());
+ layout->setMargin(0);
+ layout->setSpacing(6);
+ layout->addWidget(creationModeGroup);
+ layout->addWidget(myGroupPoints);
+ layout->addWidget(myGroupParams);
+ layout->addWidget(myGroupTangents);
/***************************************************************/
- setHelpFileName( "create_curve_page.html" );
+ setHelpFileName("create_curve_page.html");
Init();
}
-
//=================================================================================
// function : ~BasicGUI_CurveDlg()
// purpose : Destroys the object and frees any allocated resources
{
}
-
//=================================================================================
// function : Init()
// purpose :
void BasicGUI_CurveDlg::Init()
{
/* init variables */
- myEditCurrentArgument = GroupPoints->LineEdit1;
-
- myPoints.clear();
-
- globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-
showOnlyPreviewControl();
myBySelectionBtn->setChecked(true);
double aMax( 100. ), aMin( 0.0 );
/* min, max, step and decimals for spin boxes & initial values */
- initSpinBox( myParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" );
- initSpinBox( myParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" );
- myParams->myPStep->setValue( 10 );
- myParams->myPStep->setMaximum( 999 );
- myParams->myPStep->setSingleStep( 10 );
- myParams->myPMin->setValue( aMin );
- myParams->myPMax->setValue( aMax );
- myParams->myPStep->setValue( step );
- myParams->myXExpr->setText("t");
- myParams->myYExpr->setText("t");
- myParams->myZExpr->setText("t");
-
- myParams->hide();
+ initSpinBox( myGroupParams->myPMin, COORD_MIN, COORD_MAX, step, "length_precision" );
+ initSpinBox( myGroupParams->myPMax, COORD_MIN, COORD_MAX, step, "length_precision" );
+ myGroupParams->myPStep->setValue( 10 );
+ myGroupParams->myPStep->setMaximum( 999 );
+ myGroupParams->myPStep->setSingleStep( 10 );
+ myGroupParams->myPMin->setValue( aMin );
+ myGroupParams->myPMax->setValue( aMax );
+ myGroupParams->myPStep->setValue( step );
+ myGroupParams->myXExpr->setText("t");
+ myGroupParams->myYExpr->setText("t");
+ myGroupParams->myZExpr->setText("t");
+
+ myGroupParams->hide();
/* signals and slots connections */
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog( ) ) );
- connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect(myGroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myPushBtnV1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(myPushBtnV2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect( GroupPoints->CheckButton1, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) );
- connect( GroupPoints->CheckButton2, SIGNAL( toggled(bool) ), this, SLOT( CheckButtonToggled() ) );
+ connect(myGroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckButtonToggled()));
+ connect(myGroupPoints->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(CheckButtonToggled()));
+ connect(myGroupTangents, SIGNAL(toggled(bool)), this, SLOT(CheckButtonToggled()));
- connect( myGeomGUI->getApp()->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- connect( myBySelectionBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) );
- connect( myAnaliticalBtn, SIGNAL( clicked() ), this, SLOT( CreationModeChanged() ) );
+ connect(myBySelectionBtn, SIGNAL(clicked()), this, SLOT(CreationModeChanged()));
+ connect(myAnaliticalBtn, SIGNAL(clicked()), this, SLOT(CreationModeChanged()));
- connect(myParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(myParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
+ connect(myGroupParams->myPMin, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(myGroupParams->myPMax, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(myGroupParams->myPStep, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(myParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
- connect(myParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
- connect(myParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
+ connect(myGroupParams->myXExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
+ connect(myGroupParams->myYExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
+ connect(myGroupParams->myZExpr, SIGNAL(editingFinished()), this, SLOT(OnEditingFinished()));
- initName( tr( "GEOM_CURVE" ) );
- resize(100,100);
- ConstructorsClicked( 0 );
+ initName(tr("GEOM_CURVE"));
+ //resize(100, 100);
+ ConstructorsClicked(0);
}
//=================================================================================
// function : ConstructorsClicked()
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::ConstructorsClicked( int id )
+void BasicGUI_CurveDlg::ConstructorsClicked (int id)
{
- QString aTitle = tr( id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL" );
- mainFrame()->GroupConstructors->setTitle( aTitle );
+ QString aTitle = tr(id == 0 ? "GEOM_POLYLINE" : id == 1 ? "GEOM_BEZIER" : "GEOM_INTERPOL");
+ mainFrame()->GroupConstructors->setTitle(aTitle);
if (id == 0) { // polyline (wire)
- //GroupPoints->CheckButton1->hide();
- GroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) );
- GroupPoints->CheckButton2->hide();
+ myGroupPoints->CheckButton1->setText( tr( "GEOM_BUILD_CLOSED_WIRE" ) );
+ myGroupPoints->CheckButton2->hide();
+ myGroupTangents->hide();
}
else if (id == 1) { // bezier
- //GroupPoints->CheckButton1->hide();
- GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
- GroupPoints->CheckButton2->hide();
+ myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
+ myGroupPoints->CheckButton2->hide();
+ myGroupTangents->hide();
}
else { // b-spline
- //GroupPoints->CheckButton1->show();
- GroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
- GroupPoints->CheckButton2->show();
+ myGroupPoints->CheckButton1->setText( tr( "GEOM_IS_CLOSED" ) );
+ myGroupPoints->CheckButton2->show();
+ myGroupTangents->setVisible(myBySelectionBtn->isChecked());
}
myPoints.clear();
+ myVec1.nullify();
+ myVec2.nullify();
+
+ myGroupPoints->LineEdit1->setText("");
+ myLineEditV1->setText("");
+ myLineEditV2->setText("");
- myEditCurrentArgument->setText( "" );
qApp->processEvents();
updateGeometry();
- resize( minimumSizeHint() );
- SelectionIntoArgument();
-}
+ resize(minimumSizeHint());
+ myGroupPoints->PushButton1->click();
+}
//=================================================================================
// function : SetEditCurrentArgument()
//=================================================================================
void BasicGUI_CurveDlg::SetEditCurrentArgument()
{
- if ( sender() == GroupPoints->PushButton1 )
- myEditCurrentArgument = GroupPoints->LineEdit1;
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+
+ globalSelection(); // close local contexts, if any
+
+ if (sender() == myGroupPoints->PushButton1) {
+ myEditCurrentArgument = myGroupPoints->LineEdit1;
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
+ else if (sender() == myPushBtnV1) {
+ myEditCurrentArgument = myLineEditV1;
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+ else if (sender() == myPushBtnV2) {
+ myEditCurrentArgument = myLineEditV2;
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+
myEditCurrentArgument->setFocus();
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
SelectionIntoArgument();
}
//=================================================================================
void BasicGUI_CurveDlg::CheckButtonToggled()
{
- processPreview();
+ if (sender() == myGroupTangents) {
+ if (myGroupTangents->isChecked())
+ myPushBtnV1->click();
+ else
+ myGroupPoints->PushButton1->click();
+ }
+ else {
+ if (getConstructorId() == 2) { // Interpolation
+ bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
+ myGroupPoints->CheckButton2->isChecked());
+ myGroupTangents->setEnabled(!disableTangents);
+ }
+ processPreview();
+ }
}
//=================================================================================
//=================================================================================
void BasicGUI_CurveDlg::ClickOnOk()
{
- setIsApplyAndClose( true );
- if ( ClickOnApply() )
+ setIsApplyAndClose(true);
+ if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
bool BasicGUI_CurveDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
- globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ ConstructorsClicked(getConstructorId());
return true;
}
-static void synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right )
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+static void synchronize (QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right)
{
// 1. remove items from the "left" list that are not in the "right" list
- QMutableListIterator<GEOM::GeomObjPtr> it1( left );
- while ( it1.hasNext() ) {
+ QMutableListIterator<GEOM::GeomObjPtr> it1 (left);
+ while (it1.hasNext()) {
GEOM::GeomObjPtr o1 = it1.next();
bool found = false;
QMutableListIterator<GEOM::GeomObjPtr> it2( right );
}
}
-//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection as changed or other case
-//=================================================================================
void BasicGUI_CurveDlg::SelectionIntoArgument()
{
- QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
- synchronize( myPoints, points );
- if ( !myPoints.isEmpty() )
- GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
- else
- GroupPoints->LineEdit1->setText( "" );
+ myEditCurrentArgument->setText("");
+
+ if (myEditCurrentArgument == myGroupPoints->LineEdit1) {
+ QList<GEOM::GeomObjPtr> points = getSelected(TopAbs_VERTEX, -1);
+ synchronize(myPoints, points);
+ if (!myPoints.isEmpty())
+ myGroupPoints->LineEdit1->setText(QString::number(myPoints.count()) + "_" +
+ tr("GEOM_POINT") + tr("_S_"));
+ }
+ else {
+ QList<GEOM::GeomObjPtr> vecs = getSelected(TopAbs_EDGE, -1);
+ if (vecs.count() != 1) {
+ if (myEditCurrentArgument == myLineEditV1) myVec1.nullify();
+ else if (myEditCurrentArgument == myLineEditV2) myVec2.nullify();
+ }
+ else {
+ if (myEditCurrentArgument == myLineEditV1) {
+ myVec1 = vecs.first();
+ }
+ else if (myEditCurrentArgument == myLineEditV2) {
+ myVec2 = vecs.first();
+ }
+ QString aName = GEOMBase::GetName(vecs.first().get());
+ myEditCurrentArgument->setText(aName);
+ }
+ }
+
processPreview();
}
-
//=================================================================================
// function : ActivateThisDialog()
// purpose :
void BasicGUI_CurveDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
- globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::enterEvent( QEvent* )
+void BasicGUI_CurveDlg::enterEvent (QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
//=================================================================================
GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation()
{
- return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
+ return myGeomGUI->GetGeomGen()->GetICurvesOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool BasicGUI_CurveDlg::isValid( QString& msg )
+bool BasicGUI_CurveDlg::isValid (QString& msg)
{
- if( myBySelectionBtn->isChecked() )
- return myPoints.count() > 1;
+ if (myBySelectionBtn->isChecked()) {
+ bool ok = true;
+ if (getConstructorId() == 2) { // Interpolation
+ bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
+ myGroupPoints->CheckButton2->isChecked());
+ if (!disableTangents && myGroupTangents->isChecked()) {
+ ok = (myVec1 && myVec2);
+ if (!ok) msg = tr("GEOM_BOTH_TANGENTS_REQUIRED");
+ }
+ }
+ return ok && myPoints.count() > 1;
+ }
else {
- bool ok = myParams->myPMin->isValid( msg, !IsPreview() ) &&
- myParams->myPMax->isValid( msg, !IsPreview() ) &&
- myParams->myPStep->isValid( msg, !IsPreview() );
- ok &= !myParams->myXExpr->text().isEmpty();
- ok &= !myParams->myYExpr->text().isEmpty();
- ok &= !myParams->myZExpr->text().isEmpty();
+ bool ok = myGroupParams->myPMin->isValid( msg, !IsPreview() ) &&
+ myGroupParams->myPMax->isValid( msg, !IsPreview() ) &&
+ myGroupParams->myPStep->isValid( msg, !IsPreview() );
+ ok &= !myGroupParams->myXExpr->text().isEmpty();
+ ok &= !myGroupParams->myYExpr->text().isEmpty();
+ ok &= !myGroupParams->myZExpr->text().isEmpty();
return ok;
}
}
// function : execute
// purpose :
//=================================================================================
-bool BasicGUI_CurveDlg::execute( ObjectList& objects )
+bool BasicGUI_CurveDlg::execute (ObjectList& objects)
{
bool res = false;
GEOM::GEOM_Object_var anObj;
- GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
+ GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow(getOperation());
GEOM::ListOfGO_var points = new GEOM::ListOfGO();
- points->length( myPoints.count() );
- for ( int i = 0; i < myPoints.count(); i++ )
+ points->length(myPoints.count());
+ for (int i = 0; i < myPoints.count(); i++)
points[i] = myPoints[i].copy();
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0 :
- if( myBySelectionBtn->isChecked() )
- anObj = anOper->MakePolyline( points.in(), GroupPoints->CheckButton1->isChecked() );
+ if (myBySelectionBtn->isChecked())
+ anObj = anOper->MakePolyline(points.in(), myGroupPoints->CheckButton1->isChecked());
else
- anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
- qPrintable(myParams->myYExpr->text()),
- qPrintable(myParams->myZExpr->text()),
- myParams->myPMin->value(),
- myParams->myPMax->value(),
- myParams->myPStep->value(),
- GEOM::Polyline);
+ anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
+ qPrintable(myGroupParams->myYExpr->text()),
+ qPrintable(myGroupParams->myZExpr->text()),
+ myGroupParams->myPMin->value(),
+ myGroupParams->myPMax->value(),
+ myGroupParams->myPStep->value(),
+ GEOM::Polyline);
res = true;
break;
case 1 :
- if( myBySelectionBtn->isChecked() )
- anObj = anOper->MakeSplineBezier( points.in(), GroupPoints->CheckButton1->isChecked() );
+ if (myBySelectionBtn->isChecked())
+ anObj = anOper->MakeSplineBezier(points.in(), myGroupPoints->CheckButton1->isChecked());
else
- anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
- qPrintable(myParams->myYExpr->text()),
- qPrintable(myParams->myZExpr->text()),
- myParams->myPMin->value(),
- myParams->myPMax->value(),
- myParams->myPStep->value(),
- GEOM::Bezier);
-
+ anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
+ qPrintable(myGroupParams->myYExpr->text()),
+ qPrintable(myGroupParams->myZExpr->text()),
+ myGroupParams->myPMin->value(),
+ myGroupParams->myPMax->value(),
+ myGroupParams->myPStep->value(),
+ GEOM::Bezier);
res = true;
break;
case 2 :
- if( myBySelectionBtn->isChecked() )
- anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked(),
- GroupPoints->CheckButton2->isChecked() );
+ if (myBySelectionBtn->isChecked()) {
+ bool disableTangents = (myGroupPoints->CheckButton1->isChecked() ||
+ myGroupPoints->CheckButton2->isChecked());
+ if (!disableTangents && myGroupTangents->isChecked()) {
+ anObj = anOper->MakeSplineInterpolWithTangents(points.in(), myVec1.get(), myVec2.get());
+ }
+ else
+ anObj = anOper->MakeSplineInterpolation(points.in(), myGroupPoints->CheckButton1->isChecked(),
+ myGroupPoints->CheckButton2->isChecked());
+ }
else
- anObj = anOper->MakeCurveParametricNew(qPrintable(myParams->myXExpr->text()),
- qPrintable(myParams->myYExpr->text()),
- qPrintable(myParams->myZExpr->text()),
- myParams->myPMin->value(),
- myParams->myPMax->value(),
- myParams->myPStep->value(),
- GEOM::Interpolation);
+ anObj = anOper->MakeCurveParametricNew(qPrintable(myGroupParams->myXExpr->text()),
+ qPrintable(myGroupParams->myYExpr->text()),
+ qPrintable(myGroupParams->myZExpr->text()),
+ myGroupParams->myPMin->value(),
+ myGroupParams->myPMax->value(),
+ myGroupParams->myPStep->value(),
+ GEOM::Interpolation);
res = true;
break;
}
- if ( !anObj->_is_nil() ) {
- if(myAnaliticalBtn->isChecked() && !IsPreview()) {
+ if (!anObj->_is_nil()) {
+ if (myAnaliticalBtn->isChecked() && !IsPreview()) {
QStringList aParameters;
- aParameters<<myParams->myPMin->text();
- aParameters<<myParams->myPMax->text();
- aParameters<<myParams->myPStep->text();
+ aParameters<<myGroupParams->myPMin->text();
+ aParameters<<myGroupParams->myPMax->text();
+ aParameters<<myGroupParams->myPStep->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
- objects.push_back( anObj._retn() );
+ objects.push_back(anObj._retn());
}
-
+
return res;
}
//=================================================================================
-// function : addSubshapeToStudy
+// function : addSubshapesToStudy
// purpose : virtual method to add new SubObjects if local selection
//=================================================================================
void BasicGUI_CurveDlg::addSubshapesToStudy()
// function : CreationModeChanged
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::CreationModeChanged() {
+void BasicGUI_CurveDlg::CreationModeChanged()
+{
const QObject* s = sender();
- GroupPoints->setVisible(myBySelectionBtn == s);
- myParams->setVisible(myBySelectionBtn != s);
-
- ConstructorsClicked( getConstructorId() );
+ myGroupPoints->setVisible(myBySelectionBtn == s);
+ myGroupParams->setVisible(myBySelectionBtn != s);
+
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::ValueChangedInSpinBox(double/*theValue*/)
+void BasicGUI_CurveDlg::ValueChangedInSpinBox (double/*theValue*/)
{
processPreview();
}
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::ValueChangedInSpinBox(int/*theValue*/)
+void BasicGUI_CurveDlg::ValueChangedInSpinBox (int/*theValue*/)
{
processPreview();
}
//=================================================================================
-// function : ValueChangedInSpinBox()
+// function : OnEditingFinished()
// purpose :
//=================================================================================
-void BasicGUI_CurveDlg::OnEditingFinished() {
+void BasicGUI_CurveDlg::OnEditingFinished()
+{
processPreview();
}
// 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 : BasicGUI_CurveDlg.h
class DlgRef_1Sel3Check;
class QRadioButton;
+class QPushButton;
+class QLineEdit;
+class QGroupBox;
class BasicGUI_ParamCurveWidget;
//=================================================================================
Q_OBJECT
public:
- BasicGUI_CurveDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
+ BasicGUI_CurveDlg (GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0);
~BasicGUI_CurveDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
private:
void Init();
- void enterEvent( QEvent* );
+ void enterEvent (QEvent*);
private:
- DlgRef_1Sel3Check* GroupPoints;
- QList<GEOM::GeomObjPtr> myPoints;
QRadioButton* myAnaliticalBtn;
QRadioButton* myBySelectionBtn;
- BasicGUI_ParamCurveWidget* myParams;
+ DlgRef_1Sel3Check* myGroupPoints;
+ BasicGUI_ParamCurveWidget* myGroupParams;
+ QGroupBox* myGroupTangents;
+
+ QPushButton* myPushBtnV1;
+ QPushButton* myPushBtnV2;
+ QLineEdit* myLineEditV1;
+ QLineEdit* myLineEditV2;
+
+ QList<GEOM::GeomObjPtr> myPoints;
+ GEOM::GeomObjPtr myVec1, myVec2;
private slots:
void ClickOnOk();
void ActivateThisDialog();
void DeactivateActiveDialog();
- void ConstructorsClicked( int );
+ void ConstructorsClicked (int);
void CheckButtonToggled();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void CreationModeChanged();
- void ValueChangedInSpinBox(double/*theValue*/);
- void ValueChangedInSpinBox(int /*theValue*/);
+ void ValueChangedInSpinBox (double/*theValue*/);
+ void ValueChangedInSpinBox (int /*theValue*/);
void OnEditingFinished();
};
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix.cxx
+// Created: Tue Dec 7 11:59:05 2004
+// Author: Pavel DURANDIN
+
+#include <BlockFix.hxx>
+
+#include <BlockFix_SphereSpaceModifier.hxx>
+#include <BlockFix_PeriodicSurfaceModifier.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BRepAdaptor_Surface.hxx>
+
+#include <BRepTools.hxx>
+#include <BRepTools_Modifier.hxx>
+#include <BRepTools_Substitution.hxx>
+
+#include <BRepOffsetAPI_MakeFilling.hxx>
+
+#include <ShapeFix.hxx>
+#include <ShapeFix_Edge.hxx>
+#include <ShapeFix_Face.hxx>
+
+#include <ShapeAnalysis.hxx>
+#include <ShapeAnalysis_Edge.hxx>
+#include <ShapeAnalysis_Curve.hxx>
+#include <ShapeAnalysis_Surface.hxx>
+
+#include <ShapeCustom.hxx>
+
+#include <ShapeBuild_Edge.hxx>
+#include <ShapeBuild_ReShape.hxx>
+
+#include <ShapeFix_Wire.hxx>
+
+#include <Geom_Surface.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_ConicalSurface.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_ToroidalSurface.hxx>
+
+#include <Geom2d_Curve.hxx>
+
+#include <TColgp_SequenceOfPnt2d.hxx>
+
+//=======================================================================
+//function : FixResult
+//purpose : auxilary
+//=======================================================================
+static void FixResult(const TopoDS_Shape& result,
+ Handle(ShapeBuild_ReShape)& Context,
+ const Standard_Real Tol)
+{
+ for (TopExp_Explorer ex_f(result,TopAbs_FACE); ex_f.More(); ex_f.Next()) {
+ TopoDS_Shape aShape = Context->Apply(ex_f.Current().Oriented(TopAbs_FORWARD));
+ // face coud not be dropped or splitted on this step
+ TopoDS_Face aFace = TopoDS::Face(aShape);
+ TopLoc_Location L;
+ Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L);
+
+ if( Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ||
+ Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ) {
+
+ Standard_Integer nbWires = 0;
+ for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) {
+ nbWires++;
+ Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()),
+ aFace,
+ Precision::Confusion());
+ sfw->FixReorder();
+ if(sfw->StatusReorder ( ShapeExtend_FAIL ))
+ continue;
+
+ sfw->SetPrecision(2.*Tol);
+ sfw->FixShifted();
+
+ Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE );
+ isDone |= sfw->FixDegenerated();
+
+ // remove degenerated edges from not degenerated points
+ ShapeAnalysis_Edge sae;
+ Handle(ShapeExtend_WireData) sewd = sfw->WireData();
+ Standard_Integer i;
+ for( i = 1; i<=sewd->NbEdges();i++) {
+ TopoDS_Edge E = sewd->Edge(i);
+ if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aFace)) {
+ sewd->Remove(i);
+ isDone = Standard_True;
+ i--;
+ }
+ }
+
+ //isDone |= sfw->FixLacking(); // commented by skl 22.03.2005 (PAL8395)
+
+ // remove neighbour seam edges
+ if(isDone) {
+ for( i = 1; i<sewd->NbEdges();i++) {
+ if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) {
+ isDone = Standard_True;
+ sewd->Remove(i);
+ sewd->Remove(i);
+ i--;
+ }
+ }
+ if(sewd->IsSeam(1) && sewd->IsSeam(sewd->NbEdges())) {
+ sewd->Remove(1);
+ sewd->Remove(sewd->NbEdges());
+ }
+ }
+
+ if(isDone) {
+ TopoDS_Wire ResWire = sfw->Wire();
+ Context->Replace(ex_w.Current(), ResWire);
+ };
+ }
+ // Implement fix orientation in case of several wires
+ if(nbWires > 1) {
+ TopoDS_Face aFixedFace = TopoDS::Face(Context->Apply(aFace));
+ Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFixedFace);
+ if(sff->FixOrientation())
+ Context->Replace(aFixedFace,sff->Face());
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : RotateSphereSpace
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S,
+ const Standard_Real Tol)
+{
+ // Create a modification description
+ Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier;
+ SR->SetTolerance(Tol);
+
+ TopTools_DataMapOfShapeShape context;
+ BRepTools_Modifier MD;
+ TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
+
+ Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
+ FixResult(result,RS,Tol);
+ result = RS->Apply(result);
+
+ ShapeFix_Edge sfe;
+ for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
+ TopoDS_Edge E = TopoDS::Edge(exp.Current());
+ sfe.FixVertexTolerance (E);
+ }
+
+ ShapeFix::SameParameter(result,Standard_False);
+ return result;
+}
+
+//=======================================================================
+//function : RefillProblemFaces
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix::RefillProblemFaces (const TopoDS_Shape& aShape)
+{
+ Standard_Integer NbSamples = 10;
+
+ TopTools_ListOfShape theFaces;
+
+ TopExp_Explorer Explo(aShape, TopAbs_FACE);
+ for (; Explo.More(); Explo.Next())
+ {
+ TopoDS_Face aFace = TopoDS::Face(Explo.Current());
+ BRepAdaptor_Surface BAsurf(aFace);
+ GeomAbs_SurfaceType SurfType = BAsurf.GetType();
+ if (SurfType >= GeomAbs_BezierSurface)
+ {
+ TopExp_Explorer fexp(aFace, TopAbs_EDGE);
+ for (; fexp.More(); fexp.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(fexp.Current());
+ if (BRep_Tool::Degenerated(anEdge))
+ {
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anEdge, V1, V2);
+ if (V1.IsSame(V2))
+ {
+ gp_Pnt aPnt = BRep_Tool::Pnt(V1);
+ Standard_Real TolV = BRep_Tool::Tolerance(V1);
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ Handle(ShapeAnalysis_Surface) Analyser = new ShapeAnalysis_Surface(aSurf);
+ if (Analyser->IsDegenerated(aPnt, TolV))
+ {
+ theFaces.Append(aFace);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //Now all problem faces are collected in the list "theFaces"
+ BRepTools_Substitution aSubst;
+ TopTools_ListIteratorOfListOfShape itl(theFaces);
+ for (; itl.More(); itl.Next())
+ {
+ const TopoDS_Face& aFace = TopoDS::Face(itl.Value());
+ BRepOffsetAPI_MakeFilling Filler;
+ for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
+ if (!BRep_Tool::Degenerated(anEdge))
+ Filler.Add(anEdge, GeomAbs_C0);
+ }
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
+ //Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ Standard_Integer i, j;
+ for (i = 1; i < NbSamples; i++)
+ for (j = 1; j < NbSamples; j++) {
+ /*
+ gp_Pnt aPoint = aSurf->Value(Umin + i*(Umax-Umin)/NbSamples,
+ Vmin + j*(Vmax-Vmin)/NbSamples);
+ Filler.Add(aPoint);
+ */
+ Filler.Add(Umin + i*(Umax-Umin)/NbSamples,
+ Vmin + j*(Vmax-Vmin)/NbSamples,
+ aFace, GeomAbs_G1);
+ }
+
+ Filler.Build();
+ if (Filler.IsDone())
+ {
+ for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
+ {
+ const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
+ TopTools_ListOfShape Ledge;
+ if (!BRep_Tool::Degenerated(anEdge))
+ {
+ const TopTools_ListOfShape& Ledges = Filler.Generated(anEdge);
+ if (!Ledges.IsEmpty()) {
+ TopoDS_Shape NewEdge = Ledges.First();
+ Ledge.Append(NewEdge.Oriented(TopAbs_FORWARD));
+ }
+ }
+ aSubst.Substitute(anEdge, Ledge);
+ }
+ TopTools_ListOfShape Lface;
+ TopoDS_Face NewFace = TopoDS::Face(Filler.Shape());
+ NewFace.Orientation(TopAbs_FORWARD);
+ BRepAdaptor_Surface NewBAsurf(NewFace);
+ gp_Pnt MidPnt;
+ gp_Vec D1U, D1V, Normal, NewNormal;
+ Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
+ aSurf->D1((Umin+Umax)*0.5, (Vmin+Vmax)*0.5, MidPnt, D1U, D1V);
+ Normal = D1U ^ D1V;
+ NewBAsurf.D1((NewBAsurf.FirstUParameter() + NewBAsurf.LastUParameter())*0.5,
+ (NewBAsurf.FirstVParameter() + NewBAsurf.LastVParameter())*0.5,
+ MidPnt, D1U, D1V);
+ NewNormal = D1U ^ D1V;
+ if (Normal * NewNormal < 0.)
+ NewFace.Reverse();
+ Lface.Append(NewFace);
+ aSubst.Substitute(aFace, Lface);
+ }
+ }
+ aSubst.Build(aShape);
+
+ TopoDS_Shape Result = aShape;
+ if (aSubst.IsCopied(aShape))
+ Result = aSubst.Copy(aShape).First();
+
+ BRepTools::RemoveUnusedPCurves(Result);
+
+ return Result;
+}
+
+//=======================================================================
+//function : FixRanges
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S,
+ const Standard_Real Tol)
+{
+ // Create a modification description
+ Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier;
+ SR->SetTolerance(Tol);
+
+ TopTools_DataMapOfShapeShape context;
+ BRepTools_Modifier MD;
+ TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
+
+ Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
+ FixResult(result,RS,Tol);
+ result = RS->Apply(result);
+
+ ShapeFix_Edge sfe;
+ for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
+ TopoDS_Edge E = TopoDS::Edge(exp.Current());
+ sfe.FixVertexTolerance (E);
+ }
+
+ ShapeFix::SameParameter(result,Standard_False);
+
+ return result;
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_HeaderFile
+#define _BlockFix_HeaderFile
+
+#include <Standard_Real.hxx>
+
+class TopoDS_Shape;
+class BlockFix_SphereSpaceModifier;
+class BlockFix_UnionFaces;
+class BlockFix_UnionEdges;
+class BlockFix_BlockFixAPI;
+class BlockFix_PeriodicSurfaceModifier;
+class BlockFix_CheckTool;
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+class BlockFix {
+
+public:
+ Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol);
+ Standard_EXPORT static TopoDS_Shape RefillProblemFaces(const TopoDS_Shape& S);
+ Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol);
+
+private:
+
+friend class BlockFix_SphereSpaceModifier;
+friend class BlockFix_UnionFaces;
+friend class BlockFix_UnionEdges;
+friend class BlockFix_BlockFixAPI;
+friend class BlockFix_PeriodicSurfaceModifier;
+friend class BlockFix_CheckTool;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix_BlockFixAPI.cxx
+// Created: Tue Dec 7 11:59:05 2004
+// Author: Pavel DURANDIN
+
+#include <BlockFix_BlockFixAPI.hxx>
+
+#include <BlockFix.hxx>
+#include <BlockFix_UnionFaces.hxx>
+#include <BlockFix_UnionEdges.hxx>
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <ShapeUpgrade_RemoveLocations.hxx>
+
+#include <Precision.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(BlockFix_BlockFixAPI, MMgt_TShared);
+IMPLEMENT_STANDARD_RTTIEXT(BlockFix_BlockFixAPI, MMgt_TShared);
+
+//=======================================================================
+//function : BlockFix_BlockFixAPI
+//purpose :
+//=======================================================================
+BlockFix_BlockFixAPI::BlockFix_BlockFixAPI()
+{
+ myTolerance = Precision::Confusion();
+ myOptimumNbFaces = 6;
+}
+
+//=======================================================================
+//function : ~BlockFix_BlockFixAPI
+//purpose :
+//=======================================================================
+BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void BlockFix_BlockFixAPI::Perform()
+{
+ // processing spheres with degenerativities
+ TopoDS_Shape aShape = Shape();
+ myShape = BlockFix::RotateSphereSpace(aShape,myTolerance);
+
+ // try to approximate non-canonic surfaces
+ // with singularities on boundaries by filling
+ myShape = BlockFix::RefillProblemFaces(myShape);
+
+ // faces unification
+ BlockFix_UnionFaces aFaceUnifier;
+ aFaceUnifier.GetTolerance() = myTolerance;
+ aFaceUnifier.GetOptimumNbFaces() = myOptimumNbFaces;
+ TopoDS_Shape aResult = aFaceUnifier.Perform(myShape);
+
+ // avoid problem with degenerated edges appearance
+ // due to shape quality regress
+ ShapeUpgrade_RemoveLocations RemLoc;
+ RemLoc.Remove(aResult);
+ aResult = RemLoc.GetResult();
+
+ // edges unification
+ BlockFix_UnionEdges anEdgeUnifier;
+ myShape = anEdgeUnifier.Perform(aResult,myTolerance);
+
+ TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance);
+ myShape = aRes;
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_BlockFixAPI_HeaderFile
+#define _BlockFix_BlockFixAPI_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <Handle_ShapeBuild_ReShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Standard_Real.hxx>
+#include <MMgt_TShared.hxx>
+
+DEFINE_STANDARD_HANDLE(BlockFix_BlockFixAPI, MMgt_TShared);
+
+class BlockFix_BlockFixAPI : public MMgt_TShared
+{
+public:
+ Standard_EXPORT BlockFix_BlockFixAPI();
+ Standard_EXPORT ~BlockFix_BlockFixAPI();
+
+ void SetShape(const TopoDS_Shape& Shape);
+ TopoDS_Shape Shape() const;
+ Handle_ShapeBuild_ReShape& Context();
+ Standard_Real& Tolerance();
+ Standard_Integer& OptimumNbFaces();
+ Standard_EXPORT void Perform();
+
+ DEFINE_STANDARD_RTTI(BlockFix_BlockFixAPI);
+
+private:
+ Handle_ShapeBuild_ReShape myContext;
+ TopoDS_Shape myShape;
+ Standard_Real myTolerance;
+ Standard_Integer myOptimumNbFaces;
+};
+
+//=======================================================================
+//function : SetShape
+//purpose :
+//=======================================================================
+inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape)
+{
+ myShape = Shape;
+}
+
+//=======================================================================
+//function : Shape
+//purpose :
+//=======================================================================
+inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const
+{
+ return myShape;
+}
+
+//=======================================================================
+//function : Context
+//purpose :
+//=======================================================================
+inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context()
+{
+ return myContext;
+}
+
+//=======================================================================
+//function : Tolerance
+//purpose :
+//=======================================================================
+inline Standard_Real& BlockFix_BlockFixAPI::Tolerance()
+{
+ return myTolerance;
+}
+
+//=======================================================================
+//function : OptimumNbFaces
+//purpose :
+//=======================================================================
+inline Standard_Integer& BlockFix_BlockFixAPI::OptimumNbFaces()
+{
+ return myOptimumNbFaces;
+}
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix_CheckTool.cxx
+// Created: 17.12.04 11:15:25
+// Author: Sergey KUUL
+
+#include <BlockFix_CheckTool.hxx>
+
+#include <BRep_Tool.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+//=======================================================================
+//function : BlockFix_CheckTool()
+//purpose : Constructor
+//=======================================================================
+BlockFix_CheckTool::BlockFix_CheckTool( )
+{
+ myHasCheck = Standard_False;
+ myPossibleBlocks.Clear();
+}
+
+//=======================================================================
+//function : SetShape
+//purpose :
+//=======================================================================
+void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape)
+{
+ myHasCheck = Standard_False;
+ myShape = aShape;
+ myPossibleBlocks.Clear();
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+void BlockFix_CheckTool::Perform()
+{
+ myNbSolids=0;
+ myNbBlocks=0;
+ myNbDegen=0;
+ myNbUF=0;
+ myNbUE=0;
+ myNbUFUE=0;
+
+ TopExp_Explorer exps (myShape, TopAbs_SOLID);
+ TopTools_MapOfShape mapS;
+ for (; exps.More(); exps.Next()) {
+ TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
+ if (!mapS.Add(aSolid)) continue;
+ myNbSolids++;
+ Standard_Boolean IsBlock=Standard_True;
+ Standard_Boolean MayBeUF=Standard_False;
+ Standard_Boolean MayBeUE=Standard_False;
+ Standard_Integer nf=0;
+ TopExp_Explorer expf (aSolid, TopAbs_FACE);
+ TopTools_MapOfShape mapF;
+ for (; expf.More(); expf.Next()) {
+ if (mapF.Add(expf.Current()))
+ nf++;
+ }
+
+ if (nf < 6) {
+ IsBlock = Standard_False;
+ }
+ else if (nf > 6) {
+ IsBlock = Standard_False;
+ // check faces unification
+ TopTools_SequenceOfShape faces;
+ mapF.Clear();
+ for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
+ if (mapF.Add(expf.Current())) {
+ TopoDS_Face aFace = TopoDS::Face(expf.Current());
+ faces.Append(aFace);
+ }
+ }
+ Standard_Boolean HasFacesForUnification = Standard_False;
+ for (Standard_Integer i=1; i<faces.Length() && !HasFacesForUnification; i++) {
+ TopoDS_Face F1 = TopoDS::Face(faces.Value(i));
+ TopTools_MapOfShape Edges;
+ for (TopExp_Explorer expe(F1,TopAbs_EDGE); expe.More(); expe.Next())
+ Edges.Add(expe.Current().Oriented(TopAbs_FORWARD));
+ TopLoc_Location L1;
+ Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1,L1);
+ for(Standard_Integer j=i+1; j<=faces.Length() && !HasFacesForUnification; j++) {
+ TopoDS_Face F2 = TopoDS::Face(faces.Value(j));
+ TopLoc_Location L2;
+ Handle(Geom_Surface) S2 = BRep_Tool::Surface(F2,L2);
+ if( S1==S2 && L1==L2 ) {
+ // faces have equal based surface
+ // now check common edge
+ for(TopExp_Explorer expe2(F2,TopAbs_EDGE); expe2.More(); expe2.Next()) {
+ if(Edges.Contains(expe2.Current().Oriented(TopAbs_FORWARD))) {
+ HasFacesForUnification = Standard_True;
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (HasFacesForUnification) {
+ MayBeUF=Standard_True;
+ }
+ }
+
+ Standard_Integer nbe=0;
+ TopTools_MapOfShape DegenEdges;
+ TopExp_Explorer expe (aSolid, TopAbs_EDGE);
+ TopTools_MapOfShape mapE;
+ for (; expe.More(); expe.Next()) {
+ TopoDS_Edge E = TopoDS::Edge(expe.Current());
+ if (!mapE.Add(E)) continue;
+ if (BRep_Tool::Degenerated(E)) {
+ DegenEdges.Add(E);
+ }
+ else {
+ nbe++;
+ }
+ }
+ if (nbe == 12 && DegenEdges.Extent() > 0) {
+ IsBlock = Standard_False;
+ myNbDegen++;
+ myPossibleBlocks.Append(aSolid);
+ continue;
+ }
+ if (nbe < 12)
+ IsBlock = Standard_False;
+ if (nbe > 12) {
+ IsBlock = Standard_False;
+ // check edges unification
+ // creating map of edge faces
+ TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
+ TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
+
+ mapF.Clear();
+ for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
+ TopoDS_Face aFace = TopoDS::Face(expf.Current());
+ if (!mapF.Add(aFace)) continue;
+ TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
+
+ TopTools_MapOfShape mapEe;
+ for (expe.Init(aFace, TopAbs_EDGE); expe.More(); expe.Next()) {
+ TopoDS_Edge edge = TopoDS::Edge(expe.Current());
+ if (!mapEe.Add(edge)) continue;
+ if (!aMapEdgeFaces.Contains(edge)) continue;
+ const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
+ TopTools_ListIteratorOfListOfShape anIter (aList);
+ for (; anIter.More(); anIter.Next()) {
+ TopoDS_Face face = TopoDS::Face(anIter.Value());
+ if (face.IsSame(aFace)) continue;
+ if (aMapFacesEdges.Contains(face)) {
+ aMapFacesEdges.ChangeFromKey(face).Append(edge);
+ }
+ else {
+ TopTools_ListOfShape ListEdges;
+ ListEdges.Append(edge);
+ aMapFacesEdges.Add(face,ListEdges);
+ }
+ }
+ }
+ Standard_Integer i = 1;
+ for (; i <= aMapFacesEdges.Extent(); i++) {
+ const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
+ if (ListEdges.Extent() > 1) break;
+ }
+ if (i <= aMapFacesEdges.Extent()) {
+ MayBeUE = Standard_True;
+ break;
+ }
+ }
+ }
+
+ if (IsBlock)
+ myNbBlocks++;
+ else {
+ if (MayBeUF) {
+ myPossibleBlocks.Append(aSolid);
+ if (MayBeUE)
+ myNbUFUE++;
+ else
+ myNbUF++;
+ }
+ else if (MayBeUE) {
+ myNbUE++;
+ myPossibleBlocks.Append(aSolid);
+ }
+ }
+ }
+
+ myHasCheck = Standard_True;
+}
+
+//=======================================================================
+//function : NbPossibleBlocks
+//purpose :
+//=======================================================================
+Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const
+{
+ return myPossibleBlocks.Length();
+}
+
+//=======================================================================
+//function : PossibleBlock
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const
+{
+ TopoDS_Shape res;
+ if( num>0 && num<=myPossibleBlocks.Length() )
+ res = myPossibleBlocks.Value(num);
+ return res;
+}
+
+//=======================================================================
+//function : DumpCheckResult
+//purpose :
+//=======================================================================
+void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
+{
+ if(!myHasCheck)
+ S<<"Check not performed!"<<endl;
+ else {
+ S<<"dump results of check:"<<endl;
+ S<<" total number of solids = "<<myNbSolids<<endl;
+ S<<" including: number of good blocks = "<<myNbBlocks<<endl;
+ S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
+ S<<" including: need remove degenerative = "<<myNbDegen<<endl;
+ S<<" need unionfaces = "<<myNbUF<<endl;
+ S<<" need unionedges = "<<myNbUE<<endl;
+ S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
+ Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
+ S<<" number of impossible blocks = "<<nbtmp<<endl;
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_CheckTool_HeaderFile
+#define _BlockFix_CheckTool_HeaderFile
+
+#include <TopoDS_Shape.hxx>
+#include <Standard_Boolean.hxx>
+#include <Standard_Integer.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+#include <Standard_OStream.hxx>
+
+class TopoDS_Shape;
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+class BlockFix_CheckTool {
+
+public:
+ Standard_EXPORT BlockFix_CheckTool();
+ Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ;
+ Standard_EXPORT void Perform() ;
+ Standard_EXPORT Standard_Integer NbPossibleBlocks() const;
+ Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const;
+ Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const;
+
+private:
+ TopoDS_Shape myShape;
+ Standard_Boolean myHasCheck;
+ Standard_Integer myNbSolids;
+ Standard_Integer myNbBlocks;
+ TopTools_SequenceOfShape myPossibleBlocks;
+ Standard_Integer myNbDegen;
+ Standard_Integer myNbUF;
+ Standard_Integer myNbUE;
+ Standard_Integer myNbUFUE;
+ Standard_Integer myBadRanges;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix_PeriodicSurfaceModifier.cxx
+// Created: 15.12.04 10:08:50
+// Author: Sergey KUUL
+
+#include <BlockFix_PeriodicSurfaceModifier.hxx>
+
+#include <ShapeFix_Edge.hxx>
+
+#include <TopExp.hxx>
+
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+
+#include <BRepTools.hxx>
+
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
+
+#include <Geom2d_Curve.hxx>
+
+#include <gp_Pnt.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification);
+IMPLEMENT_STANDARD_RTTIEXT(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification);
+
+//=======================================================================
+//function : BlockFix_PeriodicSurfaceModifier()
+//purpose : Constructor
+//=======================================================================
+BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier()
+{
+ myMapOfFaces.Clear();
+ myMapOfSurfaces.Clear();
+}
+
+//=======================================================================
+//function : ~BlockFix_PeriodicSurfaceModifier()
+//purpose : Destructor
+//=======================================================================
+BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier()
+{
+}
+
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol)
+{
+ myTolerance = Tol;
+}
+
+//=======================================================================
+//function : ModifySurface
+//purpose : auxilary
+//=======================================================================
+static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
+ const Handle(Geom_Surface)& aSurface,
+ Handle(Geom_Surface)& aNewSurface)
+{
+ Handle(Geom_Surface) S = aSurface;
+
+ if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
+ Handle(Geom_CylindricalSurface) aCyl =
+ Handle(Geom_CylindricalSurface)::DownCast(S);
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
+ if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) {
+ gp_Ax3 ax3 = aCyl->Position();
+ gp_Ax1 NDir = ax3.Axis();
+ gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
+ Handle(Geom_CylindricalSurface) aNewCyl =
+ new Geom_CylindricalSurface(newax3,aCyl->Radius());
+ aNewSurface = aNewCyl;
+ return Standard_True;
+ }
+ }
+
+ if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
+ Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
+ if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) {
+ gp_Ax3 ax3 = aSphere->Position();
+ gp_Ax1 NDir = ax3.Axis();
+ gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
+ Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(newax3,aSphere->Radius());
+ aNewSurface = aNewSphere;
+ return Standard_True;
+ }
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewSurface
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace)
+{
+ TopLoc_Location LS;
+ Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
+
+ if(ModifySurface(F, SIni, S)) {
+
+ RevWires = Standard_False;
+ RevFace = Standard_False;
+
+ L = LS;
+ Tol = BRep_Tool::Tolerance(F);
+
+ Standard_Integer anIndex = myMapOfSurfaces.Add(S);
+ myMapOfFaces.Bind(F,anIndex);
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/,
+ Handle(Geom_Curve)& /*C*/,
+ TopLoc_Location& /*L*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewPoint
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
+ gp_Pnt& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve2d
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E,
+ const TopoDS_Face& F,
+ const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF*/,
+ Handle(Geom2d_Curve)& C,
+ Standard_Real& Tol)
+{
+ //check if undelying surface of the face was modified
+ if(myMapOfFaces.IsBound(F)) {
+ Standard_Integer anIndex = myMapOfFaces.Find(F);
+
+ Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex));
+
+ Standard_Real f,l;
+ TopLoc_Location LC, LS;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
+
+ //taking into accound the orientation of the seam
+ C = BRep_Tool::CurveOnSurface(E,F,f,l);
+ Tol = BRep_Tool::Tolerance(E);
+
+ BRep_Builder B;
+ TopoDS_Edge TempE;
+ B.MakeEdge(TempE);
+ B.Add(TempE, TopExp::FirstVertex(E));
+ B.Add(TempE, TopExp::LastVertex(E));
+
+ if(!C3d.IsNull())
+ B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
+ B.Range(TempE, f, l);
+
+ Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
+ Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation()));
+ TopLoc_Location LTemp;
+ LTemp.Identity();
+
+ Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
+ Standard_Real aWorkTol = 2*myTolerance+Tol;
+ sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
+ sfe->FixSameParameter(TempE);
+
+ //keep the orientation of original edge
+ TempE.Orientation(E.Orientation());
+ C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
+
+ //surface was modified
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewParameter
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,
+ const TopoDS_Edge& /*E*/,
+ Standard_Real& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E,
+ const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF1*/,
+ const TopoDS_Face& /*NewF2*/)
+{
+ return BRep_Tool::Continuity(E,F1,F2);
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_PeriodicSurfaceModifier_HeaderFile
+#define _BlockFix_PeriodicSurfaceModifier_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <BlockFix_PeriodicSurfaceModifier.hxx>
+
+#include <Standard_Real.hxx>
+#include <TopTools_DataMapOfShapeInteger.hxx>
+#include <TColStd_IndexedMapOfTransient.hxx>
+#include <BRepTools_Modification.hxx>
+#include <Standard_Boolean.hxx>
+#include <Handle_Geom_Surface.hxx>
+#include <Handle_Geom_Curve.hxx>
+#include <Handle_Geom2d_Curve.hxx>
+#include <GeomAbs_Shape.hxx>
+
+class TopoDS_Face;
+class Geom_Surface;
+class TopLoc_Location;
+class TopoDS_Edge;
+class Geom_Curve;
+class TopoDS_Vertex;
+class gp_Pnt;
+class Geom2d_Curve;
+
+DEFINE_STANDARD_HANDLE(BlockFix_PeriodicSurfaceModifier, BRepTools_Modification);
+
+class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification {
+
+public:
+ Standard_EXPORT BlockFix_PeriodicSurfaceModifier();
+ Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier();
+
+ Standard_EXPORT void SetTolerance (const Standard_Real Toler) ;
+ Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,
+ Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace);
+ Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E,
+ Handle(Geom_Curve)& C,
+ TopLoc_Location& L,
+ Standard_Real& Tol) ;
+ Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol);
+ Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E,
+ const TopoDS_Face& F,
+ const TopoDS_Edge& NewE,
+ const TopoDS_Face& NewF,
+ Handle(Geom2d_Curve)& C,
+ Standard_Real& Tol);
+ Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V,
+ const TopoDS_Edge& E,
+ Standard_Real& P,
+ Standard_Real& Tol);
+ Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E,
+ const TopoDS_Face& F1,
+ const TopoDS_Face& F2,
+ const TopoDS_Edge& NewE,
+ const TopoDS_Face& NewF1,
+ const TopoDS_Face& NewF2);
+
+ DEFINE_STANDARD_RTTI(BlockFix_PeriodicSurfaceModifier);
+
+private:
+ Standard_Real myTolerance;
+ TopTools_DataMapOfShapeInteger myMapOfFaces;
+ TColStd_IndexedMapOfTransient myMapOfSurfaces;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix.cxx
+// Created: Tue Dec 7 11:59:05 2004
+// Author: Pavel DURANDIN
+
+#include <BlockFix_SphereSpaceModifier.hxx>
+
+#include <ShapeAnalysis.hxx>
+
+#include <ShapeFix_Edge.hxx>
+
+#include <TopExp.hxx>
+
+#include <TopLoc_Location.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+
+#include <BRepGProp.hxx>
+#include <GProp_GProps.hxx>
+
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+
+#include <Geom_Curve.hxx>
+#include <Geom_Surface.hxx>
+
+#include <Geom2d_Curve.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Sphere.hxx>
+
+IMPLEMENT_STANDARD_HANDLE(BlockFix_SphereSpaceModifier, BRepTools_Modification);
+IMPLEMENT_STANDARD_RTTIEXT(BlockFix_SphereSpaceModifier, BRepTools_Modification);
+
+//=======================================================================
+//function : BlockFix_SphereSpaceModifier
+//purpose :
+//=======================================================================
+BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier()
+{
+ myMapOfFaces.Clear();
+ myMapOfSpheres.Clear();
+}
+
+//=======================================================================
+//function : ~BlockFix_SphereSpaceModifier
+//purpose :
+//=======================================================================
+BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {}
+
+//=======================================================================
+//function : SetTolerance
+//purpose :
+//=======================================================================
+void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol)
+{
+ myTolerance = Tol;
+}
+
+//=======================================================================
+//function : NewSurface
+//purpose :
+//=======================================================================
+static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
+ const Handle(Geom_Surface)& aSurface,
+ Handle(Geom_Surface)& aNewSurface)
+{
+ Handle(Geom_Surface) S = aSurface;
+ if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+ Handle(Geom_RectangularTrimmedSurface) RTS =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
+ S = RTS->BasisSurface();
+ }
+
+ if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
+ Standard_Real Umin, Umax, Vmin, Vmax;
+ ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
+ Standard_Real PI2 = M_PI/2.;
+ if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
+ Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
+ gp_Sphere sp = aSphere->Sphere();
+ //modified by jgv, 12.11.2012 for issue 21777//
+ Standard_Real Radius = sp.Radius();
+ Standard_Real HalfArea = 2.*M_PI*Radius*Radius;
+ GProp_GProps Properties;
+ BRepGProp::SurfaceProperties(aFace, Properties);
+ Standard_Real anArea = Properties.Mass();
+ Standard_Real AreaTol = Radius*Radius*1.e-6;
+ if (anArea > HalfArea - AreaTol) //no chance to avoid singularity
+ return Standard_False;
+ ///////////////////////////////////////////////
+ gp_Ax3 ax3 = sp.Position();
+ if(Abs(Vmax-Vmin) < PI2) {
+ gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
+ sp.SetPosition(axnew3);
+ Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
+ aNewSurface = aNewSphere;
+ return Standard_True;
+ }
+ else {
+ gp_Pnt PC = ax3.Location();
+ Standard_Real Vpar;
+ if(fabs(PI2-Vmax)>fabs(-PI2-Vmin))
+ Vpar = (PI2+Vmax)/2.;
+ else
+ Vpar = (-PI2+Vmin)/2.;
+ Standard_Real Upar = (Umin+Umax)/2.;;
+ gp_Pnt PN,PX;
+ S->D0(Upar,Vpar,PN);
+ S->D0(Upar+PI2,0.,PX);
+ gp_Dir newNorm(gp_Vec(PC,PN));
+ gp_Dir newDirX(gp_Vec(PC,PX));
+ gp_Ax3 axnew3(ax3.Axis().Location(), newNorm, newDirX);
+ sp.SetPosition(axnew3);
+ Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
+ aNewSurface = aNewSphere;
+ return Standard_True;
+ }
+ }
+ }
+ return Standard_False;
+}
+
+Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F,
+ Handle(Geom_Surface)& S,
+ TopLoc_Location& L,Standard_Real& Tol,
+ Standard_Boolean& RevWires,
+ Standard_Boolean& RevFace)
+{
+ TopLoc_Location LS;
+ Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
+
+ //check if pole of the sphere in the parametric space
+ if(ModifySurface(F, SIni, S)) {
+
+ RevWires = Standard_False;
+ RevFace = Standard_False;
+
+ L = LS;
+ Tol = BRep_Tool::Tolerance(F);
+
+ Standard_Integer anIndex = myMapOfSpheres.Add(S);
+ myMapOfFaces.Bind(F,anIndex);
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/,
+ TopLoc_Location& /*L*/,Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewPoint
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
+ gp_Pnt& /*P*/,
+ Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewCurve2d
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,
+ const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/,
+ Handle(Geom2d_Curve)& C,Standard_Real& Tol)
+{
+ //check if undelying surface of the face was modified
+ if(myMapOfFaces.IsBound(F)) {
+ Standard_Integer anIndex = myMapOfFaces.Find(F);
+
+ Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex));
+
+ Standard_Real f,l;
+ TopLoc_Location LC, LS;
+ Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
+ Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
+
+ //taking into accound the orientation of the seam
+ C = BRep_Tool::CurveOnSurface(E,F,f,l);
+ Tol = BRep_Tool::Tolerance(E);
+
+ BRep_Builder B;
+ TopoDS_Edge TempE;
+ B.MakeEdge(TempE);
+ B.Add(TempE, TopExp::FirstVertex(E));
+ B.Add(TempE, TopExp::LastVertex(E));
+
+ if(!C3d.IsNull())
+ B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
+ B.Range(TempE, f, l);
+
+ Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
+ Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation()));
+ TopLoc_Location LTemp;
+ LTemp.Identity();
+
+ Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
+ Standard_Real aWorkTol = 2*myTolerance+Tol;
+ sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
+ sfe->FixSameParameter(TempE);
+
+ //keep the orientation of original edge
+ TempE.Orientation(E.Orientation());
+ C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
+
+ // shifting seam of sphere
+ if(isClosed && !C.IsNull()) {
+ Standard_Real f2,l2;
+ Handle(Geom2d_Curve) c22 =
+ BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2);
+ Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion();
+ if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci)
+ ||(C->Value(l).SquareDistance(c22->Value(l2)) < dPreci)) {
+ gp_Vec2d shift(S->UPeriod(),0.);
+ C->Translate(shift);
+ }
+ }
+ //sphere was modified
+ return Standard_True;
+ }
+
+ return Standard_False;
+}
+
+//=======================================================================
+//function : NewParameter
+//purpose :
+//=======================================================================
+Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/,
+ Standard_Real& /*P*/,Standard_Real& /*Tol*/)
+{
+ return Standard_False;
+}
+
+//=======================================================================
+//function : Continuity
+//purpose :
+//=======================================================================
+GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,
+ const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/,
+ const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/)
+{
+ return BRep_Tool::Continuity(E,F1,F2);
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_SphereSpaceModifier_HeaderFile
+#define _BlockFix_SphereSpaceModifier_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineHandle.hxx>
+
+#include <Standard_Real.hxx>
+#include <TopTools_DataMapOfShapeInteger.hxx>
+#include <TColStd_IndexedMapOfTransient.hxx>
+#include <BRepTools_Modification.hxx>
+#include <Standard_Boolean.hxx>
+#include <Handle_Geom_Surface.hxx>
+#include <Handle_Geom_Curve.hxx>
+#include <Handle_Geom2d_Curve.hxx>
+#include <GeomAbs_Shape.hxx>
+
+class TopoDS_Face;
+class Geom_Surface;
+class TopLoc_Location;
+class TopoDS_Edge;
+class Geom_Curve;
+class TopoDS_Vertex;
+class gp_Pnt;
+class Geom2d_Curve;
+
+DEFINE_STANDARD_HANDLE(BlockFix_SphereSpaceModifier, BRepTools_Modification);
+
+class BlockFix_SphereSpaceModifier : public BRepTools_Modification {
+
+public:
+ Standard_EXPORT BlockFix_SphereSpaceModifier();
+ Standard_EXPORT ~BlockFix_SphereSpaceModifier();
+
+ Standard_EXPORT void SetTolerance (const Standard_Real Toler);
+ Standard_EXPORT Standard_Boolean NewSurface (const TopoDS_Face& F, Handle(Geom_Surface)& S,
+ TopLoc_Location& L, Standard_Real& Tol,
+ Standard_Boolean& RevWires, Standard_Boolean& RevFace);
+ Standard_EXPORT Standard_Boolean NewCurve (const TopoDS_Edge& E, Handle(Geom_Curve)& C,
+ TopLoc_Location& L, Standard_Real& Tol);
+ Standard_EXPORT Standard_Boolean NewPoint (const TopoDS_Vertex& V, gp_Pnt& P, Standard_Real& Tol);
+ Standard_EXPORT Standard_Boolean NewCurve2d (const TopoDS_Edge& E, const TopoDS_Face& F,
+ const TopoDS_Edge& NewE, const TopoDS_Face& NewF,
+ Handle(Geom2d_Curve)& C, Standard_Real& Tol);
+ Standard_EXPORT Standard_Boolean NewParameter (const TopoDS_Vertex& V, const TopoDS_Edge& E,
+ Standard_Real& P, Standard_Real& Tol);
+ Standard_EXPORT GeomAbs_Shape Continuity (const TopoDS_Edge& E,
+ const TopoDS_Face& F1,const TopoDS_Face& F2,
+ const TopoDS_Edge& NewE,
+ const TopoDS_Face& NewF1, const TopoDS_Face& NewF2);
+ Standard_EXPORT Standard_Boolean ForRotation (const TopoDS_Face& F);
+
+ DEFINE_STANDARD_RTTI(BlockFix_SphereSpaceModifier);
+
+private:
+ Standard_Real myTolerance;
+ TopTools_DataMapOfShapeInteger myMapOfFaces;
+ TColStd_IndexedMapOfTransient myMapOfSpheres;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix_UnionEdges.cxx
+// Created: 07.12.04 15:27:30
+// Author: Sergey KUUL
+
+#include <BlockFix_UnionEdges.hxx>
+
+#include <ShapeAnalysis_Edge.hxx>
+
+#include <ShapeBuild_ReShape.hxx>
+
+#include <ShapeFix_Edge.hxx>
+#include <ShapeFix_Face.hxx>
+#include <ShapeFix_Shell.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_CurveRepresentation.hxx>
+#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
+#include <BRep_TEdge.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_HCompCurve.hxx>
+#include <BRepLib.hxx>
+#include <BRepLib_MakeEdge.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_SequenceOfShape.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Approx_Curve3d.hxx>
+
+#include <GC_MakeCircle.hxx>
+
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomConvert.hxx>
+#include <GeomConvert_CompCurveToBSplineCurve.hxx>
+
+#include <Geom2dConvert.hxx>
+#include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+
+#include <TColGeom_SequenceOfSurface.hxx>
+#include <TColGeom_Array1OfBSplineCurve.hxx>
+#include <TColGeom_HArray1OfBSplineCurve.hxx>
+#include <TColGeom2d_Array1OfBSplineCurve.hxx>
+#include <TColGeom2d_HArray1OfBSplineCurve.hxx>
+#include <TColGeom2d_SequenceOfBoundedCurve.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include "utilities.h"
+
+//=======================================================================
+//function : BlockFix_UnionEdges()
+//purpose : Constructor
+//=======================================================================
+BlockFix_UnionEdges::BlockFix_UnionEdges ( )
+{
+}
+
+//=======================================================================
+//function : GlueEdgesWithPCurves
+//purpose : Glues the pcurves of the sequence of edges
+// and glues their 3d curves
+//=======================================================================
+static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
+ const TopoDS_Vertex& FirstVertex,
+ const TopoDS_Vertex& LastVertex)
+{
+ Standard_Integer i, j;
+
+ TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1));
+ //TColGeom2d_SequenceOfCurve PCurveSeq;
+ TColGeom_SequenceOfSurface SurfSeq;
+ //TopTools_SequenceOfShape LocSeq;
+
+ BRep_ListIteratorOfListOfCurveRepresentation itr( (Handle(BRep_TEdge)::DownCast(FirstEdge.TShape()))->Curves() );
+ for (; itr.More(); itr.Next())
+ {
+ Handle(BRep_CurveRepresentation) CurveRep = itr.Value();
+ if (CurveRep->IsCurveOnSurface())
+ {
+ //PCurveSeq.Append(CurveRep->PCurve());
+ SurfSeq.Append(CurveRep->Surface());
+ /*
+ TopoDS_Shape aLocShape;
+ aLocShape.Location(CurveRep->Location());
+ LocSeq.Append(aLocShape);
+ */
+ }
+ }
+
+ Standard_Real fpar, lpar;
+ BRep_Tool::Range(FirstEdge, fpar, lpar);
+ TopoDS_Edge PrevEdge = FirstEdge;
+ TopoDS_Vertex CV;
+ Standard_Real MaxTol = 0.;
+
+ TopoDS_Edge ResEdge;
+ BRep_Builder BB;
+
+ Standard_Integer nb_curve = aChain.Length(); //number of curves
+ TColGeom_Array1OfBSplineCurve tab_c3d(0,nb_curve-1); //array of the curves
+ TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances
+
+ TopoDS_Vertex PrevVertex = FirstVertex;
+ for (i = 1; i <= nb_curve; i++)
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
+ TopoDS_Vertex VF, VL;
+ TopExp::Vertices(anEdge, VF, VL);
+ Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
+
+ Standard_Real Tol1 = BRep_Tool::Tolerance(VF);
+ Standard_Real Tol2 = BRep_Tool::Tolerance(VL);
+ if (Tol1 > MaxTol)
+ MaxTol = Tol1;
+ if (Tol2 > MaxTol)
+ MaxTol = Tol2;
+
+ if (i > 1)
+ {
+ TopExp::CommonVertex(PrevEdge, anEdge, CV);
+ Standard_Real Tol = BRep_Tool::Tolerance(CV);
+ tabtolvertex(i-2) = Tol;
+ }
+
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
+ Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, fpar, lpar);
+ tab_c3d(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
+ GeomConvert::C0BSplineToC1BSplineCurve(tab_c3d(i-1), Precision::Confusion());
+ if (ToReverse)
+ tab_c3d(i-1)->Reverse();
+ PrevVertex = (ToReverse)? VF : VL;
+ PrevEdge = anEdge;
+ }
+ Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
+ Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
+ GeomConvert::ConcatC1(tab_c3d,
+ tabtolvertex,
+ ArrayOfIndices,
+ concatcurve,
+ Standard_False,
+ Precision::Confusion()); //C1 concatenation
+
+ if (concatcurve->Length() > 1)
+ {
+ GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
+
+ for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
+ Concat.Add( concatcurve->Value(i), MaxTol, Standard_True );
+
+ concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
+ }
+ Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower());
+
+ TColGeom2d_SequenceOfBoundedCurve ResPCurves;
+ TopLoc_Location aLoc;
+ for (j = 1; j <= SurfSeq.Length(); j++)
+ {
+ TColGeom2d_Array1OfBSplineCurve tab_c2d(0,nb_curve-1); //array of the pcurves
+
+ PrevVertex = FirstVertex;
+ PrevEdge = FirstEdge;
+ //TopLoc_Location theLoc = LocSeq(j).Location();
+ for (i = 1; i <= nb_curve; i++)
+ {
+ TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
+ TopoDS_Vertex VF, VL;
+ TopExp::Vertices(anEdge, VF, VL);
+ Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
+
+ /*
+ Handle(Geom2d_Curve) aPCurve =
+ BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), anEdge.Location()*theLoc, fpar, lpar);
+ */
+ Handle(Geom2d_Curve) aPCurve =
+ BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), aLoc, fpar, lpar);
+ Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurve, fpar, lpar);
+ tab_c2d(i-1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
+ Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i-1), Precision::Confusion());
+ if (ToReverse)
+ tab_c2d(i-1)->Reverse();
+ PrevVertex = (ToReverse)? VF : VL;
+ PrevEdge = anEdge;
+ }
+ Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
+ Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
+ Geom2dConvert::ConcatC1(tab_c2d,
+ tabtolvertex,
+ ArrayOfInd2d,
+ concatc2d,
+ Standard_False,
+ Precision::Confusion()); //C1 concatenation
+
+ if (concatc2d->Length() > 1)
+ {
+ Geom2dConvert_CompCurveToBSplineCurve Concat2d(concatc2d->Value(concatc2d->Lower()));
+
+ for (i = concatc2d->Lower()+1; i <= concatc2d->Upper(); i++)
+ Concat2d.Add( concatc2d->Value(i), MaxTol, Standard_True );
+
+ concatc2d->SetValue(concatc2d->Lower(), Concat2d.BSplineCurve());
+ }
+ Handle(Geom2d_BSplineCurve) aResPCurve = concatc2d->Value(concatc2d->Lower());
+ ResPCurves.Append(aResPCurve);
+ }
+
+ ResEdge = BRepLib_MakeEdge(ResCurve,
+ FirstVertex, LastVertex,
+ ResCurve->FirstParameter(), ResCurve->LastParameter());
+ BB.SameRange(ResEdge, Standard_False);
+ BB.SameParameter(ResEdge, Standard_False);
+ for (j = 1; j <= ResPCurves.Length(); j++)
+ {
+ BB.UpdateEdge(ResEdge, ResPCurves(j), SurfSeq(j), aLoc, MaxTol);
+ BB.Range(ResEdge, SurfSeq(j), aLoc, ResPCurves(j)->FirstParameter(), ResPCurves(j)->LastParameter());
+ }
+
+ BRepLib::SameParameter(ResEdge, MaxTol, Standard_True);
+
+ return ResEdge;
+}
+
+//=======================================================================
+//function : MergeEdges
+//purpose : auxilary
+//=======================================================================
+static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
+ const TopoDS_Face& aFace,
+ const Standard_Real Tol,
+ TopoDS_Edge& anEdge)
+{
+ // make chain for union
+ BRep_Builder B;
+ ShapeAnalysis_Edge sae;
+ TopoDS_Edge FirstE = TopoDS::Edge(SeqEdges.Value(1));
+ TopoDS_Edge LastE = FirstE;
+ TopoDS_Vertex VF = sae.FirstVertex(FirstE);
+ TopoDS_Vertex VL = sae.LastVertex(LastE);
+ TopTools_SequenceOfShape aChain;
+ aChain.Append(FirstE);
+ TColStd_MapOfInteger IndUsedEdges;
+ IndUsedEdges.Add(1);
+ Standard_Integer j;
+ for(j=2; j<=SeqEdges.Length(); j++) {
+ for(Standard_Integer k=2; k<=SeqEdges.Length(); k++) {
+ if(IndUsedEdges.Contains(k)) continue;
+ TopoDS_Edge edge = TopoDS::Edge(SeqEdges.Value(k));
+ TopoDS_Vertex VF2 = sae.FirstVertex(edge);
+ TopoDS_Vertex VL2 = sae.LastVertex(edge);
+ if(sae.FirstVertex(edge).IsSame(VL)) {
+ aChain.Append(edge);
+ LastE = edge;
+ VL = sae.LastVertex(LastE);
+ IndUsedEdges.Add(k);
+ }
+ else if(sae.LastVertex(edge).IsSame(VF)) {
+ aChain.Prepend(edge);
+ FirstE = edge;
+ VF = sae.FirstVertex(FirstE);
+ IndUsedEdges.Add(k);
+ }
+ }
+ }
+ if(aChain.Length()<SeqEdges.Length()) {
+ MESSAGE ("can not create correct chain...");
+ return Standard_False;
+ }
+ // union edges in chain
+ // first step: union lines and circles
+ TopLoc_Location Loc;
+ Standard_Real fp1,lp1,fp2,lp2;
+ for(j=1; j<aChain.Length(); j++) {
+ TopoDS_Edge edge1 = TopoDS::Edge(aChain.Value(j));
+ Handle(Geom_Curve) c3d1 = BRep_Tool::Curve(edge1,Loc,fp1,lp1);
+ if(c3d1.IsNull()) break;
+ while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
+ Handle(Geom_TrimmedCurve) tc =
+ Handle(Geom_TrimmedCurve)::DownCast(c3d1);
+ c3d1 = tc->BasisCurve();
+ }
+ TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1));
+ Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2);
+ if(c3d2.IsNull()) break;
+ while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
+ Handle(Geom_TrimmedCurve) tc =
+ Handle(Geom_TrimmedCurve)::DownCast(c3d2);
+ c3d2 = tc->BasisCurve();
+ }
+ if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) {
+ // union lines
+ Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1);
+ Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
+ gp_Dir Dir1 = L1->Position().Direction();
+ gp_Dir Dir2 = L2->Position().Direction();
+ //if(!Dir1.IsEqual(Dir2,Precision::Angular())) {
+ //if(!Dir1.IsParallel(Dir2,Precision::Angular())) {
+ if(!Dir1.IsParallel(Dir2,Tol)) {
+ continue;
+ }
+ // can union lines => create new edge
+ TopoDS_Vertex V1 = sae.FirstVertex(edge1);
+ gp_Pnt PV1 = BRep_Tool::Pnt(V1);
+ TopoDS_Vertex V2 = sae.LastVertex(edge2);
+ gp_Pnt PV2 = BRep_Tool::Pnt(V2);
+ gp_Vec Vec(PV1,PV2);
+ Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
+ Standard_Real dist = PV1.Distance(PV2);
+ Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist);
+ TopoDS_Edge E;
+ B.MakeEdge (E,tc,Precision::Confusion());
+ B.Add (E,V1); B.Add (E,V2);
+ B.UpdateVertex(V1, 0., E, 0.);
+ B.UpdateVertex(V2, dist, E, 0.);
+ //ShapeFix_Edge sfe;
+ //sfe.FixAddPCurve(E,aFace,Standard_False);
+ //sfe.FixSameParameter(E);
+ aChain.Remove(j);
+ aChain.SetValue(j,E);
+ j--;
+ }
+ if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) {
+ // union circles
+ Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(c3d1);
+ Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2);
+ gp_Pnt P01 = C1->Location();
+ gp_Pnt P02 = C2->Location();
+ if (P01.Distance(P02) > Precision::Confusion()) continue;
+ // can union circles => create new edge
+ TopoDS_Vertex V1 = sae.FirstVertex(edge1);
+ gp_Pnt PV1 = BRep_Tool::Pnt(V1);
+ TopoDS_Vertex V2 = sae.LastVertex(edge2);
+ gp_Pnt PV2 = BRep_Tool::Pnt(V2);
+ TopoDS_Vertex VM = sae.LastVertex(edge1);
+ gp_Pnt PVM = BRep_Tool::Pnt(VM);
+ GC_MakeCircle MC (PV1,PVM,PV2);
+ Handle(Geom_Circle) C = MC.Value();
+ TopoDS_Edge E;
+ if (!MC.IsDone() || C.IsNull()) {
+ // jfa for Mantis issue 0020228
+ if (PV1.Distance(PV2) > Precision::Confusion()) continue;
+ // closed chain
+ C = C1;
+ B.MakeEdge (E,C,Precision::Confusion());
+ B.Add(E,V1);
+ B.Add(E,V2);
+ }
+ else {
+ gp_Pnt P0 = C->Location();
+ gp_Dir D1(gp_Vec(P0,PV1));
+ gp_Dir D2(gp_Vec(P0,PV2));
+ Standard_Real fpar = C->XAxis().Direction().Angle(D1);
+ if(fabs(fpar)>Precision::Confusion()) {
+ // check orientation
+ gp_Dir ND = C->XAxis().Direction().Crossed(D1);
+ if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
+ fpar = -fpar;
+ }
+ }
+ Standard_Real lpar = C->XAxis().Direction().Angle(D2);
+ if(fabs(lpar)>Precision::Confusion()) {
+ // check orientation
+ gp_Dir ND = C->XAxis().Direction().Crossed(D2);
+ if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
+ lpar = -lpar;
+ }
+ }
+ if (lpar < fpar) lpar += 2*M_PI;
+ Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
+ B.MakeEdge (E,tc,Precision::Confusion());
+ B.Add(E,V1);
+ B.Add(E,V2);
+ B.UpdateVertex(V1, fpar, E, 0.);
+ B.UpdateVertex(V2, lpar, E, 0.);
+ }
+ aChain.Remove(j);
+ aChain.SetValue(j,E);
+ j--;
+ }
+ }
+ if (j < aChain.Length()) {
+ MESSAGE ("null curve3d in edge...");
+ return Standard_False;
+ }
+ if (aChain.Length() > 1) {
+ // second step: union edges with various curves
+ // skl for bug 0020052 from Mantis: perform such unions
+ // only if curves are bspline or bezier
+ bool NeedUnion = true;
+ for(j=1; j<=aChain.Length(); j++) {
+ TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
+ Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge,Loc,fp1,lp1);
+ if(c3d.IsNull()) continue;
+ while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
+ Handle(Geom_TrimmedCurve) tc =
+ Handle(Geom_TrimmedCurve)::DownCast(c3d);
+ c3d = tc->BasisCurve();
+ }
+ if( ( c3d->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) ||
+ c3d->IsKind(STANDARD_TYPE(Geom_BezierCurve)) ) ) continue;
+ NeedUnion = false;
+ break;
+ }
+ if(NeedUnion) {
+ MESSAGE ("can not make analitical union => make approximation");
+ TopoDS_Edge E = GlueEdgesWithPCurves(aChain, VF, VL);
+ /*
+ TopoDS_Wire W;
+ B.MakeWire(W);
+ for(j=1; j<=aChain.Length(); j++) {
+ TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
+ B.Add(W,edge);
+ }
+ Handle(BRepAdaptor_HCompCurve) Adapt = new BRepAdaptor_HCompCurve(W);
+ Approx_Curve3d Conv(Adapt,Tol,GeomAbs_C1,9,1000);
+ Handle(Geom_BSplineCurve) bc = Conv.Curve();
+ TopoDS_Edge E;
+ B.MakeEdge (E,bc,Precision::Confusion());
+ B.Add (E,VF);
+ B.Add (E,VL);
+ */
+ aChain.SetValue(1,E);
+ }
+ else {
+ MESSAGE ("can not make approximation for such types of curves");
+ return Standard_False;
+ }
+ }
+
+ anEdge = TopoDS::Edge(aChain.Value(1));
+ return Standard_True;
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
+ const Standard_Real Tol)
+{
+ myContext = new ShapeBuild_ReShape;
+ myTolerance = Tol;
+ TopoDS_Shape aResult = myContext->Apply(Shape);
+
+ // processing each solid
+ TopAbs_ShapeEnum aType = TopAbs_SOLID;
+ TopExp_Explorer exps (Shape, aType);
+ if (!exps.More()) {
+ aType = TopAbs_SHELL;
+ exps.Init(Shape, aType);
+ }
+ for (; exps.More(); exps.Next()) {
+ //TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
+ TopoDS_Shape aSolid = exps.Current();
+
+ TopTools_IndexedMapOfShape ChangedFaces;
+
+ // creating map of edge faces
+ TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
+ TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
+
+ Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
+ TopoDS_Shape aRes = aSolid;
+ aRes = aContext->Apply(aSolid);
+
+ // processing each face
+ TopExp_Explorer exp;
+ for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
+ TopoDS_Face aFace =
+ TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
+ TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
+
+ for (TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
+ TopoDS_Edge edge = TopoDS::Edge(expe.Current());
+ if (!aMapEdgeFaces.Contains(edge)) continue;
+ const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
+ TopTools_ListIteratorOfListOfShape anIter(aList);
+ for ( ; anIter.More(); anIter.Next()) {
+ TopoDS_Face face = TopoDS::Face(anIter.Value());
+ TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value()));
+ if (face1.IsSame(aFace)) continue;
+ if (aMapFacesEdges.Contains(face)) {
+ aMapFacesEdges.ChangeFromKey(face).Append(edge);
+ }
+ else {
+ TopTools_ListOfShape ListEdges;
+ ListEdges.Append(edge);
+ aMapFacesEdges.Add(face,ListEdges);
+ }
+ }
+ }
+
+ for (Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
+ const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
+ TopTools_SequenceOfShape SeqEdges;
+ TopTools_ListIteratorOfListOfShape anIter(ListEdges);
+ for ( ; anIter.More(); anIter.Next()) {
+ SeqEdges.Append(anIter.Value());
+ }
+ if (SeqEdges.Length()==1) continue;
+ TopoDS_Edge E;
+ if ( MergeEdges(SeqEdges,aFace,Tol,E) ) {
+ // now we have only one edge - aChain.Value(1)
+ // we have to replace old ListEdges with this new edge
+ aContext->Replace(SeqEdges(1),E);
+ for (Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
+ aContext->Remove(SeqEdges(j));
+ }
+ TopoDS_Face tmpF = TopoDS::Face(exp.Current());
+ if ( !ChangedFaces.Contains(tmpF) )
+ ChangedFaces.Add(tmpF);
+ tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
+ if ( !ChangedFaces.Contains(tmpF) )
+ ChangedFaces.Add(tmpF);
+ }
+ }
+
+ } // end processing each face
+
+ // fix changed faces and replace them in the local context
+ for (Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
+ TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i)));
+ Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
+ sff->SetContext(myContext);
+ sff->SetPrecision(myTolerance);
+ sff->SetMinTolerance(myTolerance);
+ sff->SetMaxTolerance(Max(1.,myTolerance*1000.));
+ sff->Perform();
+ aContext->Replace(aFace,sff->Face());
+ }
+
+ if (ChangedFaces.Extent() > 0) {
+ // fix changed shell and replace it in the local context
+ TopoDS_Shape aRes1 = aContext->Apply(aRes);
+ TopExp_Explorer expsh;
+ for (expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) {
+ TopoDS_Shell aShell = TopoDS::Shell(expsh.Current());
+ Handle(ShapeFix_Shell) sfsh = new ShapeFix_Shell;
+ sfsh->FixFaceOrientation(aShell);
+ aContext->Replace(aShell,sfsh->Shell());
+ }
+ TopoDS_Shape aRes2 = aContext->Apply(aRes1);
+ // put new solid into global context
+ myContext->Replace(aSolid,aRes2);
+ }
+
+ } // end processing each solid
+
+ aResult = myContext->Apply(Shape);
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_UnionEdges_HeaderFile
+#define _BlockFix_UnionEdges_HeaderFile
+
+#include <Standard_Real.hxx>
+
+#include <ShapeBuild_ReShape.hxx>
+
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+class TopoDS_Shape;
+
+class BlockFix_UnionEdges {
+
+public:
+ Standard_EXPORT BlockFix_UnionEdges();
+
+ Standard_EXPORT TopoDS_Shape Perform (const TopoDS_Shape& Shape,const Standard_Real Tol);
+
+private:
+ Standard_Real myTolerance;
+ Handle_ShapeBuild_ReShape myContext;
+
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2007-2012 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
+
+// File: BlockFix_UnionFaces.cxx
+// Created: Tue Dec 7 17:15:42 2004
+// Author: Pavel DURANDIN
+
+#include <BlockFix_UnionFaces.hxx>
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <ShapeAnalysis_WireOrder.hxx>
+#include <ShapeAnalysis_Edge.hxx>
+
+#include <ShapeBuild_Edge.hxx>
+#include <ShapeBuild_ReShape.hxx>
+
+#include <ShapeExtend_WireData.hxx>
+#include <ShapeExtend_CompositeSurface.hxx>
+
+#include <ShapeFix_Face.hxx>
+#include <ShapeFix_ComposeShell.hxx>
+#include <ShapeFix_SequenceOfWireSegment.hxx>
+#include <ShapeFix_WireSegment.hxx>
+#include <ShapeFix_Wire.hxx>
+#include <ShapeFix_Edge.hxx>
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+#include <IntPatch_ImpImpIntersection.hxx>
+#else
+#include <IntPatch_TheIIIntOfIntersection.hxx>
+#endif
+
+#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepTools.hxx>
+#include <BRepTopAdaptor_TopolTool.hxx>
+
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <TopTools_SequenceOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <TColGeom_HArray2OfSurface.hxx>
+
+#include <GeomAdaptor_HSurface.hxx>
+#include <GeomLib_IsPlanarSurface.hxx>
+
+#include <Geom_Surface.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_OffsetSurface.hxx>
+#include <Geom_SphericalSurface.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_SurfaceOfRevolution.hxx>
+#include <Geom_SurfaceOfLinearExtrusion.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+
+#include <Geom_Curve.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Circle.hxx>
+
+#include <Geom2d_Line.hxx>
+
+#include <gp_XY.hxx>
+#include <gp_Pnt2d.hxx>
+
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+//=======================================================================
+//function : BlockFix_UnionFaces
+//purpose :
+//=======================================================================
+BlockFix_UnionFaces::BlockFix_UnionFaces()
+ : myTolerance(Precision::Confusion()),
+ myOptimumNbFaces(6)
+{
+}
+
+//=======================================================================
+//function : GetTolerance
+//purpose :
+//=======================================================================
+Standard_Real& BlockFix_UnionFaces::GetTolerance()
+{
+ return myTolerance;
+}
+
+//=======================================================================
+//function : GetOptimumNbFaces
+//purpose :
+//=======================================================================
+Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces()
+{
+ return myOptimumNbFaces;
+}
+
+//=======================================================================
+//function : AddOrdinaryEdges
+//purpose : auxilary
+// adds edges from the shape to the sequence
+// seams and equal edges are dropped
+// Returns true if one of original edges dropped
+//=======================================================================
+static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
+ const TopoDS_Shape aShape,
+ Standard_Integer& anIndex)
+{
+ //map of edges
+ TopTools_MapOfShape aNewEdges;
+ //add edges without seams
+ for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
+ TopoDS_Shape edge = exp.Current();
+ if(aNewEdges.Contains(edge))
+ aNewEdges.Remove(edge);
+ else
+ aNewEdges.Add(edge);
+ }
+
+ Standard_Boolean isDropped = Standard_False;
+ //merge edges and drop seams
+ for(Standard_Integer i = 1; i <= edges.Length(); i++) {
+ TopoDS_Shape current = edges(i);
+ if(aNewEdges.Contains(current)) {
+
+ aNewEdges.Remove(current);
+ edges.Remove(i);
+ i--;
+
+ if(!isDropped) {
+ isDropped = Standard_True;
+ anIndex = i;
+ }
+ }
+ }
+
+ //add edges to the sequemce
+ for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
+ edges.Append(anIter.Key());
+
+ return isDropped;
+}
+
+//=======================================================================
+//function : ClearRts
+//purpose : auxilary
+//=======================================================================
+static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
+{
+ if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
+ Handle(Geom_RectangularTrimmedSurface) rts =
+ Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
+ return rts->BasisSurface();
+ }
+ return aSurface;
+}
+
+//=======================================================================
+//function : Perform
+//purpose :
+//=======================================================================
+TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
+{
+ Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
+ TopoDS_Shape aResShape = myContext->Apply(Shape);
+
+ // processing each solid
+ TopExp_Explorer exps;
+ for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
+ TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
+
+ // creating map of edge faces
+ TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
+ TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
+
+ // map of processed shapes
+ TopTools_MapOfShape aProcessed;
+
+ Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
+
+ Standard_Integer NbModif = 0;
+ Standard_Boolean hasFailed = Standard_False;
+ Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.), 0.1);
+
+ // count faces
+ int nbf = 0;
+ TopExp_Explorer exp;
+ TopTools_MapOfShape mapF;
+ for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
+ if (mapF.Add(exp.Current()))
+ nbf++;
+ }
+
+ bool doUnion = ((myOptimumNbFaces == 0) ||
+ ((myOptimumNbFaces > 0) && (nbf > myOptimumNbFaces)));
+
+ // processing each face
+ mapF.Clear();
+ for (exp.Init(aSolid, TopAbs_FACE); exp.More() && doUnion; exp.Next()) {
+ TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
+
+ if (aProcessed.Contains(aFace))
+ continue;
+
+ Standard_Integer dummy;
+ TopTools_SequenceOfShape edges;
+ AddOrdinaryEdges(edges,aFace,dummy);
+
+ TopTools_SequenceOfShape faces;
+ faces.Append(aFace);
+
+ //surface and location to construct result
+ TopLoc_Location aBaseLocation;
+ Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
+ aBaseSurface = ClearRts(aBaseSurface);
+
+ // find adjacent faces to union
+ Standard_Integer i;
+ for (i = 1; i <= edges.Length(); i++) {
+ TopoDS_Edge edge = TopoDS::Edge(edges(i));
+ if (BRep_Tool::Degenerated(edge))
+ continue;
+
+ const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
+ TopTools_ListIteratorOfListOfShape anIter(aList);
+ for (; anIter.More(); anIter.Next()) {
+ TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
+ if (anCheckedFace.IsSame(aFace))
+ continue;
+
+ if (aProcessed.Contains(anCheckedFace))
+ continue;
+
+ if (IsSameDomain(aFace,anCheckedFace)) {
+
+ if (aList.Extent() != 2) {
+ // non mainfold case is not processed
+ continue;
+ }
+
+ // replacing pcurves
+ TopoDS_Face aMockUpFace;
+ BRep_Builder B;
+ B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
+ MovePCurves(aMockUpFace,anCheckedFace);
+
+ if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
+ // sequence edges is modified
+ i = dummy;
+ }
+
+ faces.Append(anCheckedFace);
+ aProcessed.Add(anCheckedFace);
+ break;
+ }
+ }
+ }
+
+ // all faces collected in the sequence. Perform union of faces
+ if (faces.Length() > 1) {
+ NbModif++;
+ TopoDS_Face aResult;
+ BRep_Builder B;
+ B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
+ Standard_Integer nbWires = 0;
+
+ // connecting wires
+ while (edges.Length()>0) {
+
+ Standard_Boolean isEdge3d = Standard_False;
+ nbWires++;
+ TopTools_MapOfShape aVertices;
+ TopoDS_Wire aWire;
+ B.MakeWire(aWire);
+
+ TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
+ edges.Remove(1);
+
+ isEdge3d |= !BRep_Tool::Degenerated(anEdge);
+ B.Add(aWire,anEdge);
+ TopoDS_Vertex V1,V2;
+ TopExp::Vertices(anEdge,V1,V2);
+ aVertices.Add(V1);
+ aVertices.Add(V2);
+
+ Standard_Boolean isNewFound = Standard_False;
+ do {
+ isNewFound = Standard_False;
+ for(Standard_Integer j = 1; j <= edges.Length(); j++) {
+ anEdge = TopoDS::Edge(edges(j));
+ TopExp::Vertices(anEdge,V1,V2);
+ if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
+ isEdge3d |= !BRep_Tool::Degenerated(anEdge);
+ aVertices.Add(V1);
+ aVertices.Add(V2);
+ B.Add(aWire,anEdge);
+ edges.Remove(j);
+ j--;
+ isNewFound = Standard_True;
+ }
+ }
+ } while (isNewFound);
+
+ // sorting any type of edges
+ aWire = TopoDS::Wire(aContext->Apply(aWire));
+
+ TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
+ Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
+ sfw->FixReorder();
+ Standard_Boolean isDegRemoved = Standard_False;
+ if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
+ // clear degenerated edges if at least one with 3d curve exist
+ if(isEdge3d) {
+ Handle(ShapeExtend_WireData) sewd = sfw->WireData();
+ for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
+ TopoDS_Edge E = sewd->Edge(j);
+ if(BRep_Tool::Degenerated(E)) {
+ sewd->Remove(j);
+ isDegRemoved = Standard_True;
+ j--;
+ }
+ }
+ }
+ sfw->FixShifted();
+ if(isDegRemoved)
+ sfw->FixDegenerated();
+ }
+ TopoDS_Wire aWireFixed = sfw->Wire();
+ aContext->Replace(aWire,aWireFixed);
+ // add resulting wire
+ if(isEdge3d) {
+ B.Add(aResult,aWireFixed);
+ }
+ else {
+ // sorting edges
+ Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
+ Standard_Integer nbEdges = sbwd->NbEdges();
+ // sort degenerated edges and create one edge instead of several ones
+ ShapeAnalysis_WireOrder sawo(Standard_False, 0);
+ ShapeAnalysis_Edge sae;
+ Standard_Integer aLastEdge = nbEdges;
+ for(Standard_Integer j = 1; j <= nbEdges; j++) {
+ Standard_Real f,l;
+ //smh protection on NULL pcurve
+ Handle(Geom2d_Curve) c2d;
+ if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
+ aLastEdge--;
+ continue;
+ }
+ sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
+ }
+ sawo.Perform();
+
+ // constructind one degenerative edge
+ gp_XY aStart, anEnd, tmp;
+ Standard_Integer nbFirst = sawo.Ordered(1);
+ TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
+ ShapeBuild_Edge sbe;
+ TopoDS_Vertex aDummyV;
+ TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
+ sawo.XY(nbFirst,aStart,tmp);
+ sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
+
+ gp_XY aVec = anEnd-aStart;
+ Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
+
+ B.UpdateEdge(E,aLine,tmpF,0.);
+ B.Range(E,tmpF,0.,aVec.Modulus());
+ Handle(Geom_Curve) C3d;
+ B.UpdateEdge(E,C3d,0.);
+ B.Degenerated(E,Standard_True);
+ TopoDS_Wire aW;
+ B.MakeWire(aW);
+ B.Add(aW,E);
+ B.Add(aResult,aW);
+ }
+ }
+
+ // perform substitution of face
+ aContext->Replace(aContext->Apply(aFace),aResult);
+
+ ShapeFix_Face sff (aResult);
+ //Intializing by tolerances
+ sff.SetPrecision(myTolerance);
+ sff.SetMinTolerance(tol);
+ sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
+ //Setting modes
+ sff.FixOrientationMode() = 0;
+ //sff.FixWireMode() = 0;
+ sff.SetContext(aContext);
+ // Applying the fixes
+ sff.Perform();
+ if(sff.Status(ShapeExtend_FAIL))
+ hasFailed = Standard_True;
+
+ // breaking down to several faces
+ TopoDS_Shape theResult = aContext->Apply(aResult);
+ for (TopExp_Explorer aFaceExp (theResult,TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) {
+ TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
+ Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
+ grid->SetValue ( 1, 1, aBaseSurface );
+ Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
+ ShapeFix_ComposeShell CompShell;
+ CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
+ CompShell.SetContext( aContext );
+
+ TopTools_SequenceOfShape parts;
+ ShapeFix_SequenceOfWireSegment wires;
+ for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
+ Handle(ShapeExtend_WireData) sbwd =
+ new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
+ ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
+ wires.Append(seg);
+ }
+
+ CompShell.DispatchWires ( parts,wires );
+ for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
+ ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
+ aFixOrient.SetContext(aContext);
+ aFixOrient.FixOrientation();
+ }
+
+ TopoDS_Shape CompRes;
+ if ( faces.Length() !=1 ) {
+ TopoDS_Shell S;
+ B.MakeShell ( S );
+ for ( i=1; i <= parts.Length(); i++ )
+ B.Add ( S, parts(i) );
+ CompRes = S;
+ }
+ else CompRes = parts(1);
+
+ aContext->Replace(aCurrent,CompRes);
+ }
+
+ // remove the remaining faces
+ for(i = 2; i <= faces.Length(); i++)
+ aContext->Remove(faces(i));
+ }
+ } // end processing each face
+
+ //TopoDS_Shape aResult = Shape;
+ if (NbModif > 0 && !hasFailed) {
+ TopoDS_Shape aResult = aContext->Apply(aSolid);
+
+ ShapeFix_Edge sfe;
+ for (exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
+ TopoDS_Edge E = TopoDS::Edge(exp.Current());
+ sfe.FixVertexTolerance (E);
+ // ptv add fix same parameter
+ sfe.FixSameParameter(E, myTolerance);
+ }
+
+ myContext->Replace(aSolid, aResult);
+ }
+ //else
+ {
+ for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
+ TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
+ Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
+ sfw->SetContext(myContext);
+ sfw->SetPrecision(myTolerance);
+ sfw->SetMinTolerance(myTolerance);
+ sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
+ sfw->SetFace(aFace);
+ for (TopoDS_Iterator iter (aFace,Standard_False); iter.More(); iter.Next()) {
+ TopoDS_Wire wire = TopoDS::Wire(iter.Value());
+ sfw->Load(wire);
+ sfw->FixReorder();
+ sfw->FixShifted();
+ }
+ }
+ }
+ } // end processing each solid
+
+ aResShape = myContext->Apply(Shape);
+ return aResShape;
+}
+
+//=======================================================================
+//function : IsSameDomain
+//purpose :
+//=======================================================================
+bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder)
+{
+ bool isCylinder = false;
+
+ if (theInSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
+ Handle(Geom_CylindricalSurface) aGC = Handle(Geom_CylindricalSurface)::DownCast(theInSurface);
+
+ theOutCylinder = aGC->Cylinder();
+ isCylinder = true;
+ }
+ else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
+ Handle(Geom_SurfaceOfRevolution) aRS =
+ Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
+ Handle(Geom_Curve) aBasis = aRS->BasisCurve();
+ if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
+ Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
+ gp_Dir aDir = aRS->Direction();
+ gp_Dir aBasisDir = aBasisLine->Position().Direction();
+ if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
+ // basis line is parallel to the revolution axis: it is a cylinder
+ gp_Pnt aLoc = aRS->Location();
+ Standard_Real aR = aBasisLine->Lin().Distance(aLoc);
+ gp_Ax3 aCylAx (aLoc, aDir);
+
+ theOutCylinder = gp_Cylinder(aCylAx, aR);
+ isCylinder = true;
+ }
+ }
+ }
+ else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
+ Handle(Geom_SurfaceOfLinearExtrusion) aLES =
+ Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
+ Handle(Geom_Curve) aBasis = aLES->BasisCurve();
+ if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
+ Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
+ gp_Dir aDir = aLES->Direction();
+ gp_Dir aBasisDir = aBasisCircle->Position().Direction();
+ if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
+ // basis circle is normal to the extrusion axis: it is a cylinder
+ gp_Pnt aLoc = aBasisCircle->Location();
+ Standard_Real aR = aBasisCircle->Radius();
+ gp_Ax3 aCylAx (aLoc, aDir);
+
+ theOutCylinder = gp_Cylinder(aCylAx, aR);
+ isCylinder = true;
+ }
+ }
+ }
+ else {
+ }
+
+ return isCylinder;
+}
+
+Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
+ const TopoDS_Face& aCheckedFace) const
+{
+ //checking the same handles
+ TopLoc_Location L1, L2;
+ Handle(Geom_Surface) S1, S2;
+
+ S1 = BRep_Tool::Surface(aFace,L1);
+ S2 = BRep_Tool::Surface(aCheckedFace,L2);
+
+ if (S1 == S2 && L1 == L2)
+ return true;
+
+ // planar and cylindrical cases (IMP 20052)
+ Standard_Real aPrec = Precision::Confusion();
+
+ S1 = BRep_Tool::Surface(aFace);
+ S2 = BRep_Tool::Surface(aCheckedFace);
+
+ S1 = ClearRts(S1);
+ S2 = ClearRts(S2);
+
+ //Handle(Geom_OffsetSurface) aGOFS1, aGOFS2;
+ //aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1);
+ //aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2);
+ //if (!aGOFS1.IsNull()) S1 = aGOFS1->BasisSurface();
+ //if (!aGOFS2.IsNull()) S2 = aGOFS2->BasisSurface();
+
+ // case of two elementary surfaces: use OCCT tool
+ // elementary surfaces: ConicalSurface, CylindricalSurface,
+ // Plane, SphericalSurface and ToroidalSurface
+ if (S1->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
+ S2->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
+ {
+ Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(S1);
+ Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(S2);
+
+ Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
+ Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
+
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ IntPatch_ImpImpIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
+#else
+ IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
+#endif
+ if (!anIIInt.IsDone() || anIIInt.IsEmpty())
+ return false;
+
+ return anIIInt.TangentFaces();
+ }
+ catch (Standard_Failure) {
+ return false;
+ }
+ }
+
+ // case of two planar surfaces:
+ // all kinds of surfaces checked, including b-spline and bezier
+ GeomLib_IsPlanarSurface aPlanarityChecker1 (S1, aPrec);
+ if (aPlanarityChecker1.IsPlanar()) {
+ GeomLib_IsPlanarSurface aPlanarityChecker2 (S2, aPrec);
+ if (aPlanarityChecker2.IsPlanar()) {
+ gp_Pln aPln1 = aPlanarityChecker1.Plan();
+ gp_Pln aPln2 = aPlanarityChecker2.Plan();
+
+ if (aPln1.Position().Direction().IsParallel(aPln2.Position().Direction(), aPrec) &&
+ aPln1.Distance(aPln2) < aPrec) {
+ return true;
+ }
+ }
+ }
+
+ // case of two cylindrical surfaces, at least one of which is a swept surface
+ // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
+ if ((S1->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
+ S1->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
+ (S2->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
+ S2->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
+ {
+ gp_Cylinder aCyl1, aCyl2;
+ if (getCylinder(S1, aCyl1) && getCylinder(S2, aCyl2)) {
+ if (fabs(aCyl1.Radius() - aCyl2.Radius()) < aPrec) {
+ gp_Dir aDir1 = aCyl1.Position().Direction();
+ gp_Dir aDir2 = aCyl2.Position().Direction();
+ if (aDir1.IsParallel(aDir2, aPrec)) {
+ gp_Pnt aLoc1 = aCyl1.Location();
+ gp_Pnt aLoc2 = aCyl2.Location();
+ gp_Vec aVec12 (aLoc1, aLoc2);
+ if (aVec12.SquareMagnitude() < aPrec*aPrec ||
+ aVec12.IsParallel(aDir1, aPrec)) {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+//=======================================================================
+//function : MovePCurves
+//purpose :
+//=======================================================================
+void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
+ const TopoDS_Face& aSource) const
+{
+ BRep_Builder B;
+ for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
+ Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
+ aTarget, Precision::Confusion());
+ sfw->FixReorder();
+ Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
+ sfw->FixEdgeCurves();
+ if(isReoredFailed)
+ continue;
+
+ sfw->FixShifted();
+ sfw->FixDegenerated();
+
+ // remove degenerated edges from not degenerated points
+ ShapeAnalysis_Edge sae;
+ Handle(ShapeExtend_WireData) sewd = sfw->WireData();
+ for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
+ TopoDS_Edge E = sewd->Edge(i);
+ if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
+ sewd->Remove(i);
+ i--;
+ }
+ }
+
+ TopoDS_Wire ResWire = sfw->Wire();
+ B.Add(aTarget,ResWire);
+ }
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _BlockFix_UnionFaces_HeaderFile
+#define _BlockFix_UnionFaces_HeaderFile
+
+#include <Standard_Real.hxx>
+#include <Standard_Boolean.hxx>
+#include <Standard.hxx>
+#include <Standard_Macro.hxx>
+
+class TopoDS_Shape;
+class TopoDS_Face;
+
+class BlockFix_UnionFaces
+{
+public:
+ Standard_EXPORT BlockFix_UnionFaces();
+
+ Standard_EXPORT Standard_Real& GetTolerance();
+
+ /* \brief To get/set the OptimumNbFaces parameter
+ *
+ * If a being processed solid has less than OptimumNbFaces
+ * faces, no union will be performed.
+ * By default this parameter is set to 6 (to correctly
+ * process blocks - hexahedral solids)
+ * Special values: 0 - do all possible unions, regardless the faces quantity,
+ * negative - do not perform any unions, regardless the faces quantity.
+ *
+ */
+ Standard_EXPORT Standard_Integer& GetOptimumNbFaces();
+
+ Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape);
+
+ Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace,
+ const TopoDS_Face& aChekedFace) const;
+
+ Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget,
+ const TopoDS_Face& aSource) const;
+
+private:
+ Standard_Real myTolerance;
+ Standard_Integer myOptimumNbFaces;
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007-2012 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
+
+# GEOM BlockFix : tools for Blocks algorithms
+# File : Makefile.am
+# Author : Julia DOROVSKIKH
+# Module : GEOM
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# Libraries targets
+lib_LTLIBRARIES = libBlockFix.la
+
+dist_libBlockFix_la_SOURCES = \
+ BlockFix_BlockFixAPI.cxx \
+ BlockFix_CheckTool.cxx \
+ BlockFix.cxx \
+ BlockFix_PeriodicSurfaceModifier.cxx \
+ BlockFix_SphereSpaceModifier.cxx \
+ BlockFix_UnionEdges.cxx \
+ BlockFix_UnionFaces.cxx
+
+# header files
+salomeinclude_HEADERS = \
+ BlockFix.hxx \
+ BlockFix_BlockFixAPI.hxx \
+ BlockFix_CheckTool.hxx \
+ BlockFix_PeriodicSurfaceModifier.hxx \
+ BlockFix_SphereSpaceModifier.hxx \
+ BlockFix_UnionEdges.hxx \
+ BlockFix_UnionFaces.hxx
+
+libBlockFix_la_CPPFLAGS = \
+ $(CAS_CPPFLAGS) \
+ $(KERNEL_CXXFLAGS)
+
+libBlockFix_la_LDFLAGS = \
+ $(STDLIB) \
+ $(CAS_LDPATH) -lTKBO -lTKShHealing -lTKBool -lTKMesh -lTKOffset \
+ $(KERNEL_LDFLAGS) -lSALOMELocalTrace
// Function : getNewObjectName
// Purpose : Redefine this method to return proper name for a new object
//================================================================
-QString BlocksGUI_ExplodeDlg::getNewObjectName() const
+QString BlocksGUI_ExplodeDlg::getNewObjectName (int) const
{
return QString::null;
}
virtual bool execute( ObjectList& );
virtual GEOM::GEOM_Object_ptr getFather( GEOM::GEOM_Object_ptr );
- virtual QString getNewObjectName() const;
+ virtual QString getNewObjectName (int CurrObj = -1) const;
private:
void Init();
}
}
if(mode == 0 || mode == 1 || mode == 2) {
- aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
+ aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
}
else if (mode == 4) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
+ aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
}
}
}
}
}
if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
+ aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
}
else if (mode == 4) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
+ aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
}
}
}
// 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 : DlgRef.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
{
}
-//////////////////////////////////////////
-// DlgRef_1Sel4Spin2Check
-//////////////////////////////////////////
-
-DlgRef_1Sel4Spin2Check::DlgRef_1Sel4Spin2Check( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-DlgRef_1Sel4Spin2Check::~DlgRef_1Sel4Spin2Check()
-{
-}
-
-//////////////////////////////////////////
-// DlgRef_1Sel4Spin
-//////////////////////////////////////////
-
-DlgRef_1Sel4Spin::DlgRef_1Sel4Spin( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-DlgRef_1Sel4Spin::~DlgRef_1Sel4Spin()
-{
-}
-
//////////////////////////////////////////
// DlgRef_1Sel5Spin1Check
//////////////////////////////////////////
{
}
-//////////////////////////////////////////
-// DlgRef_1Sel5Spin
-//////////////////////////////////////////
-
-DlgRef_1Sel5Spin::DlgRef_1Sel5Spin( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-DlgRef_1Sel5Spin::~DlgRef_1Sel5Spin()
-{
-}
-
//////////////////////////////////////////
// DlgRef_1Spin
//////////////////////////////////////////
{
}
-//////////////////////////////////////////
-// DlgRef_2Sel4Spin1Check
-//////////////////////////////////////////
-
-DlgRef_2Sel4Spin1Check::DlgRef_2Sel4Spin1Check( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-DlgRef_2Sel4Spin1Check::~DlgRef_2Sel4Spin1Check()
-{
-}
-
//////////////////////////////////////////
// DlgRef_2Sel
//////////////////////////////////////////
// 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 : DlgRef.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
~DlgRef_1Sel3Spin1Check();
};
-//////////////////////////////////////////
-// DlgRef_1Sel4Spin2Check
-//////////////////////////////////////////
-
-#include "ui_DlgRef_1Sel4Spin2Check_QTD.h"
-
-class DLGREF_EXPORT DlgRef_1Sel4Spin2Check : public QWidget,
- public Ui::DlgRef_1Sel4Spin2Check_QTD
-{
- Q_OBJECT
-
-public:
- DlgRef_1Sel4Spin2Check( QWidget* = 0, Qt::WindowFlags = 0 );
- ~DlgRef_1Sel4Spin2Check();
-};
-
-//////////////////////////////////////////
-// DlgRef_1Sel4Spin
-//////////////////////////////////////////
-
-#include "ui_DlgRef_1Sel4Spin_QTD.h"
-
-class DLGREF_EXPORT DlgRef_1Sel4Spin : public QWidget,
- public Ui::DlgRef_1Sel4Spin_QTD
-{
- Q_OBJECT
-
-public:
- DlgRef_1Sel4Spin( QWidget* = 0, Qt::WindowFlags = 0 );
- ~DlgRef_1Sel4Spin();
-};
-
//////////////////////////////////////////
// DlgRef_1Sel5Spin1Check
//////////////////////////////////////////
~DlgRef_1Sel5Spin1Check();
};
-//////////////////////////////////////////
-// DlgRef_1Sel5Spin
-//////////////////////////////////////////
-
-#include "ui_DlgRef_1Sel5Spin_QTD.h"
-
-class DLGREF_EXPORT DlgRef_1Sel5Spin : public QWidget,
- public Ui::DlgRef_1Sel5Spin_QTD
-{
- Q_OBJECT
-
-public:
- DlgRef_1Sel5Spin( QWidget* = 0, Qt::WindowFlags = 0 );
- ~DlgRef_1Sel5Spin();
-};
-
//////////////////////////////////////////
// DlgRef_1Spin
//////////////////////////////////////////
~DlgRef_2Sel3Spin();
};
-//////////////////////////////////////////
-// DlgRef_2Sel4Spin1Check
-//////////////////////////////////////////
-
-#include "ui_DlgRef_2Sel4Spin1Check_QTD.h"
-
-class DLGREF_EXPORT DlgRef_2Sel4Spin1Check : public QWidget,
- public Ui::DlgRef_2Sel4Spin1Check_QTD
-{
- Q_OBJECT
-
-public:
- DlgRef_2Sel4Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
- ~DlgRef_2Sel4Spin1Check();
-};
-
//////////////////////////////////////////
// DlgRef_2Sel
//////////////////////////////////////////
+++ /dev/null
-<ui version="4.0" >
- <class>DlgRef_1Sel4Spin2Check_QTD</class>
- <widget class="QWidget" name="DlgRef_1Sel4Spin2Check_QTD" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>156</width>
- <height>120</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL1</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="LineEdit1" />
- </item>
-
- <item row="1" column="0" >
- <widget class="QLabel" name="TextLabel2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL2</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
- </item>
-
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL3</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
- </item>
-
- <item row="3" column="0" >
- <widget class="QLabel" name="TextLabel4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL4</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
- </item>
-
- <item row="4" column="0" >
- <widget class="QLabel" name="TextLabel5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL5</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_SC" />
- </item>
-
- <item row="5" column="0" colspan="3" >
- <widget class="QCheckBox" name="CheckBox1" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="6" column="0" colspan="3" >
- <widget class="QCheckBox" name="CheckBox2" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>SalomeApp_DoubleSpinBox</class>
- <extends>QDoubleSpinBox</extends>
- <header location="global" >SalomeApp_DoubleSpinBox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>PushButton1</tabstop>
- <tabstop>LineEdit1</tabstop>
- <tabstop>SpinBox_DX</tabstop>
- <tabstop>SpinBox_DY</tabstop>
- <tabstop>SpinBox_DZ</tabstop>
- <tabstop>SpinBox_SC</tabstop>
- <tabstop>CheckBox1</tabstop>
- <tabstop>CheckBox2</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-<ui version="4.0" >
- <class>DlgRef_1Sel4Spin_QTD</class>
- <widget class="QWidget" name="DlgRef_1Sel4Spin_QTD" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>271</width>
- <height>117</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel6" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL6</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_S" />
- </item>
- <item row="1" column="0" colspan="3" >
- <widget class="QGroupBox" name="groupBox" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <item>
- <widget class="QLabel" name="TextLabel3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL3</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
- </item>
- <item>
- <widget class="QLabel" name="TextLabel4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL4</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY" />
- </item>
- <item>
- <widget class="QLabel" name="TextLabel5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL5</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ" />
- </item>
- </layout>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="LineEdit1" />
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL1</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>SalomeApp_DoubleSpinBox</class>
- <extends>QDoubleSpinBox</extends>
- <header location="global" >SalomeApp_DoubleSpinBox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>PushButton1</tabstop>
- <tabstop>LineEdit1</tabstop>
- <tabstop>SpinBox_DX</tabstop>
- <tabstop>SpinBox_DY</tabstop>
- <tabstop>SpinBox_DZ</tabstop>
- <tabstop>SpinBox_S</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-<ui version="4.0" >
- <class>DlgRef_1Sel5Spin_QTD</class>
- <widget class="QWidget" name="DlgRef_1Sel5Spin_QTD" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>174</width>
- <height>123</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <property name="horizontalSpacing" >
- <number>0</number>
- </property>
- <property name="verticalSpacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="1" column="0" colspan="3" >
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL4</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLabel" name="TextLabel3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL3</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="3" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox5" />
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL2</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox1" />
- </item>
- <item row="1" column="2" >
- <widget class="QLabel" name="TextLabel6" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL6</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="3" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox2" />
- </item>
- <item row="2" column="1" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox3" />
- </item>
- <item row="1" column="1" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox4" />
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="TextLabel5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL5</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL1</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="LineEdit1" />
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>SalomeApp_DoubleSpinBox</class>
- <extends>QDoubleSpinBox</extends>
- <header location="global" >SalomeApp_DoubleSpinBox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>PushButton1</tabstop>
- <tabstop>LineEdit1</tabstop>
- <tabstop>SpinBox1</tabstop>
- <tabstop>SpinBox2</tabstop>
- <tabstop>SpinBox4</tabstop>
- <tabstop>SpinBox5</tabstop>
- <tabstop>SpinBox3</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
+++ /dev/null
-<ui version="4.0" >
- <class>DlgRef_2Sel4Spin1Check_QTD</class>
- <widget class="QWidget" name="DlgRef_2Sel4Spin1Check_QTD" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>156</width>
- <height>197</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <property name="horizontalSpacing" >
- <number>0</number>
- </property>
- <property name="verticalSpacing" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>9</number>
- </property>
- <property name="topMargin" >
- <number>9</number>
- </property>
- <property name="rightMargin" >
- <number>9</number>
- </property>
- <property name="bottomMargin" >
- <number>9</number>
- </property>
- <property name="horizontalSpacing" >
- <number>6</number>
- </property>
- <property name="verticalSpacing" >
- <number>6</number>
- </property>
- <item row="4" column="0" colspan="3" >
- <widget class="QCheckBox" name="CheckButton1" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="6" column="1" colspan="2" >
- <widget class="SalomeApp_IntSpinBox" name="SpinBox_DY2" />
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX2" />
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="SalomeApp_IntSpinBox" name="SpinBox_DY1" />
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX1" />
- </item>
- <item row="6" column="0" >
- <widget class="QLabel" name="TextLabel6" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL6</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="TextLabel5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL5</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="TextLabel4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL4</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL3</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="TextLabel2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL2</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="PushButton2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="LineEdit1" />
- </item>
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL1</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QLineEdit" name="LineEdit2" />
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
- <customwidgets>
- <customwidget>
- <class>SalomeApp_DoubleSpinBox</class>
- <extends>QDoubleSpinBox</extends>
- <header location="global" >SalomeApp_DoubleSpinBox.h</header>
- </customwidget>
- <customwidget>
- <class>SalomeApp_IntSpinBox</class>
- <extends>QSpinBox</extends>
- <header location="global" >SalomeApp_IntSpinBox.h</header>
- </customwidget>
- </customwidgets>
- <tabstops>
- <tabstop>PushButton1</tabstop>
- <tabstop>LineEdit1</tabstop>
- <tabstop>PushButton2</tabstop>
- <tabstop>LineEdit2</tabstop>
- <tabstop>SpinBox_DX1</tabstop>
- <tabstop>SpinBox_DY1</tabstop>
- <tabstop>CheckButton1</tabstop>
- <tabstop>SpinBox_DX2</tabstop>
- <tabstop>SpinBox_DY2</tabstop>
- </tabstops>
- <resources/>
- <connections/>
-</ui>
# 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 DLGREF :
# File : Makefile.am
# Author : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : DlgRef
ui_DlgRef_1Sel3Spin_QTD.h \
ui_DlgRef_1Sel3Spin1Check_QTD.h \
ui_DlgRef_1Sel3Spin2Check1Spin_QTD.h \
- ui_DlgRef_1Sel4Spin2Check_QTD.h \
- ui_DlgRef_1Sel4Spin_QTD.h \
ui_DlgRef_1Sel5Spin1Check_QTD.h \
- ui_DlgRef_1Sel5Spin_QTD.h \
ui_DlgRef_1Sel_QTD.h \
ui_DlgRef_1SelExt_QTD.h \
ui_DlgRef_1Spin_QTD.h \
ui_DlgRef_2Sel2Spin2Push_QTD.h \
ui_DlgRef_2Sel3Spin2Rb_QTD.h \
ui_DlgRef_2Sel3Spin_QTD.h \
- ui_DlgRef_2Sel4Spin1Check_QTD.h \
ui_DlgRef_2Sel_QTD.h \
ui_DlgRef_2SelExt_QTD.h \
ui_DlgRef_2Spin_QTD.h \
// Function : getNewObjectName
// Purpose :
//================================================================
-QString EntityGUI_SubShapeDlg::getNewObjectName() const
+QString EntityGUI_SubShapeDlg::getNewObjectName (int) const
{
return QString::null;
}
virtual bool isValid (QString&);
virtual bool execute (ObjectList&);
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
- virtual QString getNewObjectName() const;
+ virtual QString getNewObjectName (int CurrObj = -1) const;
void closeEvent (QCloseEvent*);
# Author : Damien COQUERET (OCC)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header:
include $(top_srcdir)/adm_local/unix/make_common_starter.am
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix.cdl
--- Created: Tue Dec 7 11:59:05 2004
--- Author: Pavel Durandin
---
-package BlockFix
-
-uses
-
- TColStd,
- gp,
- Geom,
- Geom2d,
- GeomAbs,
- TopLoc,
- TopoDS,
- BRepTools,
- TopTools,
- ShapeBuild
-
-is
-
- class SphereSpaceModifier;
-
- class UnionFaces;
-
- class UnionEdges;
-
- class BlockFixAPI;
- ---Purpose: API class to perform the fixing of the
- -- block
-
- class PeriodicSurfaceModifier;
-
- class CheckTool;
-
- RotateSphereSpace (S: Shape from TopoDS; Tol: Real)
- returns Shape from TopoDS;
-
- FixRanges (S: Shape from TopoDS; Tol: Real)
- returns Shape from TopoDS;
- ---Purpose: checking and fixing cases where parametric
- -- boundaries of face based on periodic surface are not
- -- contained in the range of this surface.
-
-end BlockFix;
+++ /dev/null
-// Copyright (C) 2007-2012 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
-
-// File: BlockFix.cxx
-// Created: Tue Dec 7 11:59:05 2004
-// Author: Pavel DURANDIN
-
-#include <BlockFix.hxx>
-
-#include <BlockFix_SphereSpaceModifier.hxx>
-#include <BlockFix_PeriodicSurfaceModifier.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopLoc_Location.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Vertex.hxx>
-
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_DataMapOfShapeShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-
-#include <BRepAdaptor_Surface.hxx>
-
-#include <BRepTools.hxx>
-#include <BRepTools_Modifier.hxx>
-#include <BRepTools_Substitution.hxx>
-
-#include <BRepOffsetAPI_MakeFilling.hxx>
-
-#include <ShapeFix.hxx>
-#include <ShapeFix_Edge.hxx>
-#include <ShapeFix_Face.hxx>
-
-#include <ShapeAnalysis.hxx>
-#include <ShapeAnalysis_Edge.hxx>
-#include <ShapeAnalysis_Curve.hxx>
-#include <ShapeAnalysis_Surface.hxx>
-
-#include <ShapeCustom.hxx>
-
-#include <ShapeBuild_Edge.hxx>
-#include <ShapeBuild_ReShape.hxx>
-
-#include <ShapeFix_Wire.hxx>
-
-#include <Geom_Surface.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_ConicalSurface.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Geom_ToroidalSurface.hxx>
-
-#include <Geom2d_Curve.hxx>
-
-#include <TColgp_SequenceOfPnt2d.hxx>
-
-//=======================================================================
-//function : FixResult
-//purpose : auxilary
-//=======================================================================
-static void FixResult(const TopoDS_Shape& result,
- Handle(ShapeBuild_ReShape)& Context,
- const Standard_Real Tol)
-{
- for (TopExp_Explorer ex_f(result,TopAbs_FACE); ex_f.More(); ex_f.Next()) {
- TopoDS_Shape aShape = Context->Apply(ex_f.Current().Oriented(TopAbs_FORWARD));
- // face coud not be dropped or splitted on this step
- TopoDS_Face aFace = TopoDS::Face(aShape);
- TopLoc_Location L;
- Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L);
-
- if( Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) ||
- Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ) {
-
- Standard_Integer nbWires = 0;
- for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) {
- nbWires++;
- Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()),
- aFace,
- Precision::Confusion());
- sfw->FixReorder();
- if(sfw->StatusReorder ( ShapeExtend_FAIL ))
- continue;
-
- sfw->SetPrecision(2.*Tol);
- sfw->FixShifted();
-
- Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE );
- isDone |= sfw->FixDegenerated();
-
- // remove degenerated edges from not degenerated points
- ShapeAnalysis_Edge sae;
- Handle(ShapeExtend_WireData) sewd = sfw->WireData();
- Standard_Integer i;
- for( i = 1; i<=sewd->NbEdges();i++) {
- TopoDS_Edge E = sewd->Edge(i);
- if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aFace)) {
- sewd->Remove(i);
- isDone = Standard_True;
- i--;
- }
- }
-
- //isDone |= sfw->FixLacking(); // commented by skl 22.03.2005 (PAL8395)
-
- // remove neighbour seam edges
- if(isDone) {
- for( i = 1; i<sewd->NbEdges();i++) {
- if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) {
- isDone = Standard_True;
- sewd->Remove(i);
- sewd->Remove(i);
- i--;
- }
- }
- if(sewd->IsSeam(1) && sewd->IsSeam(sewd->NbEdges())) {
- sewd->Remove(1);
- sewd->Remove(sewd->NbEdges());
- }
- }
-
- if(isDone) {
- TopoDS_Wire ResWire = sfw->Wire();
- Context->Replace(ex_w.Current(), ResWire);
- };
- }
- // Implement fix orientation in case of several wires
- if(nbWires > 1) {
- TopoDS_Face aFixedFace = TopoDS::Face(Context->Apply(aFace));
- Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFixedFace);
- if(sff->FixOrientation())
- Context->Replace(aFixedFace,sff->Face());
- }
- }
- }
-}
-
-//=======================================================================
-//function : RotateSphereSpace
-//purpose :
-//=======================================================================
-TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S,
- const Standard_Real Tol)
-{
- // Create a modification description
- Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier;
- SR->SetTolerance(Tol);
-
- TopTools_DataMapOfShapeShape context;
- BRepTools_Modifier MD;
- TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
-
- Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
- FixResult(result,RS,Tol);
- result = RS->Apply(result);
-
- ShapeFix_Edge sfe;
- for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
- TopoDS_Edge E = TopoDS::Edge(exp.Current());
- sfe.FixVertexTolerance (E);
- }
-
- ShapeFix::SameParameter(result,Standard_False);
- return result;
-}
-
-//=======================================================================
-//function : RefillProblemFaces
-//purpose :
-//=======================================================================
-TopoDS_Shape BlockFix::RefillProblemFaces (const TopoDS_Shape& aShape)
-{
- Standard_Integer NbSamples = 10;
-
- TopTools_ListOfShape theFaces;
-
- TopExp_Explorer Explo(aShape, TopAbs_FACE);
- for (; Explo.More(); Explo.Next())
- {
- TopoDS_Face aFace = TopoDS::Face(Explo.Current());
- BRepAdaptor_Surface BAsurf(aFace);
- GeomAbs_SurfaceType SurfType = BAsurf.GetType();
- if (SurfType >= GeomAbs_BezierSurface)
- {
- TopExp_Explorer fexp(aFace, TopAbs_EDGE);
- for (; fexp.More(); fexp.Next())
- {
- const TopoDS_Edge& anEdge = TopoDS::Edge(fexp.Current());
- if (BRep_Tool::Degenerated(anEdge))
- {
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(anEdge, V1, V2);
- if (V1.IsSame(V2))
- {
- gp_Pnt aPnt = BRep_Tool::Pnt(V1);
- Standard_Real TolV = BRep_Tool::Tolerance(V1);
- Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
- Handle(ShapeAnalysis_Surface) Analyser = new ShapeAnalysis_Surface(aSurf);
- if (Analyser->IsDegenerated(aPnt, TolV))
- {
- theFaces.Append(aFace);
- break;
- }
- }
- }
- }
- }
- }
-
- //Now all problem faces are collected in the list "theFaces"
- BRepTools_Substitution aSubst;
- TopTools_ListIteratorOfListOfShape itl(theFaces);
- for (; itl.More(); itl.Next())
- {
- const TopoDS_Face& aFace = TopoDS::Face(itl.Value());
- BRepOffsetAPI_MakeFilling Filler;
- for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
- {
- const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
- if (!BRep_Tool::Degenerated(anEdge))
- Filler.Add(anEdge, GeomAbs_C0);
- }
- Standard_Real Umin, Umax, Vmin, Vmax;
- BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
- //Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
- Standard_Integer i, j;
- for (i = 1; i < NbSamples; i++)
- for (j = 1; j < NbSamples; j++) {
- /*
- gp_Pnt aPoint = aSurf->Value(Umin + i*(Umax-Umin)/NbSamples,
- Vmin + j*(Vmax-Vmin)/NbSamples);
- Filler.Add(aPoint);
- */
- Filler.Add(Umin + i*(Umax-Umin)/NbSamples,
- Vmin + j*(Vmax-Vmin)/NbSamples,
- aFace, GeomAbs_G1);
- }
-
- Filler.Build();
- if (Filler.IsDone())
- {
- for (Explo.Init(aFace, TopAbs_EDGE); Explo.More(); Explo.Next())
- {
- const TopoDS_Edge& anEdge = TopoDS::Edge(Explo.Current());
- TopTools_ListOfShape Ledge;
- if (!BRep_Tool::Degenerated(anEdge))
- {
- const TopTools_ListOfShape& Ledges = Filler.Generated(anEdge);
- if (!Ledges.IsEmpty()) {
- TopoDS_Shape NewEdge = Ledges.First();
- Ledge.Append(NewEdge.Oriented(TopAbs_FORWARD));
- }
- }
- aSubst.Substitute(anEdge, Ledge);
- }
- TopTools_ListOfShape Lface;
- TopoDS_Face NewFace = TopoDS::Face(Filler.Shape());
- NewFace.Orientation(TopAbs_FORWARD);
- BRepAdaptor_Surface NewBAsurf(NewFace);
- gp_Pnt MidPnt;
- gp_Vec D1U, D1V, Normal, NewNormal;
- Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace);
- aSurf->D1((Umin+Umax)*0.5, (Vmin+Vmax)*0.5, MidPnt, D1U, D1V);
- Normal = D1U ^ D1V;
- NewBAsurf.D1((NewBAsurf.FirstUParameter() + NewBAsurf.LastUParameter())*0.5,
- (NewBAsurf.FirstVParameter() + NewBAsurf.LastVParameter())*0.5,
- MidPnt, D1U, D1V);
- NewNormal = D1U ^ D1V;
- if (Normal * NewNormal < 0.)
- NewFace.Reverse();
- Lface.Append(NewFace);
- aSubst.Substitute(aFace, Lface);
- }
- }
- aSubst.Build(aShape);
-
- TopoDS_Shape Result = aShape;
- if (aSubst.IsCopied(aShape))
- Result = aSubst.Copy(aShape).First();
-
- BRepTools::RemoveUnusedPCurves(Result);
-
- return Result;
-}
-
-//=======================================================================
-//function : FixRanges
-//purpose :
-//=======================================================================
-TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S,
- const Standard_Real Tol)
-{
- // Create a modification description
- Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier;
- SR->SetTolerance(Tol);
-
- TopTools_DataMapOfShapeShape context;
- BRepTools_Modifier MD;
- TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
-
- Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
- FixResult(result,RS,Tol);
- result = RS->Apply(result);
-
- ShapeFix_Edge sfe;
- for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
- TopoDS_Edge E = TopoDS::Edge(exp.Current());
- sfe.FixVertexTolerance (E);
- }
-
- ShapeFix::SameParameter(result,Standard_False);
-
- return result;
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_HeaderFile
-#define _BlockFix_HeaderFile
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-
-class TopoDS_Shape;
-class BlockFix_SphereSpaceModifier;
-class BlockFix_UnionFaces;
-class BlockFix_UnionEdges;
-class BlockFix_BlockFixAPI;
-class BlockFix_PeriodicSurfaceModifier;
-class BlockFix_CheckTool;
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class BlockFix {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-
- Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol);
- Standard_EXPORT static TopoDS_Shape RefillProblemFaces(const TopoDS_Shape& S);
- Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol);
-
-protected:
-
-private:
-
-friend class BlockFix_SphereSpaceModifier;
-friend class BlockFix_UnionFaces;
-friend class BlockFix_UnionEdges;
-friend class BlockFix_BlockFixAPI;
-friend class BlockFix_PeriodicSurfaceModifier;
-friend class BlockFix_CheckTool;
-
-};
-
-// other Inline functions and methods (like "C++: function call" methods)
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix.jxx>
-
-
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _BlockFix_HeaderFile
-#include <BlockFix.hxx>
-#endif
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_BlockFixAPI.cdl
--- Created: Tue Dec 7 17:56:09 2004
--- Author: Pavel Durandin
---
-class BlockFixAPI from BlockFix inherits TShared from MMgt
-
- ---Purpose:
-
-uses
-
- Shape from TopoDS,
- ReShape from ShapeBuild
-
-is
- Create returns BlockFixAPI from BlockFix;
- ---Purpose: Empty constructor
-
- SetShape(me: mutable; Shape: Shape from TopoDS);
- ---Purpose: Sets the shape to be operated on
- ---C++: inline
-
- Perform(me: mutable);
- ---Purpose:
-
- Shape(me) returns Shape from TopoDS;
- ---Purpose: Returns resulting shape.
- ---C++: inline
-
- Context(me:mutable) returns ReShape from ShapeBuild;
- ---Purpose: Returns modifiable context for storing the
- -- mofifications
- ---C++: inline
- ---C++: return &
-
- Tolerance (me:mutable) returns Real;
- ---Purpose: Returns modifiable tolerance of recognition
- ---C++: inline
- ---C++: return &
-
-fields
-
- myContext : ReShape from ShapeBuild;
- myShape : Shape from TopoDS;
- myTolerance : Real from Standard;
-
-end BlockFixAPI from BlockFix;
+++ /dev/null
-// Copyright (C) 2007-2012 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
-
-// File: BlockFix_BlockFixAPI.cxx
-// Created: Tue Dec 7 11:59:05 2004
-// Author: Pavel DURANDIN
-
-#include <BlockFix_BlockFixAPI.ixx>
-
-#include <BlockFix.hxx>
-#include <BlockFix_UnionFaces.hxx>
-#include <BlockFix_UnionEdges.hxx>
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <ShapeUpgrade_RemoveLocations.hxx>
-
-#include <Precision.hxx>
-
-//=======================================================================
-//function : ShapeConvert_CanonicAPI
-//purpose :
-//=======================================================================
-
-BlockFix_BlockFixAPI::BlockFix_BlockFixAPI()
-{
- myTolerance = Precision::Confusion();
- myOptimumNbFaces = 6;
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-void BlockFix_BlockFixAPI::Perform()
-{
- // processing spheres with degenerativities
- TopoDS_Shape aShape = Shape();
- myShape = BlockFix::RotateSphereSpace(aShape,myTolerance);
-
- // try to approximate non-canonic surfaces
- // with singularities on boundaries by filling
- myShape = BlockFix::RefillProblemFaces(myShape);
-
- // faces unification
- BlockFix_UnionFaces aFaceUnifier;
- aFaceUnifier.GetTolerance() = myTolerance;
- aFaceUnifier.GetOptimumNbFaces() = myOptimumNbFaces;
- TopoDS_Shape aResult = aFaceUnifier.Perform(myShape);
-
- // avoid problem with degenerated edges appearance
- // due to shape quality regress
- ShapeUpgrade_RemoveLocations RemLoc;
- RemLoc.Remove(aResult);
- aResult = RemLoc.GetResult();
-
- // edges unification
- BlockFix_UnionEdges anEdgeUnifier;
- myShape = anEdgeUnifier.Perform(aResult,myTolerance);
-
- TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance);
- myShape = aRes;
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_BlockFixAPI_HeaderFile
-#define _BlockFix_BlockFixAPI_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile
-#include <Handle_BlockFix_BlockFixAPI.hxx>
-#endif
-
-#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
-#include <Handle_ShapeBuild_ReShape.hxx>
-#endif
-#ifndef _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _MMgt_TShared_HeaderFile
-#include <MMgt_TShared.hxx>
-#endif
-
-class ShapeBuild_ReShape;
-class TopoDS_Shape;
-
-
-class BlockFix_BlockFixAPI : public MMgt_TShared
-{
-public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-
- // Methods PUBLIC
- //
- Standard_EXPORT BlockFix_BlockFixAPI();
- void SetShape(const TopoDS_Shape& Shape);
- Standard_EXPORT void Perform();
- TopoDS_Shape Shape() const;
- Handle_ShapeBuild_ReShape& Context();
- Standard_Real& Tolerance();
- Standard_Integer& OptimumNbFaces();
- Standard_EXPORT ~BlockFix_BlockFixAPI();
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-private:
- // Fields PRIVATE
- //
- Handle_ShapeBuild_ReShape myContext;
- TopoDS_Shape myShape;
- Standard_Real myTolerance;
- Standard_Integer myOptimumNbFaces;
-};
-
-#include <BlockFix_BlockFixAPI.lxx>
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_BlockFixAPI.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("BlockFix_BlockFixAPI",
- sizeof(BlockFix_BlockFixAPI),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(BlockFix_BlockFixAPI) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(BlockFix_BlockFixAPI))) {
- _anOtherObject = Handle(BlockFix_BlockFixAPI)((Handle(BlockFix_BlockFixAPI)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const
-{
- return STANDARD_TYPE(BlockFix_BlockFixAPI) ;
-}
-Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType));
-}
-Handle_BlockFix_BlockFixAPI::~Handle_BlockFix_BlockFixAPI() {}
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _ShapeBuild_ReShape_HeaderFile
-#include <ShapeBuild_ReShape.hxx>
-#endif
-#ifndef _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _BlockFix_BlockFixAPI_HeaderFile
-#include <BlockFix_BlockFixAPI.hxx>
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_BlockFixAPI.hxx>
-
-//=======================================================================
-//function : SetShape
-//purpose :
-//=======================================================================
-
-inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape)
-{
- myShape = Shape;
-}
-
-//=======================================================================
-//function : Shape
-//purpose :
-//=======================================================================
-
-inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const
-{
- return myShape;
-}
-
-//=======================================================================
-//function : Context
-//purpose :
-//=======================================================================
-
-inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context()
-{
- return myContext;
-}
-
-//=======================================================================
-//function : Tolerance
-//purpose :
-//=======================================================================
-
-inline Standard_Real& BlockFix_BlockFixAPI::Tolerance()
-{
- return myTolerance;
-}
-
-//=======================================================================
-//function : OptimumNbFaces
-//purpose :
-//=======================================================================
-
-inline Standard_Integer& BlockFix_BlockFixAPI::OptimumNbFaces()
-{
- return myOptimumNbFaces;
-}
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_CheckTool.cdl
--- Created: Fri Dec 17 10:36:58 2004
--- Author: Sergey KUUL
---
-class CheckTool from BlockFix
-
- ---Purpose:
-
-uses
-
- Shape from TopoDS,
- SequenceOfShape from TopTools
-
-is
-
- Create returns CheckTool from BlockFix;
- ---Purpose: Empty constructor
-
- SetShape(me: in out; aShape: Shape from TopoDS);
-
- Perform(me: in out);
- ---Purpose:
-
- NbPossibleBlocks(me) returns Integer;
-
- PossibleBlock(me; num: Integer) returns Shape from TopoDS;
-
- DumpCheckResult(me; S : in out OStream);
- ---Purpose: Dumps results of checking
-
-
-fields
-
- myShape : Shape from TopoDS;
- myHasCheck : Boolean;
- myNbSolids : Integer;
- myNbBlocks : Integer;
- myPossibleBlocks : SequenceOfShape from TopTools;
- myNbDegen : Integer;
- myNbUF : Integer;
- myNbUE : Integer;
- myNbUFUE : Integer;
- myBadRanges : Integer;
-
-end CheckTool;
+++ /dev/null
-// Copyright (C) 2007-2012 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
-//
-
-// File: BlockFix_CheckTool.cxx
-// Created: 17.12.04 11:15:25
-// Author: Sergey KUUL
-//
-#include <BlockFix_CheckTool.ixx>
-
-//#include <BlockFix_UnionEdges.hxx>
-//#include <BlockFix_UnionFaces.hxx>
-
-#include <BRep_Tool.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
-
-//=======================================================================
-//function : BlockFix_CheckTool()
-//purpose : Constructor
-//=======================================================================
-
-BlockFix_CheckTool::BlockFix_CheckTool( )
-{
- myHasCheck = Standard_False;
- myPossibleBlocks.Clear();
-}
-
-
-//=======================================================================
-//function : SetShape
-//purpose :
-//=======================================================================
-
-void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape)
-{
- myHasCheck = Standard_False;
- myShape = aShape;
- myPossibleBlocks.Clear();
-}
-
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-void BlockFix_CheckTool::Perform()
-{
- myNbSolids=0;
- myNbBlocks=0;
- myNbDegen=0;
- myNbUF=0;
- myNbUE=0;
- myNbUFUE=0;
-
- TopExp_Explorer exps (myShape, TopAbs_SOLID);
- TopTools_MapOfShape mapS;
- for (; exps.More(); exps.Next()) {
- TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
- if (!mapS.Add(aSolid)) continue;
- myNbSolids++;
- Standard_Boolean IsBlock=Standard_True;
- Standard_Boolean MayBeUF=Standard_False;
- Standard_Boolean MayBeUE=Standard_False;
- Standard_Integer nf=0;
- TopExp_Explorer expf (aSolid, TopAbs_FACE);
- TopTools_MapOfShape mapF;
- for (; expf.More(); expf.Next()) {
- if (mapF.Add(expf.Current()))
- nf++;
- }
-
- if (nf < 6) {
- IsBlock = Standard_False;
- }
- else if (nf > 6) {
- IsBlock = Standard_False;
- // check faces unification
- TopTools_SequenceOfShape faces;
- mapF.Clear();
- for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
- if (mapF.Add(expf.Current())) {
- TopoDS_Face aFace = TopoDS::Face(expf.Current());
- faces.Append(aFace);
- }
- }
- Standard_Boolean HasFacesForUnification = Standard_False;
- for (Standard_Integer i=1; i<faces.Length() && !HasFacesForUnification; i++) {
- TopoDS_Face F1 = TopoDS::Face(faces.Value(i));
- TopTools_MapOfShape Edges;
- for (TopExp_Explorer expe(F1,TopAbs_EDGE); expe.More(); expe.Next())
- Edges.Add(expe.Current().Oriented(TopAbs_FORWARD));
- TopLoc_Location L1;
- Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1,L1);
- for(Standard_Integer j=i+1; j<=faces.Length() && !HasFacesForUnification; j++) {
- TopoDS_Face F2 = TopoDS::Face(faces.Value(j));
- TopLoc_Location L2;
- Handle(Geom_Surface) S2 = BRep_Tool::Surface(F2,L2);
- if( S1==S2 && L1==L2 ) {
- // faces have equal based surface
- // now check common edge
- for(TopExp_Explorer expe2(F2,TopAbs_EDGE); expe2.More(); expe2.Next()) {
- if(Edges.Contains(expe2.Current().Oriented(TopAbs_FORWARD))) {
- HasFacesForUnification = Standard_True;
- break;
- }
- }
- }
- }
- }
- if (HasFacesForUnification) {
- MayBeUF=Standard_True;
- }
- }
-
- Standard_Integer nbe=0;
- TopTools_MapOfShape DegenEdges;
- TopExp_Explorer expe (aSolid, TopAbs_EDGE);
- TopTools_MapOfShape mapE;
- for (; expe.More(); expe.Next()) {
- TopoDS_Edge E = TopoDS::Edge(expe.Current());
- if (!mapE.Add(E)) continue;
- if (BRep_Tool::Degenerated(E)) {
- DegenEdges.Add(E);
- }
- else {
- nbe++;
- }
- }
- if (nbe == 12 && DegenEdges.Extent() > 0) {
- IsBlock = Standard_False;
- myNbDegen++;
- myPossibleBlocks.Append(aSolid);
- continue;
- }
- if (nbe < 12)
- IsBlock = Standard_False;
- if (nbe > 12) {
- IsBlock = Standard_False;
- // check edges unification
- // creating map of edge faces
- TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
- TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
-
- mapF.Clear();
- for (expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
- TopoDS_Face aFace = TopoDS::Face(expf.Current());
- if (!mapF.Add(aFace)) continue;
- TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
-
- TopTools_MapOfShape mapEe;
- for (expe.Init(aFace, TopAbs_EDGE); expe.More(); expe.Next()) {
- TopoDS_Edge edge = TopoDS::Edge(expe.Current());
- if (!mapEe.Add(edge)) continue;
- if (!aMapEdgeFaces.Contains(edge)) continue;
- const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
- TopTools_ListIteratorOfListOfShape anIter (aList);
- for (; anIter.More(); anIter.Next()) {
- TopoDS_Face face = TopoDS::Face(anIter.Value());
- if (face.IsSame(aFace)) continue;
- if (aMapFacesEdges.Contains(face)) {
- aMapFacesEdges.ChangeFromKey(face).Append(edge);
- }
- else {
- TopTools_ListOfShape ListEdges;
- ListEdges.Append(edge);
- aMapFacesEdges.Add(face,ListEdges);
- }
- }
- }
- Standard_Integer i = 1;
- for (; i <= aMapFacesEdges.Extent(); i++) {
- const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
- if (ListEdges.Extent() > 1) break;
- }
- if (i <= aMapFacesEdges.Extent()) {
- MayBeUE = Standard_True;
- break;
- }
- }
- }
-
- if (IsBlock)
- myNbBlocks++;
- else {
- if (MayBeUF) {
- myPossibleBlocks.Append(aSolid);
- if (MayBeUE)
- myNbUFUE++;
- else
- myNbUF++;
- }
- else if (MayBeUE) {
- myNbUE++;
- myPossibleBlocks.Append(aSolid);
- }
- }
- }
-
- myHasCheck = Standard_True;
-}
-
-
-//=======================================================================
-//function : NbPossibleBlocks
-//purpose :
-//=======================================================================
-
-Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const
-{
- return myPossibleBlocks.Length();
-}
-
-
-//=======================================================================
-//function : PossibleBlock
-//purpose :
-//=======================================================================
-
-TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const
-{
- TopoDS_Shape res;
- if( num>0 && num<=myPossibleBlocks.Length() )
- res = myPossibleBlocks.Value(num);
- return res;
-}
-
-
-//=======================================================================
-//function : DumpCheckResult
-//purpose :
-//=======================================================================
-
-void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
-{
- if(!myHasCheck)
- S<<"Check not performed!"<<endl;
- else {
- S<<"dump results of check:"<<endl;
- S<<" total number of solids = "<<myNbSolids<<endl;
- S<<" including: number of good blocks = "<<myNbBlocks<<endl;
- S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
- S<<" including: need remove degenerative = "<<myNbDegen<<endl;
- S<<" need unionfaces = "<<myNbUF<<endl;
- S<<" need unionedges = "<<myNbUE<<endl;
- S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
- Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
- S<<" number of impossible blocks = "<<nbtmp<<endl;
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_CheckTool_HeaderFile
-#define _BlockFix_CheckTool_HeaderFile
-
-#ifndef _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Standard_Integer_HeaderFile
-#include <Standard_Integer.hxx>
-#endif
-#ifndef _TopTools_SequenceOfShape_HeaderFile
-#include <TopTools_SequenceOfShape.hxx>
-#endif
-#ifndef _Standard_OStream_HeaderFile
-#include <Standard_OStream.hxx>
-#endif
-class TopoDS_Shape;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class BlockFix_CheckTool {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT BlockFix_CheckTool();
-Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ;
-Standard_EXPORT void Perform() ;
-Standard_EXPORT Standard_Integer NbPossibleBlocks() const;
-Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const;
-Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-TopoDS_Shape myShape;
-Standard_Boolean myHasCheck;
-Standard_Integer myNbSolids;
-Standard_Integer myNbBlocks;
-TopTools_SequenceOfShape myPossibleBlocks;
-Standard_Integer myNbDegen;
-Standard_Integer myNbUF;
-Standard_Integer myNbUE;
-Standard_Integer myNbUFUE;
-Standard_Integer myBadRanges;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_CheckTool.jxx>
-
-
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _BlockFix_CheckTool_HeaderFile
-#include <BlockFix_CheckTool.hxx>
-#endif
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_PeriodicSurfaceModifier.cdl
--- Created: Wed Dec 15 10:03:50 2004
--- Author: Sergey KUUL
---
-class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools
-
- ---Purpose:
-
-uses
- Vertex from TopoDS,
- Edge from TopoDS,
- Face from TopoDS,
- Location from TopLoc,
- Shape from GeomAbs,
- Pnt from gp,
- Curve from Geom,
- Curve from Geom2d,
- Surface from Geom,
- IndexedMapOfTransient from TColStd,
- DataMapOfShapeInteger from TopTools
-
-is
-
- Create returns mutable PeriodicSurfaceModifier from BlockFix;
-
- SetTolerance(me: mutable; Toler: Real);
- ---Purpose: Sets the tolerance for recognition of geometry
-
- NewSurface(me: mutable; F : Face from TopoDS;
- S : out Surface from Geom;
- L : out Location from TopLoc;
- Tol: out Real from Standard;
- RevWires : out Boolean from Standard;
- RevFace : out Boolean from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the face <F> has been
- -- modified. In this case, <S> is the new geometric
- -- support of the face, <L> the new location, <Tol>
- -- the new tolerance. Otherwise, returns
- -- Standard_False, and <S>, <L>, <Tol> are not
- -- significant.
-
- NewCurve(me: mutable; E : Edge from TopoDS;
- C : out Curve from Geom;
- L : out Location from TopLoc;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the edge <E> has been
- -- modified. In this case, <C> is the new geometric
- -- support of the edge, <L> the new location, <Tol>
- -- the new tolerance. Otherwise, returns
- -- Standard_False, and <C>, <L>, <Tol> are not
- -- significant.
-
- NewPoint(me: mutable; V : Vertex from TopoDS;
- P : out Pnt from gp;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the vertex <V> has been
- -- modified. In this case, <P> is the new geometric
- -- support of the vertex, <Tol> the new tolerance.
- -- Otherwise, returns Standard_False, and <P>, <Tol>
- -- are not significant.
-
- NewCurve2d(me: mutable; E : Edge from TopoDS;
- F : Face from TopoDS;
- NewE : Edge from TopoDS;
- NewF : Face from TopoDS;
- C : out Curve from Geom2d;
- Tol : out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the edge <E> has a new
- -- curve on surface on the face <F>.In this case, <C>
- -- is the new geometric support of the edge, <L> the
- -- new location, <Tol> the new tolerance.
- --
- -- Otherwise, returns Standard_False, and <C>, <L>,
- -- <Tol> are not significant.
- --
- -- <NewE> is the new edge created from <E>. <NewF>
- -- is the new face created from <F>. They may be usefull.
-
- NewParameter(me: mutable; V : Vertex from TopoDS;
- E : Edge from TopoDS;
- P : out Real from Standard;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the Vertex <V> has a new
- -- parameter on the edge <E>. In this case, <P> is
- -- the parameter, <Tol> the new tolerance.
- -- Otherwise, returns Standard_False, and <P>, <Tol>
- -- are not significant.
-
- Continuity(me: mutable; E : Edge from TopoDS;
- F1,F2 : Face from TopoDS;
- NewE : Edge from TopoDS;
- NewF1,NewF2: Face from TopoDS)
- returns Shape from GeomAbs;
- ---Purpose: Returns the continuity of <NewE> between <NewF1>
- -- and <NewF2>.
- --
- -- <NewE> is the new edge created from <E>. <NewF1>
- -- (resp. <NewF2>) is the new face created from <F1>
- -- (resp. <F2>).
-
-
-fields
-
- myTolerance : Real;
- myMapOfFaces : DataMapOfShapeInteger from TopTools;
- myMapOfSurfaces: IndexedMapOfTransient from TColStd;
-
-end PeriodicSurfaceModifier;
+++ /dev/null
-// Copyright (C) 2007-2012 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
-//
-
-// File: BlockFix_PeriodicSurfaceModifier.cxx
-// Created: 15.12.04 10:08:50
-// Author: Sergey KUUL
-
-#include <BlockFix_PeriodicSurfaceModifier.ixx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepTools.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <ShapeFix_Edge.hxx>
-#include <TopExp.hxx>
-
-
-//=======================================================================
-//function : BlockFix_PeriodicSurfaceModifier()
-//purpose : Constructor
-//=======================================================================
-
-BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( )
-{
- myMapOfFaces.Clear();
- myMapOfSurfaces.Clear();
-}
-
-
-//=======================================================================
-//function : SetTolerance
-//purpose :
-//=======================================================================
-
-void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol)
-{
- myTolerance = Tol;
-}
-
-
-//=======================================================================
-//function : ModifySurface
-//purpose : auxilary
-//=======================================================================
-
-static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
- const Handle(Geom_Surface)& aSurface,
- Handle(Geom_Surface)& aNewSurface)
-{
- Handle(Geom_Surface) S = aSurface;
-
- if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
- Handle(Geom_CylindricalSurface) aCyl =
- Handle(Geom_CylindricalSurface)::DownCast(S);
- Standard_Real Umin, Umax, Vmin, Vmax;
- BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
- if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) {
- gp_Ax3 ax3 = aCyl->Position();
- gp_Ax1 NDir = ax3.Axis();
- gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
- Handle(Geom_CylindricalSurface) aNewCyl =
- new Geom_CylindricalSurface(newax3,aCyl->Radius());
- aNewSurface = aNewCyl;
- return Standard_True;
- }
- }
-
- if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
- Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
- Standard_Real Umin, Umax, Vmin, Vmax;
- BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
- if (Umin < -Precision::PConfusion() || Umax > 2*M_PI + Precision::PConfusion()) {
- gp_Ax3 ax3 = aSphere->Position();
- gp_Ax1 NDir = ax3.Axis();
- gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
- Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(newax3,aSphere->Radius());
- aNewSurface = aNewSphere;
- return Standard_True;
- }
- }
-
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewSurface
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F,
- Handle(Geom_Surface)& S,
- TopLoc_Location& L,Standard_Real& Tol,
- Standard_Boolean& RevWires,
- Standard_Boolean& RevFace)
-{
- TopLoc_Location LS;
- Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
-
- if(ModifySurface(F, SIni, S)) {
-
- RevWires = Standard_False;
- RevFace = Standard_False;
-
- L = LS;
- Tol = BRep_Tool::Tolerance(F);
-
- Standard_Integer anIndex = myMapOfSurfaces.Add(S);
- myMapOfFaces.Bind(F,anIndex);
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewCurve
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/,
- Handle(Geom_Curve)& /*C*/,
- TopLoc_Location& /*L*/,
- Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewPoint
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
- gp_Pnt& /*P*/,
- Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewCurve2d
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E,
- const TopoDS_Face& F,
- const TopoDS_Edge& /*NewE*/,
- const TopoDS_Face& /*NewF*/,
- Handle(Geom2d_Curve)& C,
- Standard_Real& Tol)
-{
- //check if undelying surface of the face was modified
- if(myMapOfFaces.IsBound(F)) {
- Standard_Integer anIndex = myMapOfFaces.Find(F);
-
- Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex));
-
- Standard_Real f,l;
- TopLoc_Location LC, LS;
- Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
- Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
-
- //taking into accound the orientation of the seam
- C = BRep_Tool::CurveOnSurface(E,F,f,l);
- Tol = BRep_Tool::Tolerance(E);
-
- BRep_Builder B;
- TopoDS_Edge TempE;
- B.MakeEdge(TempE);
- B.Add(TempE, TopExp::FirstVertex(E));
- B.Add(TempE, TopExp::LastVertex(E));
-
- if(!C3d.IsNull())
- B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
- B.Range(TempE, f, l);
-
- Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
- Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation()));
- TopLoc_Location LTemp;
- LTemp.Identity();
-
- Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
- Standard_Real aWorkTol = 2*myTolerance+Tol;
- sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
- sfe->FixSameParameter(TempE);
-
- //keep the orientation of original edge
- TempE.Orientation(E.Orientation());
- C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
-
- //surface was modified
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewParameter
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,
- const TopoDS_Edge& /*E*/,
- Standard_Real& /*P*/,
- Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : Continuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E,
- const TopoDS_Face& F1,
- const TopoDS_Face& F2,
- const TopoDS_Edge& /*NewE*/,
- const TopoDS_Face& /*NewF1*/,
- const TopoDS_Face& /*NewF2*/)
-{
- return BRep_Tool::Continuity(E,F1,F2);
-}
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_PeriodicSurfaceModifier_HeaderFile
-#define _BlockFix_PeriodicSurfaceModifier_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
-#include <Handle_BlockFix_PeriodicSurfaceModifier.hxx>
-#endif
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
-#include <TopTools_DataMapOfShapeInteger.hxx>
-#endif
-#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
-#include <TColStd_IndexedMapOfTransient.hxx>
-#endif
-#ifndef _BRepTools_Modification_HeaderFile
-#include <BRepTools_Modification.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_Geom_Surface_HeaderFile
-#include <Handle_Geom_Surface.hxx>
-#endif
-#ifndef _Handle_Geom_Curve_HeaderFile
-#include <Handle_Geom_Curve.hxx>
-#endif
-#ifndef _Handle_Geom2d_Curve_HeaderFile
-#include <Handle_Geom2d_Curve.hxx>
-#endif
-#ifndef _GeomAbs_Shape_HeaderFile
-#include <GeomAbs_Shape.hxx>
-#endif
-class TopoDS_Face;
-class Geom_Surface;
-class TopLoc_Location;
-class TopoDS_Edge;
-class Geom_Curve;
-class TopoDS_Vertex;
-class gp_Pnt;
-class Geom2d_Curve;
-
-
-class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT BlockFix_PeriodicSurfaceModifier();
-Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
-Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
-Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
-Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
-Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Real myTolerance;
-TopTools_DataMapOfShapeInteger myMapOfFaces;
-TColStd_IndexedMapOfTransient myMapOfSurfaces;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_PeriodicSurfaceModifier.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("BlockFix_PeriodicSurfaceModifier",
- sizeof(BlockFix_PeriodicSurfaceModifier),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier))) {
- _anOtherObject = Handle(BlockFix_PeriodicSurfaceModifier)((Handle(BlockFix_PeriodicSurfaceModifier)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const
-{
- return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ;
-}
-Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType));
-}
-Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {}
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _TopoDS_Face_HeaderFile
-#include <TopoDS_Face.hxx>
-#endif
-#ifndef _Geom_Surface_HeaderFile
-#include <Geom_Surface.hxx>
-#endif
-#ifndef _TopLoc_Location_HeaderFile
-#include <TopLoc_Location.hxx>
-#endif
-#ifndef _TopoDS_Edge_HeaderFile
-#include <TopoDS_Edge.hxx>
-#endif
-#ifndef _Geom_Curve_HeaderFile
-#include <Geom_Curve.hxx>
-#endif
-#ifndef _TopoDS_Vertex_HeaderFile
-#include <TopoDS_Vertex.hxx>
-#endif
-#ifndef _gp_Pnt_HeaderFile
-#include <gp_Pnt.hxx>
-#endif
-#ifndef _Geom2d_Curve_HeaderFile
-#include <Geom2d_Curve.hxx>
-#endif
-#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
-#include <BlockFix_PeriodicSurfaceModifier.hxx>
-#endif
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_SphereSpaceModifier.cdl
--- Created: Tue Dec 7 12:01:49 2004
--- Author: Pavel Durandin
---
-class SphereSpaceModifier from BlockFix inherits Modification from BRepTools
-
- ---Purpose: Rotation of the parametric space of the sphere in order
- -- to avoid the seam and degenerared edge within it
-
-uses
- Vertex from TopoDS,
- Edge from TopoDS,
- Face from TopoDS,
- Location from TopLoc,
- Shape from GeomAbs,
- Pnt from gp,
- Curve from Geom,
- Curve from Geom2d,
- Surface from Geom,
- IndexedMapOfTransient from TColStd,
- DataMapOfShapeInteger from TopTools
-
-is
-
- Create returns mutable SphereSpaceModifier from BlockFix;
-
- SetTolerance(me: mutable; Toler: Real);
- ---Purpose: Sets the tolerance for recognition of geometry
-
- NewSurface(me: mutable; F : Face from TopoDS;
- S : out Surface from Geom;
- L : out Location from TopLoc;
- Tol: out Real from Standard;
- RevWires : out Boolean from Standard;
- RevFace : out Boolean from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the face <F> has been
- -- modified. In this case, <S> is the new geometric
- -- support of the face, <L> the new location, <Tol>
- -- the new tolerance. Otherwise, returns
- -- Standard_False, and <S>, <L>, <Tol> are not
- -- significant.
-
- NewCurve(me: mutable; E : Edge from TopoDS;
- C : out Curve from Geom;
- L : out Location from TopLoc;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the edge <E> has been
- -- modified. In this case, <C> is the new geometric
- -- support of the edge, <L> the new location, <Tol>
- -- the new tolerance. Otherwise, returns
- -- Standard_False, and <C>, <L>, <Tol> are not
- -- significant.
-
- NewPoint(me: mutable; V : Vertex from TopoDS;
- P : out Pnt from gp;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the vertex <V> has been
- -- modified. In this case, <P> is the new geometric
- -- support of the vertex, <Tol> the new tolerance.
- -- Otherwise, returns Standard_False, and <P>, <Tol>
- -- are not significant.
-
- NewCurve2d(me: mutable; E : Edge from TopoDS;
- F : Face from TopoDS;
- NewE : Edge from TopoDS;
- NewF : Face from TopoDS;
- C : out Curve from Geom2d;
- Tol : out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the edge <E> has a new
- -- curve on surface on the face <F>.In this case, <C>
- -- is the new geometric support of the edge, <L> the
- -- new location, <Tol> the new tolerance.
- --
- -- Otherwise, returns Standard_False, and <C>, <L>,
- -- <Tol> are not significant.
- --
- -- <NewE> is the new edge created from <E>. <NewF>
- -- is the new face created from <F>. They may be usefull.
-
- NewParameter(me: mutable; V : Vertex from TopoDS;
- E : Edge from TopoDS;
- P : out Real from Standard;
- Tol: out Real from Standard)
- returns Boolean from Standard;
- ---Purpose: Returns Standard_True if the Vertex <V> has a new
- -- parameter on the edge <E>. In this case, <P> is
- -- the parameter, <Tol> the new tolerance.
- -- Otherwise, returns Standard_False, and <P>, <Tol>
- -- are not significant.
-
- Continuity(me: mutable; E : Edge from TopoDS;
- F1,F2 : Face from TopoDS;
- NewE : Edge from TopoDS;
- NewF1,NewF2: Face from TopoDS)
- returns Shape from GeomAbs;
- ---Purpose: Returns the continuity of <NewE> between <NewF1>
- -- and <NewF2>.
- --
- -- <NewE> is the new edge created from <E>. <NewF1>
- -- (resp. <NewF2>) is the new face created from <F1>
- -- (resp. <F2>).
-
- ForRotation(me: mutable; F: Face from TopoDS) returns Boolean;
-
-fields
-
- myTolerance : Real;
- myMapOfFaces : DataMapOfShapeInteger from TopTools;
- myMapOfSpheres: IndexedMapOfTransient from TColStd;
- --myMapOfGeom: MapOfShapeTransient from TColStd;
-
-end SphereSpaceModifier;
-
+++ /dev/null
-// Copyright (C) 2007-2012 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
-//
-
-// File: BlockFix.cxx
-// Created: Tue Dec 7 11:59:05 2004
-// Author: Pavel DURANDIN
-
-#include <BlockFix_SphereSpaceModifier.ixx>
-
-#include <TopLoc_Location.hxx>
-#include <BRep_Tool.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <ShapeAnalysis.hxx>
-#include <gp_Sphere.hxx>
-#include <BRep_Builder.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopExp.hxx>
-#include <ShapeFix_Edge.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom2d_Curve.hxx>
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-
-
-//=======================================================================
-//function : BlockFix_SphereSpaceModifier
-//purpose :
-//=======================================================================
-
-BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier()
-{
- myMapOfFaces.Clear();
- myMapOfSpheres.Clear();
-}
-
-//=======================================================================
-//function : SetTolerance
-//purpose :
-//=======================================================================
-
-void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol)
-{
- myTolerance = Tol;
-}
-
-
-//=======================================================================
-//function : NewSurface
-//purpose :
-//=======================================================================
-
-
-static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
- const Handle(Geom_Surface)& aSurface,
- Handle(Geom_Surface)& aNewSurface)
-{
- Handle(Geom_Surface) S = aSurface;
- if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
- Handle(Geom_RectangularTrimmedSurface) RTS =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
- S = RTS->BasisSurface();
- }
-
- if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
- Standard_Real Umin, Umax, Vmin, Vmax;
- ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
- Standard_Real PI2 = M_PI/2.;
- if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
- Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
- gp_Sphere sp = aSphere->Sphere();
- //modified by jgv, 12.11.2012 for issue 21777//
- Standard_Real Radius = sp.Radius();
- Standard_Real HalfArea = 2.*M_PI*Radius*Radius;
- GProp_GProps Properties;
- BRepGProp::SurfaceProperties(aFace, Properties);
- Standard_Real anArea = Properties.Mass();
- Standard_Real AreaTol = Radius*Radius*1.e-6;
- if (anArea > HalfArea - AreaTol) //no chance to avoid singularity
- return Standard_False;
- ///////////////////////////////////////////////
- gp_Ax3 ax3 = sp.Position();
- if(Abs(Vmax-Vmin) < PI2) {
- gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
- sp.SetPosition(axnew3);
- Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
- aNewSurface = aNewSphere;
- return Standard_True;
- }
- else {
- gp_Pnt PC = ax3.Location();
- Standard_Real Vpar;
- if(fabs(PI2-Vmax)>fabs(-PI2-Vmin))
- Vpar = (PI2+Vmax)/2.;
- else
- Vpar = (-PI2+Vmin)/2.;
- Standard_Real Upar = (Umin+Umax)/2.;;
- gp_Pnt PN,PX;
- S->D0(Upar,Vpar,PN);
- S->D0(Upar+PI2,0.,PX);
- gp_Dir newNorm(gp_Vec(PC,PN));
- gp_Dir newDirX(gp_Vec(PC,PX));
- gp_Ax3 axnew3(ax3.Axis().Location(), newNorm, newDirX);
- sp.SetPosition(axnew3);
- Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
- aNewSurface = aNewSphere;
- return Standard_True;
- }
- }
- }
- return Standard_False;
-}
-
-
-Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F,
- Handle(Geom_Surface)& S,
- TopLoc_Location& L,Standard_Real& Tol,
- Standard_Boolean& RevWires,
- Standard_Boolean& RevFace)
-{
- TopLoc_Location LS;
- Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
-
- //check if pole of the sphere in the parametric space
- if(ModifySurface(F, SIni, S)) {
-
- RevWires = Standard_False;
- RevFace = Standard_False;
-
- L = LS;
- Tol = BRep_Tool::Tolerance(F);
-
- Standard_Integer anIndex = myMapOfSpheres.Add(S);
- myMapOfFaces.Bind(F,anIndex);
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-//=======================================================================
-//function : NewCurve
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/,
- TopLoc_Location& /*L*/,Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-//=======================================================================
-//function : NewPoint
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
- gp_Pnt& /*P*/,
- Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-//=======================================================================
-//function : NewCurve2d
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,
- const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/,
- Handle(Geom2d_Curve)& C,Standard_Real& Tol)
-{
- //check if undelying surface of the face was modified
- if(myMapOfFaces.IsBound(F)) {
- Standard_Integer anIndex = myMapOfFaces.Find(F);
-
- Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex));
-
- Standard_Real f,l;
- TopLoc_Location LC, LS;
- Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
- Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
-
- //taking into accound the orientation of the seam
- C = BRep_Tool::CurveOnSurface(E,F,f,l);
- Tol = BRep_Tool::Tolerance(E);
-
- BRep_Builder B;
- TopoDS_Edge TempE;
- B.MakeEdge(TempE);
- B.Add(TempE, TopExp::FirstVertex(E));
- B.Add(TempE, TopExp::LastVertex(E));
-
- if(!C3d.IsNull())
- B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
- B.Range(TempE, f, l);
-
- Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
- Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation()));
- TopLoc_Location LTemp;
- LTemp.Identity();
-
- Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
- Standard_Real aWorkTol = 2*myTolerance+Tol;
- sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
- sfe->FixSameParameter(TempE);
-
- //keep the orientation of original edge
- TempE.Orientation(E.Orientation());
- C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
-
- // shifting seam of sphere
- if(isClosed && !C.IsNull()) {
- Standard_Real f2,l2;
- Handle(Geom2d_Curve) c22 =
- BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2);
- Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion();
- if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci)
- ||(C->Value(l).SquareDistance(c22->Value(l2)) < dPreci)) {
- gp_Vec2d shift(S->UPeriod(),0.);
- C->Translate(shift);
- }
- }
- //sphere was modified
- return Standard_True;
- }
-
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : NewParameter
-//purpose :
-//=======================================================================
-
-Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/,
- Standard_Real& /*P*/,Standard_Real& /*Tol*/)
-{
- return Standard_False;
-}
-
-
-//=======================================================================
-//function : Continuity
-//purpose :
-//=======================================================================
-
-GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,
- const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/,
- const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/)
-{
- return BRep_Tool::Continuity(E,F1,F2);
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_SphereSpaceModifier_HeaderFile
-#define _BlockFix_SphereSpaceModifier_HeaderFile
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile
-#include <Handle_BlockFix_SphereSpaceModifier.hxx>
-#endif
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
-#include <TopTools_DataMapOfShapeInteger.hxx>
-#endif
-#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
-#include <TColStd_IndexedMapOfTransient.hxx>
-#endif
-#ifndef _BRepTools_Modification_HeaderFile
-#include <BRepTools_Modification.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Handle_Geom_Surface_HeaderFile
-#include <Handle_Geom_Surface.hxx>
-#endif
-#ifndef _Handle_Geom_Curve_HeaderFile
-#include <Handle_Geom_Curve.hxx>
-#endif
-#ifndef _Handle_Geom2d_Curve_HeaderFile
-#include <Handle_Geom2d_Curve.hxx>
-#endif
-#ifndef _GeomAbs_Shape_HeaderFile
-#include <GeomAbs_Shape.hxx>
-#endif
-class TopoDS_Face;
-class Geom_Surface;
-class TopLoc_Location;
-class TopoDS_Edge;
-class Geom_Curve;
-class TopoDS_Vertex;
-class gp_Pnt;
-class Geom2d_Curve;
-
-
-class BlockFix_SphereSpaceModifier : public BRepTools_Modification {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT BlockFix_SphereSpaceModifier();
-Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
-Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
-Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
-Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
-Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
-Standard_EXPORT Standard_Boolean ForRotation(const TopoDS_Face& F) ;
-Standard_EXPORT ~BlockFix_SphereSpaceModifier();
-
-
-
-
- // Type management
- //
- Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_();
- Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
- Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Real myTolerance;
-TopTools_DataMapOfShapeInteger myMapOfFaces;
-TColStd_IndexedMapOfTransient myMapOfSpheres;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_SphereSpaceModifier.jxx>
-
-#ifndef _Standard_TypeMismatch_HeaderFile
-#include <Standard_TypeMismatch.hxx>
-#endif
-
-BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {}
-
-
-
-Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_()
-{
-
- static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
- if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
- static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
- static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
- if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
-
- static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
- static Handle_Standard_Type _aType = new Standard_Type("BlockFix_SphereSpaceModifier",
- sizeof(BlockFix_SphereSpaceModifier),
- 1,
- (Standard_Address)_Ancestors,
- (Standard_Address)NULL);
-
- return _aType;
-}
-
-
-// DownCast method
-// allow safe downcasting
-//
-const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
-{
- Handle(BlockFix_SphereSpaceModifier) _anOtherObject;
-
- if (!AnObject.IsNull()) {
- if (AnObject->IsKind(STANDARD_TYPE(BlockFix_SphereSpaceModifier))) {
- _anOtherObject = Handle(BlockFix_SphereSpaceModifier)((Handle(BlockFix_SphereSpaceModifier)&)AnObject);
- }
- }
-
- return _anOtherObject ;
-}
-const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const
-{
- return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ;
-}
-Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const
-{
- return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType));
-}
-Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {}
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _TopoDS_Face_HeaderFile
-#include <TopoDS_Face.hxx>
-#endif
-#ifndef _Geom_Surface_HeaderFile
-#include <Geom_Surface.hxx>
-#endif
-#ifndef _TopLoc_Location_HeaderFile
-#include <TopLoc_Location.hxx>
-#endif
-#ifndef _TopoDS_Edge_HeaderFile
-#include <TopoDS_Edge.hxx>
-#endif
-#ifndef _Geom_Curve_HeaderFile
-#include <Geom_Curve.hxx>
-#endif
-#ifndef _TopoDS_Vertex_HeaderFile
-#include <TopoDS_Vertex.hxx>
-#endif
-#ifndef _gp_Pnt_HeaderFile
-#include <gp_Pnt.hxx>
-#endif
-#ifndef _Geom2d_Curve_HeaderFile
-#include <Geom2d_Curve.hxx>
-#endif
-#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
-#include <BlockFix_SphereSpaceModifier.hxx>
-#endif
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_UnionEdges.cdl
--- Created: Tue Dec 7 15:24:51 2004
--- Author: Sergey KUUL
---
-class UnionEdges from BlockFix
-
- ---Purpose:
-
-uses
-
- Shape from TopoDS,
- ReShape from ShapeBuild
-
-is
-
- Create returns UnionEdges from BlockFix;
-
- Perform(me: in out; Shape: Shape from TopoDS;
- Tol : Real)
- returns Shape from TopoDS;
-
-fields
-
- myTolerance : Real;
- myContext : ReShape from ShapeBuild;
-
-end UnionEdges;
+++ /dev/null
-// Copyright (C) 2007-2012 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
-
-// File: BlockFix_UnionEdges.cxx
-// Created: 07.12.04 15:27:30
-// Author: Sergey KUUL
-
-#include <BlockFix_UnionEdges.ixx>
-
-#include <ShapeAnalysis_Edge.hxx>
-
-#include <ShapeFix_Edge.hxx>
-#include <ShapeFix_Face.hxx>
-#include <ShapeFix_Shell.hxx>
-
-#include <BRep_Builder.hxx>
-#include <BRep_CurveRepresentation.hxx>
-#include <BRep_ListIteratorOfListOfCurveRepresentation.hxx>
-#include <BRep_TEdge.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepAdaptor_HCompCurve.hxx>
-#include <BRepLib.hxx>
-#include <BRepLib_MakeEdge.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_SequenceOfShape.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <Approx_Curve3d.hxx>
-
-#include <GC_MakeCircle.hxx>
-
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_Circle.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomConvert.hxx>
-#include <GeomConvert_CompCurveToBSplineCurve.hxx>
-
-#include <Geom2dConvert.hxx>
-#include <Geom2dConvert_CompCurveToBSplineCurve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-
-#include <TColGeom_SequenceOfSurface.hxx>
-#include <TColGeom_Array1OfBSplineCurve.hxx>
-#include <TColGeom_HArray1OfBSplineCurve.hxx>
-#include <TColGeom2d_Array1OfBSplineCurve.hxx>
-#include <TColGeom2d_HArray1OfBSplineCurve.hxx>
-#include <TColGeom2d_SequenceOfBoundedCurve.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-#include "utilities.h"
-
-//=======================================================================
-//function : BlockFix_UnionEdges()
-//purpose : Constructor
-//=======================================================================
-BlockFix_UnionEdges::BlockFix_UnionEdges ( )
-{
-}
-
-//=======================================================================
-//function : GlueEdgesWithPCurves
-//purpose : Glues the pcurves of the sequence of edges
-// and glues their 3d curves
-//=======================================================================
-static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain,
- const TopoDS_Vertex& FirstVertex,
- const TopoDS_Vertex& LastVertex)
-{
- Standard_Integer i, j;
-
- TopoDS_Edge FirstEdge = TopoDS::Edge(aChain(1));
- //TColGeom2d_SequenceOfCurve PCurveSeq;
- TColGeom_SequenceOfSurface SurfSeq;
- //TopTools_SequenceOfShape LocSeq;
-
- BRep_ListIteratorOfListOfCurveRepresentation itr( (Handle(BRep_TEdge)::DownCast(FirstEdge.TShape()))->Curves() );
- for (; itr.More(); itr.Next())
- {
- Handle(BRep_CurveRepresentation) CurveRep = itr.Value();
- if (CurveRep->IsCurveOnSurface())
- {
- //PCurveSeq.Append(CurveRep->PCurve());
- SurfSeq.Append(CurveRep->Surface());
- /*
- TopoDS_Shape aLocShape;
- aLocShape.Location(CurveRep->Location());
- LocSeq.Append(aLocShape);
- */
- }
- }
-
- Standard_Real fpar, lpar;
- BRep_Tool::Range(FirstEdge, fpar, lpar);
- TopoDS_Edge PrevEdge = FirstEdge;
- TopoDS_Vertex CV;
- Standard_Real MaxTol = 0.;
-
- TopoDS_Edge ResEdge;
- BRep_Builder BB;
-
- Standard_Integer nb_curve = aChain.Length(); //number of curves
- TColGeom_Array1OfBSplineCurve tab_c3d(0,nb_curve-1); //array of the curves
- TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances
-
- TopoDS_Vertex PrevVertex = FirstVertex;
- for (i = 1; i <= nb_curve; i++)
- {
- TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
- TopoDS_Vertex VF, VL;
- TopExp::Vertices(anEdge, VF, VL);
- Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
-
- Standard_Real Tol1 = BRep_Tool::Tolerance(VF);
- Standard_Real Tol2 = BRep_Tool::Tolerance(VL);
- if (Tol1 > MaxTol)
- MaxTol = Tol1;
- if (Tol2 > MaxTol)
- MaxTol = Tol2;
-
- if (i > 1)
- {
- TopExp::CommonVertex(PrevEdge, anEdge, CV);
- Standard_Real Tol = BRep_Tool::Tolerance(CV);
- tabtolvertex(i-2) = Tol;
- }
-
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, fpar, lpar);
- Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(aCurve, fpar, lpar);
- tab_c3d(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
- GeomConvert::C0BSplineToC1BSplineCurve(tab_c3d(i-1), Precision::Confusion());
- if (ToReverse)
- tab_c3d(i-1)->Reverse();
- PrevVertex = (ToReverse)? VF : VL;
- PrevEdge = anEdge;
- }
- Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
- Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
- GeomConvert::ConcatC1(tab_c3d,
- tabtolvertex,
- ArrayOfIndices,
- concatcurve,
- Standard_False,
- Precision::Confusion()); //C1 concatenation
-
- if (concatcurve->Length() > 1)
- {
- GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
-
- for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
- Concat.Add( concatcurve->Value(i), MaxTol, Standard_True );
-
- concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
- }
- Handle(Geom_BSplineCurve) ResCurve = concatcurve->Value(concatcurve->Lower());
-
- TColGeom2d_SequenceOfBoundedCurve ResPCurves;
- TopLoc_Location aLoc;
- for (j = 1; j <= SurfSeq.Length(); j++)
- {
- TColGeom2d_Array1OfBSplineCurve tab_c2d(0,nb_curve-1); //array of the pcurves
-
- PrevVertex = FirstVertex;
- PrevEdge = FirstEdge;
- //TopLoc_Location theLoc = LocSeq(j).Location();
- for (i = 1; i <= nb_curve; i++)
- {
- TopoDS_Edge anEdge = TopoDS::Edge(aChain(i));
- TopoDS_Vertex VF, VL;
- TopExp::Vertices(anEdge, VF, VL);
- Standard_Boolean ToReverse = (!VF.IsSame(PrevVertex));
-
- /*
- Handle(Geom2d_Curve) aPCurve =
- BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), anEdge.Location()*theLoc, fpar, lpar);
- */
- Handle(Geom2d_Curve) aPCurve =
- BRep_Tool::CurveOnSurface(anEdge, SurfSeq(j), aLoc, fpar, lpar);
- Handle(Geom2d_TrimmedCurve) aTrPCurve = new Geom2d_TrimmedCurve(aPCurve, fpar, lpar);
- tab_c2d(i-1) = Geom2dConvert::CurveToBSplineCurve(aTrPCurve);
- Geom2dConvert::C0BSplineToC1BSplineCurve(tab_c2d(i-1), Precision::Confusion());
- if (ToReverse)
- tab_c2d(i-1)->Reverse();
- PrevVertex = (ToReverse)? VF : VL;
- PrevEdge = anEdge;
- }
- Handle(TColGeom2d_HArray1OfBSplineCurve) concatc2d; //array of the concatenated curves
- Handle(TColStd_HArray1OfInteger) ArrayOfInd2d; //array of the remining Vertex
- Geom2dConvert::ConcatC1(tab_c2d,
- tabtolvertex,
- ArrayOfInd2d,
- concatc2d,
- Standard_False,
- Precision::Confusion()); //C1 concatenation
-
- if (concatc2d->Length() > 1)
- {
- Geom2dConvert_CompCurveToBSplineCurve Concat2d(concatc2d->Value(concatc2d->Lower()));
-
- for (i = concatc2d->Lower()+1; i <= concatc2d->Upper(); i++)
- Concat2d.Add( concatc2d->Value(i), MaxTol, Standard_True );
-
- concatc2d->SetValue(concatc2d->Lower(), Concat2d.BSplineCurve());
- }
- Handle(Geom2d_BSplineCurve) aResPCurve = concatc2d->Value(concatc2d->Lower());
- ResPCurves.Append(aResPCurve);
- }
-
- ResEdge = BRepLib_MakeEdge(ResCurve,
- FirstVertex, LastVertex,
- ResCurve->FirstParameter(), ResCurve->LastParameter());
- BB.SameRange(ResEdge, Standard_False);
- BB.SameParameter(ResEdge, Standard_False);
- for (j = 1; j <= ResPCurves.Length(); j++)
- {
- BB.UpdateEdge(ResEdge, ResPCurves(j), SurfSeq(j), aLoc, MaxTol);
- BB.Range(ResEdge, SurfSeq(j), aLoc, ResPCurves(j)->FirstParameter(), ResPCurves(j)->LastParameter());
- }
-
- BRepLib::SameParameter(ResEdge, MaxTol, Standard_True);
-
- return ResEdge;
-}
-
-//=======================================================================
-//function : MergeEdges
-//purpose : auxilary
-//=======================================================================
-static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
- const TopoDS_Face& aFace,
- const Standard_Real Tol,
- TopoDS_Edge& anEdge)
-{
- // make chain for union
- BRep_Builder B;
- ShapeAnalysis_Edge sae;
- TopoDS_Edge FirstE = TopoDS::Edge(SeqEdges.Value(1));
- TopoDS_Edge LastE = FirstE;
- TopoDS_Vertex VF = sae.FirstVertex(FirstE);
- TopoDS_Vertex VL = sae.LastVertex(LastE);
- TopTools_SequenceOfShape aChain;
- aChain.Append(FirstE);
- TColStd_MapOfInteger IndUsedEdges;
- IndUsedEdges.Add(1);
- Standard_Integer j;
- for(j=2; j<=SeqEdges.Length(); j++) {
- for(Standard_Integer k=2; k<=SeqEdges.Length(); k++) {
- if(IndUsedEdges.Contains(k)) continue;
- TopoDS_Edge edge = TopoDS::Edge(SeqEdges.Value(k));
- TopoDS_Vertex VF2 = sae.FirstVertex(edge);
- TopoDS_Vertex VL2 = sae.LastVertex(edge);
- if(sae.FirstVertex(edge).IsSame(VL)) {
- aChain.Append(edge);
- LastE = edge;
- VL = sae.LastVertex(LastE);
- IndUsedEdges.Add(k);
- }
- else if(sae.LastVertex(edge).IsSame(VF)) {
- aChain.Prepend(edge);
- FirstE = edge;
- VF = sae.FirstVertex(FirstE);
- IndUsedEdges.Add(k);
- }
- }
- }
- if(aChain.Length()<SeqEdges.Length()) {
- MESSAGE ("can not create correct chain...");
- return Standard_False;
- }
- // union edges in chain
- // first step: union lines and circles
- TopLoc_Location Loc;
- Standard_Real fp1,lp1,fp2,lp2;
- for(j=1; j<aChain.Length(); j++) {
- TopoDS_Edge edge1 = TopoDS::Edge(aChain.Value(j));
- Handle(Geom_Curve) c3d1 = BRep_Tool::Curve(edge1,Loc,fp1,lp1);
- if(c3d1.IsNull()) break;
- while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
- Handle(Geom_TrimmedCurve) tc =
- Handle(Geom_TrimmedCurve)::DownCast(c3d1);
- c3d1 = tc->BasisCurve();
- }
- TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1));
- Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2);
- if(c3d2.IsNull()) break;
- while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
- Handle(Geom_TrimmedCurve) tc =
- Handle(Geom_TrimmedCurve)::DownCast(c3d2);
- c3d2 = tc->BasisCurve();
- }
- if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) {
- // union lines
- Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1);
- Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
- gp_Dir Dir1 = L1->Position().Direction();
- gp_Dir Dir2 = L2->Position().Direction();
- //if(!Dir1.IsEqual(Dir2,Precision::Angular())) {
- //if(!Dir1.IsParallel(Dir2,Precision::Angular())) {
- if(!Dir1.IsParallel(Dir2,Tol)) {
- continue;
- }
- // can union lines => create new edge
- TopoDS_Vertex V1 = sae.FirstVertex(edge1);
- gp_Pnt PV1 = BRep_Tool::Pnt(V1);
- TopoDS_Vertex V2 = sae.LastVertex(edge2);
- gp_Pnt PV2 = BRep_Tool::Pnt(V2);
- gp_Vec Vec(PV1,PV2);
- Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
- Standard_Real dist = PV1.Distance(PV2);
- Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist);
- TopoDS_Edge E;
- B.MakeEdge (E,tc,Precision::Confusion());
- B.Add (E,V1); B.Add (E,V2);
- B.UpdateVertex(V1, 0., E, 0.);
- B.UpdateVertex(V2, dist, E, 0.);
- //ShapeFix_Edge sfe;
- //sfe.FixAddPCurve(E,aFace,Standard_False);
- //sfe.FixSameParameter(E);
- aChain.Remove(j);
- aChain.SetValue(j,E);
- j--;
- }
- if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) {
- // union circles
- Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(c3d1);
- Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2);
- gp_Pnt P01 = C1->Location();
- gp_Pnt P02 = C2->Location();
- if (P01.Distance(P02) > Precision::Confusion()) continue;
- // can union circles => create new edge
- TopoDS_Vertex V1 = sae.FirstVertex(edge1);
- gp_Pnt PV1 = BRep_Tool::Pnt(V1);
- TopoDS_Vertex V2 = sae.LastVertex(edge2);
- gp_Pnt PV2 = BRep_Tool::Pnt(V2);
- TopoDS_Vertex VM = sae.LastVertex(edge1);
- gp_Pnt PVM = BRep_Tool::Pnt(VM);
- GC_MakeCircle MC (PV1,PVM,PV2);
- Handle(Geom_Circle) C = MC.Value();
- TopoDS_Edge E;
- if (!MC.IsDone() || C.IsNull()) {
- // jfa for Mantis issue 0020228
- if (PV1.Distance(PV2) > Precision::Confusion()) continue;
- // closed chain
- C = C1;
- B.MakeEdge (E,C,Precision::Confusion());
- B.Add(E,V1);
- B.Add(E,V2);
- }
- else {
- gp_Pnt P0 = C->Location();
- gp_Dir D1(gp_Vec(P0,PV1));
- gp_Dir D2(gp_Vec(P0,PV2));
- Standard_Real fpar = C->XAxis().Direction().Angle(D1);
- if(fabs(fpar)>Precision::Confusion()) {
- // check orientation
- gp_Dir ND = C->XAxis().Direction().Crossed(D1);
- if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
- fpar = -fpar;
- }
- }
- Standard_Real lpar = C->XAxis().Direction().Angle(D2);
- if(fabs(lpar)>Precision::Confusion()) {
- // check orientation
- gp_Dir ND = C->XAxis().Direction().Crossed(D2);
- if(ND.IsOpposite(C->Axis().Direction(),Precision::Confusion())) {
- lpar = -lpar;
- }
- }
- if (lpar < fpar) lpar += 2*M_PI;
- Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
- B.MakeEdge (E,tc,Precision::Confusion());
- B.Add(E,V1);
- B.Add(E,V2);
- B.UpdateVertex(V1, fpar, E, 0.);
- B.UpdateVertex(V2, lpar, E, 0.);
- }
- aChain.Remove(j);
- aChain.SetValue(j,E);
- j--;
- }
- }
- if (j < aChain.Length()) {
- MESSAGE ("null curve3d in edge...");
- return Standard_False;
- }
- if (aChain.Length() > 1) {
- // second step: union edges with various curves
- // skl for bug 0020052 from Mantis: perform such unions
- // only if curves are bspline or bezier
- bool NeedUnion = true;
- for(j=1; j<=aChain.Length(); j++) {
- TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
- Handle(Geom_Curve) c3d = BRep_Tool::Curve(edge,Loc,fp1,lp1);
- if(c3d.IsNull()) continue;
- while(c3d->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
- Handle(Geom_TrimmedCurve) tc =
- Handle(Geom_TrimmedCurve)::DownCast(c3d);
- c3d = tc->BasisCurve();
- }
- if( ( c3d->IsKind(STANDARD_TYPE(Geom_BSplineCurve)) ||
- c3d->IsKind(STANDARD_TYPE(Geom_BezierCurve)) ) ) continue;
- NeedUnion = false;
- break;
- }
- if(NeedUnion) {
- MESSAGE ("can not make analitical union => make approximation");
- TopoDS_Edge E = GlueEdgesWithPCurves(aChain, VF, VL);
- /*
- TopoDS_Wire W;
- B.MakeWire(W);
- for(j=1; j<=aChain.Length(); j++) {
- TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
- B.Add(W,edge);
- }
- Handle(BRepAdaptor_HCompCurve) Adapt = new BRepAdaptor_HCompCurve(W);
- Approx_Curve3d Conv(Adapt,Tol,GeomAbs_C1,9,1000);
- Handle(Geom_BSplineCurve) bc = Conv.Curve();
- TopoDS_Edge E;
- B.MakeEdge (E,bc,Precision::Confusion());
- B.Add (E,VF);
- B.Add (E,VL);
- */
- aChain.SetValue(1,E);
- }
- else {
- MESSAGE ("can not make approximation for such types of curves");
- return Standard_False;
- }
- }
-
- anEdge = TopoDS::Edge(aChain.Value(1));
- return Standard_True;
-}
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
- const Standard_Real Tol)
-{
- myContext = new ShapeBuild_ReShape;
- myTolerance = Tol;
- TopoDS_Shape aResult = myContext->Apply(Shape);
-
- // processing each solid
- TopAbs_ShapeEnum aType = TopAbs_SOLID;
- TopExp_Explorer exps (Shape, aType);
- if (!exps.More()) {
- aType = TopAbs_SHELL;
- exps.Init(Shape, aType);
- }
- for (; exps.More(); exps.Next()) {
- //TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
- TopoDS_Shape aSolid = exps.Current();
-
- TopTools_IndexedMapOfShape ChangedFaces;
-
- // creating map of edge faces
- TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
- TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
-
- Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
- TopoDS_Shape aRes = aSolid;
- aRes = aContext->Apply(aSolid);
-
- // processing each face
- TopExp_Explorer exp;
- for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
- TopoDS_Face aFace =
- TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
- TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
-
- for (TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
- TopoDS_Edge edge = TopoDS::Edge(expe.Current());
- if (!aMapEdgeFaces.Contains(edge)) continue;
- const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
- TopTools_ListIteratorOfListOfShape anIter(aList);
- for ( ; anIter.More(); anIter.Next()) {
- TopoDS_Face face = TopoDS::Face(anIter.Value());
- TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value()));
- if (face1.IsSame(aFace)) continue;
- if (aMapFacesEdges.Contains(face)) {
- aMapFacesEdges.ChangeFromKey(face).Append(edge);
- }
- else {
- TopTools_ListOfShape ListEdges;
- ListEdges.Append(edge);
- aMapFacesEdges.Add(face,ListEdges);
- }
- }
- }
-
- for (Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
- const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
- TopTools_SequenceOfShape SeqEdges;
- TopTools_ListIteratorOfListOfShape anIter(ListEdges);
- for ( ; anIter.More(); anIter.Next()) {
- SeqEdges.Append(anIter.Value());
- }
- if (SeqEdges.Length()==1) continue;
- TopoDS_Edge E;
- if ( MergeEdges(SeqEdges,aFace,Tol,E) ) {
- // now we have only one edge - aChain.Value(1)
- // we have to replace old ListEdges with this new edge
- aContext->Replace(SeqEdges(1),E);
- for (Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
- aContext->Remove(SeqEdges(j));
- }
- TopoDS_Face tmpF = TopoDS::Face(exp.Current());
- if ( !ChangedFaces.Contains(tmpF) )
- ChangedFaces.Add(tmpF);
- tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
- if ( !ChangedFaces.Contains(tmpF) )
- ChangedFaces.Add(tmpF);
- }
- }
-
- } // end processing each face
-
- // fix changed faces and replace them in the local context
- for (Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
- TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i)));
- Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
- sff->SetContext(myContext);
- sff->SetPrecision(myTolerance);
- sff->SetMinTolerance(myTolerance);
- sff->SetMaxTolerance(Max(1.,myTolerance*1000.));
- sff->Perform();
- aContext->Replace(aFace,sff->Face());
- }
-
- if (ChangedFaces.Extent() > 0) {
- // fix changed shell and replace it in the local context
- TopoDS_Shape aRes1 = aContext->Apply(aRes);
- TopExp_Explorer expsh;
- for (expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) {
- TopoDS_Shell aShell = TopoDS::Shell(expsh.Current());
- Handle(ShapeFix_Shell) sfsh = new ShapeFix_Shell;
- sfsh->FixFaceOrientation(aShell);
- aContext->Replace(aShell,sfsh->Shell());
- }
- TopoDS_Shape aRes2 = aContext->Apply(aRes1);
- // put new solid into global context
- myContext->Replace(aSolid,aRes2);
- }
-
- } // end processing each solid
-
- aResult = myContext->Apply(Shape);
- return aResult;
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_UnionEdges_HeaderFile
-#define _BlockFix_UnionEdges_HeaderFile
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
-#include <Handle_ShapeBuild_ReShape.hxx>
-#endif
-class ShapeBuild_ReShape;
-class TopoDS_Shape;
-
-
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class BlockFix_UnionEdges {
-
-public:
-
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- // Methods PUBLIC
- //
-Standard_EXPORT BlockFix_UnionEdges();
-Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_Real Tol) ;
-
-
-
-
-
-protected:
-
- // Methods PROTECTED
- //
-
-
- // Fields PROTECTED
- //
-
-
-private:
-
- // Methods PRIVATE
- //
-
-
- // Fields PRIVATE
- //
-Standard_Real myTolerance;
-Handle_ShapeBuild_ReShape myContext;
-
-
-};
-
-
-
-
-
-// other Inline functions and methods (like "C++: function call" methods)
-//
-
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_UnionEdges.jxx>
-
-
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _ShapeBuild_ReShape_HeaderFile
-#include <ShapeBuild_ReShape.hxx>
-#endif
-#ifndef _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _BlockFix_UnionEdges_HeaderFile
-#include <BlockFix_UnionEdges.hxx>
-#endif
+++ /dev/null
--- Copyright (C) 2007-2012 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
---
-
--- File: BlockFix_UnionFaces.cdl
--- Created: Tue Dec 7 17:15:42 2004
--- Author: Pavel Durandin
---
-class UnionFaces from BlockFix
-
-uses
-
- Face from TopoDS,
- Shape from TopoDS
-
-is
-
- Create returns UnionFaces from BlockFix;
- ---Purpose: Empty constructor
-
- GetTolerance(me: in out) returns Real;
- ---Purpose: Returns modifiable tolerance
- ---C++: return&
-
- Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS;
- ---Purpose: Performs the unification of the fsces
- -- whith the same geometry
-
- IsSameDomain(me; aFace : Face from TopoDS;
- aChekedFace: Face from TopoDS)
- returns Boolean is virtual;
- ---Purpose: Returns true is surfaces have same geometrically domain
- -- with given tolerance
-
- MovePCurves(me; aTarget: in out Face from TopoDS;
- aSource: Face from TopoDS)
- is virtual;
- ---Purpose: Creates pcurves on aTarget face for each edge from
- -- aSource one.
-
-fields
-
- myTolerance: Real;
-
-end;
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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
-//
-
-// File: BlockFix_UnionFaces.cxx
-// Created: Tue Dec 7 17:15:42 2004
-// Author: Pavel DURANDIN
-
-#include <BlockFix_UnionFaces.ixx>
-
-#include <Basics_OCCTVersion.hxx>
-
-#include <ShapeAnalysis_WireOrder.hxx>
-#include <ShapeAnalysis_Edge.hxx>
-
-#include <ShapeBuild_Edge.hxx>
-#include <ShapeBuild_ReShape.hxx>
-
-#include <ShapeExtend_WireData.hxx>
-#include <ShapeExtend_CompositeSurface.hxx>
-
-#include <ShapeFix_Face.hxx>
-#include <ShapeFix_ComposeShell.hxx>
-#include <ShapeFix_SequenceOfWireSegment.hxx>
-#include <ShapeFix_WireSegment.hxx>
-#include <ShapeFix_Wire.hxx>
-#include <ShapeFix_Edge.hxx>
-
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
-#include <IntPatch_ImpImpIntersection.hxx>
-#else
-#include <IntPatch_TheIIIntOfIntersection.hxx>
-#endif
-
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <BRepTopAdaptor_TopolTool.hxx>
-
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-
-#include <TopTools_SequenceOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Iterator.hxx>
-
-#include <TColGeom_HArray2OfSurface.hxx>
-
-#include <GeomAdaptor_HSurface.hxx>
-#include <GeomLib_IsPlanarSurface.hxx>
-
-#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_OffsetSurface.hxx>
-#include <Geom_SphericalSurface.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_SurfaceOfRevolution.hxx>
-#include <Geom_SurfaceOfLinearExtrusion.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-
-#include <Geom_Curve.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Circle.hxx>
-
-#include <Geom2d_Line.hxx>
-
-#include <gp_XY.hxx>
-#include <gp_Pnt2d.hxx>
-
-#include <Standard_Failure.hxx>
-#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
-//=======================================================================
-//function : BlockFix_UnionFaces
-//purpose :
-//=======================================================================
-
-BlockFix_UnionFaces::BlockFix_UnionFaces()
- : myTolerance(Precision::Confusion()),
- myOptimumNbFaces(6)
-{
-}
-
-
-//=======================================================================
-//function : GetTolerance
-//purpose :
-//=======================================================================
-
-Standard_Real& BlockFix_UnionFaces::GetTolerance()
-{
- return myTolerance;
-}
-
-
-//=======================================================================
-//function : GetOptimumNbFaces
-//purpose :
-//=======================================================================
-
-Standard_Integer& BlockFix_UnionFaces::GetOptimumNbFaces()
-{
- return myOptimumNbFaces;
-}
-
-
-//=======================================================================
-//function : AddOrdinaryEdges
-//purpose : auxilary
-//=======================================================================
-// adds edges from the shape to the sequence
-// seams and equal edges are dropped
-// Returns true if one of original edges dropped
-static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
- const TopoDS_Shape aShape,
- Standard_Integer& anIndex)
-{
- //map of edges
- TopTools_MapOfShape aNewEdges;
- //add edges without seams
- for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
- TopoDS_Shape edge = exp.Current();
- if(aNewEdges.Contains(edge))
- aNewEdges.Remove(edge);
- else
- aNewEdges.Add(edge);
- }
-
- Standard_Boolean isDropped = Standard_False;
- //merge edges and drop seams
- for(Standard_Integer i = 1; i <= edges.Length(); i++) {
- TopoDS_Shape current = edges(i);
- if(aNewEdges.Contains(current)) {
-
- aNewEdges.Remove(current);
- edges.Remove(i);
- i--;
-
- if(!isDropped) {
- isDropped = Standard_True;
- anIndex = i;
- }
- }
- }
-
- //add edges to the sequemce
- for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
- edges.Append(anIter.Key());
-
- return isDropped;
-}
-
-
-//=======================================================================
-//function : ClearRts
-//purpose : auxilary
-//=======================================================================
-static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
-{
- if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
- Handle(Geom_RectangularTrimmedSurface) rts =
- Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
- return rts->BasisSurface();
- }
- return aSurface;
-}
-
-
-//=======================================================================
-//function : Perform
-//purpose :
-//=======================================================================
-
-TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
-{
- Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
- TopoDS_Shape aResShape = myContext->Apply(Shape);
-
- // processing each solid
- TopExp_Explorer exps;
- for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
- TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
-
- // creating map of edge faces
- TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
- TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
-
- // map of processed shapes
- TopTools_MapOfShape aProcessed;
-
- Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
-
- Standard_Integer NbModif = 0;
- Standard_Boolean hasFailed = Standard_False;
- Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.), 0.1);
-
- // count faces
- int nbf = 0;
- TopExp_Explorer exp;
- TopTools_MapOfShape mapF;
- for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
- if (mapF.Add(exp.Current()))
- nbf++;
- }
-
- bool doUnion = ((myOptimumNbFaces == 0) ||
- ((myOptimumNbFaces > 0) && (nbf > myOptimumNbFaces)));
-
- // processing each face
- mapF.Clear();
- for (exp.Init(aSolid, TopAbs_FACE); exp.More() && doUnion; exp.Next()) {
- TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
-
- if (aProcessed.Contains(aFace))
- continue;
-
- Standard_Integer dummy;
- TopTools_SequenceOfShape edges;
- AddOrdinaryEdges(edges,aFace,dummy);
-
- TopTools_SequenceOfShape faces;
- faces.Append(aFace);
-
- //surface and location to construct result
- TopLoc_Location aBaseLocation;
- Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
- aBaseSurface = ClearRts(aBaseSurface);
-
- // find adjacent faces to union
- Standard_Integer i;
- for (i = 1; i <= edges.Length(); i++) {
- TopoDS_Edge edge = TopoDS::Edge(edges(i));
- if (BRep_Tool::Degenerated(edge))
- continue;
-
- const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
- TopTools_ListIteratorOfListOfShape anIter(aList);
- for (; anIter.More(); anIter.Next()) {
- TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
- if (anCheckedFace.IsSame(aFace))
- continue;
-
- if (aProcessed.Contains(anCheckedFace))
- continue;
-
- if (IsSameDomain(aFace,anCheckedFace)) {
-
- if (aList.Extent() != 2) {
- // non mainfold case is not processed
- continue;
- }
-
- // replacing pcurves
- TopoDS_Face aMockUpFace;
- BRep_Builder B;
- B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
- MovePCurves(aMockUpFace,anCheckedFace);
-
- if (AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
- // sequence edges is modified
- i = dummy;
- }
-
- faces.Append(anCheckedFace);
- aProcessed.Add(anCheckedFace);
- break;
- }
- }
- }
-
- // all faces collected in the sequence. Perform union of faces
- if (faces.Length() > 1) {
- NbModif++;
- TopoDS_Face aResult;
- BRep_Builder B;
- B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
- Standard_Integer nbWires = 0;
-
- // connecting wires
- while (edges.Length()>0) {
-
- Standard_Boolean isEdge3d = Standard_False;
- nbWires++;
- TopTools_MapOfShape aVertices;
- TopoDS_Wire aWire;
- B.MakeWire(aWire);
-
- TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
- edges.Remove(1);
-
- isEdge3d |= !BRep_Tool::Degenerated(anEdge);
- B.Add(aWire,anEdge);
- TopoDS_Vertex V1,V2;
- TopExp::Vertices(anEdge,V1,V2);
- aVertices.Add(V1);
- aVertices.Add(V2);
-
- Standard_Boolean isNewFound = Standard_False;
- do {
- isNewFound = Standard_False;
- for(Standard_Integer j = 1; j <= edges.Length(); j++) {
- anEdge = TopoDS::Edge(edges(j));
- TopExp::Vertices(anEdge,V1,V2);
- if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
- isEdge3d |= !BRep_Tool::Degenerated(anEdge);
- aVertices.Add(V1);
- aVertices.Add(V2);
- B.Add(aWire,anEdge);
- edges.Remove(j);
- j--;
- isNewFound = Standard_True;
- }
- }
- } while (isNewFound);
-
- // sorting any type of edges
- aWire = TopoDS::Wire(aContext->Apply(aWire));
-
- TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
- Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
- sfw->FixReorder();
- Standard_Boolean isDegRemoved = Standard_False;
- if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
- // clear degenerated edges if at least one with 3d curve exist
- if(isEdge3d) {
- Handle(ShapeExtend_WireData) sewd = sfw->WireData();
- for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
- TopoDS_Edge E = sewd->Edge(j);
- if(BRep_Tool::Degenerated(E)) {
- sewd->Remove(j);
- isDegRemoved = Standard_True;
- j--;
- }
- }
- }
- sfw->FixShifted();
- if(isDegRemoved)
- sfw->FixDegenerated();
- }
- TopoDS_Wire aWireFixed = sfw->Wire();
- aContext->Replace(aWire,aWireFixed);
- // add resulting wire
- if(isEdge3d) {
- B.Add(aResult,aWireFixed);
- }
- else {
- // sorting edges
- Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
- Standard_Integer nbEdges = sbwd->NbEdges();
- // sort degenerated edges and create one edge instead of several ones
- ShapeAnalysis_WireOrder sawo(Standard_False, 0);
- ShapeAnalysis_Edge sae;
- Standard_Integer aLastEdge = nbEdges;
- for(Standard_Integer j = 1; j <= nbEdges; j++) {
- Standard_Real f,l;
- //smh protection on NULL pcurve
- Handle(Geom2d_Curve) c2d;
- if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
- aLastEdge--;
- continue;
- }
- sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
- }
- sawo.Perform();
-
- // constructind one degenerative edge
- gp_XY aStart, anEnd, tmp;
- Standard_Integer nbFirst = sawo.Ordered(1);
- TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
- ShapeBuild_Edge sbe;
- TopoDS_Vertex aDummyV;
- TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
- sawo.XY(nbFirst,aStart,tmp);
- sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
-
- gp_XY aVec = anEnd-aStart;
- Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
-
- B.UpdateEdge(E,aLine,tmpF,0.);
- B.Range(E,tmpF,0.,aVec.Modulus());
- Handle(Geom_Curve) C3d;
- B.UpdateEdge(E,C3d,0.);
- B.Degenerated(E,Standard_True);
- TopoDS_Wire aW;
- B.MakeWire(aW);
- B.Add(aW,E);
- B.Add(aResult,aW);
- }
- }
-
- // perform substitution of face
- aContext->Replace(aContext->Apply(aFace),aResult);
-
- ShapeFix_Face sff (aResult);
- //Intializing by tolerances
- sff.SetPrecision(myTolerance);
- sff.SetMinTolerance(tol);
- sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
- //Setting modes
- sff.FixOrientationMode() = 0;
- //sff.FixWireMode() = 0;
- sff.SetContext(aContext);
- // Applying the fixes
- sff.Perform();
- if(sff.Status(ShapeExtend_FAIL))
- hasFailed = Standard_True;
-
- // breaking down to several faces
- TopoDS_Shape theResult = aContext->Apply(aResult);
- for (TopExp_Explorer aFaceExp (theResult,TopAbs_FACE); aFaceExp.More(); aFaceExp.Next()) {
- TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
- Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
- grid->SetValue ( 1, 1, aBaseSurface );
- Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
- ShapeFix_ComposeShell CompShell;
- CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
- CompShell.SetContext( aContext );
-
- TopTools_SequenceOfShape parts;
- ShapeFix_SequenceOfWireSegment wires;
- for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
- Handle(ShapeExtend_WireData) sbwd =
- new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
- ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
- wires.Append(seg);
- }
-
- CompShell.DispatchWires ( parts,wires );
- for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
- ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
- aFixOrient.SetContext(aContext);
- aFixOrient.FixOrientation();
- }
-
- TopoDS_Shape CompRes;
- if ( faces.Length() !=1 ) {
- TopoDS_Shell S;
- B.MakeShell ( S );
- for ( i=1; i <= parts.Length(); i++ )
- B.Add ( S, parts(i) );
- CompRes = S;
- }
- else CompRes = parts(1);
-
- aContext->Replace(aCurrent,CompRes);
- }
-
- // remove the remaining faces
- for(i = 2; i <= faces.Length(); i++)
- aContext->Remove(faces(i));
- }
- } // end processing each face
-
- //TopoDS_Shape aResult = Shape;
- if (NbModif > 0 && !hasFailed) {
- TopoDS_Shape aResult = aContext->Apply(aSolid);
-
- ShapeFix_Edge sfe;
- for (exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
- TopoDS_Edge E = TopoDS::Edge(exp.Current());
- sfe.FixVertexTolerance (E);
- // ptv add fix same parameter
- sfe.FixSameParameter(E, myTolerance);
- }
-
- myContext->Replace(aSolid, aResult);
- }
- //else
- {
- for (exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
- TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
- Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
- sfw->SetContext(myContext);
- sfw->SetPrecision(myTolerance);
- sfw->SetMinTolerance(myTolerance);
- sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
- sfw->SetFace(aFace);
- for (TopoDS_Iterator iter (aFace,Standard_False); iter.More(); iter.Next()) {
- TopoDS_Wire wire = TopoDS::Wire(iter.Value());
- sfw->Load(wire);
- sfw->FixReorder();
- sfw->FixShifted();
- }
- }
- }
- } // end processing each solid
-
- aResShape = myContext->Apply(Shape);
- return aResShape;
-}
-
-
-//=======================================================================
-//function : IsSameDomain
-//purpose :
-//=======================================================================
-
-bool getCylinder (Handle(Geom_Surface)& theInSurface, gp_Cylinder& theOutCylinder)
-{
- bool isCylinder = false;
-
- if (theInSurface->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
- Handle(Geom_CylindricalSurface) aGC = Handle(Geom_CylindricalSurface)::DownCast(theInSurface);
-
- theOutCylinder = aGC->Cylinder();
- isCylinder = true;
- }
- else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfRevolution))) {
- Handle(Geom_SurfaceOfRevolution) aRS =
- Handle(Geom_SurfaceOfRevolution)::DownCast(theInSurface);
- Handle(Geom_Curve) aBasis = aRS->BasisCurve();
- if (aBasis->IsKind(STANDARD_TYPE(Geom_Line))) {
- Handle(Geom_Line) aBasisLine = Handle(Geom_Line)::DownCast(aBasis);
- gp_Dir aDir = aRS->Direction();
- gp_Dir aBasisDir = aBasisLine->Position().Direction();
- if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
- // basis line is parallel to the revolution axis: it is a cylinder
- gp_Pnt aLoc = aRS->Location();
- Standard_Real aR = aBasisLine->Lin().Distance(aLoc);
- gp_Ax3 aCylAx (aLoc, aDir);
-
- theOutCylinder = gp_Cylinder(aCylAx, aR);
- isCylinder = true;
- }
- }
- }
- else if (theInSurface->IsKind(STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion))) {
- Handle(Geom_SurfaceOfLinearExtrusion) aLES =
- Handle(Geom_SurfaceOfLinearExtrusion)::DownCast(theInSurface);
- Handle(Geom_Curve) aBasis = aLES->BasisCurve();
- if (aBasis->IsKind(STANDARD_TYPE(Geom_Circle))) {
- Handle(Geom_Circle) aBasisCircle = Handle(Geom_Circle)::DownCast(aBasis);
- gp_Dir aDir = aLES->Direction();
- gp_Dir aBasisDir = aBasisCircle->Position().Direction();
- if (aBasisDir.IsParallel(aDir, Precision::Confusion())) {
- // basis circle is normal to the extrusion axis: it is a cylinder
- gp_Pnt aLoc = aBasisCircle->Location();
- Standard_Real aR = aBasisCircle->Radius();
- gp_Ax3 aCylAx (aLoc, aDir);
-
- theOutCylinder = gp_Cylinder(aCylAx, aR);
- isCylinder = true;
- }
- }
- }
- else {
- }
-
- return isCylinder;
-}
-
-Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
- const TopoDS_Face& aCheckedFace) const
-{
- //checking the same handles
- TopLoc_Location L1, L2;
- Handle(Geom_Surface) S1, S2;
-
- S1 = BRep_Tool::Surface(aFace,L1);
- S2 = BRep_Tool::Surface(aCheckedFace,L2);
-
- if (S1 == S2 && L1 == L2)
- return true;
-
- // planar and cylindrical cases (IMP 20052)
- Standard_Real aPrec = Precision::Confusion();
-
- S1 = BRep_Tool::Surface(aFace);
- S2 = BRep_Tool::Surface(aCheckedFace);
-
- S1 = ClearRts(S1);
- S2 = ClearRts(S2);
-
- //Handle(Geom_OffsetSurface) aGOFS1, aGOFS2;
- //aGOFS1 = Handle(Geom_OffsetSurface)::DownCast(S1);
- //aGOFS2 = Handle(Geom_OffsetSurface)::DownCast(S2);
- //if (!aGOFS1.IsNull()) S1 = aGOFS1->BasisSurface();
- //if (!aGOFS2.IsNull()) S2 = aGOFS2->BasisSurface();
-
- // case of two elementary surfaces: use OCCT tool
- // elementary surfaces: ConicalSurface, CylindricalSurface,
- // Plane, SphericalSurface and ToroidalSurface
- if (S1->IsKind(STANDARD_TYPE(Geom_ElementarySurface)) &&
- S2->IsKind(STANDARD_TYPE(Geom_ElementarySurface)))
- {
- Handle(GeomAdaptor_HSurface) aGA1 = new GeomAdaptor_HSurface(S1);
- Handle(GeomAdaptor_HSurface) aGA2 = new GeomAdaptor_HSurface(S2);
-
- Handle(BRepTopAdaptor_TopolTool) aTT1 = new BRepTopAdaptor_TopolTool();
- Handle(BRepTopAdaptor_TopolTool) aTT2 = new BRepTopAdaptor_TopolTool();
-
- try {
-#if OCC_VERSION_LARGE > 0x06010000
- OCC_CATCH_SIGNALS;
-#endif
-
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- IntPatch_ImpImpIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
-#else
- IntPatch_TheIIIntOfIntersection anIIInt (aGA1, aTT1, aGA2, aTT2, aPrec, aPrec);
-#endif
- if (!anIIInt.IsDone() || anIIInt.IsEmpty())
- return false;
-
- return anIIInt.TangentFaces();
- }
- catch (Standard_Failure) {
- return false;
- }
- }
-
- // case of two planar surfaces:
- // all kinds of surfaces checked, including b-spline and bezier
- GeomLib_IsPlanarSurface aPlanarityChecker1 (S1, aPrec);
- if (aPlanarityChecker1.IsPlanar()) {
- GeomLib_IsPlanarSurface aPlanarityChecker2 (S2, aPrec);
- if (aPlanarityChecker2.IsPlanar()) {
- gp_Pln aPln1 = aPlanarityChecker1.Plan();
- gp_Pln aPln2 = aPlanarityChecker2.Plan();
-
- if (aPln1.Position().Direction().IsParallel(aPln2.Position().Direction(), aPrec) &&
- aPln1.Distance(aPln2) < aPrec) {
- return true;
- }
- }
- }
-
- // case of two cylindrical surfaces, at least one of which is a swept surface
- // swept surfaces: SurfaceOfLinearExtrusion, SurfaceOfRevolution
- if ((S1->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
- S1->IsKind(STANDARD_TYPE(Geom_SweptSurface))) &&
- (S2->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) ||
- S2->IsKind(STANDARD_TYPE(Geom_SweptSurface))))
- {
- gp_Cylinder aCyl1, aCyl2;
- if (getCylinder(S1, aCyl1) && getCylinder(S2, aCyl2)) {
- if (fabs(aCyl1.Radius() - aCyl2.Radius()) < aPrec) {
- gp_Dir aDir1 = aCyl1.Position().Direction();
- gp_Dir aDir2 = aCyl2.Position().Direction();
- if (aDir1.IsParallel(aDir2, aPrec)) {
- gp_Pnt aLoc1 = aCyl1.Location();
- gp_Pnt aLoc2 = aCyl2.Location();
- gp_Vec aVec12 (aLoc1, aLoc2);
- if (aVec12.SquareMagnitude() < aPrec*aPrec ||
- aVec12.IsParallel(aDir1, aPrec)) {
- return true;
- }
- }
- }
- }
- }
-
- return false;
-}
-
-
-//=======================================================================
-//function : MovePCurves
-//purpose :
-//=======================================================================
-
-void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
- const TopoDS_Face& aSource) const
-{
- BRep_Builder B;
- for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
- Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
- aTarget, Precision::Confusion());
- sfw->FixReorder();
- Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
- sfw->FixEdgeCurves();
- if(isReoredFailed)
- continue;
-
- sfw->FixShifted();
- sfw->FixDegenerated();
-
- // remove degenerated edges from not degenerated points
- ShapeAnalysis_Edge sae;
- Handle(ShapeExtend_WireData) sewd = sfw->WireData();
- for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
- TopoDS_Edge E = sewd->Edge(i);
- if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
- sewd->Remove(i);
- i--;
- }
- }
-
- TopoDS_Wire ResWire = sfw->Wire();
- B.Add(aTarget,ResWire);
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2012 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 _BlockFix_UnionFaces_HeaderFile
-#define _BlockFix_UnionFaces_HeaderFile
-
-#ifndef _Standard_Real_HeaderFile
-#include <Standard_Real.hxx>
-#endif
-#ifndef _Standard_Boolean_HeaderFile
-#include <Standard_Boolean.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-
-class TopoDS_Shape;
-class TopoDS_Face;
-
-class BlockFix_UnionFaces
-{
-public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
-
- // Methods PUBLIC
- //
- Standard_EXPORT BlockFix_UnionFaces();
-
- Standard_EXPORT Standard_Real& GetTolerance();
-
- /* \brief To get/set the OptimumNbFaces parameter
- *
- * If a being processed solid has less than OptimumNbFaces
- * faces, no union will be performed.
- * By default this parameter is set to 6 (to correctly
- * process blocks - hexahedral solids)
- * Special values: 0 - do all possible unions, regardless the faces quantity,
- * negative - do not perform any unions, regardless the faces quantity.
- *
- */
- Standard_EXPORT Standard_Integer& GetOptimumNbFaces();
-
- Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape);
-
- Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace,
- const TopoDS_Face& aChekedFace) const;
- Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget,
- const TopoDS_Face& aSource) const;
-
-private:
- // Fields PRIVATE
- //
- Standard_Real myTolerance;
- Standard_Integer myOptimumNbFaces;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 <BlockFix_UnionFaces.jxx>
-
-
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _TopoDS_Shape_HeaderFile
-#include <TopoDS_Shape.hxx>
-#endif
-#ifndef _TopoDS_Face_HeaderFile
-#include <TopoDS_Face.hxx>
-#endif
-#ifndef _BlockFix_UnionFaces_HeaderFile
-#include <BlockFix_UnionFaces.hxx>
-#endif
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_IndexedDataMapOfIntegerShape.hxx
GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-// Copyright (C) 2007-2012 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 _Handle_BlockFix_BlockFixAPI_HeaderFile
-#define _Handle_BlockFix_BlockFixAPI_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_MMgt_TShared_HeaderFile
-#include <Handle_MMgt_TShared.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(MMgt_TShared);
-class BlockFix_BlockFixAPI;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_BlockFixAPI);
-
-class Handle(BlockFix_BlockFixAPI) : public Handle(MMgt_TShared) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(BlockFix_BlockFixAPI)():Handle(MMgt_TShared)() {}
- Handle(BlockFix_BlockFixAPI)(const Handle(BlockFix_BlockFixAPI)& aHandle) : Handle(MMgt_TShared)(aHandle)
- {
- }
-
- Handle(BlockFix_BlockFixAPI)(const BlockFix_BlockFixAPI* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
- {
- }
-
- Handle(BlockFix_BlockFixAPI)& operator=(const Handle(BlockFix_BlockFixAPI)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(BlockFix_BlockFixAPI)& operator=(const BlockFix_BlockFixAPI* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- BlockFix_BlockFixAPI* operator->()
- {
- return (BlockFix_BlockFixAPI *)ControlAccess();
- }
-
- BlockFix_BlockFixAPI* operator->() const
- {
- return (BlockFix_BlockFixAPI *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(BlockFix_BlockFixAPI)();
-
- Standard_EXPORT static const Handle(BlockFix_BlockFixAPI) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
-#define _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_BRepTools_Modification_HeaderFile
-#include <Handle_BRepTools_Modification.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(BRepTools_Modification);
-class BlockFix_PeriodicSurfaceModifier;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier);
-
-class Handle(BlockFix_PeriodicSurfaceModifier) : public Handle(BRepTools_Modification) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(BlockFix_PeriodicSurfaceModifier)():Handle(BRepTools_Modification)() {}
- Handle(BlockFix_PeriodicSurfaceModifier)(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle)
- {
- }
-
- Handle(BlockFix_PeriodicSurfaceModifier)(const BlockFix_PeriodicSurfaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem)
- {
- }
-
- Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const BlockFix_PeriodicSurfaceModifier* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- BlockFix_PeriodicSurfaceModifier* operator->()
- {
- return (BlockFix_PeriodicSurfaceModifier *)ControlAccess();
- }
-
- BlockFix_PeriodicSurfaceModifier* operator->() const
- {
- return (BlockFix_PeriodicSurfaceModifier *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(BlockFix_PeriodicSurfaceModifier)();
-
- Standard_EXPORT static const Handle(BlockFix_PeriodicSurfaceModifier) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
+++ /dev/null
-// Copyright (C) 2007-2012 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 _Handle_BlockFix_SphereSpaceModifier_HeaderFile
-#define _Handle_BlockFix_SphereSpaceModifier_HeaderFile
-
-#ifndef _Standard_Macro_HeaderFile
-#include <Standard_Macro.hxx>
-#endif
-#ifndef _Standard_HeaderFile
-#include <Standard.hxx>
-#endif
-
-#ifndef _Handle_BRepTools_Modification_HeaderFile
-#include <Handle_BRepTools_Modification.hxx>
-#endif
-
-class Standard_Transient;
-class Handle_Standard_Type;
-class Handle(BRepTools_Modification);
-class BlockFix_SphereSpaceModifier;
-Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_SphereSpaceModifier);
-
-class Handle(BlockFix_SphereSpaceModifier) : public Handle(BRepTools_Modification) {
- public:
- void* operator new(size_t,void* anAddress)
- {
- return anAddress;
- }
- void* operator new(size_t size)
- {
- return Standard::Allocate(size);
- }
- void operator delete(void *anAddress)
- {
- if (anAddress) Standard::Free((Standard_Address&)anAddress);
- }
- Handle(BlockFix_SphereSpaceModifier)():Handle(BRepTools_Modification)() {}
- Handle(BlockFix_SphereSpaceModifier)(const Handle(BlockFix_SphereSpaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle)
- {
- }
-
- Handle(BlockFix_SphereSpaceModifier)(const BlockFix_SphereSpaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem)
- {
- }
-
- Handle(BlockFix_SphereSpaceModifier)& operator=(const Handle(BlockFix_SphereSpaceModifier)& aHandle)
- {
- Assign(aHandle.Access());
- return *this;
- }
-
- Handle(BlockFix_SphereSpaceModifier)& operator=(const BlockFix_SphereSpaceModifier* anItem)
- {
- Assign((Standard_Transient *)anItem);
- return *this;
- }
-
- BlockFix_SphereSpaceModifier* operator->()
- {
- return (BlockFix_SphereSpaceModifier *)ControlAccess();
- }
-
- BlockFix_SphereSpaceModifier* operator->() const
- {
- return (BlockFix_SphereSpaceModifier *)ControlAccess();
- }
-
- Standard_EXPORT ~Handle(BlockFix_SphereSpaceModifier)();
-
- Standard_EXPORT static const Handle(BlockFix_SphereSpaceModifier) DownCast(const Handle(Standard_Transient)& AnObject);
-};
-#endif
# 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 GEOMAlgo : tools for Glue Faces algorithm
# File : Makefile.am
lib_LTLIBRARIES = libGEOMAlgo.la
dist_libGEOMAlgo_la_SOURCES = \
- BlockFix_BlockFixAPI.cxx \
- BlockFix_CheckTool.cxx \
- BlockFix.cxx \
- BlockFix_PeriodicSurfaceModifier.cxx \
- BlockFix_SphereSpaceModifier.cxx \
- BlockFix_UnionEdges.cxx \
- BlockFix_UnionFaces.cxx \
GEOMAlgo_Algo.cxx \
GEOMAlgo_Builder_0.cxx \
GEOMAlgo_Builder_1.cxx \
# header files
salomeinclude_HEADERS = \
- BlockFix.hxx \
- BlockFix.ixx \
- BlockFix.jxx \
- BlockFix_BlockFixAPI.hxx \
- BlockFix_BlockFixAPI.ixx \
- BlockFix_BlockFixAPI.jxx \
- BlockFix_BlockFixAPI.lxx \
- BlockFix_CheckTool.hxx \
- BlockFix_CheckTool.ixx \
- BlockFix_CheckTool.jxx \
- BlockFix_PeriodicSurfaceModifier.hxx \
- BlockFix_PeriodicSurfaceModifier.ixx \
- BlockFix_PeriodicSurfaceModifier.jxx \
- BlockFix_SphereSpaceModifier.hxx \
- BlockFix_SphereSpaceModifier.ixx \
- BlockFix_SphereSpaceModifier.jxx \
- BlockFix_UnionEdges.hxx \
- BlockFix_UnionEdges.ixx \
- BlockFix_UnionEdges.jxx \
- BlockFix_UnionFaces.hxx \
- BlockFix_UnionFaces.ixx \
- BlockFix_UnionFaces.jxx \
- Handle_BlockFix_BlockFixAPI.hxx \
- Handle_BlockFix_SphereSpaceModifier.hxx \
- Handle_BlockFix_PeriodicSurfaceModifier.hxx \
GEOMAlgo_Algo.hxx \
GEOMAlgo_BuilderArea.hxx \
GEOMAlgo_BuilderFace.hxx \
$(KERNEL_LDFLAGS) -lSALOMELocalTrace
# extra distributed files
-CDL_FILES = \
- BlockFix.cdl \
- BlockFix_BlockFixAPI.cdl \
- BlockFix_CheckTool.cdl \
- BlockFix_PeriodicSurfaceModifier.cdl \
- BlockFix_SphereSpaceModifier.cdl \
- BlockFix_UnionEdges.cdl \
- BlockFix_UnionFaces.cdl \
- GEOMAlgo.cdl
+CDL_FILES = GEOMAlgo.cdl
EXTRA_DIST += \
$(CDL_FILES) \
try {
Standard_Real first, last;
Handle(Geom_Curve) curv = BRep_Tool::Curve( TopoDS::Edge( shape ), first, last );
- if ( curv->IsCN(1) ) {
+ if ( !curv.IsNull() && curv->IsCN(1) ) {
const Standard_Real param = ( first+last ) / 2.0;
gp_Pnt middleParamPoint;
gp_Vec V1;
// 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 : GEOMBase_Helper.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
-//
+
#include "GEOMBase_Helper.h"
#include "GEOMBase.h"
#include "GEOM_Operation.h"
GEOMBase_Helper::GEOMBase_Helper( SUIT_Desktop* desktop )
: myDesktop( desktop ), myViewWindow( 0 ), myDisplayer( 0 ), myCommand( 0 ), isPreview( false ),
myIsApplyAndClose( false ), myIsOptimizedBrowsing( false ), myIsWaitCursorEnabled( true ),
- myIsDisableBrowsing(false)
+ myIsDisableBrowsing(false), myIsDisplayResult(true)
{
}
const int displayMode,
const int color )
{
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
// Set color for preview shape
getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
// set width of displayed shape
- int lw = lineWidth;
- if(lw == -1) {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
- }
- getDisplayer()->SetWidth( lw );
+ getDisplayer()->SetWidth( lineWidth == -1 ? resMgr->integerValue("Geometry", "preview_edge_width", -1) : lineWidth );
// set display mode of displayed shape
- int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode );
+ int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode == -1 ? resMgr->integerValue( "Geometry", "display_mode", 0 ) : displayMode );
// Disable activation of selection
getDisplayer()->SetToActivate( activate );
getGeomEngine()->AddInStudy(aStudyDS, theObj, theName, aFatherObj);
QString anEntry;
- if ( !aSO->_is_nil() )
- anEntry = aSO->GetID();
-
+ if ( !aSO->_is_nil() ) {
+ CORBA::String_var entry = aSO->GetID();
+ anEntry = entry.in();
+ }
// Each dialog is responsible for this method implementation,
// default implementation does nothing
restoreSubShapes(aStudyDS, aSO);
//================================================================
bool GEOMBase_Helper::hasCommand() const
{
- bool res = (bool) myCommand;
return (bool)myCommand;
}
addSubshapesToStudy(); // add Sub-shapes if local selection
const int nbObjs = objects.size();
QStringList anEntryList;
- int aNumber = 1;
- for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
+ int currObj = 1, aNumber = 1;
+ for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it, currObj++ ) {
GEOM::GEOM_Object_var obj=*it;
if ( publish ) {
- QString aName = getNewObjectName();
+ QString aName = getNewObjectName(currObj);
if ( nbObjs > 1 ) {
if (aName.isEmpty())
aName = getPrefix(obj);
}
anEntryList << addInStudy( obj, aName.toLatin1().constData() );
// updateView=false
- display( obj, false );
+ if( isDisplayResult() )
+ display( obj, false );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// was modified, and need to be re-cached in GEOM_Client before redisplay
clearShapeBuffer( obj );
// withChildren=true, updateView=false
- redisplay( obj, true, false );
+ if( isDisplayResult() )
+ redisplay( obj, true, false );
}
}
// Function : getNewObjectName
// Purpose : Redefine this method to return proper name for a new object
//================================================================
-QString GEOMBase_Helper::getNewObjectName() const
+QString GEOMBase_Helper::getNewObjectName (int) const
{
return QString::null;
}
if ( sobject ) {
_PTR(ChildIterator) it( studyDS->NewChildIterator( sobject ) );
for ( ; it->More() && !found; it->Next() ) {
- GEOM::GEOM_Object_var cobject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( it->Value() ) );
- if ( !CORBA::is_nil( cobject ) ) {
- GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices();
- int length = indices->length();
- for ( int i = 0; i < length && !found; i++ ) {
- if ( indices[i] == theIndex ) {
- object = cobject;
- found = true;
- }
- }
- }
+ GEOM::GEOM_Object_var cobject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( it->Value() ) );
+ if ( !CORBA::is_nil( cobject ) ) {
+ GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices();
+ int length = indices->length();
+ for ( int i = 0; i < length && !found; i++ ) {
+ if ( indices[i] == theIndex ) {
+ object = cobject;
+ found = true;
+ }
+ }
+ }
}
}
}
SALOME_ListIteratorOfListIO it( selected );
bool stopped = false;
for ( ; it.More() && !stopped; it.Next() ) {
- Handle(SALOME_InteractiveObject) IO = it.Value();
- GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO );
- if ( object ) {
- TColStd_IndexedMapOfInteger subShapes;
- selMgr->GetIndexes( IO, subShapes );
- int nbSubShapes = subShapes.Extent();
- if ( nbSubShapes == 0 ) {
- // global selection
- if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) {
- result << object;
- if ( count > 0 ) {
- if ( strict && result.count() > count ) {
- result.clear();
- stopped = true;
- }
- else if ( !strict && result.count() == count )
- stopped = true;
- }
- }
- else if ( strict ) {
- result.clear();
- stopped = true;
- }
- }
- else {
- // local selection
- for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) {
- int idx = subShapes( i );
- GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx );
- if ( !subShape ) {
- // sub-shape is not yet published in the study
- GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
- subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership!
- }
- if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) {
- result << subShape;
- if ( count > 0 ) {
- if ( strict && result.count() > count ) {
- result.clear();
- stopped = true;
- }
- else if ( !strict && result.count() == count )
- stopped = true;
- }
- }
- else if ( strict ) {
- result.clear();
- stopped = true;
- }
- }
- }
- }
+ Handle(SALOME_InteractiveObject) IO = it.Value();
+ GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO );
+ if ( object ) {
+ TColStd_IndexedMapOfInteger subShapes;
+ selMgr->GetIndexes( IO, subShapes );
+ int nbSubShapes = subShapes.Extent();
+ if ( nbSubShapes == 0 ) {
+ // global selection
+ if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) {
+ result << object;
+ if ( count > 0 ) {
+ if ( strict && result.count() > count ) {
+ result.clear();
+ stopped = true;
+ }
+ else if ( !strict && result.count() == count )
+ stopped = true;
+ }
+ }
+ else if ( strict ) {
+ result.clear();
+ stopped = true;
+ }
+ }
+ else {
+ // local selection
+ for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) {
+ int idx = subShapes( i );
+ GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx );
+ if ( !subShape ) {
+ // sub-shape is not yet published in the study
+ GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+ subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership!
+ }
+ if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) {
+ result << subShape;
+ if ( count > 0 ) {
+ if ( strict && result.count() > count ) {
+ result.clear();
+ stopped = true;
+ }
+ else if ( !strict && result.count() == count )
+ stopped = true;
+ }
+ }
+ else if ( strict ) {
+ result.clear();
+ stopped = true;
+ }
+ }
+ }
+ }
}
}
}
// 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 : GEOMBase_Helper.h
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
-//
+
#ifndef GEOMBASE_HELPER_H
#define GEOMBASE_HELPER_H
//================================================================
// Class : GEOMBase_Helper
-// Description : Helper class for dialog box development, can be used as
+// Description : Helper class for dialog box development, can be used as
// the second base class for dialog boxes. Contains convenient methods
// performing common operations (display/erase, selection activation,
// publication in a study, transaction management)
void redisplay ( GEOM::GEOM_Object_ptr, const bool = true, const bool = true );
virtual void displayPreview ( const bool display,
- const bool activate = false,
+ const bool activate = false,
const bool update = true,
const bool toRemoveFromEngine = true,
- const double lineWidth = -1,
+ const double lineWidth = -1,
const int displayMode = -1,
const int color = -1 );
// This is the easiest way to show preview. It is based on execute() method.
// It removes temporary GEOM::GEOM_Objects automatically.
- virtual void displayPreview ( GEOM::GEOM_Object_ptr obj,
- const bool append = false,
- const bool activate = false,
+ virtual void displayPreview ( GEOM::GEOM_Object_ptr obj,
+ const bool append = false,
+ const bool activate = false,
const bool update = true,
- const double lineWidth = -1,
+ const double lineWidth = -1,
const int displayMode = -1,
const int color = -1 );
- void displayPreview ( const SALOME_Prs* prs,
- const bool append = false,
+ void displayPreview ( const SALOME_Prs* prs,
+ const bool append = false,
const bool = true );
void erasePreview ( const bool = true );
void prepareSelection( const ObjectList&, const int );
void prepareSelection( GEOM::GEOM_Object_ptr, const int );
- QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName );
+ QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName );
bool openCommand ();
bool abortCommand ();
bool onAccept( const bool publish = true, const bool useTransaction = true, bool erasePreviewFlag = true);
// This method should be called from "OK" button handler.
- // <publish> == true means that objects returned by execute()
+ // <publish> == true means that objects returned by execute()
// should be published in a study.
void showError();
inline void setPrefix( const QString& prefix ) { myPrefix = prefix; }
QString getPrefix( GEOM::GEOM_Object_ptr = GEOM::GEOM_Object::_nil() ) const;
-
+
bool selectObjects( ObjectList& objects );
- // Selects list of objects
+ // Selects list of objects
////////////////////////////////////////////////////////////////////////////
// Virtual methods, to be redefined in dialog classes
////////////////////////////////////////////////////////////////////////////
virtual GEOM::GEOM_IOperations_ptr createOperation();
- // This method should be redefined in dialog boxes so as to return
+ // This method should be redefined in dialog boxes so as to return
// proper GEOM_IOperation interface.
// Returns nil reference by default
// Called by onAccept(). Redefine this method to check validity of user input in dialog boxes.
virtual bool execute( ObjectList& objects );
- // This method is called by onAccept().
- // It should perform the required operation and put all new or modified objects into
- // <objects> argument.Should return <false> if some error occurs during its execution.
+ // This method is called by onAccept().
+ // It should perform the required operation and put all new or modified objects into
+ // <objects> argument.Should return <false> if some error occurs during its execution.
virtual void restoreSubShapes( SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_ptr theSObject );
// This method is called by addInStudy().
// for <theObj> or a nil reference if <theObj> should be published
// as a top-level object.
- virtual QString getNewObjectName() const;
+ virtual QString getNewObjectName (int CurrObj = -1) const;
virtual bool extractPrefix() const;
virtual void addSubshapesToStudy();
virtual void setIsOptimizedBrowsing( const bool theFlag );
virtual bool isOptimizedBrowsing() const;
-
+
virtual void setIsWaitCursorEnabled( const bool theFlag ) {myIsWaitCursorEnabled = theFlag;}
virtual bool isWaitCursorEnabled() const {return myIsWaitCursorEnabled ;}
virtual void setIsDisableBrowsing( const bool theFlag ) { myIsDisableBrowsing = theFlag; }
virtual bool isDisableBrowsing() const { return myIsDisableBrowsing; }
-
+ virtual void setIsDisplayResult( const bool theFlag ) {myIsDisplayResult = theFlag; }
+ virtual bool isDisplayResult() const { return myIsDisplayResult; }
private:
QString getEntry( GEOM::GEOM_Object_ptr ) const;
bool myIsApplyAndClose;
bool myIsOptimizedBrowsing;
bool myIsWaitCursorEnabled;
- bool myIsDisableBrowsing; //This flag enable/disable selection
+ bool myIsDisableBrowsing; //This flag enable/disable selection
//in the Object Browser newly created objects.
-
+ bool myIsDisplayResult; //This flag display/hide newly created objects.
};
#endif // GEOMBASE_HELPER_H
// 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 : GEOMBase_Skeleton.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#include "GEOMBase_Skeleton.h"
#include "GEOMBase.h"
// function : getNewObjectName()
// purpose : returns contents of Name field
//=================================================================================
-QString GEOMBase_Skeleton::getNewObjectName() const
+QString GEOMBase_Skeleton::getNewObjectName (int) const
{
return myMainFrame->ResultName->text();
}
// 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 : GEOMBase_Skeleton.h
// Author : Damine COQUERET, Open CASCADE S.A.S.
-//
+
#ifndef GEOMBASE_SKELETON_H
#define GEOMBASE_SKELETON_H
/*! returns contents of "Name" field
*/
- virtual QString getNewObjectName() const;
+ virtual QString getNewObjectName (int CurrObj = -1) const;
/*! returns id of a selected "constructor" radio button or '-1' in case of error
*/
void Register()
{
if ( !CORBA::is_nil( this->myObject ) )
- this->myObject->Register();
+ this->myObject->Register();
}
//! Decrement counter for the object.
void UnRegister()
{
if ( !CORBA::is_nil( this->myObject ) ) {
- this->myObject->UnRegister();
- this->myObject = TInterface::_nil();
+ this->myObject->UnRegister();
+ this->myObject = TInterface::_nil();
}
}
# Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
{
}
+//=================================================================================
+// class : GEOMGUI::OnGUIEvent
+// purpose : Main/popup menu events processing
+//=================================================================================
+bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/, const QVariant& /*theParam*/ )
+{
+ return TRUE;
+}
+
//=================================================================================
// class : GEOMGUI::OnGUIEvent
// purpose : Main/popup menu events processing
// Each of this methods can be redifined by descendants
virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent );
+ virtual bool OnGUIEvent( int theCommandID, SUIT_Desktop* parent, const QVariant& theParam );
virtual bool OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
virtual bool OnMouseMove( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* );
bool GEOMGUI_Selection::isVisible( const int index ) const
{
- bool res = false;
-
#ifdef USE_VISUAL_PROP_MAP
- bool found = false;
- QVariant v = visibleProperty( entry( index ), VISIBILITY_PROP );
- if ( v.canConvert( QVariant::Bool ) ) {
- res = v.toBool();
- found = true;
- }
-
- if ( !found ) {
+ QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Visibility ) );
+ if ( v.canConvert( QVariant::Bool ) )
+ return v.toBool();
#endif
- GEOM::GEOM_Object_var obj = getObject( index );
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- if ( !CORBA::is_nil( obj ) && view ) {
- Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
- res = view->isVisible( io );
- }
-#ifdef USE_VISUAL_PROP_MAP
+
+ bool res = false;
+
+ GEOM::GEOM_Object_var obj = getObject( index );
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ if ( !CORBA::is_nil( obj ) && view ) {
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" );
+ res = view->isVisible( io );
}
-#endif
return res;
}
{
QString res;
QString viewType = activeViewType();
+
#ifdef USE_VISUAL_PROP_MAP
- QVariant v = visibleProperty( entry( index ), DISPLAY_MODE_PROP );
+ QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::DisplayMode ) );
if ( v.canConvert( QVariant::Int ) ) {
int dm = v.toInt();
if ( viewType == OCCViewer_Viewer::Type() ) {
} else if ( viewType == SVTK_Viewer::Type() ) {
VTK_DISPLAY_MODE_TO_STRING( res, dm );
}
+ return res;
}
-
- if ( res.isEmpty() ) {
#endif
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
- SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
- if ( prs ) {
- if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
- SOCC_Prs* occPrs = (SOCC_Prs*) prs;
- AIS_ListOfInteractive lst;
- occPrs->GetObjects( lst );
- if ( lst.Extent() ) {
- Handle(AIS_InteractiveObject) io = lst.First();
- if ( !io.IsNull() ) {
- int dm;
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
- if(!aSh.IsNull()) {
- dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
- } else {
- dm = io->DisplayMode();
- }
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ int dm;
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if(!aSh.IsNull()) {
+ dm = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
+ } else {
+ dm = io->DisplayMode();
+ }
+ OCC_DISPLAY_MODE_TO_STRING( res, dm );
+ if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
+ OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
+ desktop()->activeWindow()->getViewManager()->getViewModel();
+ Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
+ dm = ic->DisplayMode();
OCC_DISPLAY_MODE_TO_STRING( res, dm );
- if ( res.isEmpty() ) { // return default display mode of AIS_InteractiveContext
- OCCViewer_Viewer* occViewer = (OCCViewer_Viewer*)SUIT_Session::session()->activeApplication()->
- desktop()->activeWindow()->getViewManager()->getViewModel();
- Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
- dm = ic->DisplayMode();
- OCC_DISPLAY_MODE_TO_STRING( res, dm );
- }
}
}
}
- else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
- vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
- if ( lst ) {
- lst->InitTraversal();
- vtkActor* actor = lst->GetNextActor();
- if ( actor ) {
- SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
- if ( salActor ) {
- int dm = salActor->getDisplayMode();
- VTK_DISPLAY_MODE_TO_STRING( res, dm );
- } // if ( salome actor )
- } // if ( actor )
- } // if ( lst == vtkPrs->GetObjects() )
- } // if VTK
}
+ else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+ vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
+ if ( lst ) {
+ lst->InitTraversal();
+ vtkActor* actor = lst->GetNextActor();
+ if ( actor ) {
+ SALOME_Actor* salActor = dynamic_cast<SALOME_Actor*>( actor );
+ if ( salActor ) {
+ int dm = salActor->getDisplayMode();
+ VTK_DISPLAY_MODE_TO_STRING( res, dm );
+ } // if ( salome actor )
+ } // if ( actor )
+ } // if ( lst == vtkPrs->GetObjects() )
+ } // if VTK
}
-
-#ifdef USE_VISUAL_PROP_MAP
}
-#endif
return res;
}
bool GEOMGUI_Selection::isVectorsMode( const int index ) const
{
- bool res = false;
-
#ifdef USE_VISUAL_PROP_MAP
- bool found = false;
- QVariant v = visibleProperty( entry( index ), VECTOR_MODE_PROP );
- if ( v.canConvert( QVariant::Bool ) ) {
- res = v.toBool();
- found = true;
- }
-
- if ( !found ) {
+ QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::EdgesDirection ) );
+ if ( v.canConvert( QVariant::Bool ) )
+ return v.toBool();
#endif
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- QString viewType = activeViewType();
- if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
- SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
- if ( prs ) {
- if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
- SOCC_Prs* occPrs = (SOCC_Prs*) prs;
- AIS_ListOfInteractive lst;
- occPrs->GetObjects( lst );
- if ( lst.Extent() ) {
- Handle(AIS_InteractiveObject) io = lst.First();
- if ( !io.IsNull() ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
- if ( !aSh.IsNull() )
- res = aSh->isShowVectors();
- }
+
+ bool res = false;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ QString viewType = activeViewType();
+ if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if ( !aSh.IsNull() )
+ res = aSh->isShowVectors();
}
- } else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
- vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
- if ( lst ) {
- lst->InitTraversal();
- vtkActor* actor = lst->GetNextActor();
- if ( actor ) {
- GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
- if ( aGeomActor )
- res = aGeomActor->GetVectorMode();
+ }
+ }
+ else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+ vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
+ if ( lst ) {
+ lst->InitTraversal();
+ vtkActor* actor = lst->GetNextActor();
+ if ( actor ) {
+ GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(actor);
+ if ( aGeomActor )
+ res = aGeomActor->GetVectorMode();
}
- }
}
}
}
-#ifdef USE_VISUAL_PROP_MAP
}
-#endif
return res;
}
return "";
}
-bool GEOMGUI_Selection::topLevel( const int index ) const {
- bool res = false;
-
+bool GEOMGUI_Selection::topLevel( const int index ) const
+{
#ifdef USE_VISUAL_PROP_MAP
- bool found = false;
- QVariant v = visibleProperty( entry( index ), TOP_LEVEL_PROP );
- if ( v.canConvert<bool>() ) {
- res = v.toBool();
- found = true;
- }
-
- if ( !found ) {
+ QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::TopLevel ) );
+ if ( v.canConvert<bool>() )
+ return v.toBool();
#endif
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- QString viewType = activeViewType();
- if ( view && viewType == OCCViewer_Viewer::Type() ) {
- SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
- if ( prs ) {
- if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
- SOCC_Prs* occPrs = (SOCC_Prs*) prs;
- AIS_ListOfInteractive lst;
- occPrs->GetObjects( lst );
- if ( lst.Extent() ) {
- Handle(AIS_InteractiveObject) io = lst.First();
- if ( !io.IsNull() ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
- if ( !aSh.IsNull() )
- res = (bool)aSh->isTopLevel();
- }
+
+ bool res = false;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ QString viewType = activeViewType();
+ if ( view && viewType == OCCViewer_Viewer::Type() ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if ( !aSh.IsNull() )
+ res = (bool)aSh->isTopLevel();
}
}
}
return res;
}
-bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{
- bool res = false;
-
+bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const
+{
#ifdef USE_VISUAL_PROP_MAP
- bool found = false;
- QVariant v = visibleProperty( entry( idx ), MATERIAL_PROP );
- if ( v.canConvert<QString>() ) {
- Material_Model material;
- material.fromProperties( v.toString() );
- res = material.isPhysical();
- found = true;
- }
-
- if ( !found ) {
+ QVariant v = visibleProperty( entry( idx ), GEOM::propertyName( GEOM::Material ) );
+ if ( v.canConvert<QString>() ) {
+ Material_Model material;
+ material.fromProperties( v.toString() );
+ return material.isPhysical();
+ }
#endif
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- QString viewType = activeViewType();
- if ( view ) {
- SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
- if ( prs ) {
- if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
- SOCC_Prs* occPrs = (SOCC_Prs*) prs;
- AIS_ListOfInteractive lst;
- occPrs->GetObjects( lst );
- if ( lst.Extent() ) {
- Handle(AIS_InteractiveObject) io = lst.First();
- if ( !io.IsNull() ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
- if ( !aSh.IsNull() )
- res = (bool) aSh->Attributes()->ShadingAspect()->
- Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
- }
- }
- }
- else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
- vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
- if ( lst ) {
- lst->InitTraversal();
- vtkActor* actor = lst->GetNextActor();
- if ( actor ) {
- GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor );
- if ( aGeomGActor ) {
- GEOM_VTKPropertyMaterial* mat = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty());
- res = mat->GetPhysical();
- } // if ( salome actor )
- } // if ( actor )
- } // if ( lst == vtkPrs->GetObjects() )
- }
- }
- }
- }
- return res;
+
+ bool res = false;
+
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ QString viewType = activeViewType();
+ if ( view ) {
+ SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() );
+ if ( prs ) {
+ if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC
+ SOCC_Prs* occPrs = (SOCC_Prs*) prs;
+ AIS_ListOfInteractive lst;
+ occPrs->GetObjects( lst );
+ if ( lst.Extent() ) {
+ Handle(AIS_InteractiveObject) io = lst.First();
+ if ( !io.IsNull() ) {
+ Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(io);
+ if ( !aSh.IsNull() )
+ res = (bool) aSh->Attributes()->ShadingAspect()->
+ Material(Aspect_TOFM_BOTH_SIDE).MaterialType( Graphic3d_MATERIAL_PHYSIC );
+ }
+ }
+ }
+ else if ( viewType == SVTK_Viewer::Type() ) { // assuming VTK
+ SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+ vtkActorCollection* lst = vtkPrs ? vtkPrs->GetObjects() : 0;
+ if ( lst ) {
+ lst->InitTraversal();
+ vtkActor* actor = lst->GetNextActor();
+ if ( actor ) {
+ GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( actor );
+ if ( aGeomGActor ) {
+ GEOM_VTKPropertyMaterial* mat = GEOM_VTKPropertyMaterial::SafeDownCast(aGeomGActor->GetProperty());
+ res = mat->GetPhysical();
+ } // if ( salome actor )
+ } // if ( actor )
+ } // if ( lst == vtkPrs->GetObjects() )
+ }
+ }
+ }
+
+ return res;
}
// of auto-color picking up
#define SIMPLE_AUTOCOLOR
+// Hard-coded value of shape deflection coefficient for VTK viewer
+const double VTK_MIN_DEFLECTION = 0.001;
+
//================================================================
// Function : getActiveStudy
// Purpose : Get active study, returns 0 if no open study frame
myShadingColor = SalomeApp_Tools::color( col );
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
+ myHasDisplayMode = false;
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
myToActivate = true;
// This parameter is used for activisation/deactivisation of objects to be displayed
-
+
#if OCC_VERSION_LARGE > 0x06050100 // Functionnality available only in OCCT 6.5.2
- // Activate parallel vizualisation only for testing purpose
- // and if the corresponding env variable is set to 1
+ // Activate parallel vizualisation only for testing purpose
+ // and if the corresponding env variable is set to 1
char* parallel_visu = getenv("PARALLEL_VISU");
if (parallel_visu && atoi(parallel_visu))
{
int aMgrId = getViewManagerId(vf);
SalomeApp_Study* aStudy = getStudy();
- aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 1 );
+ aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 1 );
setVisibilityState(theIO->getEntry(), Qtx::ShownState);
int aMgrId = getViewManagerId(vf);
SalomeApp_Study* aStudy = getStudy();
- aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 0 );
+ aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 0 );
setVisibilityState(theIO->getEntry(), Qtx::HiddenState);
}
UpdateViewer();
}
+Quantity_Color GEOM_Displayer::qColorFromResources( const QString& property, const QColor& defColor )
+{
+ // VSR: this method can be improved in future:
+ // to improve performance, the default values from resource manager should be cached in the displayer
+ return SalomeApp_Tools::color( SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", property, defColor ) );
+}
+
+QColor GEOM_Displayer::colorFromResources( const QString& property, const QColor& defColor )
+{
+ // VSR: this method can be improved in future:
+ // to improve performance, the default values from resource manager should be cached in the displayer
+ return SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", property, defColor );
+}
+
+void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create )
+{
+ // check that shape is not null
+ if ( AISShape.IsNull() ) return;
+
+ // check that study is active
+ SalomeApp_Study* study = getStudy();
+ if ( !study ) return;
+
+ if ( myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points
+ !TopoDS_Iterator(myShape).More() )
+ return; // NPAL15983 (Bug when displaying empty groups)
+
+ // set interactive object
+
+ Handle( SALOME_InteractiveObject ) anIO;
+
+ if ( !myIO.IsNull() ) {
+ AISShape->setIO( myIO );
+ AISShape->SetOwner( myIO );
+ anIO = myIO;
+ }
+ else if ( !myName.empty() ) {
+ // workaround to allow selection of temporary objects
+ static int tempId = 0;
+ anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
+ AISShape->setIO( anIO );
+ AISShape->SetOwner( anIO );
+ }
+
+ // flag: only vertex or compound of vertices is processed (specific handling)
+ bool onlyVertex = myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape );
+ // presentation study entry (empty for temporary objects like preview)
+ QString entry = !anIO.IsNull() ? QString( anIO->getEntry() ) : QString();
+ // flag: temporary object
+ bool isTemporary = entry.isEmpty() || entry.startsWith( "TEMP_" );
+ // currently active view window's ID (-1 if no active view)
+ int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
+
+ // get presentation properties
+ PropMap propMap = getObjectProperties( study, entry, myViewFrame );
+
+ // Temporary staff: vertex must be infinite for correct visualization
+ AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
+
+ // set material
+ Material_Model material;
+ // if predefined color isn't set in displayer(via GEOM_Displayer::SetColor() function)
+ if( !HasColor() )
+ material.fromProperties( propMap.value( GEOM::propertyName( GEOM::Material ) ).toString() );
+ // - set front material properties
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_FRONT_SIDE );
+ AISShape->SetMaterial( material.getMaterialOCCAspect( true ) );
+ // - set back material properties
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_BACK_SIDE );
+ AISShape->SetMaterial( material.getMaterialOCCAspect( false ) );
+ // - switch to default (both sides) facing mode
+ AISShape->SetCurrentFacingModel( Aspect_TOFM_BOTH_SIDE );
+
+ // set colors
+
+ // - shading color
+ if ( HasColor() ) {
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function;
+ // we set it to the shape not taking into account material properties
+ AISShape->SetShadingColor( (Quantity_NameOfColor)GetColor() );
+ }
+ else if ( !material.isPhysical() ) {
+ // shading color from properties is used only for non-physical materials
+ AISShape->SetShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::ShadingColor ) ).value<QColor>() ) );
+ }
+
+ // - wireframe color
+ Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetLineAspect( anAspect );
+
+ // - unfree boundaries color
+ anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
+
+ // - free boundaries color
+ anAspect = AISShape->Attributes()->FreeBoundaryAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
+
+ // - standalone edges color
+ anAspect = AISShape->Attributes()->WireAspect();
+ anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::LineColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetWireAspect( anAspect );
+
+ // - color for edges in shading+edges mode
+ AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
+
+ // ???
+ AISShape->storeBoundaryColors();
+
+ // set display mode
+ AISShape->SetDisplayMode( HasDisplayMode() ?
+ // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
+ GetDisplayMode() :
+ // display mode from properties
+ propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
+
+ // set display vectors flag
+ AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
+
+ // set transparency
+ // VSR: ??? next line is commented: transparency property is set in the AfterDisplay() function
+ //AISShape->SetTransparency( propMap.value( GEOM::propertyName( GEOM::Transparency ) ).toDouble() );
+
+ // set iso properties
+ int uIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[0].toInt();
+ int vIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[1].toInt();
+ Quantity_Color isosColor = SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>() );
+ int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
+ Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
+ Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
+ uIsoAspect->SetColor( isosColor );
+ uIsoAspect->SetWidth( isosWidth );
+ uIsoAspect->SetNumber( uIsos );
+ vIsoAspect->SetColor( isosColor );
+ vIsoAspect->SetWidth( isosWidth );
+ vIsoAspect->SetNumber( vIsos );
+ AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
+ AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
+
+ // set deflection coefficient
+ // ... to avoid to small values of the coefficient, its lower value is limited
+ AISShape->SetOwnDeviationCoefficient( qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ) );
+
+ // set texture
+ if ( HasTexture() ) {
+ // predefined display texture, manually set to displayer via GEOM_Displayer::SetTexture() function
+ AISShape->SetTextureFileName( TCollection_AsciiString( GetTexture().c_str() ) );
+ AISShape->SetTextureMapOn();
+ AISShape->DisableTextureModulate();
+ AISShape->SetDisplayMode( 3 );
+ }
+
+ // set line width
+ AISShape->SetWidth( HasWidth() ?
+ // predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
+ GetWidth() :
+ // libe width from properties
+ propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
+
+ // set top-level flag
+ AISShape->setTopLevel( propMap.value( GEOM::propertyName( GEOM::TopLevel ) ).toBool() );
+
+ // set point marker (for vertex / compound of vertices only)
+ if ( onlyVertex ) {
+ QStringList aList = propMap.value( GEOM::propertyName( GEOM::PointMarker ) ).toString().split( GEOM::subSectionSeparator() );
+ if ( aList.size() == 2 ) {
+ // standard marker string contains "TypeOfMarker:ScaleOfMarker"
+ int aTypeOfMarker = aList[0].toInt();
+ double aScaleOfMarker = (aList[1].toInt() + 1) * 0.5;
+ Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
+ anAspect->SetScale( aScaleOfMarker );
+ anAspect->SetTypeOfMarker( (Aspect_TypeOfMarker)( aTypeOfMarker-1 ) );
+ anAspect->SetColor( HasColor() ?
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ) );
+ AISShape->Attributes()->SetPointAspect( anAspect );
+ }
+ else if ( aList.size() == 1 ) {
+ // custom marker string contains "IdOfTexture"
+ int textureId = aList[0].toInt();
+ Standard_Integer aWidth, aHeight;
+#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
+ Handle(TColStd_HArray1OfByte) aTexture =
+#else
+ Handle(Graphic3d_HArray1OfBytes) aTexture =
+#endif
+ GeometryGUI::getTexture( study, textureId, aWidth, aHeight );
+ if ( !aTexture.IsNull() ) {
+ static int TextureId = 0;
+ Handle(Prs3d_PointAspect) aTextureAspect =
+ new Prs3d_PointAspect( HasColor() ?
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ (Quantity_NameOfColor)GetColor() :
+ // color from properties
+ SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
+ ++TextureId,
+ aWidth, aHeight,
+ aTexture );
+ AISShape->Attributes()->SetPointAspect( aTextureAspect );
+ }
+ }
+ }
+
+ if ( create && !isTemporary && aMgrId != -1 ) {
+ // set properties to the study
+ study->setObjectPropMap( aMgrId, entry, propMap );
+ }
+
+ // AISShape->SetName(???); ??? necessary to set name ???
+}
+
+void GEOM_Displayer::updateActorProperties( GEOM_Actor* actor, bool create )
+{
+ // check that actor is not null
+ if ( !actor ) return;
+
+ // check that study is active
+ SalomeApp_Study* study = getStudy();
+ if ( !study ) return;
+
+ // set interactive object
+
+ Handle( SALOME_InteractiveObject ) anIO;
+
+ if ( !myIO.IsNull() ) {
+ actor->setIO( myIO );
+ anIO = myIO;
+ }
+ else if ( !myName.empty() ) {
+ // workaround to allow selection of temporary objects
+ static int tempId = 0;
+ anIO = new SALOME_InteractiveObject( QString( "TEMP_VTK_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
+ actor->setIO( anIO );
+ }
+
+ // presentation study entry (empty for temporary objects like preview)
+ QString entry = !anIO.IsNull() ? QString( anIO->getEntry() ) : QString();
+ // flag: temporary object
+ bool isTemporary = entry.isEmpty() || entry.startsWith( "TEMP_" );
+ // currently active view window's ID (-1 if no active view)
+ int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
+
+ // get presentation properties
+ PropMap propMap = getObjectProperties( study, entry, myViewFrame );
+ QColor c;
+
+ /////////////////////////////////////////////////////////////////////////
+ // VSR: for VTK viewer currently deflection coefficient is hardcoded
+ // due to performance problem
+ // actor->SetShape(myShape,aDefPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble(),myType == GEOM_VECTOR);
+ /////////////////////////////////////////////////////////////////////////
+ if ( !actor->getTopo().IsSame( myShape ) )
+ actor->SetShape( myShape, VTK_MIN_DEFLECTION, myType == GEOM_VECTOR );
+
+ // set material
+ Material_Model material;
+ material.fromProperties( propMap.value( GEOM::propertyName( GEOM::Material ) ).toString() );
+ std::vector<vtkProperty*> mprops;
+ mprops.push_back( material.getMaterialVTKProperty( true ) );
+ mprops.push_back( material.getMaterialVTKProperty( false) );
+ actor->SetMaterial( mprops );
+
+ // set iso-lines properties
+
+ // - set number of iso-lines
+ int nbIsos[2]= { 1, 1 };
+ QStringList isos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() );
+ nbIsos[0] = isos[0].toInt();
+ nbIsos[1] = isos[1].toInt();
+ actor->SetNbIsos( nbIsos );
+
+ // - set iso-lines width
+ actor->SetIsosWidth( propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt() );
+
+ // - set iso-lines color
+ c = propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>();
+ actor->SetIsosColor( c.redF(), c.greenF(), c.blueF() );
+
+ // set colors
+
+ if ( HasColor() ) {
+ // - same color for all sub-actors
+ Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
+ actor->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
+ }
+ else {
+ // shading color (for non-physical materials)
+ if ( !material.isPhysical() ) {
+ c = propMap.value( GEOM::propertyName( GEOM::ShadingColor ) ).value<QColor>();
+ actor->GetFrontMaterial()->SetColor( c.redF(), c.greenF(), c.blueF() );
+ actor->GetBackMaterial()->SetColor( c.redF(), c.greenF(), c.blueF() );
+ }
+
+ // - standalone edge color
+ c = propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>();
+ actor->SetIsolatedEdgeColor( c.redF(), c.greenF(), c.blueF() );
+
+ c = propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>();
+ // - shared edges color ???
+ actor->SetSharedEdgeColor( c.redF(), c.greenF(), c.blueF() );
+
+ c = propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value<QColor>();
+ // - free edges color ???
+ actor->SetFreeEdgeColor( c.redF(), c.greenF(), c.blueF() );
+
+ // - point color
+ c = propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>();
+ actor->SetPointColor( c.redF(), c.greenF(), c.blueF() );
+ }
+
+ // - color for edges in shading+edges mode
+ c = propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>();
+ actor->SetEdgesInShadingColor( c.redF(), c.greenF(), c.blueF() );
+
+ // set opacity
+ actor->SetOpacity( 1.0 - propMap.value( GEOM::propertyName( GEOM::Transparency ) ).toDouble() );
+
+ // set line width
+ actor->SetWidth( HasWidth() ?
+ // predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
+ GetWidth() :
+ // libe width from properties
+ propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
+
+ // set display vectors flag
+ actor->SetVectorMode( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
+
+ // set display mode
+ int displayMode = HasDisplayMode() ?
+ // predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
+ GetDisplayMode() :
+ // display mode from properties
+ propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt();
+
+ // specific processing of 'shading with edges' mode, as VTK provides only the following standard display modes:
+ // Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
+ // GEOM actor allows alternative display modes (see VTKViewer::Representation enum) and enum in GEOM_Actor:
+ // eWireframe - 0, eShading - 1, eShadingWithEdges - 3
+
+ if ( displayMode == 2 )
+ // this is 'Shading with edges' mode => we have to do the correct mapping to EDisplayMode
+ // enum in GEOM_Actor (and further to VTKViewer::Representation enum)
+ displayMode++;
+ actor->setDisplayMode( displayMode );
+
+ if ( myToActivate )
+ actor->PickableOn();
+ else
+ actor->PickableOff();
+
+ if ( create && !isTemporary && aMgrId != -1 ) {
+ // set properties to the study
+ study->setObjectPropMap( aMgrId, entry, propMap );
+ }
+}
+
//=================================================================
/*!
* GEOM_Displayer::Erase
void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
{
SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( prs );
- if ( !occPrs )
+ SalomeApp_Study* study = getStudy();
+
+ if ( !occPrs || myShape.IsNull() || !study )
return;
- if ( myType == GEOM_MARKER && !myShape.IsNull() && myShape.ShapeType() == TopAbs_FACE )
+ if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE )
{
+ //
+ // specific processing for local coordinate system presentation
+ //
+
TopoDS_Face aFace = TopoDS::Face( myShape );
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
if ( !aPlane.IsNull() )
if ( occPrs->IsNull() )
{
+ // new presentation is being created
aTrh = new GEOM_AISTrihedron( aPlc );
-
- if ( HasColor() )
- aTrh->SetColor( (Quantity_NameOfColor)GetColor() );
-
- if ( HasWidth() )
- aTrh->SetWidth( GetWidth() );
-
- if ( !myIO.IsNull() )
- {
- aTrh->setIO( myIO );
- aTrh->SetOwner( myIO );
- }
-
occPrs->AddObject( aTrh );
}
else
{
+ // presentation is being updated
AIS_ListOfInteractive aList;
occPrs->GetObjects( aList );
AIS_ListIteratorOfListOfInteractive anIter( aList );
- for ( ; anIter.More(); anIter.Next() )
- {
+ for ( ; anIter.More() && aTrh.IsNull(); anIter.Next() ) {
aTrh = Handle(GEOM_AISTrihedron)::DownCast( anIter.Value() );
- if ( !aTrh.IsNull() )
- {
- aTrh->SetComponent( aPlc );
- aTrh->SetToUpdate();
- }
+ }
+ }
+
+ if ( !aTrh.IsNull() ) {
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ if ( HasColor() )
+ aTrh->SetColor( (Quantity_NameOfColor)GetColor() );
+ // predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
+ if ( HasWidth() )
+ aTrh->SetWidth( GetWidth() );
+
+ if ( !myIO.IsNull() )
+ {
+ aTrh->setIO( myIO );
+ aTrh->SetOwner( myIO );
}
+ aTrh->SetComponent( aPlc );
+ aTrh->SetToUpdate();
}
-
occPrs->SetToActivate( ToActivate() );
}
}
else
{
+ //
+ // processing for usual geometry presentation
+ //
+
// if presentation is empty we try to create new one
if ( occPrs->IsNull() )
{
- SalomeApp_Study* aStudy = getStudy();
- if(!aStudy)
- return;
- if ( !myShape.IsNull() ) {
-
- bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape ));
-
- QString anEntry;
- int aMgrId = -1;
- if(!myIO.IsNull()) {
- aMgrId = getViewManagerId(myViewFrame);
- anEntry = myIO->getEntry();
- }
- bool useStudy = !anEntry.isEmpty() && aMgrId != -1;
- bool useObjColor = false;
- bool useObjMarker = false;
-
- PropMap aPropMap;
- PropMap aDefPropMap;
-
- //Handle(GEOM_AISShape) AISShape = new GEOM_AISShape( myShape, "" );
- Handle(GEOM_AISShape) AISShape;
- if (myType == GEOM_VECTOR)
- AISShape = new GEOM_AISVector (myShape, "");
- else {
- if (myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points
- !TopoDS_Iterator(myShape).More())
- return;// NPAL15983 (Bug when displaying empty groups)
- AISShape = new GEOM_AISShape (myShape, "");
- }
- // Temporary staff: vertex must be infinite for correct visualization
- AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
-
- if(useStudy){
- aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
- aDefPropMap = getDefaultPropertyMap(SOCC_Viewer::Type());
- Quantity_Color quant_col;
- if(aPropMap.contains(COLOR_PROP)) {
- quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value<QColor>());
- AISShape->SetShadingColor( quant_col );
- } else
- useObjColor = true;
- MergePropertyMaps(aPropMap, aDefPropMap);
- if(!useObjColor && aPropMap.contains(COLOR_PROP)) {
- quant_col = SalomeApp_Tools::color( aPropMap.value(COLOR_PROP).value<QColor>());
- AISShape->SetShadingColor( quant_col );
- }
-
- // Setup shape properties here ..., e.g. display mode, color, transparency, etc
- Standard_Boolean isTopLevel = Standard_False;
- if(aPropMap.contains(TOP_LEVEL_PROP)) {
- isTopLevel = aPropMap.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
- }
- AISShape->SetDisplayMode( aPropMap.value(DISPLAY_MODE_PROP).toInt() );
- AISShape->setTopLevel(isTopLevel);
-
- AISShape->SetDisplayVectors(aPropMap.value(VECTOR_MODE_PROP).toInt());
- }else {
- AISShape->SetDisplayMode( myDisplayMode );
- AISShape->SetShadingColor( myShadingColor );
- }
-
- // Set color and number for iso lines
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QColor col = aResMgr->colorValue( "Geometry", "isos_color",
- QColor(int(0.5*255), int(0.5*255), int(0.5*255)) );
- Quantity_Color aColor = SalomeApp_Tools::color( col );
-
- //get the ISOS number, set transparency if need
- int anUIsoNumber, aVIsoNumber;
- if(useStudy) {
- QString anIsos = aPropMap.value(ISOS_PROP).toString();
- QStringList uv = anIsos.split(DIGIT_SEPARATOR);
- anUIsoNumber = uv[0].toInt();
- aVIsoNumber = uv[1].toInt();
- AISShape->SetTransparency(aPropMap.value(TRANSPARENCY_PROP).toDouble());
- } else {
- anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1);
- aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1);
- }
-
- Handle(Prs3d_IsoAspect) anAspect = AISShape->Attributes()->UIsoAspect();
- anAspect->SetNumber( anUIsoNumber );
- anAspect->SetColor( aColor );
-
- if(HasIsosWidth())
- anAspect->SetWidth( GetIsosWidth() );
- AISShape->Attributes()->SetUIsoAspect( anAspect );
- anAspect = AISShape->Attributes()->VIsoAspect();
- anAspect->SetNumber( aVIsoNumber );
- if(HasIsosWidth())
- anAspect->SetWidth( GetIsosWidth() );
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetVIsoAspect( anAspect );
-
- if ( HasColor() )
- {
- AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
- if ( onlyVertex )
- {
- if(aPropMap.contains(MARKER_TYPE_PROP)) {
- QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
- if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- int aTypeOfMarker = aList[0].toInt();
- double aScaleOfMarker = aList[1].toDouble();
- anAspect->SetScale( aScaleOfMarker );
- anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1));
- anAspect->SetColor((Quantity_NameOfColor)GetColor());
- AISShape->Attributes()->SetPointAspect(anAspect);
- } else { //Custom marker string contains "IdOfTexsture"
- int textureId = aList[0].toInt();
- Standard_Integer aWidth, aHeight;
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture =
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture =
-#endif
- GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight);
- if (!aTexture.IsNull()) {
- static int TextureId = 0;
- Handle(Prs3d_PointAspect) aTextureAspect =
- new Prs3d_PointAspect ((Quantity_NameOfColor)GetColor(),
- ++TextureId,
- aWidth, aHeight,
- aTexture);
- AISShape->Attributes()->SetPointAspect(aTextureAspect);
- } else {
- useObjMarker = true;
- }
- }
- } else {
- useObjMarker = true;
- }
- }
- }
- else
- {
- if ( onlyVertex )
- {
- col = aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) );
- aColor = SalomeApp_Tools::color( col );
-
- if(aPropMap.contains(MARKER_TYPE_PROP)) {
- QStringList aList = aPropMap.value(MARKER_TYPE_PROP).toString().split(DIGIT_SEPARATOR);
- if(aList.size() == 2) { //Standard marker string contains "TypeOfMarker:ScaleOfMarker"
- int aTypeOfMarker = aList[0].toInt();
- double aScaleOfMarker = aList[1].toDouble();
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( aScaleOfMarker );
- anAspect->SetTypeOfMarker((Aspect_TypeOfMarker) (aTypeOfMarker-1) );
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetPointAspect( anAspect );
- } else { //Custom marker string contains "IdOfTexsture"
- int textureId = aList[0].toInt();
- Standard_Integer aWidth, aHeight;
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture =
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture =
-#endif
- GeometryGUI::getTexture(aStudy, textureId, aWidth, aHeight);
- if (!aTexture.IsNull()) {
- static int TextureId = 0;
- Handle(Prs3d_PointAspect) aTextureAspect =
- new Prs3d_PointAspect (aColor, ++TextureId, aWidth, aHeight, aTexture);
- AISShape->Attributes()->SetPointAspect( aTextureAspect );
- } else {
- useObjMarker = true;
- }
- }
- } else {
- useObjMarker = true;
- }
- }
- else {
- // Set line aspect
- col = aResMgr->colorValue( "Geometry", "wireframe_color", QColor( 255, 255, 0 ) );
- aColor = SalomeApp_Tools::color( col );
-
- Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetLineAspect( anAspect );
-
- // Set unfree boundaries aspect
- anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
- AISShape->storeBoundaryColors();
-
- // Set free boundaries aspect
- col = aResMgr->colorValue( "Geometry", "free_bound_color", QColor( 0, 255, 0 ) );
- aColor = SalomeApp_Tools::color( col );
-
- anAspect = AISShape->Attributes()->FreeBoundaryAspect();
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
-
- // Set wire aspect
- col = aResMgr->colorValue( "Geometry", "line_color", QColor( 255, 0, 0 ) );
- aColor = SalomeApp_Tools::color( col );
-
- anAspect = AISShape->Attributes()->WireAspect();
- anAspect->SetColor( aColor );
- AISShape->Attributes()->SetWireAspect( anAspect );
-
- // Set color for edges in shading
- col = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) );
- aColor = SalomeApp_Tools::color( col );
- AISShape->SetEdgesInShadingColor( aColor );
-
- // bug [SALOME platform 0019868]
- // Set deviation angle. Default one is 12 degrees (Prs3d_Drawer.cxx:18)
- //AISShape->SetOwnDeviationAngle( 10*PI/180 );
-
- // IMP 0020626
- double aDC = 0;
- if(useStudy) {
- aDC = aPropMap.value(DEFLECTION_COEFF_PROP).toDouble();
- SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
- SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
- }
- else {
- aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
- }
-
- aDC = std::max( aDC, DEFLECTION_MIN ); // to avoid to small values of the coefficient
- AISShape->SetOwnDeviationCoefficient(aDC);
- }
- }
-
- if ( HasTexture() )
- {
- AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str()));
- AISShape->SetTextureMapOn();
- AISShape->DisableTextureModulate();
- AISShape->SetDisplayMode(3);
- }
-
- if ( HasWidth() )
- AISShape->SetWidth( GetWidth() );
-
- if ( !myIO.IsNull() )
- {
- AISShape->setIO( myIO );
- AISShape->SetOwner( myIO );
- }
- else if ( !myName.empty() )
- {
- // Workaround to allow selection of temporary objects
- static int tempId = 0;
- char buf[50];
- sprintf( buf, "TEMP_%d", tempId++ );
- Handle( SALOME_InteractiveObject ) anObj =
- new SALOME_InteractiveObject( buf, "GEOM", myName.c_str() );
- AISShape->setIO( anObj );
- AISShape->SetOwner( anObj );
- }
+ // create presentation (specific for vectors)
+ Handle(GEOM_AISShape) AISShape = ( myType == GEOM_VECTOR ) ? new GEOM_AISVector( myShape, "" )
+ : new GEOM_AISShape ( myShape, "" );
+ // update shape properties
+ updateShapeProperties( AISShape, true );
- Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
- if ( !anIO.IsNull() ) {
- _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
- if ( SO ) {
- // get CORBA reference to data object
- CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
- if ( !CORBA::is_nil( object ) ) {
- // downcast to GEOM object
- GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
- bool hasColor = false;
- SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
- if( hasColor && useObjColor) {
- Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- AISShape->SetColor( aQuanColor );
- AISShape->SetShadingColor( aQuanColor );
- if ( onlyVertex ) {
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetColor( aQuanColor );
- anAspect->SetScale( myScaleOfMarker );
- anAspect->SetTypeOfMarker( myTypeOfMarker );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, SalomeApp_Tools::color( aQuanColor ) );
- } else if( !hasColor ) {
- //In case if color wasn't defined in the property map of the object
- //and GEOM_Object color also wasn't defined get default color from Resource Mgr.
- QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( col );
- AISShape->SetShadingColor( aQuanColor );
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
- }
-
- // ... marker type
- if(useObjMarker) {
- GEOM::marker_type aType = aGeomObject->GetMarkerType();
- GEOM::marker_size aSize = aGeomObject->GetMarkerSize();
- if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) {
- Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 );
- double aMSize = ((int)aSize+1)*0.5;
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( aMSize );
- anAspect->SetTypeOfMarker( aMType );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor )
- aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- anAspect->SetColor( aQuanColor );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- else if ( aType == GEOM::MT_USER ) {
- int aTextureId = aGeomObject->GetMarkerTexture();
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- Standard_Integer aWidth, aHeight;
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture =
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture =
-#endif
- GeometryGUI::getTexture(getStudy(), aTextureId, aWidth, aHeight);
- if (!aTexture.IsNull()) {
- static int TextureId = 0;
- Handle(Prs3d_PointAspect) aTextureAspect =
- new Prs3d_PointAspect(aQuanColor, ++TextureId, aWidth, aHeight, aTexture );
- AISShape->Attributes()->SetPointAspect( aTextureAspect );
- }
- } else { //Use marker from the preferences
- Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
- anAspect->SetScale( myScaleOfMarker );
- anAspect->SetTypeOfMarker( myTypeOfMarker );
- Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
- if ( hasColor )
- aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
- anAspect->SetColor( aQuanColor );
- AISShape->Attributes()->SetPointAspect( anAspect );
- }
- }
- }
- }
+ // add shape to the presentation
+ occPrs->AddObject( AISShape );
- // get material properties, set material
- Material_Model material;
- if ( useStudy ) {
- // Get material property from study and construct material model
- material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() );
- } else {
- // Get material property from study and construct material model
- QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
- material.fromResources( mname );
- }
+ // In accordance with ToActivate() value object will be activated/deactivated
+ // when it will be displayed
+ occPrs->SetToActivate( ToActivate() );
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
+ if ( AISShape->isTopLevel() && GEOM_AISShape::topLevelDisplayMode() == GEOM_AISShape::TopShowAdditionalWActor ) {
+ // 21671: EDF 1829 GEOM : Bring to front selected objects (continuation):
- // Set material for the selected shape
- AISShape->SetMaterial( material.getMaterialOCCAspect() );
- if(HasWidth())
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
- if(HasIsosWidth())
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
- }
+ // create additional wireframe shape
+ Handle(GEOM_TopWireframeShape) aWirePrs = new GEOM_TopWireframeShape(myShape);
+ aWirePrs->SetWidth(AISShape->Width());
+ if ( !myIO.IsNull() ) {
+ aWirePrs->setIO( myIO );
+ aWirePrs->SetOwner( myIO );
+ }
- // AISShape->SetName(???); ??? necessary to set name ???
- occPrs->AddObject( AISShape );
-
- // In accordance with ToActivate() value object will be activated/deactivated
- // when it will be displayed
- occPrs->SetToActivate( ToActivate() );
-
- if( AISShape->isTopLevel() && AISShape->topLevelDisplayMode() == GEOM_AISShape::TopShowAdditionalWActor) {
- //21671: EDF 1829 GEOM : Bring to front selected objects (continuation):
- // Display wireframe presentation additionally
- Handle(GEOM_TopWireframeShape) aWirePrs = new GEOM_TopWireframeShape(myShape);
- aWirePrs->SetWidth(AISShape->Width());
- if ( !myIO.IsNull() ) {
- aWirePrs->setIO( myIO );
- aWirePrs->SetOwner( myIO );
- }
- occPrs->AddObject(aWirePrs);
- }
+ // add shape to the presentation
+ occPrs->AddObject( aWirePrs );
}
}
// if presentation is found -> set again shape for it
else
{
- if ( !myShape.IsNull() )
+ AIS_ListOfInteractive IOList;
+ occPrs->GetObjects( IOList );
+ AIS_ListIteratorOfListOfInteractive Iter( IOList );
+ for ( ; Iter.More(); Iter.Next() )
{
- AIS_ListOfInteractive IOList;
- occPrs->GetObjects( IOList );
- AIS_ListIteratorOfListOfInteractive Iter( IOList );
- for ( ; Iter.More(); Iter.Next() )
- {
- Handle(GEOM_AISShape) AISShape = Handle(GEOM_AISShape)::DownCast( Iter.Value() );
- if ( AISShape.IsNull() )
- continue;
- if ( AISShape->Shape() != myShape )
- {
- AISShape->Set( myShape );
- AISShape->UpdateSelection();
- AISShape->SetToUpdate();
- }
- if ( !myIO.IsNull() )
- {
- AISShape->setIO( myIO );
- AISShape->SetOwner( myIO );
- }
- }
+ Handle(GEOM_AISShape) AISShape = Handle(GEOM_AISShape)::DownCast( Iter.Value() );
+ if ( AISShape.IsNull() )
+ continue;
+
+ // re-set shape (it might be changed)
+ if ( AISShape->Shape() != myShape )
+ AISShape->Set( myShape );
+
+ // update shape properties
+ updateShapeProperties( AISShape, false );
+
+ // force updating
+ AISShape->UpdateSelection();
+ AISShape->SetToUpdate();
}
}
}
//=================================================================
void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
{
- SalomeApp_Study* aStudy = getStudy();
- int aMgrId = -1;
SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( prs );
+ SalomeApp_Study* study = getStudy();
- if ( !vtkPrs || myShape.IsNull() || !aStudy)
+ if ( !vtkPrs || myShape.IsNull() || !study )
return;
- bool useStudy = false;
- bool useObjCol = false;
- PropMap aPropMap;
-
- vtkActorCollection* theActors = 0;
-
- QString anEntry;
- if(!myIO.IsNull()) {
- anEntry = myIO->getEntry();
- }
-
- if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE ) {
- //myToActivate = false; // ouv: commented to make the trihedron pickable (see IPAL18657)
- GEOM_VTKTrihedron* aTrh = GEOM_VTKTrihedron::New();
-
- if ( HasColor() ) {
- Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
- aTrh->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
- }
-
- Handle(Geom_Plane) aPlane =
- Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( TopoDS::Face( myShape ) ) );
- if ( aPlane.IsNull() )
- return;
-
- gp_Ax2 anAx2 = aPlane->Pln().Position().Ax2();
- aTrh->SetPlacement( new Geom_Axis2Placement( anAx2 ) );
-
- // if ( SVTK_Viewer* vf = dynamic_cast<SVTK_Viewer*>( GetActiveView() ) )
- // aTrh->SetSize( 0.5 * vf->GetTrihedronSize() );
-
- vtkPrs->AddObject( aTrh );
+ if ( myType == GEOM_MARKER && myShape.ShapeType() == TopAbs_FACE )
+ {
+ //
+ // specific processing for local coordinate system presentation
+ //
- theActors = vtkActorCollection::New();
- theActors->AddItem( aTrh );
- }
- else {
- PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
+ TopoDS_Face aFace = TopoDS::Face( myShape );
+ Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
+ if ( !aPlane.IsNull() ) {
+ gp_Ax3 aPos = aPlane->Pln().Position();
+ Handle(Geom_Axis2Placement) aPlc = new Geom_Axis2Placement( aPos.Ax2() );
- if(!myIO.IsNull()) {
- aMgrId = getViewManagerId(myViewFrame);
- }
- useStudy = !anEntry.isEmpty() && aMgrId != -1;
+ GEOM_VTKTrihedron* aTrh = 0;
+ if ( vtkPrs->IsNull() ) {
+ // new presentation is being created
+ aTrh = GEOM_VTKTrihedron::New();
+ vtkPrs->AddObject( aTrh );
+ }
+ else {
+ // presentation is being updated
+ vtkActorCollection* actors = vtkPrs->GetObjects();
+ if ( actors ) {
+ actors->InitTraversal();
+ vtkActor* a = actors->GetNextActor();
+ while ( a && !aTrh ) {
+ aTrh = GEOM_VTKTrihedron::SafeDownCast( a );
+ a = actors->GetNextActor();
+ }
+ }
+ }
+
+ if ( aTrh ) {
+ // predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
+ if ( HasColor() ) {
+ Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
+ aTrh->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
+ }
+#ifdef VTK_TRIHEDRON_WIDTH
+ //
+ // VSR: currently isn't supported
+ //
+ // predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
+ if ( HasWidth() )
+ aTrh->SetWidth( GetWidth() );
+#endif
- theActors = vtkActorCollection::New();
- GEOM_Actor* aGeomActor = GEOM_Actor::New();
- aGeomActor->SetShape(myShape,aDefPropMap.value(DEFLECTION_COEFF_PROP).toDouble(),myType == GEOM_VECTOR);
- theActors->AddItem(aGeomActor);
- aGeomActor->Delete();
+ if ( !myIO.IsNull() )
+ aTrh->setIO( myIO );
- if(useStudy) {
- aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
- if(!aPropMap.contains(COLOR_PROP))
- useObjCol = true;
- MergePropertyMaps(aPropMap, aDefPropMap);
+ aTrh->SetPlacement( aPlc );
+ }
}
}
-
- theActors->InitTraversal();
-
- vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
-
- vtkProperty* aProp = 0;
-
- if ( HasColor() || HasWidth() )
- {
- aProp = vtkProperty::New();
- aProp->SetRepresentationToWireframe();
- }
-
- if ( HasColor() )
- {
- Quantity_Color aColor( (Quantity_NameOfColor)GetColor() );
- aProp->SetColor( aColor.Red(), aColor.Green(), aColor.Blue() );
- }
-
- while ( anActor != NULL )
+ else
{
- SALOME_Actor* GActor = SALOME_Actor::SafeDownCast( anActor );
-
- GActor->setIO( myIO );
+ //
+ // processing for usual geometry presentation
+ //
- if ( aProp )
+ // if presentation is empty we try to create new one
+ if ( vtkPrs->IsNull() )
{
- GActor->SetProperty( aProp );
- GActor->SetPreviewProperty( aProp );
+ // create an actor
+ GEOM_Actor* actor = GEOM_Actor::New();
+ // update actor properties
+ updateActorProperties( actor, true );
+ // add actor to the presentation
+ vtkPrs->AddObject( actor );
}
-
- GEOM_Actor* aGeomGActor = GEOM_Actor::SafeDownCast( anActor );
- if ( aGeomGActor != 0 )
- {
- if ( aProp ) {
- aGeomGActor->SetShadingProperty( aProp );
- aGeomGActor->SetWireframeProperty( aProp );
- }
-
- // Set color for edges in shading
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- if(aResMgr) {
- QColor c = aResMgr->colorValue( "Geometry", "edges_in_shading_color", QColor( 255, 255, 0 ) );
- aGeomGActor->SetEdgesInShadingColor( c.red()/255., c.green()/255., c.blue()/255. );
- }
-
- int aIsos[2]= { 1, 1 };
- if(useStudy) {
- QString anIsos = aPropMap.value(ISOS_PROP).toString();
- QStringList uv = anIsos.split(DIGIT_SEPARATOR);
- aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
- aGeomGActor->SetNbIsos(aIsos);
- aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
- SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
- SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
- aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toInt());
- int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
- // Specially processing of 'Shading with edges' mode from preferences,
- // because there is the following enum in VTK viewer:
- // Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
- // (see VTKViewer::Representation enum) and the following enum in GEOM_Actor:
- // eWireframe - 0, eShading - 1, eShadingWithEdges - 3
- if ( aDispModeId == 2 )
- // this is 'Shading with edges' mode => do the correct mapping to EDisplayMode
- // enum in GEOM_Actor (and further to VTKViewer::Representation enum)
- aDispModeId++;
- aGeomGActor->setDisplayMode(aDispModeId);
- aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble());
-
- // Create material model
- Material_Model material;
- material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() );
- // Set material properties for the object
- aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
- // Set the same front and back materials for the selected shape
- std::vector<vtkProperty*> aProps;
- aProps.push_back( material.getMaterialVTKProperty() );
- aGeomGActor->SetMaterial(aProps);
-
- vtkFloatingPointType aColor[3] = {1.,0.,0.};
- if ( useObjCol ) { //Get Color from geom object
- Handle( SALOME_InteractiveObject ) anIO = aGeomGActor->getIO();
- if ( !anIO.IsNull() ) {
- _PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
- if ( SO ) {
- // get CORBA reference to data object
- CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
- if ( !CORBA::is_nil( object ) ) {
- // downcast to GEOM object
- GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
- bool hasColor = false;
- SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
- if(hasColor) {
- aColor[0] = aSColor.R; aColor[1] = aSColor.G; aColor[2] = aSColor.B;
- } else {
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- if(aResMgr) {
- QColor c = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
- aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
- }
- }
- aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
- }
- }
- }
- } else {
- QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
- aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
- }
-
- if ( !material.isPhysical() )
- aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]);
- }
- else {
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- if ( aResMgr ) {
- // Create material model
- Material_Model material;
- // Get material name from resources
- QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
- material.fromResources( mname );
- // Set material properties for the object
- aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
- // Set material for the selected shape
- std::vector<vtkProperty*> aProps;
- aProps.push_back( material.getMaterialVTKProperty() );
- aGeomGActor->SetMaterial(aProps);
- }
+ else {
+ // presentation is being updated
+ vtkActorCollection* actors = vtkPrs->GetObjects();
+ if ( actors ) {
+ actors->InitTraversal();
+ vtkActor* a = actors->GetNextActor();
+ while ( a ) {
+ GEOM_Actor* actor = GEOM_Actor::SafeDownCast( a );
+ if ( actor ) {
+ // update actor properties
+ updateActorProperties( actor, false );
+ a = actors->GetNextActor();
+ }
+ }
}
}
- if ( aGeomGActor )
- {
- if ( HasWidth() )
- aGeomGActor->SetWidth( GetWidth() );
-
- if ( HasIsosWidth() )
- aGeomGActor->SetIsosWidth( GetIsosWidth() );
- }
-
- if ( myToActivate )
- GActor->PickableOn();
- else
- GActor->PickableOff();
-
- vtkPrs->AddObject( GActor );
-
- anActor = (vtkActor*)theActors->GetNextActor();
}
-
- if ( aProp )
- aProp->Delete();
-
- theActors->Delete();
}
//=================================================================
Handle(SALOME_InteractiveObject) IO = sh->getIO();
if ( IO.IsNull() ) continue;
PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
- if ( aPropMap.contains( TRANSPARENCY_PROP ) ) {
- double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble();
+ if ( aPropMap.contains( GEOM::propertyName( GEOM::Transparency ) ) ) {
+ double transparency = aPropMap.value(GEOM::propertyName( GEOM::Transparency )).toDouble();
ic->SetTransparency( sh, transparency, true );
}
}
return myIsosWidth;
}
-void GEOM_Displayer::SetIsosWidth(const int width)
+void GEOM_Displayer::SetIsosWidth(const int width)
{
myIsosWidth = width;
}
int GEOM_Displayer::SetDisplayMode( const int theMode )
{
int aPrevMode = myDisplayMode;
- if ( theMode != -1 )
+ if ( theMode != -1 ) {
myDisplayMode = theMode;
- else
- {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
+ myHasDisplayMode = true;
+ }
+ else {
+ UnsetDisplayMode();
}
return aPrevMode;
}
int aPrevMode = myDisplayMode;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
+ myHasDisplayMode = false;
return aPrevMode;
}
+bool GEOM_Displayer::HasDisplayMode() const
+{
+ return myHasDisplayMode;
+}
+
SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
{
static QList<QColor> colors;
return aSColor;
}
+PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
+ const QString& entry,
+ SALOME_View* view )
+{
+ // get default properties for the explicitly specified default view type
+ PropMap propMap = GEOM_Displayer::getDefaultPropertyMap();
+ if ( study && view ) {
+ SUIT_ViewModel* viewModel = dynamic_cast<SUIT_ViewModel*>( view );
+ SUIT_ViewManager* viewMgr = ( viewModel != 0 ) ? viewModel->getViewManager() : 0;
+ int viewId = ( viewMgr != 0 ) ? viewMgr->getGlobalId() : -1;
+
+ if ( viewModel && viewId != -1 ) {
+ // get properties from the study
+ PropMap storedMap = study->getObjectPropMap( viewId, entry );
+ // overwrite default properties from stored ones (that are specified)
+ for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
+ if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
+ propMap.insert( GEOM::propertyName( (GEOM::Property)prop ),
+ storedMap.value( GEOM::propertyName( (GEOM::Property)prop ) ) );
+ }
+ // ... specific processing for color
+ // ... current implementation is to use same stored color for all aspects
+ // ... (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
+ if ( storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
+ }
-PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type) {
- PropMap aDefaultMap;
- SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- //1. Visibility
- aDefaultMap.insert(VISIBILITY_PROP , 1);
-
- //2. Nb Isos
- int anUIsoNumber;
- int aVIsoNumber;
- if(viewer_type == SOCC_Viewer::Type()) {
- anUIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_u", 1);
- aVIsoNumber = aResMgr->integerValue("OCCViewer", "iso_number_v", 1);
- } else if( viewer_type==SVTK_Viewer::Type()) {
- anUIsoNumber = aResMgr->integerValue("VTKViewer", "iso_number_u", 1);
- aVIsoNumber = aResMgr->integerValue("VTKViewer", "iso_number_u", 1);
+ if ( !entry.isEmpty() ) {
+ // get CORBA reference to geom object
+ _PTR(SObject) SO( study->studyDS()->FindObjectID( entry.toStdString() ) );
+ if ( SO ) {
+ CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
+ if ( !CORBA::is_nil( object ) ) {
+ GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );
+ // check that geom object has color properly set
+ bool hasColor = false;
+ SALOMEDS::Color aSColor = getColor( geomObject, hasColor );
+ // set color from geometry object (only once, if it is not yet set in GUI)
+ // current implementation is to use same color for all aspects
+ // (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
+ if ( hasColor && !storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
+ QColor objColor = QColor::fromRgbF( aSColor.R, aSColor.G, aSColor.B );
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), objColor );
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ), objColor );
+ }
+ // check that object has point marker properly set
+ GEOM::marker_type mType = geomObject->GetMarkerType();
+ GEOM::marker_size mSize = geomObject->GetMarkerSize();
+ int mTextureId = geomObject->GetMarkerTexture();
+ bool hasMarker = ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER && mSize > GEOM::MS_NONE && mSize <= GEOM::MS_70 ) ||
+ ( mType == GEOM::MT_USER && mTextureId > 0 );
+ // set point marker from geometry object (only once, if it is not yet set in GUI)
+ if ( hasMarker && !storedMap.contains( GEOM::propertyName( GEOM::PointMarker ) ) ) {
+ if ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER ) {
+ // standard type
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
+ QString( "%1%2%3" ).arg( (int)mType ).arg( GEOM::subSectionSeparator() ).arg( (int)mSize ) );
+ }
+ else if ( mType == GEOM::MT_USER ) {
+ // custom texture
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ), QString::number( mTextureId ) );
+ }
+ }
+ }
+ }
+ }
+ }
}
- QString anIsos("%1%2%3");
- anIsos = anIsos.arg(anUIsoNumber);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(aVIsoNumber);
- aDefaultMap.insert(ISOS_PROP , anIsos);
+ return propMap;
+}
- //3. Transparency
- aDefaultMap.insert( TRANSPARENCY_PROP , 0.0 );
+PropMap GEOM_Displayer::getDefaultPropertyMap()
+{
+ PropMap propMap;
- //4. Display Mode
- aDefaultMap.insert( DISPLAY_MODE_PROP , aResMgr->integerValue("Geometry", "display_mode", 0));
+ // get resource manager
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- //5. Vector Mode
- aDefaultMap.insert( VECTOR_MODE_PROP , 0);
+ // fill in the properties map with default values
- //6. Color
- QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
- aDefaultMap.insert( COLOR_PROP , col);
+ // - visibility (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::Visibility ), false );
- //7. Deflection Coeff
- double aDC;
+ // - nb isos (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::NbIsos ),
+ QString( "%1%2%3" ).
+ arg( resMgr->integerValue( "Geometry", "iso_number_u", 1 ) ).
+ arg( GEOM::subSectionSeparator() ).
+ arg( resMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
- if(viewer_type == SOCC_Viewer::Type()) {
- aDC = aResMgr->doubleValue("Geometry", "deflection_coeff", 0.001);
- } else if( viewer_type==SVTK_Viewer::Type()) {
- aDC = 0.001;
- }
+ // - transparency (opacity = 1-transparency)
+ propMap.insert( GEOM::propertyName( GEOM::Transparency ), 0.0 );
- aDefaultMap.insert( DEFLECTION_COEFF_PROP , aDC);
+ // - display mode (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
+ resMgr->integerValue( "Geometry", "display_mode", 0 ) );
- //8. Material
- Material_Model material;
- QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
- material.fromResources( mname );
- aDefaultMap.insert( MATERIAL_PROP, material.toProperties() );
+ // - show edges direction flag (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::EdgesDirection ), false );
- //9. Width of the edges
- aDefaultMap.insert( EDGE_WIDTH_PROP , aResMgr->integerValue("Geometry", "edge_width", 1));
+ // - shading color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
+ colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
+ // - wireframe color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::WireframeColor ),
+ colorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
- //10. Width of iso-lines
- aDefaultMap.insert( ISOS_WIDTH_PROP , aResMgr->integerValue("Geometry", "isolines_width", 1));
+ // - standalone edges color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::LineColor ),
+ colorFromResources( "line_color", QColor( 255, 0, 0 ) ) );
- if(viewer_type == SOCC_Viewer::Type()) {
+ // - free boundaries color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ),
+ colorFromResources( "free_bound_color", QColor( 0, 255, 0 ) ) );
- aDefaultMap.insert(TOP_LEVEL_PROP, Standard_False);
- }
+ // - points color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::PointColor ),
+ colorFromResources( "point_color", QColor( 255, 255, 0 ) ) );
- return aDefaultMap;
-}
+ // - isos color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::IsosColor ),
+ colorFromResources( "isos_color", QColor( 200, 200, 200 ) ) );
-bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault) {
- int nbInserted = 0;
- if(!theOrigin.contains(VISIBILITY_PROP)) {
- theOrigin.insert(VISIBILITY_PROP, 0);
- nbInserted++;
- }
- if(!theOrigin.contains(TRANSPARENCY_PROP)) {
- theOrigin.insert(TRANSPARENCY_PROP, theDefault.value(TRANSPARENCY_PROP));
- nbInserted++;
- }
- if(!theOrigin.contains(DISPLAY_MODE_PROP)) {
- theOrigin.insert(DISPLAY_MODE_PROP, theDefault.value(DISPLAY_MODE_PROP));
- nbInserted++;
- }
- if(!theOrigin.contains(ISOS_PROP)) {
- theOrigin.insert(ISOS_PROP, theDefault.value(ISOS_PROP));
- nbInserted++;
- }
- if(!theOrigin.contains(VECTOR_MODE_PROP)) {
- theOrigin.insert(VECTOR_MODE_PROP, theDefault.value(VECTOR_MODE_PROP));
- nbInserted++;
- }
- if(!theOrigin.contains(DEFLECTION_COEFF_PROP)) {
- theOrigin.insert(DEFLECTION_COEFF_PROP, theDefault.value(DEFLECTION_COEFF_PROP));
- nbInserted++;
- }
- if(!theOrigin.contains(MATERIAL_PROP)) {
- theOrigin.insert(MATERIAL_PROP, theDefault.value(MATERIAL_PROP));
- nbInserted++;
- }
+ // - outlines color (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::OutlineColor ),
+ colorFromResources( "edges_in_shading_color", QColor( 180, 180, 180 ) ) );
- if(!theOrigin.contains(EDGE_WIDTH_PROP)) {
- theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP));
- nbInserted++;
- }
+ // - deflection coefficient (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::Deflection ),
+ resMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 ) );
- if(!theOrigin.contains(ISOS_WIDTH_PROP)) {
- theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP));
- nbInserted++;
- }
+ // - material (take default value from preferences)
+ Material_Model material;
+ material.fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) );
+ propMap.insert( GEOM::propertyName( GEOM::Material ), material.toProperties() );
- if(!theOrigin.contains(COLOR_PROP)) {
- theOrigin.insert(COLOR_PROP, theDefault.value(COLOR_PROP));
- nbInserted++;
- }
+ // - edge width (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::LineWidth ),
+ resMgr->integerValue( "Geometry", "edge_width", 1 ) );
- return (nbInserted > 0);
-}
+ // - isos width (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::IsosWidth ),
+ resMgr->integerValue( "Geometry", "isolines_width", 1 ) );
+ // - point marker (take default value from preferences)
+ propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
+ QString( "%1%2%3" ).
+ arg( resMgr->integerValue( "Geometry", "type_of_marker", 1 ) + 1 ).
+ arg( GEOM::subSectionSeparator() ).
+ arg( resMgr->integerValue( "Geometry", "marker_scale", 1 ) ) );
+
+ // - top-level flag (false by default)
+ propMap.insert( GEOM::propertyName( GEOM::TopLevel ), false );
+
+ return propMap;
+}
SALOMEDS::Color GEOM_Displayer::getColor(GEOM::GEOM_Object_var theGeomObject, bool& hasColor) {
SALOMEDS::Color aSColor;
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aChildSObject));
if ( CORBA::is_nil( aChildObject ) )
continue;
-
+
SALOMEDS::Color aReservedColor = aChildObject->GetColor();
if ( aReservedColor.R >= 0 && aReservedColor.G >= 0 && aReservedColor.B >= 0 )
aReservedColors.append( aReservedColor );
#include <SALOME_InteractiveObject.hxx>
+class GEOM_Actor;
class SALOME_ListIO;
class SALOME_View;
class SALOME_Prs;
class SalomeApp_Study;
class SalomeApp_Application;
class SUIT_SelectionFilter;
+class Handle_GEOM_AISShape;
//class SALOME_Selection;
class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer
int SetDisplayMode( const int );
int GetDisplayMode() const;
int UnsetDisplayMode();
-
+ bool HasDisplayMode() const;
/* Sets name - for temporary objects only */
void SetName( const char* theName );
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
static SALOMEDS::Color getPredefinedUniqueColor();
- static PropMap getDefaultPropertyMap(const QString& viewer_type);
-
- static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
-
/*Get color of the geom object*/
static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor);
SUIT_SelectionFilter* getFilter( const int theMode );
SUIT_SelectionFilter* getComplexFilter( const QList<int>* );
+ Quantity_Color qColorFromResources( const QString&, const QColor& );
+ QColor colorFromResources( const QString&, const QColor& );
+ void updateShapeProperties( const Handle(GEOM_AISShape)&, bool );
+ void updateActorProperties( GEOM_Actor*, bool );
+
+ PropMap getObjectProperties( SalomeApp_Study*, const QString&, SALOME_View* = 0 );
+ PropMap getDefaultPropertyMap();
+
protected:
Handle(SALOME_InteractiveObject) myIO;
TopoDS_Shape myShape;
int myIsosWidth;
bool myToActivate;
int myDisplayMode;
+ bool myHasDisplayMode;
Aspect_TypeOfMarker myTypeOfMarker;
double myScaleOfMarker;
private:
SalomeApp_Application* myApp;
+ friend class GEOM_Swig;
};
#endif // GEOM_DISPLAYER_H
<source>ICON_DLG_FREE_FACES</source>
<translation>free_faces.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_FREE_BOUNDS</source>
+ <translation>free_bound.png</translation>
+ </message>
<message>
<source>ICON_DLG_FUSE</source>
<translation>fuse.png</translation>
<source>GEOM_ANGLE_1</source>
<translation>Angle</translation>
</message>
+ <message>
+ <source>GEOM_ANGLE_STEP</source>
+ <translation>Angular step :</translation>
+ </message>
<message>
<source>GEOM_ARC_ELLIPSE</source>
<translation>Arc of ellipse</translation>
<source>GEOM_MIN</source>
<translation>Min :</translation>
</message>
+ <message>
+ <source>GEOM_MINDIST_NAME</source>
+ <translation>MinDist</translation>
+ </message>
+ <message>
+ <source>GEOM_MINDIST_NO_SOL</source>
+ <translation>No solution found</translation>
+ </message>
<message>
<source>GEOM_MINDIST_OBJ</source>
<translation>Objects And Results</translation>
<source>GEOM_SOURCE_OBJECT</source>
<translation>Source vertex, edge or wire</translation>
</message>
+ <message>
+ <source>GEOM_SOLUTION</source>
+ <translation>Solution :</translation>
+ </message>
+ <message>
+ <source>GEOM_SOLUTION_I</source>
+ <translation>Solution %1</translation>
+ </message>
<message>
<source>GEOM_TARGET_OBJECT</source>
<translation>Target face</translation>
<source>GEOM_STEP</source>
<translation>Step :</translation>
</message>
+ <message>
+ <source>GEOM_STEP_R</source>
+ <translation>Radial step :</translation>
+ </message>
<message>
<source>GEOM_STEP_TITLE</source>
<translation>Step value for GUI constructions</translation>
<source>MEN_TOOLS</source>
<translation>Tools</translation>
</message>
+ <message>
+ <source>MEN_MATERIALS_LIBRARY</source>
+ <translation>Materials library</translation>
+ </message>
<message>
<source>MEN_TORUS</source>
<translation>Torus</translation>
<source>MEN_POP_MATERIAL_PROPERTIES</source>
<translation>Material Properties</translation>
</message>
+ <message>
+ <source>MEN_POP_PREDEF_MATER_CUSTOM</source>
+ <translation>Custom...</translation>
+ </message>
<message>
<source>NAME_LBL</source>
<translation>Name: </translation>
<source>PREF_MATERIAL</source>
<translation>Default material</translation>
</message>
+ <message>
+ <source>PREF_PREDEF_MATERIALS</source>
+ <translation>Show predefined materials in popup menu</translation>
+ </message>
+ <message>
+ <source>PREF_EDITGROUP_COLOR</source>
+ <translation>Subshapes color for editing a group</translation>
+ </message>
<message>
<source>PREF_EDGE_WIDTH</source>
<translation>Edges width</translation>
<source>PREF_MEASURES_LINE_WIDTH</source>
<translation>Measures lines width</translation>
</message>
+ <message>
+ <source>PREF_ISOS</source>
+ <translation>Number of isolines</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_U</source>
+ <translation>Along U</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_V</source>
+ <translation>Along V</translation>
+ </message>
<message>
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
<translation>ProcessShape</translation>
</message>
+ <message>
+ <source>MATERIAL_LIBRARY_TLT</source>
+ <translation>Materials Library</translation>
+ </message>
<message>
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
<translation>SupressHoles</translation>
<source>STB_POP_WIREFRAME</source>
<translation>Wireframe</translation>
</message>
+ <message>
+ <source>STB_MATERIALS_LIBRARY</source>
+ <translation>Displays content of Materials library</translation>
+ </message>
+ <message>
+ <source>STB_POP_PREDEF_MATER_CUSTOM</source>
+ <translation>Custom...</translation>
+ </message>
<message>
<source>STB_PROPAGATE</source>
<translation>Propagate</translation>
<source>GEOM_IS_REORDER</source>
<translation>Reorder vertices taking into account distances</translation>
</message>
+ <message>
+ <source>GEOM_INTERPOL_TANGENTS</source>
+ <translation>Tangents</translation>
+ </message>
+ <message>
+ <source>GEOM_INTERPOL_FIRST_VEC</source>
+ <translation>First tangent vector</translation>
+ </message>
+ <message>
+ <source>GEOM_INTERPOL_LAST_VEC</source>
+ <translation>Last tangent vector</translation>
+ </message>
+ <message>
+ <source>GEOM_BOTH_TANGENTS_REQUIRED</source>
+ <translation>Both tangent vectors must be defined</translation>
+ </message>
<message>
<source>GEOM_CURVE_CRMODE</source>
<translation>Creation Mode</translation>
<source>NUMBER_OPEN</source>
<translation>Number of open free boundaries: </translation>
</message>
+ <message>
+ <source>NAME_CLOSED</source>
+ <translation>Closed_Free_Boundary_%1</translation>
+ </message>
+ <message>
+ <source>NAME_OPEN</source>
+ <translation>Open_Free_Boundary_%1</translation>
+ </message>
</context>
<context>
<name>RepairGUI_GlueDlg</name>
<source>MATERIAL_PROPERTIES_TLT</source>
<translation>Color and Material Properties</translation>
</message>
+ <message>
+ <source>FRONT_FACE</source>
+ <translation>Front face</translation>
+ </message>
+ <message>
+ <source>BACK_FACE</source>
+ <translation>Back face</translation>
+ </message>
<message>
<source>REFLECTION_0</source>
<translation>Ambient</translation>
<source>REFLECTION_3</source>
<translation>Emissive</translation>
</message>
- <message>
- <source>ENABLED</source>
- <translation>Enabled</translation>
- </message>
<message>
<source>SHININESS</source>
<translation>Shininess:</translation>
<source>MEN_TOOLS</source>
<translation>Outils</translation>
</message>
+ <message>
+ <source>MEN_MATERIALS_LIBRARY</source>
+ <translation type="unfinished">Materials library</translation>
+ </message>
<message>
<source>MEN_TORUS</source>
<translation>Tore</translation>
<source>MEN_POP_MATERIAL_PROPERTIES</source>
<translation>Propriétés des matériaux</translation>
</message>
+ <message>
+ <source>MEN_POP_PREDEF_MATER_CUSTOM</source>
+ <translation type="unfinished">Custom...</translation>
+ </message>
<message>
<source>NAME_LBL</source>
<translation>Nom : </translation>
<source>PREF_MATERIAL</source>
<translation>Matériau</translation>
</message>
+ <message>
+ <source>PREF_PREDEF_MATERIALS</source>
+ <translation type="unfinished">Show predefined materials in popup menu</translation>
+ </message>
+ <message>
+ <source>PREF_EDITGROUP_COLOR</source>
+ <translation type="unfinished">Subshapes color for editing a group</translation>
+ </message>
<message>
<source>PREF_EDGE_WIDTH</source>
<translation>Epaisseur des arêtes</translation>
<source>PREF_MEASURES_LINE_WIDTH</source>
<translation>Epaisseur des traits de mesure</translation>
</message>
+ <message>
+ <source>PREF_ISOS</source>
+ <translation>Nombre d'isolignes</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_U</source>
+ <translation>Selon U</translation>
+ </message>
+ <message>
+ <source>PREF_ISOS_V</source>
+ <translation>Selon V</translation>
+ </message>
<message>
<source>PROCESS_SHAPE_NEW_OBJ_NAME</source>
<translation>FormeRetraitee</translation>
</message>
+ <message>
+ <source>MATERIAL_LIBRARY_TLT</source>
+ <translation type="unfinished">Materials Library</translation>
+ </message>
<message>
<source>REMOVE_HOLES_NEW_OBJ_NAME</source>
<translation>SupprimerTrous</translation>
<source>STB_POP_WIREFRAME</source>
<translation>Contours</translation>
</message>
+ <message>
+ <source>STB_MATERIALS_LIBRARY</source>
+ <translation type="unfinished">Displays content of Materials library</translation>
+ </message>
+ <message>
+ <source>STB_POP_PREDEF_MATER_CUSTOM</source>
+ <translation type="unfinished">Custom...</translation>
+ </message>
<message>
<source>STB_PROPAGATE</source>
<translation>Propager</translation>
<source>GEOM_IS_REORDER</source>
<translation>Réarranger les points en prenant en compte les distances</translation>
</message>
+ <message>
+ <source>GEOM_INTERPOL_TANGENTS</source>
+ <translation type="unfinished">Tangents</translation>
+ </message>
+ <message>
+ <source>GEOM_INTERPOL_FIRST_VEC</source>
+ <translation type="unfinished">First tangent vector</translation>
+ </message>
+ <message>
+ <source>GEOM_INTERPOL_LAST_VEC</source>
+ <translation type="unfinished">Last tangent vector</translation>
+ </message>
+ <message>
+ <source>GEOM_BOTH_TANGENTS_REQUIRED</source>
+ <translation type="unfinished">Both tangent vectors must be defined</translation>
+ </message>
<message>
<source>GEOM_CURVE_CRMODE</source>
<translation>Mode de création</translation>
<source>NUMBER_OPEN</source>
<translation>Nombre de contours libres ouverts</translation>
</message>
+ <message>
+ <source>NAME_CLOSED</source>
+ <translation type="unfinished">Closed_Free_Boundary_%1</translation>
+ </message>
+ <message>
+ <source>NAME_OPEN</source>
+ <translation type="unfinished">Open_Free_Boundary_%1</translation>
+ </message>
</context>
<context>
<name>RepairGUI_GlueDlg</name>
<source>MATERIAL_PROPERTIES_TLT</source>
<translation>Couleur et propriétés des matériaux</translation>
</message>
+ <message>
+ <source>FRONT_FACE</source>
+ <translation type="unfinished">Front face</translation>
+ </message>
+ <message>
+ <source>BACK_FACE</source>
+ <translation type="unfinished">Back face</translation>
+ </message>
<message>
<source>REFLECTION_0</source>
<translation>Ambiante</translation>
<source>REFLECTION_3</source>
<translation>Emissive</translation>
</message>
- <message>
- <source>ENABLED</source>
- <translation>Activée</translation>
- </message>
<message>
<source>SHININESS</source>
<translation>Brillance:</translation>
#include "GEOM_Actor.h"
#include <Material_ResourceMgr.h>
+#include <Material_Model.h>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <QFileInfo>
#include <QString>
#include <QPainter>
+#include <QSignalMapper>
#include <AIS_Drawer.hxx>
#include <AIS_ListOfInteractive.hxx>
// purpose : Constructor
//=======================================================================
GeometryGUI::GeometryGUI() :
- SalomeApp_Module( "GEOM" ),
- LightApp_Module( "GEOM" )
+ SalomeApp_Module( "GEOM" )
{
if ( CORBA::is_nil( myComponentGeom ) )
{
myDisplayer = 0;
myLocalSelectionMode = GEOM_ALLOBJECTS;
+
+ connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
}
//=======================================================================
// function : GeometryGUI::OnGUIEvent()
// purpose : manage all events on GUI [static]
//=======================================================================
-void GeometryGUI::OnGUIEvent( int id )
+void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
{
SUIT_Application* anApp = application();
if (!anApp) return;
case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL
case GEOMOp::OpDelete: // MENU EDIT - DELETE
case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY
+ case GEOMOp::OpMaterialsLibrary: // MENU TOOLS - MATERIALS LIBRARY
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
case GEOMOp::OpColor: // POPUP MENU - COLOR
case GEOMOp::OpSetTexture: // POPUP MENU - SETTEXTURE
case GEOMOp::OpPublishObject: // ROOT GEOM OBJECT - POPUP MENU - PUBLISH
case GEOMOp::OpPointMarker: // POPUP MENU - POINT MARKER
case GEOMOp::OpMaterialProperties: // POPUP MENU - MATERIAL PROPERTIES
+ case GEOMOp::OpPredefMaterial: // POPUP MENU - <SOME MATERIAL>
+ case GEOMOp::OpPredefMaterCustom: // POPUP MENU - MATERIAL PROPERTIES - CUSTOM...
case GEOMOp::OpEdgeWidth: // POPUP MENU - LINE WIDTH - EDGE WIDTH
case GEOMOp::OpIsosWidth: // POPUP MENU - LINE WIDTH - ISOS WIDTH
case GEOMOp::OpBringToFront: // POPUP MENU - BRING TO FRONT
// call method of corresponding GUI library
if ( library ) {
- library->OnGUIEvent( id, desk );
-
- // Update a list of materials for "Preferences" dialog
- if ( id == GEOMOp::OpMaterialProperties ) {
- LightApp_Preferences* pref = preferences();
- if ( pref ) {
- Material_ResourceMgr aMatResMgr;
- setPreferenceProperty( pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true )->id(),
- "strings",
- aMatResMgr.materials() );
- }
- }
+ if( !theParam.isValid() )
+ library->OnGUIEvent( id, 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" ) );
createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" );
#endif
+ createGeomAction( GEOMOp::OpMaterialsLibrary, "MATERIALS_LIBRARY" );
createGeomAction( GEOMOp::OpDMWireframe, "WIREFRAME" );
createGeomAction( GEOMOp::OpDMShading, "SHADING" );
createGeomAction( GEOMOp::OpDMShadingWithEdges, "SHADING_WITH_EDGES" );
createGeomAction( GEOMOp::OpUnpublishObject, "POP_UNPUBLISH_OBJ" );
createGeomAction( GEOMOp::OpPublishObject, "POP_PUBLISH_OBJ" );
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
- createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" );
+ createGeomAction( GEOMOp::OpMaterialProperties, "POP_MATERIAL_PROPERTIES" );
+ createGeomAction( GEOMOp::OpPredefMaterCustom, "POP_PREDEF_MATER_CUSTOM" );
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
createMenu( GEOMOp::OpGetNonBlocks, measurId, -1 );
createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
-#ifdef _DEBUG_ // PAL16821
int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
+#if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
createMenu( separator(), toolsId, -1 );
createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
#endif
+
+ createMenu( separator(), toolsId, -1 );
+ createMenu( GEOMOp::OpMaterialsLibrary, toolsId, -1 );
+ createMenu( separator(), toolsId, -1 );
int viewId = createMenu( tr( "MEN_VIEW" ), -1, -1 );
createMenu( separator(), viewId, -1 );
mgr->insert( separator(), -1, -1 ); // -----------
dispmodeId = mgr->insert( tr( "MEN_DISPLAY_MODE" ), -1, -1 ); // display mode menu
mgr->insert( action( GEOMOp::OpWireframe ), dispmodeId, -1 ); // wireframe
- mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpWireframe ), clientOCCorVTK + " and displaymode='Wireframe'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpShading ), dispmodeId, -1 ); // shading
- mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShading ), clientOCCorVTK + " and displaymode='Shading'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpShadingWithEdges ), dispmodeId, -1 ); // shading with edges
- mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpShadingWithEdges ), clientOCCorVTK + " and displaymode='ShadingWithEdges'", QtxPopupMgr::ToggleRule );
mgr->insert( action( GEOMOp::OpTexture ), dispmodeId, -1 ); // wireframe
mgr->setRule( action( GEOMOp::OpTexture ), clientOCC_AndSomeVisible, QtxPopupMgr::VisibleRule );
mgr->setRule( action( GEOMOp::OpTexture), clientOCC + " and displaymode='Texture'", QtxPopupMgr::ToggleRule );
mgr->insert( separator(), dispmodeId, -1 );
mgr->insert( action( GEOMOp::OpVectors ), dispmodeId, -1 ); // vectors
- mgr->setRule( action( GEOMOp::OpVectors ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ 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->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpTransparency ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpIsos ), -1, -1 ); // isos
- mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpIsos ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible" + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpDeflection ), -1, -1 ); // deflection
- mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpDeflection ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible" + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
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 );
- mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 ); // material properties
- mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'}) and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
- mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 ); // texture
+
+ // material properties
+ mgr->insert( action( GEOMOp::OpMaterialProperties ), -1, -1 );
+ mgr->setRule( action( GEOMOp::OpMaterialProperties ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
+
+ // texture
+ mgr->insert( action( GEOMOp::OpSetTexture ), -1, -1 );
mgr->setRule( action( GEOMOp::OpSetTexture ), clientOCCorOB_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
int lineW = mgr->insert( tr( "MEN_LINE_WIDTH" ), -1, -1 ); // line width menu
mgr->insert( action( GEOMOp::OpEdgeWidth ), lineW, -1 ); // edge width
- mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpEdgeWidth ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->insert( action( GEOMOp::OpIsosWidth ), lineW, -1 ); // isos width
- mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
+ mgr->setRule( action( GEOMOp::OpIsosWidth ), clientOCCorVTK_AndSomeVisible + " and ($component={'GEOM'})", QtxPopupMgr::VisibleRule );
mgr->insert( separator(), -1, -1 ); // -----------
mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() )
if ( sr->viewer() == viewer )
{
- delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) );
+ /*delete*/ myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) );
break;
}
}
if ( LightApp_VTKSelector* sr = itVTKSel.next() )
if ( sr->viewer() == viewer )
{
- delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) );
+ /*delete*/ myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) );
break;
}
}
SalomeApp_Module::contextMenuPopup( client, menu, title );
SALOME_ListIO lst;
getApp()->selectionMgr()->selectedObjects( lst );
+
+ //Add submenu for predefined materials
+ bool isPredefMat = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "predef_materials" );
+ if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() > 0 ) {
+ QtxPopupMgr* mgr = popupMgr();
+ //get parrent for submenu
+ QAction* act = mgr->action( mgr->actionId( action( GEOMOp::OpMaterialProperties ) ) );
+ //Clear old menu
+ QMenu* oldMenu = act->menu() ;
+ if( oldMenu ) {
+ delete oldMenu;
+ }
+ 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() );
+ if ( anApp && anApp->activeViewManager() ) {
+ LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
+ if( aStudy ) {
+ v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), GEOM::propertyName( GEOM::Material ), QVariant() );
+ }
+ }
+ QString curModel = "";
+ if ( v.canConvert<QString>() ) curModel = v.toString();
+ // get list of all predefined materials
+ QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
+ bool found = false;
+ 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
+ Material_Model aModel;
+ aModel.fromResources( material );
+ if ( !found && aModel.toProperties() == curModel ) {
+ menAct->setChecked( true );
+ found = true;
+ }
+ }
+ matMenu->insertAction( matMenu->addSeparator(), action( GEOMOp::OpPredefMaterCustom ) );
+ matMenu->insertSeparator( action( GEOMOp::OpPredefMaterCustom ) );
+ connect( signalMapper, SIGNAL( mapped( const QString & ) ),
+ this, SLOT( OnSetMaterial( const QString & ) ) );
+ act->setMenu( matMenu );
+ }
+ }
+ //Set name
if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) io = lst.First();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
}
}
+void GeometryGUI::OnSetMaterial(const QString& theName)
+{
+ OnGUIEvent( GEOMOp::OpPredefMaterial, QVariant( theName ) );
+}
+
+
void GeometryGUI::createPreferences()
{
int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
+ addPreference( tr( "PREF_PREDEF_MATERIALS" ), genGroup,
+ LightApp_Preferences::Bool, "Geometry", "predef_materials" );
+
int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
- LightApp_Preferences::Selector,
- "Geometry", "material" );
+ LightApp_Preferences::Selector,
+ "Geometry", "material" );
+
+ addPreference( tr( "PREF_EDITGROUP_COLOR" ), genGroup,
+ LightApp_Preferences::Color, "Geometry", "editgroup_color" );
const int nb = 4;
int wd[nb];
setPreferenceProperty( wd[i], "min", 1 );
setPreferenceProperty( wd[i], "max", 5 );
}
+
+ 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" );
+ setPreferenceProperty( isoU, "min", 0 );
+ setPreferenceProperty( isoU, "max", 100000 );
+ int isoV = addPreference( tr( "PREF_ISOS_V" ), isoGroup,
+ LightApp_Preferences::IntSpin, "Geometry", "iso_number_v" );
+ setPreferenceProperty( isoV, "min", 0 );
+ setPreferenceProperty( isoV, "max", 100000 );
// Quantities with individual precision settings
int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
setPreferenceProperty( step, "precision", 3 );
// Set property for deflection value for spinboxes
- setPreferenceProperty( defl, "min", DEFLECTION_MIN );
+ setPreferenceProperty( defl, "min", GEOM::minDeflection() );
setPreferenceProperty( defl, "max", 1.0 );
setPreferenceProperty( defl, "step", 1.0e-04 );
setPreferenceProperty( defl, "precision", 6 );
// Set property for default material
- Material_ResourceMgr aMatResMgr;
- setPreferenceProperty( material, "strings", aMatResMgr.materials() );
-
+ setPreferenceProperty( material, "strings", Material_ResourceMgr::resourceMgr()->materials() );
+
// Set property vertex marker type
QList<QVariant> aMarkerTypeIndicesList;
QList<QVariant> aMarkerTypeIconsList;
if (!obj->FindAttribute(anAttr, "AttributeIOR"))
continue;
- std::string param,occParam = vType.toLatin1().data();
- occParam += NAME_SEPARATOR;
- occParam += QString::number(aMgrId).toLatin1().data();
- occParam += NAME_SEPARATOR;
+ QString param, occParam = vType;
+ occParam += GEOM::sectionSeparator();
+ occParam += QString::number(aMgrId);
+ occParam += GEOM::sectionSeparator();
- if (aProps.contains(VISIBILITY_PROP)) {
- param = occParam + VISIBILITY_PROP;
- ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
+ if (aProps.contains(GEOM::propertyName( GEOM::Visibility ))) {
+ param = occParam + GEOM::propertyName( GEOM::Visibility );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Visibility )).toBool() ? "On" : "Off");
}
- if (aProps.contains(DISPLAY_MODE_PROP)) {
- param = occParam + DISPLAY_MODE_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::DisplayMode ))) {
+ param = occParam + GEOM::propertyName( GEOM::DisplayMode );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::DisplayMode )).toString().toStdString());
}
- if (aProps.contains(COLOR_PROP)) {
- QColor c = aProps.value(COLOR_PROP).value<QColor>();
- QString colorStr = QString::number(c.red()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
- colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
- param = occParam + COLOR_PROP;
- ip->setParameter(entry, param, colorStr.toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Color ))) {
+ QColor c = aProps.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
+ QStringList val;
+ val << QString::number(c.redF());
+ val << QString::number(c.greenF());
+ val << QString::number(c.blueF());
+ param = occParam + GEOM::propertyName( GEOM::Color );
+ ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
}
if (vType == SVTK_Viewer::Type()) {
- if (aProps.contains(OPACITY_PROP)) {
- param = occParam + OPACITY_PROP;
- ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Opacity ))) {
+ param = occParam + GEOM::propertyName( GEOM::Opacity );
+ ip->setParameter(entry, param.toStdString(), QString::number(1. - aProps.value(GEOM::propertyName( GEOM::Transparency )).toDouble()).toStdString());
}
} else if (vType == SOCC_Viewer::Type()) {
- if (aProps.contains(TRANSPARENCY_PROP)) {
- param = occParam + TRANSPARENCY_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Transparency ))) {
+ param = occParam + GEOM::propertyName( GEOM::Transparency );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Transparency )).toString().toStdString());
}
- if (aProps.contains(TOP_LEVEL_PROP)) {
- param = occParam + TOP_LEVEL_PROP;
- Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
- if (val == Standard_True)
- ip->setParameter(entry, param, "1");
+ if (aProps.contains(GEOM::propertyName( GEOM::TopLevel ))) {
+ param = occParam + GEOM::propertyName( GEOM::TopLevel );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::TopLevel )).toString().toStdString());
}
}
- if (aProps.contains(ISOS_PROP)) {
- param = occParam + ISOS_PROP;
- ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::NbIsos ))) {
+ param = occParam + GEOM::propertyName( GEOM::NbIsos );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::NbIsos )).toString().toStdString());
}
- if (aProps.contains(VECTOR_MODE_PROP)) {
- param = occParam + VECTOR_MODE_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::EdgesDirection ))) {
+ param = occParam + GEOM::propertyName( GEOM::EdgesDirection );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::EdgesDirection )).toString().toStdString());
}
- if (aProps.contains(DEFLECTION_COEFF_PROP)) {
- param = occParam + DEFLECTION_COEFF_PROP;
- ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Deflection ))) {
+ param = occParam + GEOM::propertyName( GEOM::Deflection );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Deflection )).toString().toStdString());
}
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
- if (aProps.contains(MARKER_TYPE_PROP)) {
- param = occParam + MARKER_TYPE_PROP;
- ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::PointMarker ))) {
+ param = occParam + GEOM::propertyName( GEOM::PointMarker );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::PointMarker )).toString().toStdString());
}
- if (aProps.contains(MATERIAL_PROP)) {
- param = occParam + MATERIAL_PROP;
- ip->setParameter(entry, param, aProps.value(MATERIAL_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::Material ))) {
+ param = occParam + GEOM::propertyName( GEOM::Material );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Material )).toString().toStdString());
}
- if (aProps.contains(EDGE_WIDTH_PROP)) {
- param = occParam + EDGE_WIDTH_PROP;
- ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::LineWidth ))) {
+ param = occParam + GEOM::propertyName( GEOM::LineWidth );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::LineWidth )).toString().toStdString());
}
- if (aProps.contains(ISOS_WIDTH_PROP)) {
- param = occParam + ISOS_WIDTH_PROP;
- ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
+ if (aProps.contains(GEOM::propertyName( GEOM::IsosWidth ))) {
+ param = occParam + GEOM::propertyName( GEOM::IsosWidth );
+ ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
}
} // object iterator
} // for (views)
{
// visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
// '_' is used as separator and should not be used in viewer type or parameter names.
- QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts);
+ QStringList lst = QString((*namesIt).c_str()).split( GEOM::sectionSeparator(), QString::SkipEmptyParts);
if (lst.size() != 3)
continue;
}
QString val((*valuesIt).c_str());
- if (paramNameStr == VISIBILITY_PROP) {
- aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0);
- } else if (paramNameStr == OPACITY_PROP) {
- aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
- } else if (paramNameStr == TRANSPARENCY_PROP) {
- aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() );
- } else if (paramNameStr == TOP_LEVEL_PROP) {
- aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False );
- } else if (paramNameStr == DISPLAY_MODE_PROP) {
- aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
- } else if (paramNameStr == ISOS_PROP) {
- aListOfMap[viewIndex].insert( ISOS_PROP, val);
- } else if (paramNameStr == COLOR_PROP) {
- QStringList rgb = val.split(DIGIT_SEPARATOR);
+ if (paramNameStr == GEOM::propertyName( GEOM::Visibility )) {
+ aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Visibility ), val == "On");
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Opacity )) {
+ aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Transparency ), 1. - val.toDouble());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Transparency )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Transparency ), val.toDouble() );
+ } else if (paramNameStr == GEOM::propertyName( GEOM::TopLevel )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::TopLevel ), val == "true" || val == "1");
+ } else if (paramNameStr == GEOM::propertyName( GEOM::DisplayMode )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::DisplayMode ), val.toInt());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::NbIsos )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::NbIsos ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Color )) {
+ QStringList rgb = val.split(GEOM::subSectionSeparator());
if (rgb.count() == 3) {
- QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255));
- aListOfMap[viewIndex].insert( COLOR_PROP, c);
+ QColor c = QColor::fromRgbF(rgb[0].toDouble(), rgb[1].toDouble(), rgb[2].toDouble());
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Color ), c);
}
- } else if (paramNameStr == VECTOR_MODE_PROP) {
- aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt());
- } else if (paramNameStr == DEFLECTION_COEFF_PROP) {
- aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
- } else if (paramNameStr == MARKER_TYPE_PROP) {
- aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
- } else if (paramNameStr == MATERIAL_PROP) {
- aListOfMap[viewIndex].insert( MATERIAL_PROP, val);
- } else if (paramNameStr == EDGE_WIDTH_PROP) {
- aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP, val);
- } else if (paramNameStr == ISOS_WIDTH_PROP) {
- aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP, val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::EdgesDirection )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val == "true" || val == "1");
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Deflection ), val.toDouble());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::PointMarker )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::PointMarker ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::Material )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Material ), val);
+ } else if (paramNameStr == GEOM::propertyName( GEOM::LineWidth )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt());
+ } else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) {
+ aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt());
}
} // for names/parameters iterator
appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
//Get Visibility property of the current PropMap
- if (aListOfMap[index].value(VISIBILITY_PROP) == 1) {
+ if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
SUIT_ViewManager* vman = lst.at(index);
SUIT_ViewModel* vmodel = vman->getViewModel();
displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
}
return result;
}
+
+void GeometryGUI::updateMaterials()
+{
+ LightApp_Preferences* pref = preferences();
+ if ( pref ) {
+ QStringList materials = Material_ResourceMgr::resourceMgr()->materials();
+ QString currentMaterial = SUIT_Session::session()->resourceMgr()->stringValue( "Geometry", "material" );
+ if ( !materials.contains( currentMaterial ) )
+ // user material set as default in the preferences, might be removed
+ SUIT_Session::session()->resourceMgr()->setValue( "Geometry", "material", QString( "Plastic" ) );
+
+ QtxPreferenceItem* prefItem = pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true );
+ if ( prefItem ) {
+ setPreferenceProperty( prefItem->id(),
+ "strings", materials );
+ prefItem->retrieve();
+ }
+ }
+}
void EmitSignalDefaultStepValueChanged( double newVal );
// Process action
- void OnGUIEvent( int id );
+ void OnGUIEvent( int id, const QVariant& theParam = QVariant( QVariant::Invalid ) );
// The Working Plane management
void SetWorkingPlane( gp_Ax3 wp ) { myWorkingPlane = wp; }
void OnGUIEvent();
void onWindowActivated( SUIT_ViewWindow* );
void onViewAboutToShow();
+ void OnSetMaterial( const QString& );
+ void updateMaterials();
signals :
void SignalDeactivateActiveDialog();
OpExport = 1001, // MENU FILE - EXPORT
OpDelete = 1020, // MENU EDIT - DELETE
OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY
+ OpMaterialsLibrary = 1040, // MENU TOOLS - MATERIALS LIBRARY
OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX
OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE
OpSelectWire = 1102, // POPUP MENU - SELECT ONLY - WIRE
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
OpSetTexture = 1211, // POPUP MENU - SETTEXTURE
OpMaterialProperties = 1212, // POPUP MENU - MATERIAL PROPERTIES
+ OpPredefMaterial = 1213, // POPUP MENU - MATERIAL PROPERTIES - <SOME MATERIAL>
+ OpPredefMaterCustom = 1214, // POPUP MENU - MATERIAL PROPERTIES - CUSTOM...
OpDiscloseChildren = 1250, // POPUP MENU - DISCLOSE CHILD ITEMS
OpConcealChildren = 1251, // POPUP MENU - CONCEAL CHILD ITEMS
OpUnpublishObject = 1253, // POPUP MENU - UNPUBLISH
// 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_CircleDriver.hxx>
+
#include <GEOMImpl_ICircle.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRep_Tool.hxx>
+
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
//=======================================================================
//function : GetID
//purpose :
-//=======================================================================
+//=======================================================================
const Standard_GUID& GEOMImpl_CircleDriver::GetID()
{
static Standard_GUID aCircleDriver("FF1BBB32-5D14-4df2-980B-3A668264EA16");
- return aCircleDriver;
+ return aCircleDriver;
}
//=======================================================================
//function : GEOMImpl_CircleDriver
-//purpose :
+//purpose :
//=======================================================================
-GEOMImpl_CircleDriver::GEOMImpl_CircleDriver()
+GEOMImpl_CircleDriver::GEOMImpl_CircleDriver()
{
}
//=======================================================================
//function : Execute
//purpose :
-//=======================================================================
+//=======================================================================
Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const
{
- if (Label().IsNull()) return 0;
+ if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_ICircle aCI (aFunction);
Handle(GEOM_Function) aRefVector = aCI.GetVector();
if (!aRefVector.IsNull()) {
TopoDS_Shape aShapeVec = aRefVector->GetValue();
- if (aShapeVec.ShapeType() != TopAbs_EDGE) {
- Standard_ConstructionError::Raise
- ("Circle creation aborted: invalid vector argument, must be a vector or an edge");
- }
- TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
- TopoDS_Vertex V1, V2;
- TopExp::Vertices(anE, V1, V2, Standard_True);
- if (!V1.IsNull() && !V2.IsNull()) {
- aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
- if (aV.Magnitude() < gp::Resolution()) {
- Standard_ConstructionError::Raise
- ("Circle creation aborted: vector of zero length is given");
- }
- }
+ aV = GEOMUtils::GetVector(aShapeVec);
}
// Axes
gp_Ax2 anAxes (aP, aV);
//Make Circle
gp_Ax2 anAxes (aP1, aDir);
gp_Circ aCirc (anAxes, aRadius);
- aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
+ aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
}
}
else if (aType == CIRCLE_THREE_PNT) {
Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
Handle(Geom_Circle) aCirc = GC_MakeCircle(aP1, aP2, aP3).Value();
aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
- }
+ }
}
else {
}
aFunction->SetValue(aShape);
- log.SetTouched(Label());
+ log.SetTouched(Label());
- return 1;
+ return 1;
}
//=======================================================================
//function : GEOMImpl_CircleDriver_Type_
//purpose :
-//=======================================================================
+//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_CircleDriver_Type_()
{
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
- if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
-
+
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_CircleDriver",
//=======================================================================
//function : DownCast
//purpose :
-//=======================================================================
+//=======================================================================
const Handle(GEOMImpl_CircleDriver) Handle(GEOMImpl_CircleDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_CircleDriver) _anOtherObject;
// 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_FaceDriver.hxx>
+
#include <GEOMImpl_IFace.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
+#include <GEOMUtils.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRep_Tool.hxx>
} else if (aRefShape.ShapeType() == TopAbs_FACE) {
double aH = aFI.GetH() / 2.0;
double aW = aFI.GetW() / 2.0;
- gp_Ax3 anAx = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
+ gp_Ax3 anAx = GEOMUtils::GetPosition(aRefShape);
gp_Pln aPln (anAx);
aShape = BRepBuilderAPI_MakeFace(aPln, -aH, +aH, -aW, +aW).Shape();
}
#include <GEOMImpl_Fillet1d.hxx>
#include <GEOMImpl_IFillet1d.hxx>
#include <GEOMImpl_Types.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_HealingDriver.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <ShapeFix_Wire.hxx>
#include <StdFail_NotDone.hxx>
#include <Standard_ConstructionError.hxx>
aListOfNewEdge.Append(anEdgeToEdgeMap.Find(anEdge));
}
- GEOMImpl_IShapesOperations::SortShapes(aListOfNewEdge);
+ GEOMUtils::SortShapes(aListOfNewEdge);
BRepBuilderAPI_MakeWire aWireTool;
aWireTool.Add(aListOfNewEdge);
#include <GEOMImpl_IBlockTrsf.hxx>
#include <GEOMImpl_CopyDriver.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
+
+#include <GEOMUtils.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
} // while (listPrevEdges.Extent() > 0)
// Sort shapes in current chain (Mantis issue 21053)
- GEOMImpl_IShapesOperations::SortShapes(currentChain, Standard_False);
+ GEOMUtils::SortShapes(currentChain, Standard_False);
aFirstInChains.Append(currentChain.First());
aMapChains.Bind(currentChain.First(), currentChain);
}
// Sort chains (Mantis issue 21053)
- GEOMImpl_IShapesOperations::SortShapes(aFirstInChains, Standard_False);
+ GEOMUtils::SortShapes(aFirstInChains, Standard_False);
// Store sorted chains in the document
TopTools_ListIteratorOfListOfShape aChainsIt (aFirstInChains);
GEOMImpl_ISpline aCI (aFunction);
- int aLen = thePoints.size();
- aCI.SetLength(aLen);
aCI.SetConstructorType(POINT_CONSTRUCTOR);
- int ind = 1;
+ Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
- for (; it != thePoints.end(); it++, ind++) {
+ for (; it != thePoints.end(); it++) {
Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
-
- if (aRefPnt.IsNull()) return NULL;
-
- aCI.SetPoint(ind, aRefPnt);
+ if (aRefPnt.IsNull()) {
+ SetErrorCode("NULL point for Besier curve");
+ return NULL;
+ }
+ aPoints->Append(aRefPnt);
}
+ aCI.SetPoints(aPoints);
aCI.SetIsClosed(theIsClosed);
//Add a new Spline object
Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
- //Add a new Spline function for creation a bezier curve relatively to points set
+ //Add a new Spline function for interpolation type
Handle(GEOM_Function) aFunction =
aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOLATION);
if (aFunction.IsNull()) return NULL;
GEOMImpl_ISpline aCI (aFunction);
- int aLen = thePoints.size();
aCI.SetConstructorType(POINT_CONSTRUCTOR);
- aCI.SetLength(aLen);
- int ind = 1;
+ Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
- for (; it != thePoints.end(); it++, ind++) {
+ for (; it != thePoints.end(); it++) {
Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
-
- if (aRefPnt.IsNull()) return NULL;
-
- aCI.SetPoint(ind, aRefPnt);
+ if (aRefPnt.IsNull()) {
+ return NULL;
+ }
+ aPoints->Append(aRefPnt);
}
+ aCI.SetPoints(aPoints);
aCI.SetIsClosed(theIsClosed);
aCI.SetDoReordering(theDoReordering);
return aSpline;
}
+
+//=============================================================================
+/*!
+ * MakeSplineInterpolWithTangents
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSplineInterpolWithTangents
+ (std::list<Handle(GEOM_Object)> thePoints,
+ Handle(GEOM_Object) theFirstVec,
+ Handle(GEOM_Object) theLastVec)
+{
+ SetErrorCode(KO);
+
+ //Add a new Spline object
+ Handle(GEOM_Object) aSpline = GetEngine()->AddObject(GetDocID(), GEOM_SPLINE);
+
+ //Add a new Spline function for interpolation type
+ Handle(GEOM_Function) aFunction =
+ aSpline->AddFunction(GEOMImpl_SplineDriver::GetID(), SPLINE_INTERPOL_TANGENTS);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_SplineDriver::GetID()) return NULL;
+
+ GEOMImpl_ISpline aCI (aFunction);
+
+ aCI.SetConstructorType(POINT_CONSTRUCTOR);
+
+ Handle(TColStd_HSequenceOfTransient) aPoints = new TColStd_HSequenceOfTransient;
+ std::list<Handle(GEOM_Object)>::iterator it = thePoints.begin();
+ for (; it != thePoints.end(); it++) {
+ Handle(GEOM_Function) aRefPnt = (*it)->GetLastFunction();
+ if (aRefPnt.IsNull()) {
+ SetErrorCode("NULL point for Interpolation");
+ return NULL;
+ }
+ aPoints->Append(aRefPnt);
+ }
+ aCI.SetPoints(aPoints);
+
+ Handle(GEOM_Function) aVec1 = theFirstVec->GetLastFunction();
+ Handle(GEOM_Function) aVec2 = theLastVec->GetLastFunction();
+
+ if (aVec1.IsNull() || aVec2.IsNull()) return NULL;
+
+ aCI.SetFirstVector(aVec1);
+ aCI.SetLastVector(aVec2);
+
+ //Compute the Spline value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Spline 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 << aSpline << " = geompy.MakeInterpolWithTangents([";
+
+ it = thePoints.begin();
+ pd << (*it++);
+ while (it != thePoints.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "], " << theFirstVec << ", " << theLastVec << ")";
+
+ SetErrorCode(OK);
+ return aSpline;
+}
+
//=============================================================================
/*!
* MakeCurveParametric
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCurveParametric
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
double theParamMin, double theParamMax, double theParamStep,
- CurveType theCurveType,
+ CurveType theCurveType,
int theParamNbStep, bool theNewMethod)
{
TCollection_AsciiString aPyScript;
coords = PyObject_CallFunction(func,(char*)"(d, d, i)", theParamMin, theParamMax, theParamNbStep );
else
coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
-
+
PyObject* new_stderr = NULL;
if (coords == NULL){
GEOMImpl_ISpline aCI (aFunction);
- aCI.SetLength(lsize);
aCI.SetConstructorType(COORD_CONSTRUCTOR);
aCI.SetIsClosed(false);
aCI.SetCoordinates(aCoordsArray);
GEOMImpl_ISpline aCI (aFunction);
aCI.SetConstructorType(COORD_CONSTRUCTOR);
- aCI.SetLength(lsize);
aCI.SetIsClosed(false);
aCI.SetDoReordering(false);
aCI.SetCoordinates(aCoordsArray);
class Handle(GEOM_Object);
class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
-
+
public:
enum CurveType { Polyline, Bezier, Interpolation };
-
+
Standard_EXPORT GEOMImpl_ICurvesOperations(GEOM_Engine* theEngine, int theDocID);
Standard_EXPORT ~GEOMImpl_ICurvesOperations();
Standard_EXPORT Handle(GEOM_Object) MakeArc (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3);
-
+
Standard_EXPORT Handle(GEOM_Object) MakeArcCenter (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3,
bool theIsClosed = false,
bool theDoReordering = false);
+ Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolWithTangents
+ (std::list<Handle(GEOM_Object)> thePoints,
+ Handle(GEOM_Object) theFirstVec,
+ Handle(GEOM_Object) theLastVec);
+
Standard_EXPORT Handle(GEOM_Object) MakeCurveParametric
- (const char* thexExpr, const char* theyExpr, const char* thezExpr,
- double theParamMin, double theParamMax, double theParamStep,
+ (const char* thexExpr, const char* theyExpr, const char* thezExpr,
+ double theParamMin, double theParamMax, double theParamStep,
CurveType theCurveType, int theParamNbStep=0, bool theNewMethod=false);
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
if (aFunction->GetDriverGUID() != GEOMImpl_ImportDriver::GetID()) return result;
Handle(TCollection_HAsciiString) aHLibName;
- if (!IsSupported(Standard_True, theFormatName/*.SubString(1,4)*/, aHLibName)) {
+ if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) {
return result;
}
TCollection_AsciiString aLibName = aHLibName->String();
if (theFileName.IsEmpty() || theFormatName.IsEmpty() || theParameterName.IsEmpty()) return aValue;
Handle(TCollection_HAsciiString) aHLibName;
- if (!IsSupported(Standard_True, theFormatName/*.SubString(1,4)*/, aHLibName)) {
+ if (!IsSupported(Standard_True, theFormatName.SubString(1,4), aHLibName)) {
return aValue;
}
TCollection_AsciiString aLibName = aHLibName->String();
#include <GEOMImpl_IMeasure.hxx>
#include <GEOMImpl_IShapesOperations.hxx>
+#include <GEOMUtils.hxx>
+
#include <GEOMAlgo_ShapeInfo.hxx>
#include <GEOMAlgo_ShapeInfoFiller.hxx>
return aKind;
}
-//=============================================================================
-/*! Get LCS, corresponding to the given shape.
- * Origin of the LCS is situated at the shape's center of mass.
- * Axes of the LCS are obtained from shape's location or,
- * if the shape is a planar face, from position of its plane.
- */
-//=============================================================================
-gp_Ax3 GEOMImpl_IMeasureOperations::GetPosition (const TopoDS_Shape& theShape)
-{
- gp_Ax3 aResult;
-
- if (theShape.IsNull())
- return aResult;
-
- // Axes
- aResult.Transform(theShape.Location().Transformation());
- if (theShape.ShapeType() == TopAbs_FACE) {
- Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(theShape));
- if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
- Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
- gp_Pln aPln = aGPlane->Pln();
- aResult = aPln.Position();
- // In case of reverse orinetation of the face invert the plane normal
- // (the face's normal does not mathc the plane's normal in this case)
- if(theShape.Orientation() == TopAbs_REVERSED)
- {
- gp_Dir Vx = aResult.XDirection();
- gp_Dir N = aResult.Direction().Mirrored(Vx);
- gp_Pnt P = aResult.Location();
- aResult = gp_Ax3(P, N, Vx);
- }
- }
- }
-
- // Origin
- gp_Pnt aPnt;
-
- TopAbs_ShapeEnum aShType = theShape.ShapeType();
-
- if (aShType == TopAbs_VERTEX) {
- aPnt = BRep_Tool::Pnt(TopoDS::Vertex(theShape));
- }
- else {
- if (aShType == TopAbs_COMPOUND) {
- aShType = GEOMImpl_IShapesOperations::GetTypeOfSimplePart(theShape);
- }
-
- GProp_GProps aSystem;
- if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE)
- BRepGProp::LinearProperties(theShape, aSystem);
- else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL)
- BRepGProp::SurfaceProperties(theShape, aSystem);
- else
- BRepGProp::VolumeProperties(theShape, aSystem);
-
- aPnt = aSystem.CentreOfMass();
- }
-
- aResult.SetLocation(aPnt);
-
- return aResult;
-}
-
//=============================================================================
/*!
* GetPosition
OCC_CATCH_SIGNALS;
#endif
- gp_Ax3 anAx3 = GetPosition(aShape);
+ gp_Ax3 anAx3 = GEOMUtils::GetPosition(aShape);
gp_Pnt anOri = anAx3.Location();
gp_Dir aDirZ = anAx3.Direction();
SetErrorCode(OK);
}
+//=============================================================================
+/*!
+ * GetBoundingBox
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IMeasureOperations::GetBoundingBox
+ (Handle(GEOM_Object) theShape)
+{
+ SetErrorCode(KO);
+
+ if (theShape.IsNull()) return NULL;
+
+ //Add a new BoundingBox object
+ Handle(GEOM_Object) aBnd = GetEngine()->AddObject(GetDocID(), GEOM_BOX);
+
+ //Add a new BoundingBox function
+ Handle(GEOM_Function) aFunction =
+ aBnd->AddFunction(GEOMImpl_MeasureDriver::GetID(), BND_BOX_MEASURE);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_MeasureDriver::GetID()) return NULL;
+
+ GEOMImpl_IMeasure aCI (aFunction);
+
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) return NULL;
+
+ aCI.SetBase(aRefShape);
+
+ //Compute the BoundingBox value
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Measure driver failed to compute a bounding box");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aBnd << " = geompy.MakeBoundingBox(" << theShape << ")";
+
+ SetErrorCode(OK);
+ return aBnd;
+}
+
//=============================================================================
/*!
* GetTolerance
return Astr;
}
+//=============================================================================
+/*!
+ * AreCoordsInside
+ */
+//=============================================================================
+std::vector<bool> GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape,
+ const std::vector<double>& coords,
+ double tolerance)
+{
+ std::vector<bool> res;
+ if (!theShape.IsNull()) {
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (!aRefShape.IsNull()) {
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (!aShape.IsNull()) {
+ BRepClass3d_SolidClassifier SC(aShape);
+ unsigned int nb_points = coords.size()/3;
+ for (int i = 0; i < nb_points; i++) {
+ double x = coords[3*i];
+ double y = coords[3*i+1];
+ double z = coords[3*i+2];
+ gp_Pnt aPnt(x, y, z);
+ SC.Perform(aPnt, tolerance);
+ res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
+ }
+ }
+ }
+ }
+ return res;
+}
//=======================================================================
//function : CheckSingularCase
}
*/
-
-//=============================================================================
-/*!
- * AreCoordsInside
- */
-//=============================================================================
-std::vector<bool> GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape,
- const std::vector<double>& coords,
- double tolerance)
-{
- std::vector<bool> res;
- if (!theShape.IsNull()) {
- Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
- if (!aRefShape.IsNull()) {
- TopoDS_Shape aShape = aRefShape->GetValue();
- if (!aShape.IsNull()) {
- BRepClass3d_SolidClassifier SC(aShape);
- unsigned int nb_points = coords.size()/3;
- for (int i = 0; i < nb_points; i++) {
- double x = coords[3*i];
- double y = coords[3*i+1];
- double z = coords[3*i+2];
- gp_Pnt aPnt(x, y, z);
- SC.Perform(aPnt, tolerance);
- res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
- }
- }
- }
- }
- return res;
-}
-
//=============================================================================
/*!
* GetMinDistance
// additional workaround for bugs 19899, 19908 and 19910 from Mantis
gp_Pnt Ptmp1, Ptmp2;
double dist = CheckSingularCase(aShape1, aShape2, Ptmp1, Ptmp2);
- if(dist>-1.0) {
+ if (dist > -1.0) {
Ptmp1.Coord(X1, Y1, Z1);
Ptmp2.Coord(X2, Y2, Z2);
SetErrorCode(OK);
return MinDist;
}
+//=======================================================================
+/*!
+ * Get coordinates of closest points of two shapes
+ */
+//=======================================================================
+Standard_Integer GEOMImpl_IMeasureOperations::ClosestPoints (Handle(GEOM_Object) theShape1,
+ Handle(GEOM_Object) theShape2,
+ Handle(TColStd_HSequenceOfReal)& theDoubles)
+{
+ SetErrorCode(KO);
+ Standard_Integer nbSolutions = 0;
+
+ if (theShape1.IsNull() || theShape2.IsNull()) return nbSolutions;
+
+ Handle(GEOM_Function) aRefShape1 = theShape1->GetLastFunction();
+ Handle(GEOM_Function) aRefShape2 = theShape2->GetLastFunction();
+ if (aRefShape1.IsNull() || aRefShape2.IsNull()) return nbSolutions;
+
+ TopoDS_Shape aShape1 = aRefShape1->GetValue();
+ TopoDS_Shape aShape2 = aRefShape2->GetValue();
+ if (aShape1.IsNull() || aShape2.IsNull()) {
+ SetErrorCode("One of Objects has NULL Shape");
+ return nbSolutions;
+ }
+
+ // Compute the extremities
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+
+ // skl 30.06.2008
+ // additional workaround for bugs 19899, 19908 and 19910 from Mantis
+ gp_Pnt P1, P2;
+ double dist = CheckSingularCase(aShape1, aShape2, P1, P2);
+ if (dist > -1.0) {
+ nbSolutions = 1;
+
+ theDoubles->Append(P1.X());
+ theDoubles->Append(P1.Y());
+ theDoubles->Append(P1.Z());
+ theDoubles->Append(P2.X());
+ theDoubles->Append(P2.Y());
+ theDoubles->Append(P2.Z());
+
+ SetErrorCode(OK);
+ return nbSolutions;
+ }
+
+ BRepExtrema_DistShapeShape dst (aShape1, aShape2);
+ if (dst.IsDone()) {
+ nbSolutions = dst.NbSolution();
+ if (theDoubles.IsNull()) theDoubles = new TColStd_HSequenceOfReal;
+
+ gp_Pnt P1, P2;
+ for (int i = 1; i <= nbSolutions; i++) {
+ P1 = dst.PointOnShape1(i);
+ P2 = dst.PointOnShape2(i);
+
+ theDoubles->Append(P1.X());
+ theDoubles->Append(P1.Y());
+ theDoubles->Append(P1.Z());
+ theDoubles->Append(P2.X());
+ theDoubles->Append(P2.Y());
+ theDoubles->Append(P2.Z());
+ }
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return nbSolutions;
+ }
+
+ SetErrorCode(OK);
+ return nbSolutions;
+}
+
//=======================================================================
/*!
* Get coordinates of point
// 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_IMeasureOperations_HXX_
#define _GEOMImpl_IMeasureOperations_HXX_
Standard_Real& Ymin, Standard_Real& Ymax,
Standard_Real& Zmin, Standard_Real& Zmax);
+ Standard_EXPORT Handle(GEOM_Object) GetBoundingBox (Handle(GEOM_Object) theShape);
+
Standard_EXPORT void GetTolerance (Handle(GEOM_Object) theShape,
Standard_Real& FaceMin, Standard_Real& FaceMax,
Standard_Real& EdgeMin, Standard_Real& EdgeMax,
Standard_Real& X1, Standard_Real& Y1, Standard_Real& Z1,
Standard_Real& X2, Standard_Real& Y2, Standard_Real& Z2);
+ Standard_EXPORT Standard_Integer ClosestPoints (Handle(GEOM_Object) theShape1,
+ Handle(GEOM_Object) theShape2,
+ Handle(TColStd_HSequenceOfReal)& theDoubles);
+
Standard_EXPORT void PointCoordinates (Handle(GEOM_Object) theShape,
Standard_Real& theX, Standard_Real& theY, Standard_Real& theZ);
Standard_EXPORT Standard_Real MinSurfaceCurvatureByPoint (Handle(GEOM_Object) theSurf,
Handle(GEOM_Object) thePoint);
- public:
- Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape);
-
private:
void StructuralDump (const BRepCheck_Analyzer& theAna,
const TopoDS_Shape& theShape,
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
//NOTE: This is an intreface to a function for the Pipe creation.
-//
+
#ifndef _GEOMImpl_IPIPEDIFFSECT_HXX_
#define _GEOMImpl_IPIPEDIFFSECT_HXX_
#include "GEOM_Function.hxx"
+#include <TColStd_HSequenceOfTransient.hxx>
+
#ifndef _GEOMImpl_IPIPE_HXX_
#include "GEOMImpl_IPipe.hxx"
#endif
#include "GEOM_Function.hxx"
+#include <TColStd_HSequenceOfTransient.hxx>
+
class GEOMImpl_IPipePath
{
public:
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
//NOTE: This is an intreface to a function for the Pipe creation.
-//
+
#ifndef _GEOMImpl_IPIPESHELLSECT_HXX_
#define _GEOMImpl_IPIPESHELLSECT_HXX_
#include "GEOMImpl_IPipeDiffSect.hxx"
#endif
+#include <TColStd_HSequenceOfTransient.hxx>
+
#define PIPEDS_LIST_SUBBASES 6
#include "GEOM_ISubShape.hxx"
#include "GEOM_PythonDump.hxx"
+#include "GEOMUtils.hxx"
+
#include "GEOMAlgo_ClsfBox.hxx"
#include "GEOMAlgo_ClsfSolid.hxx"
#include "GEOMAlgo_CoupleOfShapes.hxx"
#include <BRepClass3d_SolidClassifier.hxx>
#include <Precision.hxx>
-#define STD_SORT_ALGO 1
-
//=============================================================================
/*!
* constructor:
}
// for stable order of returned entities
- GEOMImpl_IShapesOperations::SortShapes(listOnePerSet, Standard_False);
+ GEOMUtils::SortShapes(listOnePerSet, Standard_False);
TopTools_ListIteratorOfListOfShape aListIt (listOnePerSet);
for (; aListIt.More(); aListIt.Next()) {
bool isOldSorting = false;
if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN)
isOldSorting = true;
- SortShapes(listShape, isOldSorting);
+ GEOMUtils::SortShapes(listShape, isOldSorting);
}
TopTools_IndexedMapOfShape anIndices;
bool isOldSorting = false;
if (theExplodeType == EXPLODE_OLD_INCLUDE_MAIN)
isOldSorting = true;
- SortShapes(listShape, isOldSorting);
+ GEOMUtils::SortShapes(listShape, isOldSorting);
}
TopTools_IndexedMapOfShape anIndices;
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aMainShape, anIndices);
- if (anIndices.Contains(aSubShape)) {
+// if (anIndices.Contains(aSubShape)) {
+// SetErrorCode(OK);
+// return anIndices.FindIndex(aSubShape);
+// }
+ int id = anIndices.FindIndex(aSubShape);
+ if (id > 0)
+ {
SetErrorCode(OK);
- return anIndices.FindIndex(aSubShape);
+ return id;
}
-
return -1;
}
+
+
+//=============================================================================
+/*!
+ * GetSubShapeIndices
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) GEOMImpl_IShapesOperations::GetSubShapesIndices (Handle(GEOM_Object) theMainShape,
+ std::list<Handle(GEOM_Object)> theSubShapes)
+{
+ MESSAGE("GEOMImpl_IShapesOperations::GetSubShapesIndices")
+ SetErrorCode(KO);
+
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+
+ TopoDS_Shape aMainShape = theMainShape->GetValue();
+ if (aMainShape.IsNull())
+ {
+ MESSAGE("NULL main shape")
+ return NULL;
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopExp::MapShapes(aMainShape, anIndices);
+
+ std::list<Handle(GEOM_Object)>::iterator it;
+ for (it=theSubShapes.begin(); it != theSubShapes.end(); ++it)
+ {
+ TopoDS_Shape aSubShape = (*it)->GetValue();
+ if (aSubShape.IsNull())
+ {
+ MESSAGE("NULL subshape")
+ return NULL;
+ }
+ int id = anIndices.FindIndex(aSubShape);
+ aSeq->Append(id);
+ }
+
+ SetErrorCode(OK);
+ return aSeq;
+}
+
+
//=============================================================================
/*!
* GetTopologyIndex
TopoDS_Shape aShape = theShape->GetValue();
// Check presence of triangulation, build if need
- if (!CheckTriangulation(aShape)) {
+ if (!GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theBox)->GetLastFunction();
// Make a Python command
- GEOM::TPythonDump(aFunction)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnBoxIDs = geompy.GetShapesOnBoxIDs("
<< theBox << ", "
<< theShape << ", "
TopTools_ListOfShape res;
// Check presence of triangulation, build if need
- if (!CheckTriangulation(aShape)) {
+ if (!GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
GEOM::GetCreatedLast(theShape,theCheckShape)->GetLastFunction();
// Make a Python command
- GEOM::TPythonDump(aFunction)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnBoxIDs = geompy.GetShapesOnShapeIDs("
<< theCheckShape << ", "
<< theShape << ", "
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!CheckTriangulation(theShape)) {
+ if (!GEOMUtils::CheckTriangulation(theShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
- << "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
+ << "listShapesOnCylinder = geompy.GetShapesOnSphereIDs"
<< "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
<< theRadius << ", " << theState << ")";
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!CheckTriangulation(aShape)) {
+ if (!GEOMUtils::CheckTriangulation(aShape)) {
SetErrorCode("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
}
}
-//================================================================================
-/*!
- * \brief Return type of shape for explode. In case of compound it will be a type of sub-shape.
- */
-//================================================================================
-TopAbs_ShapeEnum GEOMImpl_IShapesOperations::GetTypeOfSimplePart (const TopoDS_Shape& theShape)
-{
- TopAbs_ShapeEnum aType = theShape.ShapeType();
- if (aType == TopAbs_VERTEX) return TopAbs_VERTEX;
- else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE;
- else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE;
- else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID;
- else if (aType == TopAbs_COMPOUND) {
- // Only the iType of the first shape in the compound is taken into account
- TopoDS_Iterator It (theShape, Standard_False, Standard_False);
- if (It.More()) {
- return GetTypeOfSimplePart(It.Value());
- }
- }
- return TopAbs_SHAPE;
-}
-
//=============================================================================
/*!
* case GetInPlace:
GProp_GProps aProps;
// Find the iType of the aWhat shape
- iType = GetTypeOfSimplePart(aWhat);
+ iType = GEOMUtils::GetTypeOfSimplePart(aWhat);
if (iType == TopAbs_SHAPE) {
SetErrorCode("Error: An attempt to extract a shape of not supported type.");
return NULL;
return NULL;
}
*/
- iType = GetTypeOfSimplePart(aWhat);
+ iType = GEOMUtils::GetTypeOfSimplePart(aWhat);
if (iType == TopAbs_SHAPE) {
SetErrorCode("Error: An attempt to extract a shape of not supported type.");
return NULL;
return aResult;
}
-//=======================================================================
-//function : ShapeToDouble
-//purpose : used by CompareShapes::operator()
-//=======================================================================
-std::pair<double, double> ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting)
-{
- // Computing of CentreOfMass
- gp_Pnt GPoint;
- double Len;
-
- if (S.ShapeType() == TopAbs_VERTEX) {
- GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
- Len = (double)S.Orientation();
- }
- else {
- GProp_GProps GPr;
- // BEGIN: fix for Mantis issue 0020842
- if (isOldSorting) {
- BRepGProp::LinearProperties(S, GPr);
- }
- else {
- if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
- BRepGProp::LinearProperties(S, GPr);
- }
- else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
- BRepGProp::SurfaceProperties(S, GPr);
- }
- else {
- BRepGProp::VolumeProperties(S, GPr);
- }
- }
- // END: fix for Mantis issue 0020842
- GPoint = GPr.CentreOfMass();
- Len = GPr.Mass();
- }
-
- double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
- return std::make_pair(dMidXYZ, Len);
-}
-
-//=======================================================================
-//function : CompareShapes::operator()
-//purpose : used by std::sort(), called from SortShapes()
-//=======================================================================
-bool GEOMImpl_IShapesOperations::CompareShapes::operator()(const TopoDS_Shape& theShape1,
- const TopoDS_Shape& theShape2)
-{
- if (!myMap.IsBound(theShape1)) {
- myMap.Bind(theShape1, ShapeToDouble(theShape1, myIsOldSorting));
- }
-
- if (!myMap.IsBound(theShape2)) {
- myMap.Bind(theShape2, ShapeToDouble(theShape2, myIsOldSorting));
- }
-
- std::pair<double, double> val1 = myMap.Find(theShape1);
- std::pair<double, double> val2 = myMap.Find(theShape2);
-
- double tol = Precision::Confusion();
- bool exchange = Standard_False;
-
- double dMidXYZ = val1.first - val2.first;
- if (dMidXYZ >= tol) {
- exchange = Standard_True;
- }
- else if (Abs(dMidXYZ) < tol) {
- double dLength = val1.second - val2.second;
- if (dLength >= tol) {
- exchange = Standard_True;
- }
- else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) {
- // PAL17233
- // equal values possible on shapes such as two halves of a sphere and
- // a membrane inside the sphere
- Bnd_Box box1,box2;
- BRepBndLib::Add(theShape1, box1);
- if (!box1.IsVoid()) {
- BRepBndLib::Add(theShape2, box2);
- Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
- if (dSquareExtent >= tol) {
- exchange = Standard_True;
- }
- else if (Abs(dSquareExtent) < tol) {
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
- box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
- box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
- if ((val1 - val2) >= tol) {
- exchange = Standard_True;
- }
- }
- }
- }
- }
-
- //return val1 < val2;
- return !exchange;
-}
-
-//=======================================================================
-//function : SortShapes
-//purpose :
-//=======================================================================
-void GEOMImpl_IShapesOperations::SortShapes(TopTools_ListOfShape& SL,
- const Standard_Boolean isOldSorting)
-{
-#ifdef STD_SORT_ALGO
- std::vector<TopoDS_Shape> aShapesVec;
- aShapesVec.reserve(SL.Extent());
-
- TopTools_ListIteratorOfListOfShape it (SL);
- for (; it.More(); it.Next()) {
- aShapesVec.push_back(it.Value());
- }
- SL.Clear();
-
- CompareShapes shComp (isOldSorting);
- std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
- //std::sort(aShapesVec.begin(), aShapesVec.end(), shComp);
-
- std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
- for (; anIter != aShapesVec.end(); ++anIter) {
- SL.Append(*anIter);
- }
-#else
- // old implementation
- Standard_Integer MaxShapes = SL.Extent();
- TopTools_Array1OfShape aShapes (1,MaxShapes);
- TColStd_Array1OfInteger OrderInd(1,MaxShapes);
- TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z;
- TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z;
-
- // Computing of CentreOfMass
- Standard_Integer Index;
- GProp_GProps GPr;
- gp_Pnt GPoint;
- TopTools_ListIteratorOfListOfShape it(SL);
- for (Index=1; it.More(); Index++)
- {
- TopoDS_Shape S = it.Value();
- SL.Remove( it ); // == it.Next()
- aShapes(Index) = S;
- OrderInd.SetValue (Index, Index);
- if (S.ShapeType() == TopAbs_VERTEX) {
- GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S ));
- Length.SetValue( Index, (Standard_Real) S.Orientation());
- }
- else {
- // BEGIN: fix for Mantis issue 0020842
- if (isOldSorting) {
- BRepGProp::LinearProperties (S, GPr);
- }
- else {
- if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
- BRepGProp::LinearProperties (S, GPr);
- }
- else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
- BRepGProp::SurfaceProperties(S, GPr);
- }
- else {
- BRepGProp::VolumeProperties(S, GPr);
- }
- }
- // END: fix for Mantis issue 0020842
- GPoint = GPr.CentreOfMass();
- Length.SetValue(Index, GPr.Mass());
- }
- MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9);
- //cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl;
- }
-
- // Sorting
- Standard_Integer aTemp;
- Standard_Boolean exchange, Sort = Standard_True;
- Standard_Real tol = Precision::Confusion();
- while (Sort)
- {
- Sort = Standard_False;
- for (Index=1; Index < MaxShapes; Index++)
- {
- exchange = Standard_False;
- Standard_Real dMidXYZ = MidXYZ(OrderInd(Index)) - MidXYZ(OrderInd(Index+1));
- Standard_Real dLength = Length(OrderInd(Index)) - Length(OrderInd(Index+1));
- if ( dMidXYZ >= tol ) {
-// cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <<MidXYZ(OrderInd(Index+1))
-// << " d: " << dMidXYZ << endl;
- exchange = Standard_True;
- }
- else if ( Abs(dMidXYZ) < tol && dLength >= tol ) {
-// cout << "Length: " << Length(OrderInd(Index))<< " > " <<Length(OrderInd(Index+1))
-// << " d: " << dLength << endl;
- exchange = Standard_True;
- }
- else if ( Abs(dMidXYZ) < tol && Abs(dLength) < tol &&
- aShapes(OrderInd(Index)).ShapeType() <= TopAbs_FACE) {
- // PAL17233
- // equal values possible on shapes such as two halves of a sphere and
- // a membrane inside the sphere
- Bnd_Box box1,box2;
- BRepBndLib::Add( aShapes( OrderInd(Index) ), box1 );
- if ( box1.IsVoid() ) continue;
- BRepBndLib::Add( aShapes( OrderInd(Index+1) ), box2 );
- Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
- if ( dSquareExtent >= tol ) {
-// cout << "SquareExtent: " << box1.SquareExtent()<<" > "<<box2.SquareExtent() << endl;
- exchange = Standard_True;
- }
- else if ( Abs(dSquareExtent) < tol ) {
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
- box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- val1 = (aXmin+aXmax)*999 + (aYmin+aYmax)*99 + (aZmin+aZmax)*0.9;
- box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
- val2 = (aXmin+aXmax)*999 + (aYmin+aYmax)*99 + (aZmin+aZmax)*0.9;
- //exchange = val1 > val2;
- if ((val1 - val2) >= tol) {
- exchange = Standard_True;
- }
- //cout << "box: " << val1<<" > "<<val2 << endl;
- }
- }
-
- if (exchange)
- {
-// cout << "exchange " << Index << " & " << Index+1 << endl;
- aTemp = OrderInd(Index);
- OrderInd(Index) = OrderInd(Index+1);
- OrderInd(Index+1) = aTemp;
- Sort = Standard_True;
- }
- }
- }
-
- for (Index=1; Index <= MaxShapes; Index++)
- SL.Append( aShapes( OrderInd(Index) ));
-#endif
-}
-
-//=======================================================================
-//function : CompsolidToCompound
-//purpose :
-//=======================================================================
-TopoDS_Shape GEOMImpl_IShapesOperations::CompsolidToCompound (const TopoDS_Shape& theCompsolid)
-{
- if (theCompsolid.ShapeType() != TopAbs_COMPSOLID) {
- return theCompsolid;
- }
-
- TopoDS_Compound aCompound;
- BRep_Builder B;
- B.MakeCompound(aCompound);
-
- TopTools_MapOfShape mapShape;
- TopoDS_Iterator It (theCompsolid, Standard_True, Standard_True);
-
- for (; It.More(); It.Next()) {
- TopoDS_Shape aShape_i = It.Value();
- if (mapShape.Add(aShape_i)) {
- B.Add(aCompound, aShape_i);
- }
- }
-
- return aCompound;
-}
-
-//=======================================================================
-//function : CheckTriangulation
-//purpose :
-//=======================================================================
-bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
-{
- bool isTriangulation = true;
-
- TopExp_Explorer exp (aShape, TopAbs_FACE);
- if (exp.More())
- {
- TopLoc_Location aTopLoc;
- Handle(Poly_Triangulation) aTRF;
- aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
- if (aTRF.IsNull()) {
- isTriangulation = false;
- }
- }
- else // no faces, try edges
- {
- TopExp_Explorer expe (aShape, TopAbs_EDGE);
- if (!expe.More()) {
- return false;
- }
- TopLoc_Location aLoc;
- Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
- if (aPE.IsNull()) {
- isTriangulation = false;
- }
- }
-
- if (!isTriangulation) {
- // calculate deflection
- Standard_Real aDeviationCoefficient = 0.001;
-
- Bnd_Box B;
- BRepBndLib::Add(aShape, B);
- Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
- B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
-
- Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
- Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
- Standard_Real aHLRAngle = 0.349066;
-
- BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
- }
-
- return true;
-}
-
#define MAX_TOLERANCE 1.e-7
//=======================================================================
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShapeWhere,theShapeWhat)->GetLastFunction();
// Make a Python command
- GEOM::TPythonDump(aFunction)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listSameIDs = geompy.GetSameIDs("
<< theShapeWhere << ", "
<< theShapeWhat << ")";
class Handle(GEOM_Object);
class Handle(TColStd_HArray1OfInteger);
-inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2)
-{
- return S1.IsSame(S2);
-}
-
class GEOMImpl_IShapesOperations : public GEOM_IOperations
{
public:
Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape,
Handle(GEOM_Object) theSubShape);
+
+ Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetSubShapesIndices (Handle(GEOM_Object) theMainShape,
+ std::list<Handle(GEOM_Object)> theSubShapes);
Standard_EXPORT Standard_Integer GetTopologyIndex (Handle(GEOM_Object) theMainShape,
Handle(GEOM_Object) theSubShape);
const Standard_Integer theShapeType,
GEOMAlgo_State theState);
- public:
- /*!
- * \brief Sort shapes in the list by their coordinates.
- * \param SL The list of shapes to sort.
- */
- struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
- {
- CompareShapes (bool isOldSorting)
- : myIsOldSorting(isOldSorting) {}
-
- bool operator()(const TopoDS_Shape& lhs, const TopoDS_Shape& rhs);
-
- typedef NCollection_DataMap<TopoDS_Shape, std::pair<double, double> > NCollection_DataMapOfShapeDouble;
- NCollection_DataMapOfShapeDouble myMap;
- bool myIsOldSorting;
- };
-
- Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL,
- const Standard_Boolean isOldSorting = Standard_True);
-
- /*!
- * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
- *
- * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
- *
- * \param theCompsolid The compsolid to be converted.
- * \retval TopoDS_Shape Returns the resulting compound.
- */
- Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
-
- /*!
- * \brief Build a triangulation on \a theShape if it is absent.
- * \param theShape The shape to check/build triangulation on.
- * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
- */
- Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
-
- /*!
- * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
- * \param theShape The shape to get type of.
- * \retval TopAbs_ShapeEnum Return type of shape for explode.
- */
- Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape);
-
private:
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// NOTE: This is an interface to a function for the Spline creation.
-#include "GEOM_Function.hxx"
-#include <TColStd_HArray1OfReal.hxx>
+#include <GEOM_Function.hxx>
-#define SPL_ARG_LENG 1
-#define SPL_ARG_CLOS 2
-#define SPL_ARG_REOR 3
-#define SPL_ARG_LAST 2
-
-#define SPL_CONSTRUCTOR 4
-#define SPL_ARG_ARRAY 5
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_HArray1OfReal.hxx>
class GEOMImpl_ISpline
{
public:
+ enum {
+ ARG_POINTS = 1,
+ ARG_CLOSED = 2,
+ ARG_REORDER = 3,
+ CONSTRUCTOR = 4,
+ ARG_ARRAY = 5,
+ ARG_VEC_1 = 6,
+ ARG_VEC_2 = 7
+ };
+
GEOMImpl_ISpline(Handle(GEOM_Function) theFunction): _func(theFunction) {}
- void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); }
+ // Set
- void SetIsClosed(bool theIsClosed) { _func->SetInteger(SPL_ARG_CLOS, (int)theIsClosed); }
+ void SetPoints (const Handle(TColStd_HSequenceOfTransient)& thePoints)
+ { _func->SetReferenceList(ARG_POINTS, thePoints); }
- void SetDoReordering(bool theDoReordering) { _func->SetInteger(SPL_ARG_REOR, (int)theDoReordering); }
+ void SetIsClosed (bool theIsClosed) { _func->SetInteger(ARG_CLOSED, (int)theIsClosed); }
+ void SetDoReordering (bool theDoReordering) { _func->SetInteger(ARG_REORDER, (int)theDoReordering); }
- void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); }
+ void SetConstructorType (int theConstructor) { _func->SetInteger(CONSTRUCTOR, theConstructor); }
- int GetLength() { return _func->GetInteger(SPL_ARG_LENG); }
+ void SetCoordinates (const Handle(TColStd_HArray1OfReal)& theValue)
+ { _func->SetRealArray(ARG_ARRAY, theValue); }
- bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); }
+ void SetFirstVector (Handle(GEOM_Function) theVec) { _func->SetReference(ARG_VEC_1, theVec); }
+ void SetLastVector (Handle(GEOM_Function) theVec) { _func->SetReference(ARG_VEC_2, theVec); }
- bool GetDoReordering() { return (bool)_func->GetInteger(SPL_ARG_REOR); }
+ // Get
- Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); }
+ Handle(TColStd_HSequenceOfTransient) GetPoints() { return _func->GetReferenceList(ARG_POINTS); }
+ bool GetIsClosed() { return (bool)_func->GetInteger(ARG_CLOSED); }
+ bool GetDoReordering() { return (bool)_func->GetInteger(ARG_REORDER); }
- void SetConstructorType(int theConstructor) {_func->SetInteger(SPL_CONSTRUCTOR,theConstructor); }
+ int GetConstructorType() { return _func->GetInteger(CONSTRUCTOR); }
- int GetConstructorType() { return _func->GetInteger(SPL_CONSTRUCTOR); }
+ Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(ARG_ARRAY); }
+ Handle(GEOM_Function) GetFirstVector () { return _func->GetReference(ARG_VEC_1); }
+ Handle(GEOM_Function) GetLastVector () { return _func->GetReference(ARG_VEC_2); }
+
+ /* Old implementation (Salome 6.6.0 and earlier)
+#define SPL_ARG_LENG 1
+#define SPL_ARG_CLOS 2
+#define SPL_ARG_REOR 3
+#define SPL_ARG_LAST 2
+
+#define SPL_CONSTRUCTOR 4
+#define SPL_ARG_ARRAY 5
+
+ void SetLength(int theLen) { _func->SetInteger(SPL_ARG_LENG, theLen); }
+ void SetIsClosed(bool theIsClosed) { _func->SetInteger(SPL_ARG_CLOS, (int)theIsClosed); }
+ void SetDoReordering(bool theDoReordering) { _func->SetInteger(SPL_ARG_REOR, (int)theDoReordering); }
+ void SetConstructorType(int theConstructor) {_func->SetInteger(SPL_CONSTRUCTOR,theConstructor); }
+ void SetPoint(int theId, Handle(GEOM_Function) theP) { _func->SetReference(SPL_ARG_LAST + theId, theP); }
void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue)
{ _func->SetRealArray(SPL_ARG_ARRAY, theValue); }
-
+ int GetLength() { return _func->GetInteger(SPL_ARG_LENG); }
+ bool GetIsClosed() { return (bool)_func->GetInteger(SPL_ARG_CLOS); }
+ bool GetDoReordering() { return (bool)_func->GetInteger(SPL_ARG_REOR); }
+ int GetConstructorType() { return _func->GetInteger(SPL_CONSTRUCTOR); }
+ Handle(GEOM_Function) GetPoint(int theId) { return _func->GetReference(SPL_ARG_LAST + theId); }
Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SPL_ARG_ARRAY); }
+ */
private:
// 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>
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateTwoPoints("
+ GEOM::TPythonDump(aFunction) << "geompy.TranslateTwoPoints("
<< theObject << ", " << thePoint1 << ", " << thePoint2 << ")";
SetErrorCode(OK);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.TranslateVector("
+ GEOM::TPythonDump(aFunction) << "geompy.TranslateVector("
<< theObject << ", " << theVector << ")";
SetErrorCode(OK);
{
SetErrorCode(KO);
- if (theObject.IsNull() || theVector.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
- GEOMImpl_ITranslate aTI(aFunction);
- aTI.SetVector(theVector->GetLastFunction());
+ GEOMImpl_ITranslate aTI (aFunction);
aTI.SetOriginal(aLastFunction);
+ if (!theVector.IsNull())
+ aTI.SetVector(theVector->GetLastFunction());
aTI.SetStep1(theStep);
aTI.SetNbIter1(theNbTimes);
{
SetErrorCode(KO);
- if (theObject.IsNull() || theVector.IsNull() || theVector2.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
if (aFunction->GetDriverGUID() != GEOMImpl_TranslateDriver::GetID()) return NULL;
GEOMImpl_ITranslate aTI (aFunction);
- aTI.SetVector(theVector->GetLastFunction());
- aTI.SetVector2(theVector2->GetLastFunction());
aTI.SetOriginal(aLastFunction);
+ if (!theVector.IsNull())
+ aTI.SetVector(theVector->GetLastFunction());
aTI.SetStep1(theStep1);
aTI.SetNbIter1(theNbTimes1);
+ if (!theVector2.IsNull())
+ aTI.SetVector2(theVector2->GetLastFunction());
aTI.SetStep2(theStep2);
aTI.SetNbIter2(theNbTimes2);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPlane("
+ GEOM::TPythonDump(aFunction) << "geompy.MirrorByPlane("
<< theObject << ", " << thePlane << ")";
SetErrorCode(OK);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorPoint("
+ GEOM::TPythonDump(aFunction) << "geompy.MirrorByPoint("
<< theObject << ", " << thePoint << ")";
SetErrorCode(OK);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.MirrorAxis("
+ GEOM::TPythonDump(aFunction) << "geompy.MirrorByAxis("
<< theObject << ", " << theAxis << ")";
SetErrorCode(OK);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.OffsetShape("
+ GEOM::TPythonDump(aFunction) << "geompy.Offset("
<< theObject << ", " << theOffset << ")";
SetErrorCode(OK);
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShape("
+ GEOM::TPythonDump(aFunction) << "geompy.Scale("
<< theObject << ", " << thePoint << ", " << theFactor << ")";
SetErrorCode(OK);
return aCopy;
}
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.ScaleShapeAlongAxes("
+ GEOM::TPythonDump(aFunction) << "geompy.ScaleAlongAxes("
<< theObject << ", " << thePoint << ", "
<< theFactorX << ", " << theFactorY << ", " << theFactorZ << ")";
return theObject;
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionShape("
+ GEOM::TPythonDump(aFunction) << "geompy.Position("
<< theObject << ", " << theStartLCS << ", " << theEndLCS << ")";
SetErrorCode(OK);
//Make a Python command
if (theCopy) {
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.PositionAlongPath("
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakePositionAlongPath("
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
return aCopy;
}
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionAlongPath("
+ GEOM::TPythonDump(aFunction) << "geompy.PositionAlongPath("
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
//=============================================================================
/*!
- * Rotate
+ * RotateCopy
*/
//=============================================================================
-Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject, Handle(GEOM_Object) theAxis, double theAngle)
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngle)
{
SetErrorCode(KO);
//=============================================================================
/*!
- * Rotate1D
+ * Rotate1D (for MultiRotate1DNbTimes)
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
{
SetErrorCode(KO);
- if (theObject.IsNull() || theAxis.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
GEOMImpl_IRotate aRI(aFunction);
aRI.SetOriginal(aLastFunction);
- aRI.SetAxis(theAxis->GetLastFunction());
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
aRI.SetNbIter1(theNbTimes);
//Compute the translation
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1D("
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate1DNbTimes("
<< theObject << ", " << theAxis << ", " << theNbTimes << ")";
SetErrorCode(OK);
//=============================================================================
/*!
- * Rotate2D
+ * Rotate1D (for MultiRotate1DByStep)
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate1D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngleStep,
+ Standard_Integer theNbSteps)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+
+ //Add a rotate function
+ aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_1D_STEP);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+ //Convert angle into degrees
+ double anAngleStep = theAngleStep * 180. / M_PI;
+
+ GEOMImpl_IRotate aRI (aFunction);
+ aRI.SetOriginal(aLastFunction);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngleStep);
+ aRI.SetNbIter1(theNbSteps);
+
+ //Compute the translation
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Rotate 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(aFunction)
+ << aCopy << " = geompy.MultiRotate1DByStep(" << theObject << ", "
+ << theAxis << ", " << anAngleStep << "*math.pi/180.0, " << theNbSteps << ")";
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
+//=============================================================================
+/*!
+ * Rotate2D (for MultiRotate2DNbTimes)
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
- double theAngle,
+ Standard_Integer theNbObjects,
+ double theRadialStep,
+ Standard_Integer theNbSteps)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+
+ //Add a new Copy object
+ Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+
+ //Add a rotate function
+ aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
+
+ double anAngle = 360. / (double)theNbObjects;
+
+ GEOMImpl_IRotate aRI (aFunction);
+ aRI.SetOriginal(aLastFunction);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngle);
+ aRI.SetNbIter1(theNbObjects);
+ aRI.SetStep(theRadialStep);
+ aRI.SetNbIter2(theNbSteps);
+
+ //Compute the translation
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Rotate 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(aFunction) << aCopy << " = geompy.MultiRotate2DNbTimes("
+ << theObject << ", " << theAxis << ", " << theNbObjects
+ << ", " << theRadialStep << ", " << theNbSteps << ")";
+
+ SetErrorCode(OK);
+ return aCopy;
+}
+
+//=============================================================================
+/*!
+ * Rotate2D (for MultiRotate2DByStep)
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ITransformOperations::Rotate2D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngleStep,
Standard_Integer theNbTimes1,
double theStep,
Standard_Integer theNbTimes2)
{
SetErrorCode(KO);
- if (theObject.IsNull() || theAxis.IsNull()) return NULL;
+ if (theObject.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
//Add a new Copy object
Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_2D);
if (aFunction.IsNull()) return NULL;
- //Check if the function is set correctly
+ //Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_RotateDriver::GetID()) return NULL;
- GEOMImpl_IRotate aRI(aFunction);
- aRI.SetAxis(theAxis->GetLastFunction());
+ //Convert angle into degrees
+ double anAngleStep = theAngleStep * 180. / M_PI;
+
+ GEOMImpl_IRotate aRI (aFunction);
aRI.SetOriginal(aLastFunction);
+ if (!theAxis.IsNull())
+ aRI.SetAxis(theAxis->GetLastFunction());
+ aRI.SetAngle(anAngleStep);
aRI.SetNbIter1(theNbTimes1);
- aRI.SetNbIter2(theNbTimes2);
- aRI.SetAngle(theAngle);
aRI.SetStep(theStep);
+ aRI.SetNbIter2(theNbTimes2);
//Compute the translation
try {
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MultiRotate2D("
- << theObject << ", " << theAxis << ", " << theAngle << ", "
- << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
+ GEOM::TPythonDump(aFunction)
+ << aCopy << " = geompy.MultiRotate2DByStep(" << theObject << ", "
+ << theAxis << ", " << anAngleStep << "*math.pi/180.0, "
+ << theNbTimes1 << ", " << theStep << ", " << theNbTimes2 << ")";
SetErrorCode(OK);
return aCopy;
if (theObject.IsNull() || theCentPoint.IsNull() || thePoint1.IsNull() || thePoint2.IsNull()) return NULL;
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
- if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
+ if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated
// Get last functions of the arguments
Handle(GEOM_Function) aCPF = theCentPoint->GetLastFunction();
}
//Make a Python command
- GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.RotateThreePoints(" << theObject
+ GEOM::TPythonDump(aFunction) << "geompy.RotateThreePoints(" << theObject
<< ", " << theCentPoint << ", "<<thePoint1 << ", " << thePoint2 << ")";
SetErrorCode(OK);
// 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_ITransformOperations_HXX_
#define _GEOMImpl_ITransformOperations_HXX_
Handle(GEOM_Object) theAxis,
Standard_Integer theNbTimes);
+ Standard_EXPORT Handle(GEOM_Object) Rotate1D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ double theAngleStep,
+ Standard_Integer theNbSteps);
+
+ Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
+ Handle(GEOM_Object) theAxis,
+ Standard_Integer theNbObjects,
+ double theRadialStep,
+ Standard_Integer theNbSteps);
+
Standard_EXPORT Handle(GEOM_Object) Rotate2D (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
double theAngle,
// 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_MarkerDriver.hxx>
#include <GEOMImpl_IMarker.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
+
+#include <GEOMUtils.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRep_Tool.hxx>
} else if (aType == MARKER_SHAPE) {
Handle(GEOM_Function) aRefShape = aPI.GetShape();
TopoDS_Shape aSh = aRefShape->GetValue();
- gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aSh);
+ gp_Ax3 anAx3 = GEOMUtils::GetPosition(aSh);
gp_Pln aPln (anAx3);
double aTrimSize = 100.0;
// 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_MeasureDriver.hxx>
#include <GEOMImpl_IMeasure.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <BRep_Tool.hxx>
+#include <BRepTools.hxx>
#include <BRepGProp.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
#include <TopAbs.hxx>
#include <TopoDS.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <Standard_NullObject.hxx>
+#include <StdFail_NotDone.hxx>
//=======================================================================
//function : GetID
{
Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue();
- if (aShapeBase.IsNull()) {
+ if (aShapeBase.IsNull())
Standard_NullObject::Raise("Shape for centre of mass calculation is null");
- }
- gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aShapeBase);
+ gp_Ax3 aPos = GEOMUtils::GetPosition(aShapeBase);
gp_Pnt aCenterMass = aPos.Location();
aShape = BRepBuilderAPI_MakeVertex(aCenterMass).Shape();
}
+ else if (aType == BND_BOX_MEASURE)
+ {
+ Handle(GEOM_Function) aRefBase = aCI.GetBase();
+ TopoDS_Shape aShapeBase = aRefBase->GetValue();
+ if (aShapeBase.IsNull())
+ Standard_NullObject::Raise("Shape for bounding box calculation is null");
+
+ BRepBuilderAPI_Copy aCopyTool (aShapeBase);
+ if (!aCopyTool.IsDone())
+ Standard_NullObject::Raise("Shape for bounding box calculation is bad");
+
+ aShapeBase = aCopyTool.Shape();
+
+ // remove triangulation to obtain more exact boundaries
+ BRepTools::Clean(aShapeBase);
+
+ Bnd_Box B;
+ BRepBndLib::Add(aShapeBase, B);
+
+ Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
+ B.Get(Xmin, Ymin, Zmin, Xmax, Ymax, Zmax);
+
+ if (Xmax - Xmin < Precision::Confusion()) Xmax += Precision::Confusion();
+ if (Ymax - Ymin < Precision::Confusion()) Ymax += Precision::Confusion();
+ if (Zmax - Zmin < Precision::Confusion()) Zmax += Precision::Confusion();
+
+ gp_Pnt P1 (Xmin, Ymin, Zmin);
+ gp_Pnt P2 (Xmax, Ymax, Zmax);
+
+ BRepPrimAPI_MakeBox MB (P1, P2);
+ MB.Build();
+ if (!MB.IsDone()) StdFail_NotDone::Raise("Bounding box cannot be computed from the given shape");
+ aShape = MB.Shape();
+ }
else if (aType == VERTEX_BY_INDEX)
{
Handle(GEOM_Function) aRefBase = aCI.GetBase();
}
else
{
- gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(aFace);
+ gp_Ax3 aPos = GEOMUtils::GetPosition(aFace);
p1 = aPos.Location();
}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#include <Standard_Stream.hxx>
-
#include <GEOMImpl_PipeDriver.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_IPipeDiffSect.hxx>
#include <GEOMImpl_IPipeShellSect.hxx>
#include <GEOMImpl_IPipeBiNormal.hxx>
#include <GEOMImpl_IPipePath.hxx>
#include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <ShapeAnalysis_FreeBounds.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <ShapeFix_Face.hxx>
#include "utilities.h"
+//////////////////////////////////////////////////////////////////////////
+// Uncomment below macro to perform gluing in the end of MakePipe operation
+// as fix of issue 0020207.
+//////////////////////////////////////////////////////////////////////////
+//#define GLUE_0020207
+
+
//=======================================================================
//function : GetID
//purpose :
}
// Glue (for bug 0020207)
+ // No gluing is needed as the bug 0020207 is fixed in OCCT.
+#ifdef GLUE_0020207
TopExp_Explorer anExpV (aShape, TopAbs_VERTEX);
if (anExpV.More()) {
Standard_Real aVertMaxTol = -RealLast();
aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
//aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
}
+#endif
- TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
log.SetTouched(Label());
// 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_PipeTShapeDriver.hxx>
+
#include <GEOMImpl_IPipeTShape.hxx>
#include <GEOMImpl_Types.hxx>
-
#include <GEOMImpl_Block6Explorer.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOM_IOperations.hxx>
+
+#include <GEOMUtils.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
-#include "GEOMAlgo_FinderShapeOn1.hxx"
-#include "GEOMAlgo_FinderShapeOn2.hxx"
+#include <GEOMAlgo_FinderShapeOn1.hxx>
+#include <GEOMAlgo_FinderShapeOn2.hxx>
#include <GEOMAlgo_ClsfBox.hxx>
#include <TFunction_Logbook.hxx>
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!GEOMImpl_IShapesOperations::CheckTriangulation(aShape)) {
+ if (!GEOMUtils::CheckTriangulation(aShape)) {
StdFail_NotDone::Raise("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Check presence of triangulation, build if need
- if (!GEOMImpl_IShapesOperations::CheckTriangulation(theShape)) {
+ if (!GEOMUtils::CheckTriangulation(theShape)) {
StdFail_NotDone::Raise("Cannot build triangulation on the shape");
return aSeqOfIDs;
}
// 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_Types.hxx>
#include <GEOM_Function.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
+#include <GEOMUtils.hxx>
#include <Basics_OCCTVersion.hxx>
// Standard_TypeMismatch::Raise("Plane creation aborted: non-planar face given as argument");
//}
//aShape = BRepBuilderAPI_MakeFace(aGS, -aSize, +aSize, -aSize, +aSize).Shape();
- gp_Ax3 anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
+ gp_Ax3 anAx3 = GEOMUtils::GetPosition(aRefShape);
gp_Pln aPln (anAx3);
aShape = BRepBuilderAPI_MakeFace(aPln, -aSize, +aSize, -aSize, +aSize).Shape();
}
TopoDS_Shape aRefShape = aRef->GetValue();
if (aRefShape.ShapeType() != TopAbs_FACE)
return 0;
- anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
+ anAx3 = GEOMUtils::GetPosition(aRefShape);
}
if ( anOrientation == 2)
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <IntTools.hxx>
}
Standard_Real aFP, aLP, aP;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP);
- aP = aFP + (aLP - aFP) * aPI.GetParameter();
- aPnt = aCurve->Value(aP);
+ if ( !aCurve.IsNull() ) {
+ aP = aFP + (aLP - aFP) * aPI.GetParameter();
+ aPnt = aCurve->Value(aP);
+ }
+ else {
+ // null curve, e.g. degenerated edge
+ TopoDS_Iterator It(aRefShape, Standard_False, Standard_False);
+ TopoDS_Vertex aVertex;
+ if ( It.More() ) {
+ TopoDS_Shape aShape = It.Value();
+ if ( !aShape.IsNull() )
+ aVertex = TopoDS::Vertex( aShape );
+ }
+ if ( !aVertex.IsNull() ) {
+ aPnt = BRep_Tool::Pnt( aVertex );
+ }
+ else {
+ Standard_TypeMismatch::Raise
+ ("Point On Curve creation aborted : null curve");
+ }
+ }
}
else if (aType == POINT_CURVE_COORD) {
Handle(GEOM_Function) aRefFunc = aPI.GetCurve();
// Check orientation
Standard_Real UFirst, ULast;
Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast);
- Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
-
- Standard_Real dU = ULast - UFirst;
- Standard_Real par1 = UFirst + 0.1 * dU;
- Standard_Real par2 = ULast - 0.1 * dU;
-
- gp_Pnt P1 = EdgeCurve->Value(par1);
- gp_Pnt P2 = EdgeCurve->Value(par2);
- if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
- ReOrientedCurve = EdgeCurve->Reversed();
- UFirst = EdgeCurve->ReversedParameter(ULast);
+ if ( !EdgeCurve.IsNull() ) {
+ Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
+
+ Standard_Real dU = ULast - UFirst;
+ Standard_Real par1 = UFirst + 0.1 * dU;
+ Standard_Real par2 = ULast - 0.1 * dU;
+
+ gp_Pnt P1 = EdgeCurve->Value(par1);
+ gp_Pnt P2 = EdgeCurve->Value(par2);
+
+ if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
+ ReOrientedCurve = EdgeCurve->Reversed();
+ UFirst = EdgeCurve->ReversedParameter(ULast);
+ }
+
+ // Get the point by length
+ GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
+ GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
+ Standard_Real aParam = anAbsPnt.Parameter();
+ aPnt = AdapCurve.Value(aParam);
+ }
+ else {
+ // null curve, e.g. degenerated edge
+ TopoDS_Iterator It(aRefEdge, Standard_False, Standard_False);
+ TopoDS_Vertex aVertex;
+ if ( It.More() ) {
+ TopoDS_Shape aShape = It.Value();
+ if ( !aShape.IsNull() )
+ aVertex = TopoDS::Vertex( aShape );
+ }
+ if ( !aVertex.IsNull() ) {
+ aPnt = BRep_Tool::Pnt( aVertex );
+ }
+ else {
+ Standard_TypeMismatch::Raise
+ ("Point On Curve creation aborted : null curve");
+ }
}
-
- // Get the point by length
- GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
- GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
- Standard_Real aParam = anAbsPnt.Parameter();
- aPnt = AdapCurve.Value(aParam);
}
else if (aType == POINT_SURFACE_PAR) {
Handle(GEOM_Function) aRefFunc = aPI.GetSurface();
// 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_PositionDriver.hxx>
+
#include <GEOMImpl_IPosition.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
+#include <GEOMUtils.hxx>
// OCCT Includes
#include <BRepBuilderAPI_Transform.hxx>
gp_Ax3 aStartAx3, aDestAx3;
// End LCS
- aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS);
+ aDestAx3 = GEOMUtils::GetPosition(aShapeEndLCS);
// Start LCS
- aStartAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeStartLCS);
+ aStartAx3 = GEOMUtils::GetPosition(aShapeStartLCS);
// Set transformation
aTrsf.SetDisplacement(aStartAx3, aDestAx3);
gp_Ax3 aStartAx3, aDestAx3;
// End LCS
- aDestAx3 = GEOMImpl_IMeasureOperations::GetPosition(aShapeEndLCS);
+ aDestAx3 = GEOMUtils::GetPosition(aShapeEndLCS);
// Set transformation
aTrsf.SetDisplacement(aStartAx3, aDestAx3);
// 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_PrismDriver.hxx>
#include <GEOMImpl_IPrism.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
#include <GEOMImpl_GlueDriver.hxx>
#include <GEOMImpl_PipeDriver.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOM_Object.hxx>
+
+#include <GEOMUtils.hxx>
#include <BRepPrimAPI_MakePrism.hxx>
#include <BRepFeat_MakeDPrism.hxx>
}
else
{
- TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
}
// 1. aCDG = geompy.MakeCDG(theBase)
gp_Pnt aCDG = theCDG;
if (!isCDG) {
- gp_Ax3 aPos = GEOMImpl_IMeasureOperations::GetPosition(theShapeBase);
+ gp_Ax3 aPos = GEOMUtils::GetPosition(theShapeBase);
aCDG = aPos.Location();
}
TopoDS_Shape aShapeCDG_1 = BRepBuilderAPI_MakeVertex(aCDG).Shape();
// 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_RevolutionDriver.hxx>
-#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOMImpl_IRevolution.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
+
#include <BRepPrimAPI_MakeRevol.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRep_Tool.hxx>
if (aShape.IsNull()) return 0;
- TopoDS_Shape aRes = GEOMImpl_IShapesOperations::CompsolidToCompound(aShape);
+ TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
log.SetTouched(Label());
// 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_RotateDriver.hxx>
#include <GEOMImpl_IRotate.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Ax1.hxx>
+
+#include <GEOMUtils.hxx>
+
#include <BRepBuilderAPI_Transform.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Compound.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepGProp.hxx>
+
#include <TopAbs.hxx>
#include <TopExp.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Compound.hxx>
#include <TopoDS_Edge.hxx>
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
+
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <Geom_Line.hxx>
#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
+
#include <Precision.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Ax1.hxx>
+
//=======================================================================
//function : GetID
//purpose :
Handle(GEOM_Function) anAxis = RI.GetAxis();
if (anAxis.IsNull()) return 0;
TopoDS_Shape A = anAxis->GetValue();
- if (A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
+ gp_Vec aV = GEOMUtils::GetVector(A);
TopoDS_Edge anEdge = TopoDS::Edge(A);
-
gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir aDir(gp_Vec(aP1, aP2));
- gp_Ax1 anAx1(aP1, aDir);
+ gp_Dir aDir (aV);
+ gp_Ax1 anAx1 (aP1, aDir);
+
Standard_Real anAngle = RI.GetAngle();
if (fabs(anAngle) < Precision::Angular()) anAngle += 2.*M_PI; // NPAL19665,19769
aTrsf.SetRotation(anAx1, anAngle);
TopLoc_Location aLocRes (aTrsfOrig);
aShape = anOriginal.Located(aLocRes);
}
- else if (aType == ROTATE_1D) {
+ else if (aType == ROTATE_1D || aType == ROTATE_1D_STEP) {
//Get direction
+ gp_Pnt aP1 = gp::Origin();
+ gp_Dir D = gp::DZ();
Handle(GEOM_Function) anAxis = RI.GetAxis();
- if(anAxis.IsNull()) return 0;
- TopoDS_Shape A = anAxis->GetValue();
- if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(A);
-
- gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir D(gp_Vec(aP1, aP2));
-
- gp_Ax1 AX1(aP1, D);
+ if (!anAxis.IsNull()) {
+ TopoDS_Shape A = anAxis->GetValue();
+ gp_Vec aV = GEOMUtils::GetVector(A);
+ TopoDS_Edge anEdge = TopoDS::Edge(A);
+ aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
+ D = gp_Dir(aV);
+ }
+ gp_Ax1 AX1 (aP1, D);
Standard_Integer nbtimes = RI.GetNbIter1();
- Standard_Real angle = 360.0/nbtimes;
+ Standard_Real angle = 360. / nbtimes;
+ if (aType == ROTATE_1D_STEP)
+ angle = RI.GetAngle();
TopoDS_Compound aCompound;
BRep_Builder B;
B.Add(aCompound, anOriginal);
}
else {
- aTrsf.SetRotation(AX1, i*angle*M_PI/180.);
+ aTrsf.SetRotation(AX1, i * angle * M_PI / 180.);
//TopLoc_Location aLocRes (aTrsf * aTrsfOrig); // gp_Trsf::Multiply() has a bug
gp_Trsf aTrsfNew (aTrsfOrig);
aTrsfNew.PreMultiply(aTrsf);
}
else if (aType == ROTATE_2D) {
//Get direction
+ gp_Pnt aP1 = gp::Origin();
+ gp_Dir D = gp::DZ();
Handle(GEOM_Function) anAxis = RI.GetAxis();
- if(anAxis.IsNull()) return 0;
- TopoDS_Shape A = anAxis->GetValue();
- if(A.IsNull() || A.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(A);
- gp_Pnt aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
- gp_Pnt aP2 = BRep_Tool::Pnt(TopExp::LastVertex(anEdge));
- gp_Dir D(gp_Vec(aP1, aP2));
-
- gp_Ax1 AX1(aP1, D);
+ if (!anAxis.IsNull()) {
+ TopoDS_Shape A = anAxis->GetValue();
+ gp_Vec aV = GEOMUtils::GetVector(A);
+ TopoDS_Edge anEdge = TopoDS::Edge(A);
+ aP1 = BRep_Tool::Pnt(TopExp::FirstVertex(anEdge));
+ D = gp_Dir(aV);
+ }
+ gp_Ax1 AX1 (aP1, D);
gp_Trsf aTrsf1;
gp_Trsf aTrsf2;
B.Add(aCompound, anOriginal.Located(aLocRes));
}
else {
- aTrsf2.SetRotation(AX1, j*ang*M_PI/180.);
+ aTrsf2.SetRotation(AX1, j * ang * M_PI / 180.);
//TopLoc_Location aLocRes (aTrsf2 * aTrsf1 * aTrsfOrig); // gp_Trsf::Multiply() has a bug
gp_Trsf aTrsfNew (aTrsfOrig);
aTrsfNew.PreMultiply(aTrsf1);
// 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_Types.hxx>
#include <GEOM_Function.hxx>
-#include <GEOMImpl_IMeasureOperations.hxx>
+#include <GEOMUtils.hxx>
#include <Basics_Utils.hxx>
// return 0;
//Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast( aGS );
//aWPlane = aGPlane->Pln().Position();
- aWPlane = GEOMImpl_IMeasureOperations::GetPosition(aShape);
+ aWPlane = GEOMUtils::GetPosition(aShape);
}
gp_Trsf aTrans;
aTrans.SetTransformation(aWPlane);
// 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_SplineDriver.hxx>
+
#include <GEOMImpl_ISpline.hxx>
#include <GEOMImpl_Types.hxx>
+
#include <GEOM_Function.hxx>
+#include <GEOMUtils.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TColgp_Array1OfPnt.hxx>
#include <TColgp_HArray1OfPnt.hxx>
+#include <Standard_Stream.hxx>
+
+#include <Standard_NullObject.hxx>
+
//=======================================================================
//function : GetID
//purpose :
TopoDS_Shape aShape;
- if (aType == SPLINE_BEZIER || aType == SPLINE_INTERPOLATION) {
+ if (aType == SPLINE_BEZIER ||
+ aType == SPLINE_INTERPOLATION ||
+ aType == SPLINE_INTERPOL_TANGENTS) {
bool useCoords = aCI.GetConstructorType() == COORD_CONSTRUCTOR;
- TColgp_Array1OfPnt points(1, (useCoords ? aCI.GetLength() : 1) );
- if(useCoords) {
- Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
+
+ Handle(TColStd_HArray1OfReal) aCoordsArray; // parametric case
+ Handle(TColStd_HSequenceOfTransient) aPoints; // points case
+
+ int aLen = 0;
+ if (useCoords) {
+ aCoordsArray = aCI.GetCoordinates();
+ aLen = aCoordsArray->Length() / 3;
+ }
+ else {
+ aPoints = aCI.GetPoints();
+ aLen = aPoints->Length();
+ }
+
+ if (aLen < 2) return 0;
+
+ TColgp_Array1OfPnt points (1, (useCoords ? aLen : 1));
+ if (useCoords) {
int anArrayLength = aCoordsArray->Length();
for (int i = 0, j = 1; i <= (anArrayLength-3); i += 3) {
gp_Pnt aPnt = gp_Pnt(aCoordsArray->Value(i+1), aCoordsArray->Value(i+2), aCoordsArray->Value(i+3));
- points.SetValue(j,aPnt);
+ points.SetValue(j, aPnt);
j++;
- }
+ }
}
-
- int ind, aLen = aCI.GetLength();
- if (aLen < 2) return 0;
- Standard_Boolean isSeveral = Standard_False;
- gp_Pnt aPrevP;
int aRealLen = aLen;
+
if (aType == SPLINE_BEZIER && aCI.GetIsClosed()) {
TopoDS_Vertex aV1;
- if(useCoords) {
+ if (useCoords) {
aV1 = BRepBuilderAPI_MakeVertex(points.Value(1));
- } else {
- Handle(GEOM_Function) aFPoint = aCI.GetPoint(1);
+ }
+ else {
+ Handle(GEOM_Function) aFPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(1));
TopoDS_Shape aFirstPnt = aFPoint->GetValue();
aV1 = TopoDS::Vertex(aFirstPnt);
}
TopoDS_Vertex aV2;
- if(useCoords) {
+ if (useCoords) {
aV2 = BRepBuilderAPI_MakeVertex(points.Value(aLen));
- } else {
- Handle(GEOM_Function) aLPoint = aCI.GetPoint(aLen);
+ }
+ else {
+ Handle(GEOM_Function) aLPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(aLen));
TopoDS_Shape aLastPnt = aLPoint->GetValue();
aV2 = TopoDS::Vertex(aLastPnt);
}
-
+
if (!aV1.IsNull() && !aV2.IsNull() && !aV1.IsSame(aV2)) {
aRealLen++;
}
}
-
+
+ int ind;
+ Standard_Boolean isSeveral = Standard_False;
+ gp_Pnt aPrevP;
+
TColgp_Array1OfPnt CurvePoints (1, aRealLen);
for (ind = 1; ind <= aLen; ind++) {
gp_Pnt aP;
- if( useCoords ) {
+ if (useCoords) {
aP = points.Value(ind);
if (!isSeveral && ind > 1) {
if (aP.Distance(aPrevP) > Precision::Confusion()) {
}
CurvePoints.SetValue(ind, aP);
aPrevP = aP;
- } else {
- Handle(GEOM_Function) aRefPoint = aCI.GetPoint(ind);
+ }
+ else {
+ Handle(GEOM_Function) aRefPoint = Handle(GEOM_Function)::DownCast(aPoints->Value(ind));
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
if (aShapePnt.ShapeType() == TopAbs_VERTEX) {
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
}
}
}
+
if (aType == SPLINE_BEZIER) {
if (!isSeveral) {
Standard_ConstructionError::Raise("Points for Bezier Curve are too close");
if (aRealLen > aLen) { // set last point equal to first for the closed curve
CurvePoints.SetValue(aRealLen, CurvePoints.Value(1));
}
- Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints);
+ Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve (CurvePoints);
aShape = BRepBuilderAPI_MakeEdge(GBC).Edge();
- } else {
+ }
+ else {
//GeomAPI_PointsToBSpline GBC (CurvePoints);
//aShape = BRepBuilderAPI_MakeEdge(GBC).Edge();
-
- Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt(1, aLen);
if (aCI.GetDoReordering()) {
for (int curInd = 1; curInd < aLen - 1; curInd++) {
CurvePoints.SetValue(curInd + 1, nearPnt);
}
}
- for (ind = 1; ind <= aLen; ind++) {
- aHCurvePoints->SetValue(ind, CurvePoints.Value(ind));
- }
}
- else {
- for (ind = 1; ind <= aLen; ind++) {
- aHCurvePoints->SetValue(ind, CurvePoints.Value(ind));
- }
+
+ Handle(TColgp_HArray1OfPnt) aHCurvePoints = new TColgp_HArray1OfPnt (1, aLen);
+ for (ind = 1; ind <= aLen; ind++) {
+ aHCurvePoints->SetValue(ind, CurvePoints.Value(ind));
}
-
- bool isClosed = aCI.GetIsClosed();
+
+ bool isClosed = Standard_False;
+ if (aType == SPLINE_INTERPOLATION)
+ isClosed = aCI.GetIsClosed();
+
GeomAPI_Interpolate GBC (aHCurvePoints, isClosed, gp::Resolution());
+
+ if (aType == SPLINE_INTERPOL_TANGENTS) {
+ Handle(GEOM_Function) aVec1Ref = aCI.GetFirstVector();
+ Handle(GEOM_Function) aVec2Ref = aCI.GetLastVector();
+
+ if (aVec1Ref.IsNull() || aVec2Ref.IsNull())
+ Standard_NullObject::Raise("Null object is given for a vector");
+
+ TopoDS_Shape aVec1Sh = aVec1Ref->GetValue();
+ TopoDS_Shape aVec2Sh = aVec2Ref->GetValue();
+
+ gp_Vec aV1 = GEOMUtils::GetVector(aVec1Sh);
+ gp_Vec aV2 = GEOMUtils::GetVector(aVec2Sh);
+
+ GBC.Load(aV1, aV2, /*Scale*/Standard_True);
+ }
+
GBC.Perform();
if (GBC.IsDone())
aShape = BRepBuilderAPI_MakeEdge(GBC.Curve()).Edge();
}
else {
}
-
+
if (aShape.IsNull()) return 0;
-
+
aFunction->SetValue(aShape);
-
+
log.SetTouched(Label());
-
+
return 1;
}
// 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>
B.MakeCompound( aCompound );
Handle(GEOM_Function) aVector = TI.GetVector();
- if(aVector.IsNull()) return 0;
- TopoDS_Shape aV = aVector->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
-
- gp_Vec Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec.Normalize();
+ gp_Vec Vec = gp::DX();
+ if (!aVector.IsNull()) {
+ TopoDS_Shape aV = aVector->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec.Normalize();
+ }
TopLoc_Location aLocOrig = anOriginal.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
}
else if (aType == TRANSLATE_2D) {
Standard_Integer nbtimes1 = TI.GetNbIter1(), nbtimes2 = TI.GetNbIter2();
- Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2();
- gp_Vec aVec;
+ Standard_Real DX, DY, DZ, step1 = TI.GetStep1(), step2 = TI.GetStep2();
Handle(GEOM_Function) aVector = TI.GetVector();
- if(aVector.IsNull()) return 0;
- TopoDS_Shape aV = aVector->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Handle(GEOM_Function) aVector2 = TI.GetVector2();
- gp_Vec Vec1(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec1.Normalize();
+ gp_Vec Vec1 = gp::DX();
+ gp_Vec Vec2 = gp::DY();
- Handle(GEOM_Function) aVector2 = TI.GetVector2();
- if(aVector2.IsNull()) return 0;
- aV = aVector2->GetValue();
- if(aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
- anEdge = TopoDS::Edge(aV);
+ if (!aVector.IsNull()) {
+ TopoDS_Shape aV = aVector->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec1 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec1.Normalize();
+ }
- gp_Vec Vec2(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
- Vec2.Normalize();
+ if (!aVector2.IsNull()) {
+ TopoDS_Shape aV = aVector2->GetValue();
+ if (aV.IsNull() || aV.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge anEdge = TopoDS::Edge(aV);
+ Vec2 = gp_Vec(BRep_Tool::Pnt(TopExp::FirstVertex(anEdge)), BRep_Tool::Pnt(TopExp::LastVertex(anEdge)));
+ Vec2.Normalize();
+ }
TopoDS_Compound aCompound;
BRep_Builder B;
- B.MakeCompound( aCompound );
+ B.MakeCompound(aCompound);
TopLoc_Location aLocOrig = anOriginal.Location();
gp_Trsf aTrsfOrig = aLocOrig.Transformation();
+ gp_Vec aVec;
for (int i = 0; i < nbtimes1; i++) {
for (int j = 0; j < nbtimes2; j++) {
#define ROTATE_2D 4
#define ROTATE_THREE_POINTS 5
#define ROTATE_THREE_POINTS_COPY 6
+#define ROTATE_1D_STEP 7
#define MIRROR_PLANE 1
#define MIRROR_PLANE_COPY 2
#define POLYLINE_POINTS 1
-#define SPLINE_BEZIER 1
-#define SPLINE_INTERPOLATION 2
+#define SPLINE_BEZIER 1
+#define SPLINE_INTERPOLATION 2
+#define SPLINE_INTERPOL_TANGENTS 3
#define CIRCLE_THREE_PNT 1
#define CIRCLE_PNT_VEC_R 2
// Measures
#define CDG_MEASURE 1
+#define BND_BOX_MEASURE 2
#define VECTOR_FACE_NORMALE 4
#define VERTEX_BY_INDEX 5
-I$(srcdir)/../NMTDS \
-I$(srcdir)/../NMTTools \
-I$(srcdir)/../GEOM \
+ -I$(srcdir)/../BlockFix \
-I$(srcdir)/../GEOMAlgo \
+ -I$(srcdir)/../GEOMUtils \
-I$(srcdir)/../SKETCHER \
-I$(srcdir)/../ARCHIMEDE \
-I$(top_builddir)/idl
libGEOMimpl_la_LDFLAGS = \
../GEOM/libGEOMbasic.la \
+ ../BlockFix/libBlockFix.la \
../GEOMAlgo/libGEOMAlgo.la \
+ ../GEOMUtils/libGEOMUtils.la \
../ShHealOper/libShHealOper.la \
../ARCHIMEDE/libGEOMArchimede.la \
../SKETCHER/libGEOMSketcher.la \
case GEOMOp::OpColor: // POPUP - COLOR
OnColor();
break;
- case GEOMOp::OpSetTexture: // POPUP - TEXTURE
+ case GEOMOp::OpSetTexture: // POPUP - TEXTURE
OnTexture();
break;
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
case GEOMOp::OpMaterialProperties: // POPUP - MATERIAL PROPERTIES
OnMaterialProperties();
break;
+ case GEOMOp::OpPredefMaterCustom: // POPUP - MATERIAL PROPERTIES - CUSTOM...
+ OnMaterialProperties();
+ break;
+ case GEOMOp::OpMaterialsLibrary: // POPUP MENU - MATERIAL PROPERTIES
+ OnMaterialsLibrary();
+ break;
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
OnAutoColor();
break;
return true;
}
+//=======================================================================
+// function : OnGUIEvent()
+// purpose :
+//=======================================================================
+bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent, const QVariant& theParam )
+{
+ getGeometryGUI()->EmitSignalDeactivateDialog();
+
+ switch ( theCommandID ) {
+ case GEOMOp::OpPredefMaterial: // POPUP MENU - MATERIAL PROPERTIES - <SOME MATERIAL>
+ OnSetMaterial( theParam );
+ break;
+ default:
+ SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+ break;
+ }
+ return true;
+}
+
//===============================================================================
// function : OnEditDelete()
// purpose :
~GEOMToolsGUI();
bool OnGUIEvent( int, SUIT_Desktop* );
+ bool OnGUIEvent( int theCommandID, SUIT_Desktop*, const QVariant& );
+
virtual void deactivate();
enum ActionType { SHOWDLG, INCR, DECR };
void OnPublishObject() ;
void OnPointMarker();
void OnMaterialProperties();
+ void OnMaterialsLibrary();
+ void OnSetMaterial(const QVariant& );
void OnEdgeWidth();
void OnIsosWidth();
void OnBringToFront();
#include "GEOMToolsGUI_PublishDlg.h"
#include "GEOMToolsGUI_MaterialPropertiesDlg.h"
#include "GEOMToolsGUI_LineWidthDlg.h"
-#include "Material_Model.h"
+#include <Material_Model.h>
+
+#include <GEOM_VTKPropertyMaterial.hxx>
#include <GeometryGUI.h>
#include <GeometryGUI_Operations.h>
// VTK includes
#include <vtkRenderer.h>
+class QtxDialog;
// If the next macro is defined, autocolor feature works for all sub-shapes;
// if it is undefined, autocolor feature works for groups only
#define GENERAL_AUTOCOLOR
SUIT_ViewWindow* window = app->desktop()->activeWindow();
if ( !window ) return;
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+ bool isOCC = window->getViewManager()->getType() == OCCViewer_Viewer::Type();
+ bool isVTK = window->getViewManager()->getType() == SVTK_Viewer::Type();
// get view id
int mgrId = window->getViewManager()->getGlobalId();
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
// get view id
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if ( isVTK ) {
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
// get initial color (use first object from selection)
SVTK_View* aView = vtkVW->getView();
QColor color = aView->GetColor( selected.First() );
- QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+ QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
// show Choose Color dialog box
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
QColor color = QColor((int)( aColor.Red() * 255.0 ),
(int)( aColor.Green() * 255.0 ),
(int)( aColor.Blue() * 255.0 ));
- QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
+ QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
// show Choose Color dialog box
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
{
// get material property
QString matProp;
- matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+ matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
Material_Model material;
material.fromProperties( matProp );
// change color only for shapes with not physical type of material
if ( !material.isPhysical() ) {
view->SetColor( IO, color );
- study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+ study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
}
// store color to GEOM_Object
// get material property
QString matProp;
- matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
+ matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
Material_Model material;
material.fromProperties( matProp );
io->Redisplay( Standard_True );
- study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
+ study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
}
// store color to GEOM_Object
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
ic->InitCurrent();
if ( ic->MoreCurrent() ) {
}
for(; ic->MoreCurrent(); ic->NextCurrent()) {
- int aMgrId = window->getViewManager()->getGlobalId();
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
- QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
+ QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ) , QVariant() );
int width = v.isValid() ? v.toInt() : 1;
ic->SetLocalAttributes(CurObject, CurDrawer);
ic->Redisplay(CurObject);
- QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
- aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
+ QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
+ aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
}
}
GeometryGUI::Modified();
if ( !vtkVW )
return;
+ int aMgrId = window->getViewManager()->getGlobalId();
+
SALOME_View* view = GEOM_Displayer::GetActiveView();
vtkActorCollection* aCollection = vtkActorCollection::New();
anActor->SetNbIsos(aIsos);
anActor->StoreIsoNumbers();
- QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
- int aMgrId = window->getViewManager()->getGlobalId();
- aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_PROP, anIsos);
+ QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
+ aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
}
anAct = aCollection->GetNextActor();
}
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if (isOCC) { // if is OCCViewer
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
ic->Redisplay(CurObject);
- appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aNewDC);
+ appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aNewDC);
}
}
}
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetDeflection(aDC);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aDC);
+ appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC);
}
anAct = aCollection->GetNextActor();
}
void GEOMToolsGUI::OnMaterialProperties()
{
- GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop() );
+ GEOMToolsGUI_MaterialPropertiesDlg* dlg = new GEOMToolsGUI_MaterialPropertiesDlg( SUIT_Session::session()->activeApplication()->desktop(), true, false, QtxDialog::OK | QtxDialog::Close | QtxDialog::Apply | QtxDialog::Help );
+ dlg->show();
+}
+
+void GEOMToolsGUI::OnMaterialsLibrary()
+{
+ GEOMToolsGUI_MaterialPropertiesDlg dlg( SUIT_Session::session()->activeApplication()->desktop(), false, true, QtxDialog::Standard );
+ dlg.setWindowTitle( tr( "MATERIAL_LIBRARY_TLT" ) );
dlg.exec();
}
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window->getViewManager()->getGlobalId();
+ int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
if (isOCC) { // if is OCCViewer
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
ic->Redisplay(cur);
}
}
- appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth);
+ appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aNewWidth);
}
}
}
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetWidth(aWidth);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth);
+ appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth);
}
anAct = aCollection->GetNextActor();
}
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
ic->InitCurrent();
if ( ic->MoreCurrent() ) {
return;
for(; ic->MoreCurrent(); ic->NextCurrent()) {
- int aMgrId = window->getViewManager()->getGlobalId();
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
ic->Redisplay(CurObject);
- aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+ aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
}
GeometryGUI::Modified();
}
if ( !vtkVW )
return;
+ int aMgrId = window->getViewManager()->getGlobalId();
+
SALOME_View* view = GEOM_Displayer::GetActiveView();
vtkActorCollection* aCollection = vtkActorCollection::New();
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
// There are no casting to needed actor.
anActor->SetIsosWidth(aWidth);
- int aMgrId = window->getViewManager()->getGlobalId();
- aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
+ aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
}
anAct = aCollection->GetNextActor();
}
if ( isOCC ) {
GEOMBase* gb = new GEOMBase();
Handle(GEOM_AISShape) aisShape;
+ int aMgrId = window->getViewManager()->getGlobalId();
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
SALOME_ListIO anIOlst;
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
if ( !aisShape.IsNull() ) {
+ appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked );
aisShape->setTopLevel(checked);
- int aMgrId = window->getViewManager()->getGlobalId();
- appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), TOP_LEVEL_PROP, checked );
anIOlst.Append(aisShape->getIO());
}
} // for...
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
+ int aMgrId = window->getViewManager()->getGlobalId();
SALOME_ListIO anIOlst;
AIS_ListOfInteractive aList;
if(CurObject.IsNull())
continue;
+ appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), GEOM::propertyName( GEOM::TopLevel ), Standard_False );
CurObject->setTopLevel(Standard_False);
-
- int aMgrId = window->getViewManager()->getGlobalId();
- appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), TOP_LEVEL_PROP, Standard_False );
anIOlst.Append(CurObject->getIO());
}
disp->Redisplay(anIOlst);
}
}
+void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
+{
+ if ( !theParam.canConvert<QString>() ) return;
+
+ QString theName = theParam.toString();
+
+ SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
+
+ LightApp_SelectionMgr* selMgr = app->selectionMgr();
+
+ SALOME_ListIO selected;
+ selMgr->selectedObjects( selected );
+
+ if ( selected.IsEmpty() ) return;
+
+ GEOM_Displayer displayer( study );
+
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ int mgrId = dynamic_cast<SUIT_ViewModel*>( window )->getViewManager()->getGlobalId();
+
+ Material_Model aModel;
+ aModel.fromResources( theName );
+ QString prop = aModel.toProperties();
+
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) io = It.Value();
+ study->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+}
SpinBox->setAcceptNames( false );
SpinBox->setPrecision( aPrecision );
SpinBox->setDecimals( aPrecision );
- SpinBox->setRange( DEFLECTION_MIN, 1.0 );
+ SpinBox->setRange( GEOM::minDeflection(), 1.0 );
SpinBox->setSingleStep( 1.0e-04 );
// Add a hint for the user saying how to tune precision
QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
QString aMarker = "%1%2%3";
aMarker = aMarker.arg(getMarkerType());
- aMarker = aMarker.arg(DIGIT_SEPARATOR);
+ aMarker = aMarker.arg(GEOM::subSectionSeparator());
aMarker = aMarker.arg(getStandardMarkerScale());
- getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, aMarker);
+ getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), aMarker);
}
else if ( getCustomMarkerID() > 0 ) {
anObject->SetMarkerTexture( getCustomMarkerID() );
- getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, QString::number(getCustomMarkerID()));
+ getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), QString::number(getCustomMarkerID()));
}
}
}
#include "GEOM_Constants.h"
#include "GEOM_VTKPropertyMaterial.hxx"
#include "GEOMBase.h"
+#include "GEOM_Displayer.h"
#include <QtxColorButton.h>
#include <QtxDoubleSpinBox.h>
#include <QHBoxLayout>
#include <QKeyEvent>
#include <QLabel>
+#include <QLineEdit>
#include <QMap>
#include <QMenu>
#include <QPushButton>
/*!
\brief Constructor
\param parent parent widget
+ \param showSelWidget if \c true then objects can be selected by user
+ \param modal if \c true dialog box is modal
+ \param f specified control buttons for dialog box (QtxDialog::ButtonFlags)
*/
-GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget* parent )
- : QtxDialog( parent, true, true, OK | Close | Apply | Help )
+GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget* parent,bool showSelWidget, bool modal,const int f )
+ : QtxDialog( parent, modal, true, f )
{
+ myShowSelWidget = showSelWidget;
// Set title
setWindowTitle( tr( "MATERIAL_PROPERTIES_TLT" ) );
-
+
// main layout
QVBoxLayout* main = new QVBoxLayout( mainFrame() );
main->setMargin( 0 );
QFrame* fr = new QFrame( mainFrame() );
fr->setFrameStyle( QFrame::Box | QFrame::Sunken );
main->addWidget( fr );
+ // selection widget
+ myLineEditCurArg = new QLineEdit(fr);
+ myLineEditCurArg->setReadOnly(true);
+ myPushBtn = new QPushButton(fr);
+ QLabel* PushBtnLab = new QLabel( tr( "GEOM_OBJECTS" ), fr );
// materials list widget
myMaterials = new GEOMToolsGUI_MaterialList( fr );
// "physical" material type widgets
myPhysical = new QCheckBox( tr( "PHYSICAL" ), propWidget );
+ // Labels for front and back reflection components
+ QLabel* aFrontLabel = new QLabel( tr( "FRONT_FACE" ), propWidget );
+ QLabel* aBackLabel = new QLabel( tr( "BACK_FACE" ), propWidget );
+
// reflection components widgets
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
{
Reflection refl;
+
+ refl.enabled = new QCheckBox( propWidget );
refl.label = new QLabel( tr( QString( "REFLECTION_%1" ).arg( i ).toLatin1().data() ), propWidget );
refl.color = new QtxColorButton( propWidget );
//refl.color->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- refl.coef = new QtxDoubleSpinBox( propWidget );
- refl.coef->setPrecision( 4 );
- refl.coef->setDecimals( 4 );
- refl.coef->setRange( 0., 1. );
- refl.coef->setSingleStep( 0.05 );
- refl.coef->setMinimumWidth( 80 );
-
- refl.enabled = new QCheckBox( tr( "ENABLED" ), propWidget );
+ refl.front_coef = new QtxDoubleSpinBox( propWidget );
+ refl.front_coef->setPrecision( 4 );
+ refl.front_coef->setDecimals( 4 );
+ refl.front_coef->setRange( 0., 1. );
+ refl.front_coef->setSingleStep( 0.05 );
+ refl.front_coef->setMinimumWidth( 80 );
+
+ refl.back_coef = new QtxDoubleSpinBox( propWidget );
+ refl.back_coef->setPrecision( 4 );
+ refl.back_coef->setDecimals( 4 );
+ refl.back_coef->setRange( 0., 1. );
+ refl.back_coef->setSingleStep( 0.05 );
+ refl.back_coef->setMinimumWidth( 80 );
myReflection << refl;
}
// shininess widgets
QLabel* shininessLab = new QLabel( tr( "SHININESS" ), propWidget );
- myShininess = new QtxDoubleSpinBox( propWidget );
- myShininess->setPrecision( 4 );
- myShininess->setDecimals( 4 );
- myShininess->setRange( 0., 1. );
- myShininess->setSingleStep( 0.05 );
+ myFrontShininess = new QtxDoubleSpinBox( propWidget );
+ myFrontShininess->setPrecision( 4 );
+ myFrontShininess->setDecimals( 4 );
+ myFrontShininess->setRange( 0., 1. );
+ myFrontShininess->setSingleStep( 0.05 );
+
+ myBackShininess = new QtxDoubleSpinBox( propWidget );
+ myBackShininess->setPrecision( 4 );
+ myBackShininess->setDecimals( 4 );
+ myBackShininess->setRange( 0., 1. );
+ myBackShininess->setSingleStep( 0.05 );
// separator widgets
QFrame* line1 = new QFrame( propWidget );
line1->setFrameStyle( QFrame::HLine | QFrame::Sunken );
QFrame* line2 = new QFrame( propWidget );
line2->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ QFrame* line3 = new QFrame( propWidget );
+ line3->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+ QFrame* line4 = new QFrame( propWidget );
+ line4->setFrameStyle( QFrame::VLine | QFrame::Sunken );
+ QFrame* line5 = new QFrame( propWidget );
+ line5->setFrameStyle( QFrame::HLine | QFrame::Sunken );
// add / remove material buttons
myAddButton = new QPushButton( tr( "ADD_MATERIAL" ), propWidget );
btnLayout->addWidget( myDelButton );
// layout all properties widgets together
- propLayout->addWidget( myColorLab, 0, 0 );
- propLayout->addWidget( myColor, 0, 1 );
- propLayout->addWidget( line1, 1, 0, 1, 4 );
- propLayout->addWidget( myPhysical, 2, 0, 1, 2 );
+ propLayout->addWidget( PushBtnLab,0,0);
+ propLayout->addWidget( myPushBtn,0,1);
+ propLayout->addWidget( myLineEditCurArg, 0, 2, 1, 5 );
+ propLayout->addWidget( line1, 1, 0, 1, 7 );
+ propLayout->addWidget( myColorLab, 2, 1 );
+ propLayout->addWidget( myColor, 2, 2 );
+ propLayout->addWidget( myPhysical, 2, 0 );
+ propLayout->addWidget( line2, 3, 0, 1, 7 );
+ propLayout->addWidget( aFrontLabel, 4, 4);
+ propLayout->addWidget( aBackLabel, 4, 6);
+
+ propLayout->addWidget( line3, 4, 3, 6, 1 );
+ propLayout->addWidget( line4, 4, 5, 6, 1 );
+
+ if( !myShowSelWidget ) {
+ myColorLab->hide();
+ myColor->hide();
+ line1->hide();
+ myLineEditCurArg->hide();
+ myPushBtn->hide();
+ PushBtnLab->hide();
+ }
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
- propLayout->addWidget( myReflection[i].label, i+3, 0 );
- propLayout->addWidget( myReflection[i].color, i+3, 1 );
- propLayout->addWidget( myReflection[i].coef, i+3, 2 );
- propLayout->addWidget( myReflection[i].enabled, i+3, 3 );
+ propLayout->addWidget( myReflection[i].enabled, i+5, 0 );
+ propLayout->addWidget( myReflection[i].label, i+5, 1 );
+ propLayout->addWidget( myReflection[i].color, i+5, 2 );
+ propLayout->addWidget( myReflection[i].front_coef, i+5, 4 );
+ propLayout->addWidget( myReflection[i].back_coef, i+5, 6 );
}
- propLayout->addWidget( shininessLab, 7, 0 );
- propLayout->addWidget( myShininess, 7, 2 );
- propLayout->addWidget( line2, 8, 0, 1, 4 );
- propLayout->setRowStretch( 9, 5 );
- propLayout->addLayout( btnLayout, 10, 0, 1, 4 );
+
+ propLayout->addWidget( shininessLab, 9, 0 );
+ propLayout->addWidget( myFrontShininess, 9, 4 );
+ propLayout->addWidget( myBackShininess, 9, 6 );
+ propLayout->addWidget( line5, 10, 0, 1, 7 );
+ propLayout->setRowStretch( 11, 5 );
+ propLayout->addLayout( btnLayout, 12, 0, 1, 7 );
// initialize dialog box
setButtonPosition( Right, Close );
// install event filter to the materials list to process key press events
myMaterials->installEventFilter( this );
+ //Set image
+ myPushBtn->setIcon(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
// connect signals
// note: all widgets, that change material properties, are connected to the common signal
// changed(), instead of connecting directly to the slot - this allows easy temporary blocking
connect( myPhysical, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ ) {
connect( myReflection[i].color, SIGNAL( changed( QColor ) ), this, SIGNAL( changed() ) );
- connect( myReflection[i].coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
+ connect( myReflection[i].front_coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
+ connect( myReflection[i].back_coef, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
connect( myReflection[i].enabled, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
}
- connect( myShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
+ connect( myFrontShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
+ connect( myBackShininess, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
connect( myMaterials, SIGNAL( itemSelectionChanged() ),
this, SLOT( onMaterialChanged() ) );
connect( myMaterials, SIGNAL( itemChanged( QListWidgetItem* ) ),
connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) );
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
connect( this, SIGNAL( changed() ), this, SLOT( onChanged() ) );
+ connect(myPushBtn, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
// initialize current material model according to the selection
myColor->setColor( SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) );
if ( window ) {
int mgrId = window->getViewManager()->getGlobalId();
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
- QString matProp = propMap.value(MATERIAL_PROP).toString();
+ QString matProp = propMap.value(GEOM::propertyName( GEOM::Material )).toString();
if ( !matProp.isEmpty() )
myCurrentModel.fromProperties( matProp );
- QColor c = propMap.value(COLOR_PROP).value<QColor>();
+ QColor c = propMap.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
if ( c.isValid() )
myColor->setColor( c );
}
}
}
}
-
+ myLineEditCurArg->setText("");
+ myPushBtn->click();
+ SelectionIntoArgument();
+
// finally activate current material properties
myMaterials->setCurrentRow( 0 );
}
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
{
myReflection[i].color->setColor( model.color( (Material_Model::ReflectionType)i ) );
- myReflection[i].coef->setValue( model.reflection( (Material_Model::ReflectionType)i ) );
+ myReflection[i].front_coef->setValue( model.reflection( (Material_Model::ReflectionType)i, true ) );
+ myReflection[i].back_coef->setValue( model.reflection( (Material_Model::ReflectionType)i, false ) );
myReflection[i].enabled->setChecked( model.hasReflection( (Material_Model::ReflectionType)i ) );
}
// shininess
- myShininess->setValue( model.shininess() );
+ myFrontShininess->setValue( model.shininess( true ) );
+ myBackShininess->setValue( model.shininess( false ) );
// type (physical or no)
myPhysical->setChecked( model.isPhysical() );
model.setPhysical( myPhysical->isChecked() );
// shininess
- model.setShininess( myShininess->value() );
+ model.setShininess( myFrontShininess->value(), true );
+ model.setShininess( myBackShininess->value(), false );
// reflection components
for ( int i = Material_Model::Ambient; i <= Material_Model::Emissive; i++ )
{
model.setColor ( (Material_Model::ReflectionType)i, myReflection[i].color->color() );
- model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].coef->value() );
+ model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].front_coef->value(), true );
+ model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].back_coef->value(), false );
model.setReflection( (Material_Model::ReflectionType)i, myReflection[i].enabled->isChecked() );
}
}
{
// save user materials
myResourceMgr.save();
-
+ if( !myShowSelWidget ) return;
// store selected material properties in the current model
toModel( myCurrentModel );
SVTK_View* aView = vtkVW->getView();
// get VTK material properties from the current model
- GEOM_VTKPropertyMaterial* vtkProp = myCurrentModel.getMaterialVTKProperty();
+ GEOM_VTKPropertyMaterial* vtkPropF = myCurrentModel.getMaterialVTKProperty();
+ GEOM_VTKPropertyMaterial* vtkPropB = myCurrentModel.getMaterialVTKProperty( false );
SUIT_OverrideCursor wc();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
// set material property to the presentation
- aView->SetMaterial( It.Value(), vtkProp );
+ aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
// store chosen material in the property map
- study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
// set correct color for the non-physical material
if ( !myCurrentModel.isPhysical() ) {
aView->SetColor( It.Value(), myColor->color() );
- study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Color ), myColor->color() );
}
}
aView->Repaint();
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
// get OCC material aspect from the current model
- Graphic3d_MaterialAspect occAspect = myCurrentModel.getMaterialOCCAspect();
+ Graphic3d_MaterialAspect front_occAspect = myCurrentModel.getMaterialOCCAspect( true );
+ Graphic3d_MaterialAspect back_occAspect = myCurrentModel.getMaterialOCCAspect( false );
SUIT_OverrideCursor wc();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
Handle(GEOM_AISShape) aisShape = GEOMBase::ConvertIOinGEOMAISShape( It.Value(), true );
if ( !aisShape.IsNull() ) {
- // set material property to the presentation
- aisShape->SetMaterial( occAspect );
- // store chosen material in the property map
- study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
- // set correct color for the non-physical material
- if ( !myCurrentModel.isPhysical() ) {
- aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
- study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
- ic->RecomputePrsOnly( aisShape, Standard_False );
- }
- //if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
- ic->Redisplay( aisShape, Standard_False );
+ // Set front material for the selected shape
+ aisShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
+ aisShape->SetMaterial(front_occAspect);
+ // Set back material for the selected shape
+ aisShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
+ aisShape->SetMaterial(back_occAspect);
+ // Return to the default facing mode
+ aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
+ // store chosen material in the property map
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
+ // set correct color for the non-physical material
+ if ( !myCurrentModel.isPhysical() ) {
+ aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
+ study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Color ), myColor->color() );
+ ic->RecomputePrsOnly( aisShape, Standard_False );
+ }
+ //if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
+ ic->Redisplay( aisShape, Standard_False );
}
}
ic->UpdateCurrentViewer();
myColor->setEnabled( !myPhysical->isChecked() );
myReflection[0].color->setEnabled( myPhysical->isChecked() );
}
+
+
+void GEOMToolsGUI_MaterialPropertiesDlg::SetEditCurrentArgument()
+{
+ QPushButton* send = (QPushButton*)sender();
+
+ if (send == myPushBtn) {
+ // enable line edit
+ myLineEditCurArg->setEnabled(true);
+ myLineEditCurArg->setFocus();
+ SelectionIntoArgument();
+ // after setFocus(), because it will be setDown(false) when loses focus
+ send->setDown(true);
+ }
+}
+
+/*!
+ \brief Called when selection as changed or other case
+*/
+void GEOMToolsGUI_MaterialPropertiesDlg::SelectionIntoArgument()
+{
+ myLineEditCurArg->setText( "" );
+ QString aString = "";
+
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( study ) {
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+ int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
+ }
+ myLineEditCurArg->setText( aString );
+}
enum { TypeRole = Qt::UserRole + 123, NameRole };
public:
- GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 );
+ GEOMToolsGUI_MaterialPropertiesDlg( QWidget* = 0 , bool = true, bool = false,const int = Standard );
~GEOMToolsGUI_MaterialPropertiesDlg();
void accept();
void onAddMaterial();
void onApply();
void onHelp();
+ void SetEditCurrentArgument();
+ void SelectionIntoArgument();
private:
typedef struct
{
+ QCheckBox* enabled;
QLabel* label;
QtxColorButton* color;
- QtxDoubleSpinBox* coef;
- QCheckBox* enabled;
+ QtxDoubleSpinBox* front_coef;
+ QtxDoubleSpinBox* back_coef;
} Reflection;
GEOMToolsGUI_MaterialList* myMaterials;
QCheckBox* myPhysical;
QList<Reflection> myReflection;
- QtxDoubleSpinBox* myShininess;
+ QtxDoubleSpinBox* myFrontShininess;
+ QtxDoubleSpinBox* myBackShininess;
QLabel* myColorLab;
QtxColorButton* myColor;
QPushButton* myAddButton;
QPushButton* myDelButton;
Material_ResourceMgr myResourceMgr;
Material_Model myCurrentModel;
+ bool myShowSelWidget;
+ QLineEdit* myLineEditCurArg;
+ QPushButton* myPushBtn;
};
class GEOMToolsGUI_MaterialList : public QListWidget
SUIT_OverrideCursor();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
aView->SetTransparency( It.Value(), newValue );
- aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue );
+ aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), GEOM::propertyName( GEOM::Transparency ) , newValue );
}
GeometryGUI::Modified();
aView->Repaint();
if ( !aisShape.IsNull() ) {
ic->SetTransparency( aisShape, newValue, false );
ic->Redisplay( aisShape, Standard_False, Standard_True );
- aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue );
+ aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), GEOM::propertyName( GEOM::Transparency ) , newValue );
}
} // for...
ic->UpdateCurrentViewer();
--- /dev/null
+// Copyright (C) 2007-2012 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 <GEOMUtils.hxx>
+
+#include <Basics_OCCTVersion.hxx>
+
+#include <utilities.h>
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
+
+// OCCT Includes
+#include <BRepMesh_IncrementalMesh.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepGProp.hxx>
+#include <BRepTools.hxx>
+
+#include <Bnd_Box.hxx>
+
+#include <TopAbs.hxx>
+#include <TopExp.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+
+#include <Geom_Surface.hxx>
+#include <Geom_Plane.hxx>
+
+#include <GeomLProp_CLProps.hxx>
+#include <GeomLProp_SLProps.hxx>
+
+#include <GProp_GProps.hxx>
+#include <GProp_PrincipalProps.hxx>
+
+#include <gp_Pln.hxx>
+#include <gp_Lin.hxx>
+
+#include <vector>
+
+#include <Standard_Failure.hxx>
+#include <Standard_NullObject.hxx>
+#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+
+#define STD_SORT_ALGO 1
+
+//=======================================================================
+//function : GetPosition
+//purpose :
+//=======================================================================
+gp_Ax3 GEOMUtils::GetPosition (const TopoDS_Shape& theShape)
+{
+ gp_Ax3 aResult;
+
+ if (theShape.IsNull())
+ return aResult;
+
+ // Axes
+ aResult.Transform(theShape.Location().Transformation());
+ if (theShape.ShapeType() == TopAbs_FACE) {
+ Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(theShape));
+ if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
+ Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
+ gp_Pln aPln = aGPlane->Pln();
+ aResult = aPln.Position();
+ // In case of reverse orinetation of the face invert the plane normal
+ // (the face's normal does not mathc the plane's normal in this case)
+ if(theShape.Orientation() == TopAbs_REVERSED)
+ {
+ gp_Dir Vx = aResult.XDirection();
+ gp_Dir N = aResult.Direction().Mirrored(Vx);
+ gp_Pnt P = aResult.Location();
+ aResult = gp_Ax3(P, N, Vx);
+ }
+ }
+ }
+
+ // Origin
+ gp_Pnt aPnt;
+
+ TopAbs_ShapeEnum aShType = theShape.ShapeType();
+
+ if (aShType == TopAbs_VERTEX) {
+ aPnt = BRep_Tool::Pnt(TopoDS::Vertex(theShape));
+ }
+ else {
+ if (aShType == TopAbs_COMPOUND) {
+ aShType = GetTypeOfSimplePart(theShape);
+ }
+
+ GProp_GProps aSystem;
+ if (aShType == TopAbs_EDGE || aShType == TopAbs_WIRE)
+ BRepGProp::LinearProperties(theShape, aSystem);
+ else if (aShType == TopAbs_FACE || aShType == TopAbs_SHELL)
+ BRepGProp::SurfaceProperties(theShape, aSystem);
+ else
+ BRepGProp::VolumeProperties(theShape, aSystem);
+
+ aPnt = aSystem.CentreOfMass();
+ }
+
+ aResult.SetLocation(aPnt);
+
+ return aResult;
+}
+
+//=======================================================================
+//function : GetVector
+//purpose :
+//=======================================================================
+gp_Vec GEOMUtils::GetVector (const TopoDS_Shape& theShape)
+{
+ if (theShape.IsNull())
+ Standard_NullObject::Raise("Null shape is given for a vector");
+
+ if (theShape.ShapeType() != TopAbs_EDGE)
+ Standard_TypeMismatch::Raise("Invalid shape is given, must be a vector or an edge");
+
+ TopoDS_Edge anE = TopoDS::Edge(theShape);
+
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(anE, V1, V2, Standard_True);
+
+ if (V1.IsNull() || V2.IsNull())
+ Standard_NullObject::Raise("Invalid edge is given, it must have two points");
+
+ gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
+ if (aV.Magnitude() < gp::Resolution()) {
+ Standard_ConstructionError::Raise("Vector of zero length is given");
+ }
+
+ return aV;
+}
+
+//=======================================================================
+//function : ShapeToDouble
+//purpose : used by CompareShapes::operator()
+//=======================================================================
+std::pair<double, double> ShapeToDouble (const TopoDS_Shape& S, bool isOldSorting)
+{
+ // Computing of CentreOfMass
+ gp_Pnt GPoint;
+ double Len;
+
+ if (S.ShapeType() == TopAbs_VERTEX) {
+ GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
+ Len = (double)S.Orientation();
+ }
+ else {
+ GProp_GProps GPr;
+ // BEGIN: fix for Mantis issue 0020842
+ if (isOldSorting) {
+ BRepGProp::LinearProperties(S, GPr);
+ }
+ else {
+ if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
+ BRepGProp::LinearProperties(S, GPr);
+ }
+ else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
+ BRepGProp::SurfaceProperties(S, GPr);
+ }
+ else {
+ BRepGProp::VolumeProperties(S, GPr);
+ }
+ }
+ // END: fix for Mantis issue 0020842
+ GPoint = GPr.CentreOfMass();
+ Len = GPr.Mass();
+ }
+
+ double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
+ return std::make_pair(dMidXYZ, Len);
+}
+
+//=======================================================================
+//function : CompareShapes::operator()
+//purpose : used by std::sort(), called from SortShapes()
+//=======================================================================
+bool GEOMUtils::CompareShapes::operator() (const TopoDS_Shape& theShape1,
+ const TopoDS_Shape& theShape2)
+{
+ if (!myMap.IsBound(theShape1)) {
+ myMap.Bind(theShape1, ShapeToDouble(theShape1, myIsOldSorting));
+ }
+
+ if (!myMap.IsBound(theShape2)) {
+ myMap.Bind(theShape2, ShapeToDouble(theShape2, myIsOldSorting));
+ }
+
+ std::pair<double, double> val1 = myMap.Find(theShape1);
+ std::pair<double, double> val2 = myMap.Find(theShape2);
+
+ double tol = Precision::Confusion();
+ bool exchange = Standard_False;
+
+ double dMidXYZ = val1.first - val2.first;
+ if (dMidXYZ >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dMidXYZ) < tol) {
+ double dLength = val1.second - val2.second;
+ if (dLength >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) {
+ // PAL17233
+ // equal values possible on shapes such as two halves of a sphere and
+ // a membrane inside the sphere
+ Bnd_Box box1,box2;
+ BRepBndLib::Add(theShape1, box1);
+ if (!box1.IsVoid()) {
+ BRepBndLib::Add(theShape2, box2);
+ Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
+ if (dSquareExtent >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dSquareExtent) < tol) {
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
+ box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+ box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+ if ((val1 - val2) >= tol) {
+ exchange = Standard_True;
+ }
+ }
+ }
+ }
+ }
+
+ //return val1 < val2;
+ return !exchange;
+}
+
+//=======================================================================
+//function : SortShapes
+//purpose :
+//=======================================================================
+void GEOMUtils::SortShapes (TopTools_ListOfShape& SL,
+ const Standard_Boolean isOldSorting)
+{
+#ifdef STD_SORT_ALGO
+ std::vector<TopoDS_Shape> aShapesVec;
+ aShapesVec.reserve(SL.Extent());
+
+ TopTools_ListIteratorOfListOfShape it (SL);
+ for (; it.More(); it.Next()) {
+ aShapesVec.push_back(it.Value());
+ }
+ SL.Clear();
+
+ CompareShapes shComp (isOldSorting);
+ std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+ //std::sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+
+ std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
+ for (; anIter != aShapesVec.end(); ++anIter) {
+ SL.Append(*anIter);
+ }
+#else
+ // old implementation
+ Standard_Integer MaxShapes = SL.Extent();
+ TopTools_Array1OfShape aShapes (1,MaxShapes);
+ TColStd_Array1OfInteger OrderInd(1,MaxShapes);
+ TColStd_Array1OfReal MidXYZ (1,MaxShapes); //X,Y,Z;
+ TColStd_Array1OfReal Length (1,MaxShapes); //X,Y,Z;
+
+ // Computing of CentreOfMass
+ Standard_Integer Index;
+ GProp_GProps GPr;
+ gp_Pnt GPoint;
+ TopTools_ListIteratorOfListOfShape it(SL);
+ for (Index=1; it.More(); Index++)
+ {
+ TopoDS_Shape S = it.Value();
+ SL.Remove( it ); // == it.Next()
+ aShapes(Index) = S;
+ OrderInd.SetValue (Index, Index);
+ if (S.ShapeType() == TopAbs_VERTEX) {
+ GPoint = BRep_Tool::Pnt( TopoDS::Vertex( S ));
+ Length.SetValue( Index, (Standard_Real) S.Orientation());
+ }
+ else {
+ // BEGIN: fix for Mantis issue 0020842
+ if (isOldSorting) {
+ BRepGProp::LinearProperties (S, GPr);
+ }
+ else {
+ if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
+ BRepGProp::LinearProperties (S, GPr);
+ }
+ else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
+ BRepGProp::SurfaceProperties(S, GPr);
+ }
+ else {
+ BRepGProp::VolumeProperties(S, GPr);
+ }
+ }
+ // END: fix for Mantis issue 0020842
+ GPoint = GPr.CentreOfMass();
+ Length.SetValue(Index, GPr.Mass());
+ }
+ MidXYZ.SetValue(Index, GPoint.X()*999.0 + GPoint.Y()*99.0 + GPoint.Z()*0.9);
+ //cout << Index << " L: " << Length(Index) << "CG: " << MidXYZ(Index) << endl;
+ }
+
+ // Sorting
+ Standard_Integer aTemp;
+ Standard_Boolean exchange, Sort = Standard_True;
+ Standard_Real tol = Precision::Confusion();
+ while (Sort)
+ {
+ Sort = Standard_False;
+ for (Index=1; Index < MaxShapes; Index++)
+ {
+ exchange = Standard_False;
+ Standard_Real dMidXYZ = MidXYZ(OrderInd(Index)) - MidXYZ(OrderInd(Index+1));
+ Standard_Real dLength = Length(OrderInd(Index)) - Length(OrderInd(Index+1));
+ if ( dMidXYZ >= tol ) {
+// cout << "MidXYZ: " << MidXYZ(OrderInd(Index))<< " > " <<MidXYZ(OrderInd(Index+1))
+// << " d: " << dMidXYZ << endl;
+ exchange = Standard_True;
+ }
+ else if ( Abs(dMidXYZ) < tol && dLength >= tol ) {
+// cout << "Length: " << Length(OrderInd(Index))<< " > " <<Length(OrderInd(Index+1))
+// << " d: " << dLength << endl;
+ exchange = Standard_True;
+ }
+ else if ( Abs(dMidXYZ) < tol && Abs(dLength) < tol &&
+ aShapes(OrderInd(Index)).ShapeType() <= TopAbs_FACE) {
+ // PAL17233
+ // equal values possible on shapes such as two halves of a sphere and
+ // a membrane inside the sphere
+ Bnd_Box box1,box2;
+ BRepBndLib::Add( aShapes( OrderInd(Index) ), box1 );
+ if ( box1.IsVoid() ) continue;
+ BRepBndLib::Add( aShapes( OrderInd(Index+1) ), box2 );
+ Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
+ if ( dSquareExtent >= tol ) {
+// cout << "SquareExtent: " << box1.SquareExtent()<<" > "<<box2.SquareExtent() << endl;
+ exchange = Standard_True;
+ }
+ else if ( Abs(dSquareExtent) < tol ) {
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
+ box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val1 = (aXmin+aXmax)*999 + (aYmin+aYmax)*99 + (aZmin+aZmax)*0.9;
+ box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val2 = (aXmin+aXmax)*999 + (aYmin+aYmax)*99 + (aZmin+aZmax)*0.9;
+ //exchange = val1 > val2;
+ if ((val1 - val2) >= tol) {
+ exchange = Standard_True;
+ }
+ //cout << "box: " << val1<<" > "<<val2 << endl;
+ }
+ }
+
+ if (exchange)
+ {
+// cout << "exchange " << Index << " & " << Index+1 << endl;
+ aTemp = OrderInd(Index);
+ OrderInd(Index) = OrderInd(Index+1);
+ OrderInd(Index+1) = aTemp;
+ Sort = Standard_True;
+ }
+ }
+ }
+
+ for (Index=1; Index <= MaxShapes; Index++)
+ SL.Append( aShapes( OrderInd(Index) ));
+#endif
+}
+
+//=======================================================================
+//function : CompsolidToCompound
+//purpose :
+//=======================================================================
+TopoDS_Shape GEOMUtils::CompsolidToCompound (const TopoDS_Shape& theCompsolid)
+{
+ if (theCompsolid.ShapeType() != TopAbs_COMPSOLID) {
+ return theCompsolid;
+ }
+
+ TopoDS_Compound aCompound;
+ BRep_Builder B;
+ B.MakeCompound(aCompound);
+
+ TopTools_MapOfShape mapShape;
+ TopoDS_Iterator It (theCompsolid, Standard_True, Standard_True);
+
+ for (; It.More(); It.Next()) {
+ TopoDS_Shape aShape_i = It.Value();
+ if (mapShape.Add(aShape_i)) {
+ B.Add(aCompound, aShape_i);
+ }
+ }
+
+ return aCompound;
+}
+
+//=======================================================================
+//function : CheckTriangulation
+//purpose :
+//=======================================================================
+bool GEOMUtils::CheckTriangulation (const TopoDS_Shape& aShape)
+{
+ bool isTriangulation = true;
+
+ TopExp_Explorer exp (aShape, TopAbs_FACE);
+ if (exp.More())
+ {
+ TopLoc_Location aTopLoc;
+ Handle(Poly_Triangulation) aTRF;
+ aTRF = BRep_Tool::Triangulation(TopoDS::Face(exp.Current()), aTopLoc);
+ if (aTRF.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+ else // no faces, try edges
+ {
+ TopExp_Explorer expe (aShape, TopAbs_EDGE);
+ if (!expe.More()) {
+ return false;
+ }
+ TopLoc_Location aLoc;
+ Handle(Poly_Polygon3D) aPE = BRep_Tool::Polygon3D(TopoDS::Edge(expe.Current()), aLoc);
+ if (aPE.IsNull()) {
+ isTriangulation = false;
+ }
+ }
+
+ if (!isTriangulation) {
+ // calculate deflection
+ Standard_Real aDeviationCoefficient = 0.001;
+
+ Bnd_Box B;
+ BRepBndLib::Add(aShape, B);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ B.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+
+ Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
+ Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
+ Standard_Real aHLRAngle = 0.349066;
+
+ BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
+ }
+
+ return true;
+}
+
+//=======================================================================
+//function : GetTypeOfSimplePart
+//purpose :
+//=======================================================================
+TopAbs_ShapeEnum GEOMUtils::GetTypeOfSimplePart (const TopoDS_Shape& theShape)
+{
+ TopAbs_ShapeEnum aType = theShape.ShapeType();
+ if (aType == TopAbs_VERTEX) return TopAbs_VERTEX;
+ else if (aType == TopAbs_EDGE || aType == TopAbs_WIRE) return TopAbs_EDGE;
+ else if (aType == TopAbs_FACE || aType == TopAbs_SHELL) return TopAbs_FACE;
+ else if (aType == TopAbs_SOLID || aType == TopAbs_COMPSOLID) return TopAbs_SOLID;
+ else if (aType == TopAbs_COMPOUND) {
+ // Only the iType of the first shape in the compound is taken into account
+ TopoDS_Iterator It (theShape, Standard_False, Standard_False);
+ if (It.More()) {
+ return GetTypeOfSimplePart(It.Value());
+ }
+ }
+ return TopAbs_SHAPE;
+}
--- /dev/null
+// Copyright (C) 2007-2012 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 _GEOMUtils_HXX_
+#define _GEOMUtils_HXX_
+
+#include <TopoDS_Shape.hxx>
+
+#include <TopTools_ListOfShape.hxx>
+
+#include <TopAbs.hxx>
+
+#include <gp_Ax3.hxx>
+#include <gp_Vec.hxx>
+
+#include <NCollection_DataMap.hxx>
+
+#include <functional>
+
+inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2)
+{
+ return S1.IsSame(S2);
+}
+
+class GEOMUtils {
+
+ public:
+ /*!
+ * \brief Get Local Coordinate System, corresponding to the given shape.
+ *
+ * Origin of the LCS is situated at the shape's center of mass.
+ * Axes of the LCS are obtained from shape's location or,
+ * if the shape is a planar face, from position of its plane.
+ */
+ Standard_EXPORT static gp_Ax3 GetPosition (const TopoDS_Shape& theShape);
+
+ /*!
+ * \brief Get vector, defined by the given edge.
+ */
+ Standard_EXPORT static gp_Vec GetVector (const TopoDS_Shape& theShape);
+
+ /*!
+ * \brief Sort shapes in the list by their coordinates.
+ * \param SL The list of shapes to sort.
+ */
+ struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
+ {
+ CompareShapes (bool isOldSorting)
+ : myIsOldSorting(isOldSorting) {}
+
+ bool operator() (const TopoDS_Shape& lhs, const TopoDS_Shape& rhs);
+
+ typedef NCollection_DataMap<TopoDS_Shape, std::pair<double, double> > GEOMUtils_DataMapOfShapeDouble;
+ GEOMUtils_DataMapOfShapeDouble myMap;
+ bool myIsOldSorting;
+ };
+
+ /*!
+ * \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9
+ */
+ Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL,
+ const Standard_Boolean isOldSorting = Standard_True);
+
+ /*!
+ * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
+ *
+ * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
+ *
+ * \param theCompsolid The compsolid to be converted.
+ * \retval TopoDS_Shape Returns the resulting compound.
+ */
+ Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
+
+ /*!
+ * \brief Build a triangulation on \a theShape if it is absent.
+ * \param theShape The shape to check/build triangulation on.
+ * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
+ */
+ Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
+
+ /*!
+ * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
+ * \param theShape The shape to get type of.
+ * \retval TopAbs_ShapeEnum Return type of shape for explode.
+ */
+ Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape);
+
+};
+
+#endif
--- /dev/null
+# Copyright (C) 2007-2012 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
+
+# GEOMUtils : implementaion of some common methods for GEOMImpl package
+# File : Makefile.am
+# Author : Julia DOROVSKIKH
+
+include $(top_srcdir)/adm_local/unix/make_common_starter.am
+
+# Libraries targets
+lib_LTLIBRARIES = libGEOMUtils.la
+
+# header files
+salomeinclude_HEADERS = \
+ GEOMUtils.hxx
+
+dist_libGEOMUtils_la_SOURCES = \
+ GEOMUtils.cxx
+
+# additional information to compile and link file
+
+libGEOMUtils_la_CPPFLAGS = \
+ $(CAS_CPPFLAGS) \
+ $(KERNEL_CXXFLAGS) \
+ $(BOOST_CPPFLAGS) \
+ -I$(srcdir)/../ShHealOper \
+ -I$(srcdir)/../NMTDS \
+ -I$(srcdir)/../NMTTools \
+ -I$(srcdir)/../BlockFix \
+ -I$(srcdir)/../GEOMAlgo \
+ -I$(srcdir)/../SKETCHER \
+ -I$(srcdir)/../ARCHIMEDE
+
+libGEOMUtils_la_LDFLAGS = \
+ ../BlockFix/libBlockFix.la \
+ ../GEOMAlgo/libGEOMAlgo.la \
+ ../ShHealOper/libShHealOper.la \
+ ../ARCHIMEDE/libGEOMArchimede.la \
+ ../SKETCHER/libGEOMSketcher.la \
+ $(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \
+ $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lTKFeat \
+ $(STDLIB)
#include <TopExp.hxx>
#include <OSD.hxx>
-#include "SALOMEDS_Tool.hxx"
+#include <SALOMEDS_Tool.hxx>
//============================================================================
// function : GEOM_Gen_i()
// Remove the created file and tmp directory
if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
- SALOMEDS::Study_var Study = theComponent->GetStudy();
- TCollection_AsciiString name (Study->Name());
-
return true;
}
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
+ PortableServer::Servant aServant = _poa->reference_to_servant(aTrsfOp.in());
+ GEOM_ITransformOperations_i* aTrsfOpSv = dynamic_cast<GEOM_ITransformOperations_i*>(aServant);
+
// Reconstruct arguments and tree of sub-shapes of the arguments
CORBA::String_var anIOR;
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
- GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject);
+ GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
{
GEOMImpl_ITranslate aTI (anOFun);
aMultiArgShape = GEOMImpl_ITransformOperations::TranslateShape1D(anArgOShape, &aTI);
- //anArgOMulti = aTrsfOp->Translate1D(anArgO, , , );
+ //anArgOMulti = aTrsfOpSv->Translate1D(anArgO, , , );
}
break;
case TRANSLATE_2D:
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
+ PortableServer::Servant aServant = _poa->reference_to_servant(aTrsfOp.in());
+ GEOM_ITransformOperations_i* aTrsfOpSv = dynamic_cast<GEOM_ITransformOperations_i*>(aServant);
+
// Reconstruct published sub-shapes
SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO);
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
- GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO);
+ GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
+ PortableServer::Servant aServant = _poa->reference_to_servant(aTrsfOp.in());
+ GEOM_ITransformOperations_i* aTrsfOpSv = dynamic_cast<GEOM_ITransformOperations_i*>(aServant);
+
// Reconstruct arguments and tree of sub-shapes of the arguments
CORBA::String_var anIOR;
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
- GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anArgO, theObject);
+ GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anArgO, theObject);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
GEOM::GEOM_IGroupOperations_var aGroupOp = GetIGroupOperations(theStudy->StudyId());
GEOM::GEOM_ITransformOperations_var aTrsfOp = GetITransformOperations(theStudy->StudyId());
+ PortableServer::Servant aServant = _poa->reference_to_servant(aTrsfOp.in());
+ GEOM_ITransformOperations_i* aTrsfOpSv = dynamic_cast<GEOM_ITransformOperations_i*>(aServant);
+
// Reconstruct published sub-shapes
SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator(theOldSO);
case GEOM::FSM_MultiTransformed:
{
// Only for Multi-transformations
- GEOM::GEOM_Object_var anArgOTrsf = aTrsfOp->TransformLikeOtherCopy(anOldSubO, theNewO);
+ GEOM::GEOM_Object_var anArgOTrsf = aTrsfOpSv->TransformLikeOtherCopy(anOldSubO, theNewO);
if (!CORBA::is_nil(anArgOTrsf)) {
CORBA::String_var anArgOTrsfEntry = anArgOTrsf->GetEntry();
Handle(GEOM_Object) anArgOTrsfImpl = _impl->GetObject(anArgOTrsf->GetStudyID(), anArgOTrsfEntry);
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeSplineInterpolWithTangents
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSplineInterpolWithTangents
+ (const GEOM::ListOfGO& thePoints,
+ GEOM::GEOM_Object_ptr theFirstVec,
+ GEOM::GEOM_Object_ptr theLastVec)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference points
+ int ind = 0;
+ int aLen = thePoints.length();
+ std::list<Handle(GEOM_Object)> aPoints;
+ for (; ind < aLen; ind++) {
+ Handle(GEOM_Object) aPnt = GetObjectImpl(thePoints[ind]);
+ if (aPnt.IsNull()) return aGEOMObject._retn();
+ aPoints.push_back(aPnt);
+ }
+
+ //Get the reference vectors
+ Handle(GEOM_Object) aVec1 = GetObjectImpl(theFirstVec);
+ Handle(GEOM_Object) aVec2 = GetObjectImpl(theLastVec);
+
+ if (aVec1.IsNull() || aVec2.IsNull()) return aGEOMObject._retn();
+
+ // Make Polyline
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeSplineInterpolWithTangents(aPoints, aVec1, aVec2);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeCurveParametric
CORBA::Boolean theIsClosed,
CORBA::Boolean theDoReordering);
+ GEOM::GEOM_Object_ptr MakeSplineInterpolWithTangents (const GEOM::ListOfGO& thePoints,
+ GEOM::GEOM_Object_ptr theFirstVec,
+ GEOM::GEOM_Object_ptr theLastVec);
+
GEOM::GEOM_Object_ptr MakeCurveParametric
(const char* thexExpr, const char* theyExpr, const char* thezExpr,
double theParamMin, double theParamMax, double theParamStep,
// 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>
GetOperations()->GetBoundingBox(aShape, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
}
+//=============================================================================
+/*!
+ * MakeBoundingBox
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::MakeBoundingBox
+ (GEOM::GEOM_Object_ptr theShape)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return aGEOMObject._retn();
+
+ // Make Box - bounding box of theShape
+ Handle(GEOM_Object) anObject = GetOperations()->GetBoundingBox(aShape);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* GetTolerance
return GetOperations()->GetMinDistance(aShape1, aShape2, X1, Y1, Z1, X2, Y2, Z2);
}
+//=============================================================================
+/*!
+ * ClosestPoints
+ */
+//=============================================================================
+CORBA::Long GEOM_IMeasureOperations_i::ClosestPoints
+ (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2,
+ GEOM::ListOfDouble_out theCoords)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ // allocate the CORBA array
+ int nbSols = 0;
+ GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+ Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
+
+ if (!aShape1.IsNull() && !aShape2.IsNull()) {
+ Handle(TColStd_HSequenceOfReal) aDoubles = new TColStd_HSequenceOfReal;
+ // Get shape parameters
+ nbSols = GetOperations()->ClosestPoints(aShape1, aShape2, aDoubles);
+ int nbDbls = aDoubles->Length();
+ aDoublesArray->length(nbDbls);
+ for (int id = 0; id < nbDbls; id++) {
+ aDoublesArray[id] = aDoubles->Value(id + 1);
+ }
+ }
+
+ theCoords = aDoublesArray._retn();
+ return nbSols;
+}
+
//=============================================================================
/*!
* PointCoordinates
// 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_IMeasureOperations_i_HeaderFile
#define _GEOM_IMeasureOperations_i_HeaderFile
CORBA::Double& Ymin, CORBA::Double& Ymax,
CORBA::Double& Zmin, CORBA::Double& Zmax);
+ GEOM::GEOM_Object_ptr MakeBoundingBox (GEOM::GEOM_Object_ptr theShape);
+
void GetTolerance (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& FaceMin, CORBA::Double& FaceMax,
CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2);
+ CORBA::Long ClosestPoints (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2,
+ GEOM::ListOfDouble_out theCoords);
+
void PointCoordinates (GEOM::GEOM_Object_ptr theShape,
CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z);
return anID;
}
+//=============================================================================
+/*!
+ * GetSubShapesIndices
+ */
+//=============================================================================
+GEOM::ListOfLong* GEOM_IShapesOperations_i::GetSubShapesIndices
+ (GEOM::GEOM_Object_ptr theMainShape, const GEOM::ListOfGO& theSubShapes)
+{
+ GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
+
+ //Get the reference main shape
+ Handle(GEOM_Object) aMainShapeRef = GetObjectImpl(theMainShape);
+ if (aMainShapeRef.IsNull()) return aSeq._retn();
+
+ //Get the subshapes
+ std::list<Handle(GEOM_Object)> aShapes;
+ int aLen = theSubShapes.length();
+ for (int ind = 0; ind < aLen; ind++) {
+ Handle(GEOM_Object) aSh = GetObjectImpl(theSubShapes[ind]);
+ if (aSh.IsNull())
+ {
+ MESSAGE("NULL shape")
+ return aSeq._retn();
+ }
+ aShapes.push_back(aSh);
+ }
+
+ //Get the IDs of <theSubShapes> inside <theMainShape>
+ Handle(TColStd_HSequenceOfInteger) aHSeq =
+ GetOperations()->GetSubShapesIndices(aMainShapeRef, aShapes);
+
+ 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] = aHSeq->Value(i);
+
+ return aSeq._retn();
+}
+
+
//=============================================================================
/*!
* GetTopologyIndex
CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape);
+
+ GEOM::ListOfLong* GetSubShapesIndices (GEOM::GEOM_Object_ptr theMainShape,
+ const GEOM::ListOfGO& theSubShapes);
CORBA::Long GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape);
// 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>
//Get the vector of translation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DX by default
//Perform the translation
Handle(GEOM_Object) anObject =
//Get the vector1 of translation
Handle(GEOM_Object) aVector1 = GetObjectImpl(theVector1);
- if (aVector1.IsNull()) return aGEOMObject._retn();
+ //if (aVector1.IsNull()) return aGEOMObject._retn(); // DX by default
//Get the vector2 of translation
Handle(GEOM_Object) aVector2 = GetObjectImpl(theVector2);
- if (aVector2.IsNull()) return aGEOMObject._retn();
+ //if (aVector2.IsNull()) return aGEOMObject._retn(); // DY by default
//Perform the translation
Handle(GEOM_Object) anObject = GetOperations()->Translate2D
//Get the a directon of rotation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
//Perform the rotation
Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MultiRotate1DByStep
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngleStep,
+ CORBA::Long theNbSteps)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theAngleStep, theNbSteps);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MultiRotate2DNbTimes
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Long theNbObjects,
+ CORBA::Double theRadialStep,
+ CORBA::Long theNbSteps)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
+ (aBasicObject, aVector, theNbObjects, theRadialStep, theNbSteps);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MultiRotate2DByStep
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Get the object itself
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Get the a directon of rotation
+ Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ //Perform the rotation
+ Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
+ (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
+ if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MultiRotate2D
//Get the a directon of rotation
Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
- if (aVector.IsNull()) return aGEOMObject._retn();
+ //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
+
+ double anAngle = M_PI * theAngle / 180.;
//Perform the rotation
Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
- (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
+ (aBasicObject, aVector, anAngle, theNbTimes1, theStep, theNbTimes2);
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
return GetObject(anObject);
// 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_ITransformOperations_i_HeaderFile
#define _GEOM_ITransformOperations_i_HeaderFile
{
public:
GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
- GEOM::GEOM_Gen_ptr theEngine,
- ::GEOMImpl_ITransformOperations* theImpl);
+ GEOM::GEOM_Gen_ptr theEngine,
+ ::GEOMImpl_ITransformOperations* theImpl);
~GEOM_ITransformOperations_i();
GEOM::GEOM_Object_ptr TranslateTwoPoints (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TranslateTwoPointsCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject,
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ);
GEOM::GEOM_Object_ptr TranslateVector (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector);
+ GEOM::GEOM_Object_ptr theVector);
GEOM::GEOM_Object_ptr TranslateVectorCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector);
+ GEOM::GEOM_Object_ptr theVector);
GEOM::GEOM_Object_ptr TranslateVectorDistance (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Double theDistance,
- CORBA::Boolean theCopy);
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theDistance,
+ CORBA::Boolean theCopy);
GEOM::GEOM_Object_ptr MultiTranslate1D (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theVector,
GEOM::GEOM_Object_ptr Rotate (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theAxis,
- CORBA::Double theAngle);
+ CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Long theNbTimes);
-
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Long theNbTimes);
+
+ GEOM::GEOM_Object_ptr MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngleStep,
+ CORBA::Long theNbSteps);
+
+ GEOM::GEOM_Object_ptr MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Long theNbObjects,
+ CORBA::Double theRadialStep,
+ CORBA::Long theNbSteps);
+
+ GEOM::GEOM_Object_ptr MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2);
+
GEOM::GEOM_Object_ptr MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theVector,
- CORBA::Double theAngle,
- CORBA::Long theNbTimes1,
- CORBA::Double theStep,
- CORBA::Long theNbTimes2);
-
+ GEOM::GEOM_Object_ptr theVector,
+ CORBA::Double theAngle,
+ CORBA::Long theNbTimes1,
+ CORBA::Double theStep,
+ CORBA::Long theNbTimes2);
+
GEOM::GEOM_Object_ptr RotateCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis,
- CORBA::Double theAngle);
+ GEOM::GEOM_Object_ptr theAxis,
+ CORBA::Double theAngle);
GEOM::GEOM_Object_ptr MirrorPlane (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePlane);
+ GEOM::GEOM_Object_ptr thePlane);
GEOM::GEOM_Object_ptr MirrorPlaneCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePlane);
+ GEOM::GEOM_Object_ptr thePlane);
GEOM::GEOM_Object_ptr MirrorAxis (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis);
+ GEOM::GEOM_Object_ptr theAxis);
GEOM::GEOM_Object_ptr MirrorAxisCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theAxis);
+ GEOM::GEOM_Object_ptr theAxis);
GEOM::GEOM_Object_ptr MirrorPoint (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
GEOM::GEOM_Object_ptr MirrorPointCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset);
+ CORBA::Double theOffset);
GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject,
- CORBA::Double theOffset);
+ CORBA::Double theOffset);
GEOM::GEOM_Object_ptr ProjectShapeCopy (GEOM::GEOM_Object_ptr theSource,
GEOM::GEOM_Object_ptr theTarget);
GEOM::GEOM_Object_ptr ScaleShape (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactor);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactor);
GEOM::GEOM_Object_ptr ScaleShapeCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactor);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactor);
GEOM::GEOM_Object_ptr ScaleShapeAlongAxes (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactorX,
- CORBA::Double theFactorY,
- CORBA::Double theFactorZ);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactorX,
+ CORBA::Double theFactorY,
+ CORBA::Double theFactorZ);
GEOM::GEOM_Object_ptr ScaleShapeAlongAxesCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePoint,
- CORBA::Double theFactorX,
- CORBA::Double theFactorY,
- CORBA::Double theFactorZ);
+ GEOM::GEOM_Object_ptr thePoint,
+ CORBA::Double theFactorX,
+ CORBA::Double theFactorY,
+ CORBA::Double theFactorZ);
GEOM::GEOM_Object_ptr PositionShape (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theStartLCS,
- GEOM::GEOM_Object_ptr theEndLCS);
+ GEOM::GEOM_Object_ptr theStartLCS,
+ GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theStartLCS,
- GEOM::GEOM_Object_ptr theEndLCS);
+ GEOM::GEOM_Object_ptr theStartLCS,
+ GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr thePath,
- CORBA::Double theDistance,
- CORBA::Boolean theCopy,
- CORBA::Boolean theReverse);
+ GEOM::GEOM_Object_ptr thePath,
+ CORBA::Double theDistance,
+ CORBA::Boolean theCopy,
+ CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theCentPoint,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr theCentPoint,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr RotateThreePointsCopy (GEOM::GEOM_Object_ptr theObject,
- GEOM::GEOM_Object_ptr theCentPoint,
- GEOM::GEOM_Object_ptr thePoint1,
- GEOM::GEOM_Object_ptr thePoint2);
+ GEOM::GEOM_Object_ptr theCentPoint,
+ GEOM::GEOM_Object_ptr thePoint1,
+ GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr TransformLikeOtherCopy (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theSample);
char* aName = _impl->GetName();
if (aName)
return aName; // this is already copy of pointer (see implementation of _impl)
- return strdup("");
+ return CORBA::string_dup("");
}
//=============================================================================
--- /dev/null
+// Copyright (C) 2007-2012 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
+//
+// File : GEOM_wrap.hxx
+// Created : Mon Dec 24 14:39:49 2012
+// Author : Edward AGAPOV (eap)
+
+
+#ifndef __GEOM_wrap_HXX__
+#define __GEOM_wrap_HXX__
+
+#include <SALOME_GenericObj_wrap.hxx>
+
+namespace GEOM
+{
+ // Declare a type GEOM::GEOM_Object_wrap to replace GEOM::GEOM_Object_var,
+ // to be used in the case if a new GEOM_Object is received, in which case
+ // obj->UnRegister() must be called to avoid a memory leak.
+ // The GEOM::GEOM_Object_wrap object calls UnRegister() at destruction.
+ // A simple rule: use GEOM::GEOM_Object_wrap if an object is returned by a
+ // GEOM operation (GEOM::GEOM_IBasicOperations etc).
+ //
+ typedef SALOME::GenericObj_wrap< GEOM_Object > GEOM_Object_wrap;
+ //
+ // wrappers of operations
+ typedef SALOME::GenericObj_wrap< GEOM_IBasicOperations > GEOM_IBasicOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_ITransformOperations> GEOM_ITransformOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_I3DPrimOperations > GEOM_I3DPrimOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IShapesOperations > GEOM_IShapesOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IBlocksOperations > GEOM_IBlocksOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IBooleanOperations > GEOM_IBooleanOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_ICurvesOperations > GEOM_ICurvesOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_ILocalOperations > GEOM_ILocalOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IHealingOperations > GEOM_IHealingOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IInsertOperations > GEOM_IInsertOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IMeasureOperations > GEOM_IMeasureOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IGroupOperations > GEOM_IGroupOperations_wrap;
+ typedef SALOME::GenericObj_wrap< GEOM_IAdvancedOperations > GEOM_IAdvancedOperations_wrap;
+}
+
+#endif
# Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am
GEOM_IGroupOperations_i.hh \
GEOM_IAdvancedOperations_i.hh \
GEOM_Gen_i.hh \
- GEOM_GEOM_I.hxx
+ GEOM_GEOM_I.hxx \
+ GEOM_wrap.hxx
dist_libGEOMEngine_la_SOURCES = \
GEOM_Object_i.cc \
# Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
# Libraries targets
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# File : GEOM_ObjectInfo.py
# Author : Michael ZORIN
# Module : GEOM
-# $Header:
#
import salome
import geompy
# File : GEOM_Sketcher.py
# Author : Damien COQUERET, Open CASCADE
# Module : GEOM
-# $Header$
#
import geompy
Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object)->GEOM_Object
Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object)->GEOM_Object
Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object,Boolean)->GEOM_Object
+ InterpT1 = geompy.MakeInterpolWithTangents([px, py, pxyz], vx, vz) #(List of GO, GO, GO)->GEOM_Object
+ InterpT2 = geompy.MakeInterpolWithTangents([px, py, pxyz], vxy, vxyz) #(List of GO, GO, GO)->GEOM_Object
Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
[100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object
#Create Patterns
MultiTrans1D = geompy.MakeMultiTranslation1D(Fillet, vz, step1, nbtimes1)
MultiTrans2D = geompy.MakeMultiTranslation2D(Fillet, vz, step1, nbtimes1, vy, step2, nbtimes2)
- #!!!!Angle In Degree!!!!
- MultiRot1D = geompy.MultiRotate1D(Chamfer, vx, nbtimes1)
- MultiRot2D = geompy.MultiRotate2D(Chamfer, vx, angle, nbtimes1, step1, nbtimes2)
+ MultiRot1Dt = geompy.MultiRotate1DNbTimes(Chamfer, vx, nbtimes1)
+ MultiRot1Ds = geompy.MultiRotate1DByStep(Chamfer, vx, math.pi/4., nbtimes1)
+ MultiRot2Dt = geompy.MultiRotate2DNbTimes(Chamfer, vx, nbtimes1, step1, nbtimes2)
+ MultiRot2Ds = geompy.MultiRotate2DByStep(Chamfer, vx, angle1, nbtimes1, step1, nbtimes2)
#Create Informations objects
CDG = geompy.MakeCDG(Prism) #(GEOM_Object)->GEOM_Object
id_Polyline = geompy.addToStudy(Polyline, "Polyline")
id_Bezier = geompy.addToStudy(Bezier, "Bezier")
id_Interpol = geompy.addToStudy(Interpol, "Interpol")
+ id_InterpT1 = geompy.addToStudy(InterpT1, "InterpT1")
+ id_InterpT2 = geompy.addToStudy(InterpT2, "InterpT2")
id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher")
id_Sketcher3d_1 = geompy.addToStudy(Sketcher3d_1, "Sketcher 3D by interface")
id_MultiTrans1D = geompy.addToStudy(MultiTrans1D, "MultiTrans1D")
id_MultiTrans2D = geompy.addToStudy(MultiTrans2D, "MultiTrans2D")
- id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MultiRot1D")
- id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MultiRot2D")
+ id_MultiRot1Dt = geompy.addToStudy(MultiRot1Dt, "MultiRot1D NbTimes")
+ id_MultiRot1Ds = geompy.addToStudy(MultiRot1Ds, "MultiRot1D ByStep")
+ id_MultiRot2Dt = geompy.addToStudy(MultiRot2Dt, "MultiRot2D NbTimes")
+ id_MultiRot2Ds = geompy.addToStudy(MultiRot2Ds, "MultiRot2D ByStep")
id_CDG = geompy.addToStudy(CDG, "CDG")
id_Archimede = geompy.addToStudy(Archimede, "Archimede")
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
def TestMeasureOperations (geompy, math):
print " Xmin = ", BB[0], ", Xmax = ", BB[1]
print " Ymin = ", BB[2], ", Ymax = ", BB[3]
print " Zmin = ", BB[4], ", Zmax = ", BB[5]
+ BB = geompy.MakeBoundingBox(box)
+ geompy.addToStudy(BB, "BoundingBox")
####### Inertia #######
print "\nMinimal distance between Box and Cube = ", MinDistComps[0]
print "Its components are (", MinDistComps[1], ", ", MinDistComps[2], ", ", MinDistComps[3], ")"
+ # Get all closest points
+ [nbSols, listCoords] = geompy.ClosestPoints(box, cube)
+ for i in range(nbSols):
+ v1 = geompy.MakeVertex(listCoords[i*6 + 0], listCoords[i*6 + 1], listCoords[i*6 + 2])
+ v2 = geompy.MakeVertex(listCoords[i*6 + 3], listCoords[i*6 + 4], listCoords[i*6 + 5])
+
+ geompy.addToStudy(v1, 'MinDist_%d_on_Box'%(i+1))
+ geompy.addToStudy(v2, 'MinDist_%d_on_Cube'%(i+1))
+ pass
+
####### Angle #######
OX = geompy.MakeVectorDXDYDZ(10, 0,0)
# File : GEOM_TestOthers.py
# Author : Julia DOROVSKIKH
# Module : GEOM
-# $Header$
#
# ! Please, if you edit this example file, update also
# ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_others.doc
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
- MultiRot1D = geompy.MakeMultiRotation1D(f12, vy, pz, 6)
- MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
+ MultiRot1Dt = geompy.MakeMultiRotation1DNbTimes(f12, vy, pz, 6)
+ MultiRot1Ds = geompy.MakeMultiRotation1DByStep(f12, vy, pz, math.pi/5., 6)
- id_MultiRot1D = geompy.addToStudy(MultiRot1D, "MakeMultiRotation1D")
- id_MultiRot2D = geompy.addToStudy(MultiRot2D, "MakeMultiRotation2D")
+ MultiRot2Dt = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 5, 30, 3)
+ MultiRot2Ds = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4., 6, 30, 3)
+
+ geompy.addToStudy(MultiRot1Dt, "MakeMultiRotation1DNbTimes")
+ geompy.addToStudy(MultiRot1Ds, "MakeMultiRotation1DByStep")
+ geompy.addToStudy(MultiRot2Dt, "MakeMultiRotation2DNbTimes")
+ geompy.addToStudy(MultiRot2Ds, "MakeMultiRotation2DByStep")
# MakeFilletAll
radius_fillet = 10.
# File : GEOM_blocks.py
# Author : Julia DOROVSKIKH
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_example.py
# Author : Paul RASCLE, EDF
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_example2.py
# Author : Paul RASCLE, EDF
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_example3.py
# Author : Paul RASCLE, EDF
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_example5.py
# Author : Damien COQUERET, Open CASCADE
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_example6.py
# Author : Dmitry MATVEITChEV
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_moteur.py
# Author : Damien COQUERET, Open CASCADE
# Module : GEOM
-# $Header$
#
import salome
import geompy
# File : GEOM_usinggeom.py
# Author : Damien COQUERET, Open CASCADE
# Module : GEOM
-# $Header$
#
import geompy
import math
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# GEOM GEOM_SWIG : binding of C++ omplementaion with Python
+# GEOM GEOM_SWIG : binding of C++ implementaion with Python
# File : batchmode_geompy.py
# Author : Paul RASCLE, EDF
# Module : GEOM
-# $Header$
-# From Salome version 3.2.0 geompy package suits for work in batch mode
+# From Salome version 3.2.0 geompy package suits for work in batch mode
#
from geompy import *
# File : geompy.py
# Author : Paul RASCLE, EDF
# Module : GEOM
-# $Header$
#
import salome
import geompyDC
\brief Module geompy
"""
+##
+## @defgroup l1_publish_data Publishing results in SALOME study
+## @{
+##
+## @details
+##
+## By default, all functions of geompy.py Python interface do not publish
+## resulting geometrical objects. This can be done in the Python script
+## by means of geompy.addToStudy() or geompy.addToStudyInFather()
+## functions.
+##
+## However, it is possible to publish result data in the study
+## automatically. For this, almost each function of geompy.py module has
+## an additional @a theName parameter (@c None by default).
+## As soon as non-empty string value is passed to this parameter,
+## the result object is published in the study automatically.
+##
+## For example,
+##
+## @code
+## box = geompy.MakeBoxDXDYDZ(100, 100, 100) # box is not published in the study yet
+## geompy.addToStudy(box, "box") # explicit publishing
+## @endcode
+##
+## can be replaced by one-line instruction
+##
+## @code
+## box = geompy.MakeBoxDXDYDZ(100, 100, 100, theName="box") # box is published in the study with "box" name
+## @endcode
+##
+## ... or simply
+##
+## @code
+## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "box") # box is published in the study with "box" name
+## @endcode
+##
+## Note, that some functions produce more than one geometrical objects. For example,
+## geompy.GetNonBlocks() function returns two objects: group of all non-hexa solids and group of
+## all non-quad faces. For such functions it is possible to specify separate names for results.
+##
+## For example
+##
+## @code
+## # create and publish cylinder
+## cyl = geompy.MakeCylinderRH(100, 100, "cylinder")
+## # get non blocks from cylinder
+## g1, g2 = geompy.GetNonBlocks(cyl, "nonblock")
+## @endcode
+##
+## Above example will publish both result compounds (first with non-hexa solids and
+## second with non-quad faces) as two items, both named "nonblock".
+## However, if second command is invoked as
+##
+## @code
+## g1, g2 = geompy.GetNonBlocks(cyl, ("nonhexa", "nonquad"))
+## @endcode
+##
+## ... the first compound will be published with "nonhexa" name, and second will be named "nonquad".
+##
+## Automatic publication of all results can be also enabled/disabled by means of the function
+## geompy.addToStudyAuto(). The automatic publishing is managed by the numeric parameter passed
+## to this function:
+## - if @a maxNbSubShapes = 0, automatic publishing is disabled.
+## - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
+## maximum number of sub-shapes allowed for publishing is unlimited; any negative
+## value passed as parameter has the same effect.
+## - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
+## maximum number of sub-shapes allowed for publishing is set to specified value.
+##
+## When automatic publishing is enabled, you even do not need to pass @a theName parameter
+## to the functions creating objects, instead default names will be used. However, you
+## can always change the behavior, by passing explicit name to the @a theName parameter
+## and it will be used instead default one.
+## The publishing of the collections of objects will be done according to the above
+## mentioned rules (maximum allowed number of sub-shapes).
+##
+## For example:
+##
+## @code
+## geompy.addToStudyAuto() # enable automatic publication
+## box = geompy.MakeBoxDXDYDZ(100, 100, 100)
+## # the box is created and published in the study with default name
+## geompy.addToStudyAuto(5) # set max allowed number of sub-shapes to 5
+## vertices = geompy.SubShapeAll(box, geompy.ShapeType['VERTEX'])
+## # only 5 first vertices will be published, with default names
+## print len(vertices)
+## # note, that result value still containes all 8 vertices
+## geompy.addToStudyAuto(-1) # disable automatic publication
+## @endcode
+##
+## This feature can be used, for example, for debugging purposes.
+##
+## @note
+## - Use automatic publication feature with caution. When it is enabled, any function of geompy.py module
+## publishes the results in the study, that can lead to the huge size of the study data tree.
+## For example, repeating call of geompy.SubShapeAll() command on the same main shape each time will
+## publish all child objects, that will lead to a lot of duplicated items in the study.
+## - Sub-shapes are automatically published as child items of the parent main shape in the study if main
+## shape was also published before. Otherwise, sub-shapes are published as top-level objects.
+## - Not that some functions of geompy.py module do not have @theName parameter (and, thus, do not support
+## automatic publication). For example, some transformation operations like geompy.TranslateDXDYDZ().
+## Refer to the documentation to check if some function has such possibility.
+##
+## @}
+
+
## @defgroup l1_geompy_auxiliary Auxiliary data structures and methods
## @defgroup l1_geompy_purpose All package methods, grouped by their purpose
## @defgroup l3_basic_op Basic Operations
## @defgroup l3_boolean Boolean Operations
## @defgroup l3_transform Transformation Operations
+## @defgroup l3_transform_d Transformation Operations deprecated methods
## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
## @defgroup l3_blocks_op Blocks Operations
## @defgroup l3_healing Repairing Operations
# @ingroup l1_geompy_auxiliary
ShapeType = {"AUTO":-1, "COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
+# service function
+def _toListOfNames(_names, _size=-1):
+ l = []
+ import types
+ if type(_names) in [types.ListType, types.TupleType]:
+ for i in _names: l.append(i)
+ elif _names:
+ l.append(_names)
+ if l and len(l) < _size:
+ for i in range(len(l), _size): l.append("%s_%d"%(l[0],i))
+ return l
+
## Raise an Error, containing the Method_name, if Operation is Failed
## @ingroup l1_geompy_auxiliary
def RaiseIfFailed (Method_name, Operation):
def __init__(self):
GEOM._objref_GEOM_Gen.__init__(self)
+ self.myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
self.myBuilder = None
self.myStudyId = 0
self.father = None
self.AdvOp = None
pass
+ ## Process object publication in the study, as follows:
+ # - if @a theName is specified (not None), the object is published in the study
+ # with this name, not taking into account "auto-publishing" option;
+ # - if @a theName is NOT specified, the object is published in the study
+ # (using default name, which can be customized using @a theDefaultName parameter)
+ # only if auto-publishing is switched on.
+ #
+ # @param theObj object, a subject for publishing
+ # @param theName object name for study
+ # @param theDefaultName default name for the auto-publishing
+ #
+ # @sa addToStudyAuto()
+ def _autoPublish(self, theObj, theName, theDefaultName="noname"):
+ # ---
+ def _item_name(_names, _defname, _idx=-1):
+ if not _names: _names = _defname
+ if type(_names) in [types.ListType, types.TupleType]:
+ if _idx >= 0:
+ if _idx >= len(_names) or not _names[_idx]:
+ if type(_defname) not in [types.ListType, types.TupleType]:
+ _name = "%s_%d"%(_defname, _idx+1)
+ elif len(_defname) > 0 and _idx >= 0 and _idx < len(_defname):
+ _name = _defname[_idx]
+ else:
+ _name = "%noname_%d"%(dn, _idx+1)
+ pass
+ else:
+ _name = _names[_idx]
+ pass
+ else:
+ # must be wrong usage
+ _name = _names[0]
+ pass
+ else:
+ if _idx >= 0:
+ _name = "%s_%d"%(_names, _idx+1)
+ else:
+ _name = _names
+ pass
+ return _name
+ # ---
+ if not theObj:
+ return # null object
+ if not theName and not self.myMaxNbSubShapesAllowed:
+ return # nothing to do: auto-publishing is disabled
+ if not theName and not theDefaultName:
+ return # neither theName nor theDefaultName is given
+ import types
+ if type(theObj) in [types.ListType, types.TupleType]:
+ # list of objects is being published
+ idx = 0
+ for obj in theObj:
+ if not obj: continue # bad object
+ ###if obj.GetStudyEntry(): continue # already published
+ name = _item_name(theName, theDefaultName, idx)
+ if obj.IsMainShape() or not obj.GetMainShape().GetStudyEntry():
+ self.addToStudy(obj, name) # "%s_%d"%(aName, idx)
+ else:
+ self.addToStudyInFather(obj.GetMainShape(), obj, name) # "%s_%d"%(aName, idx)
+ pass
+ idx = idx+1
+ if not theName and idx == self.myMaxNbSubShapesAllowed: break
+ pass
+ pass
+ else:
+ # single object is published
+ ###if theObj.GetStudyEntry(): return # already published
+ name = _item_name(theName, theDefaultName)
+ if theObj.IsMainShape():
+ self.addToStudy(theObj, name)
+ else:
+ self.addToStudyInFather(theObj.GetMainShape(), theObj, name)
+ pass
+ pass
+ pass
+
## @addtogroup l1_geompy_auxiliary
## @{
def init_geom(self,theStudy):
self.AdvOp = self.GetIAdvancedOperations (self.myStudyId)
pass
+ ## Enable / disable results auto-publishing
+ #
+ # The automatic publishing is managed in the following way:
+ # - if @a maxNbSubShapes = 0, automatic publishing is disabled.
+ # - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
+ # maximum number of sub-shapes allowed for publishing is unlimited; any negative
+ # value passed as parameter has the same effect.
+ # - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
+ # maximum number of sub-shapes allowed for publishing is set to specified value.
+ #
+ # @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
+ # @ingroup l1_publish_data
+ def addToStudyAuto(self, maxNbSubShapes=-1):
+ """
+ Enable / disable results auto-publishing
+
+ The automatic publishing is managed in the following way:
+ - if @a maxNbSubShapes = 0, automatic publishing is disabled;
+ - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
+ maximum number of sub-shapes allowed for publishing is unlimited; any negative
+ value passed as parameter has the same effect.
+ - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
+ maximum number of sub-shapes allowed for publishing is set to this value.
+
+ Parameters:
+ maxNbSubShapes maximum number of sub-shapes allowed for publishing.
+
+ Example of usage:
+ geompy.addToStudyAuto() # enable auto-publishing
+ geompy.MakeBoxDXDYDZ(100) # box is created and published with default name
+ geompy.addToStudyAuto(0) # disable auto-publishing
+ """
+ self.myMaxNbSubShapesAllowed = max(-1, maxNbSubShapes)
+ pass
+
## Dump component to the Python script
# This method overrides IDL function to allow default values for the parameters.
def DumpPython(self, theStudy, theIsPublished=True, theIsMultiFile=True):
# these arguments description
# \return study entry of the published shape in form of string
#
+ # @ingroup l1_publish_data
# @ref swig_all_addtostudy "Example"
def addToStudy(self, aShape, aName, doRestoreSubShapes=False,
theArgs=[], theFindMethod=GEOM.FSM_GetInPlace, theInheritFirstArg=False):
# \param aName the name for the shape
#
# \return study entry of the published shape in form of string
+ #
+ # @ingroup l1_publish_data
# @ref swig_all_addtostudyInFather "Example"
def addToStudyInFather(self, aFather, aShape, aName):
"""
# @param theX The X coordinate of the point.
# @param theY The Y coordinate of the point.
# @param theZ The Z coordinate of the point.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertex(self, theX, theY, theZ):
+ def MakeVertex(self, theX, theY, theZ, theName=None):
"""
Create point by three coordinates.
theX The X coordinate of the point.
theY The Y coordinate of the point.
theZ The Z coordinate of the point.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
RaiseIfFailed("MakePointXYZ", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point, distant from the referenced point
# @param theX Displacement from the referenced point along OX axis.
# @param theY Displacement from the referenced point along OY axis.
# @param theZ Displacement from the referenced point along OZ axis.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexWithRef(self,theReference, theX, theY, theZ):
+ def MakeVertexWithRef(self, theReference, theX, theY, theZ, theName=None):
"""
Create a point, distant from the referenced point
on the given distances along the coordinate axes.
theX Displacement from the referenced point along OX axis.
theY Displacement from the referenced point along OY axis.
theZ Displacement from the referenced point along OZ axis.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointWithReference(theReference, theX, theY, theZ)
RaiseIfFailed("MakePointWithReference", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurve(self,theRefCurve, theParameter):
+ def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None):
"""
Create a point, corresponding to the given parameter on the given curve.
Parameters:
theRefCurve The referenced curve.
theParameter Value of parameter on the referenced curve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter)
RaiseIfFailed("MakePointOnCurve", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point by projection give coordinates on the given curve
# @param theX X-coordinate in 3D space
# @param theY Y-coordinate in 3D space
# @param theZ Z-coordinate in 3D space
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurveByCoord(self,theRefCurve, theX, theY, theZ):
+ def MakeVertexOnCurveByCoord(self, theRefCurve, theX, theY, theZ, theName=None):
"""
Create a point by projection give coordinates on the given curve
theX X-coordinate in 3D space
theY Y-coordinate in 3D space
theZ Z-coordinate in 3D space
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointOnCurveByCoord(theRefCurve, theX, theY, theZ)
RaiseIfFailed("MakeVertexOnCurveByCoord", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point, corresponding to the given length on the given curve.
# @param theLength Length on the referenced curve. It can be negative.
# @param theStartPoint Point allowing to choose the direction for the calculation
# of the length. If None, start from the first point of theRefCurve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
+ def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
"""
Create a point, corresponding to the given length on the given curve.
theLength Length on the referenced curve. It can be negative.
theStartPoint Point allowing to choose the direction for the calculation
of the length. If None, start from the first point of theRefCurve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point, corresponding to the given parameters on the
# @param theRefSurf The referenced surface.
# @param theUParameter Value of U-parameter on the referenced surface.
# @param theVParameter Value of V-parameter on the referenced surface.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexOnSurface "Example"
- def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter):
+ def MakeVertexOnSurface(self, theRefSurf, theUParameter, theVParameter, theName=None):
"""
Create a point, corresponding to the given parameters on the
given surface.
theRefSurf The referenced surface.
theUParameter Value of U-parameter on the referenced surface.
theVParameter Value of V-parameter on the referenced surface.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointOnSurface(theRefSurf, theUParameter, theVParameter)
RaiseIfFailed("MakePointOnSurface", self.BasicOp)
anObj.SetParameters(Parameters);
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point by projection give coordinates on the given surface
# @param theX X-coordinate in 3D space
# @param theY Y-coordinate in 3D space
# @param theZ Z-coordinate in 3D space
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexOnSurfaceByCoord "Example"
- def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ):
+ def MakeVertexOnSurfaceByCoord(self, theRefSurf, theX, theY, theZ, theName=None):
"""
Create a point by projection give coordinates on the given surface
theX X-coordinate in 3D space
theY Y-coordinate in 3D space
theZ Z-coordinate in 3D space
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
anObj = self.BasicOp.MakePointOnSurfaceByCoord(theRefSurf, theX, theY, theZ)
RaiseIfFailed("MakeVertexOnSurfaceByCoord", self.BasicOp)
anObj.SetParameters(Parameters);
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point, which lays on the given face.
# Such point can be used to uniquely identify the face inside any
# shape in case, when the shape does not contain overlapped faces.
# @param theFace The referenced face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexInsideFace "Example"
- def MakeVertexInsideFace (self, theFace):
+ def MakeVertexInsideFace (self, theFace, theName=None):
"""
Create a point, which lays on the given face.
The point will lay in arbitrary place of the face.
Parameters:
theFace The referenced face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakePointOnFace(theFace)
RaiseIfFailed("MakeVertexInsideFace", self.BasicOp)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a point on intersection of two lines.
# @param theRefLine1, theRefLine2 The referenced lines.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexOnLinesIntersection "Example"
- def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2):
+ def MakeVertexOnLinesIntersection(self, theRefLine1, theRefLine2, theName=None):
"""
Create a point on intersection of two lines.
Parameters:
theRefLine1, theRefLine2 The referenced lines.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakePointOnLinesIntersection(theRefLine1, theRefLine2)
RaiseIfFailed("MakePointOnLinesIntersection", self.BasicOp)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Create a tangent, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created tangent.
#
# @ref swig_MakeTangentOnCurve "Example"
- def MakeTangentOnCurve(self, theRefCurve, theParameter):
+ def MakeTangentOnCurve(self, theRefCurve, theParameter, theName=None):
"""
Create a tangent, corresponding to the given parameter on the given curve.
Parameters:
theRefCurve The referenced curve.
theParameter Value of parameter on the referenced curve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created tangent.
"""
anObj = self.BasicOp.MakeTangentOnCurve(theRefCurve, theParameter)
RaiseIfFailed("MakeTangentOnCurve", self.BasicOp)
+ self._autoPublish(anObj, theName, "tangent")
return anObj
## Create a tangent plane, corresponding to the given parameter on the given face.
# @param theParameterV vertical value of the center point (0.0 - 1.0).
# @param theParameterU horisontal value of the center point (0.0 - 1.0).
# @param theTrimSize the size of plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created tangent.
#
# @ref swig_MakeTangentPlaneOnFace "Example"
- def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize):
+ def MakeTangentPlaneOnFace(self, theFace, theParameterU, theParameterV, theTrimSize, theName=None):
"""
Create a tangent plane, corresponding to the given parameter on the given face.
theParameterV vertical value of the center point (0.0 - 1.0).
theParameterU horisontal value of the center point (0.0 - 1.0).
theTrimSize the size of plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created tangent.
"""
anObj = self.BasicOp.MakeTangentPlaneOnFace(theFace, theParameterU, theParameterV, theTrimSize)
RaiseIfFailed("MakeTangentPlaneOnFace", self.BasicOp)
+ self._autoPublish(anObj, theName, "tangent")
return anObj
## Create a vector with the given components.
# @param theDX X component of the vector.
# @param theDY Y component of the vector.
# @param theDZ Z component of the vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vector.
#
# @ref tui_creation_vector "Example"
- def MakeVectorDXDYDZ(self,theDX, theDY, theDZ):
+ def MakeVectorDXDYDZ(self, theDX, theDY, theDZ, theName=None):
"""
Create a vector with the given components.
theDX X component of the vector.
theDY Y component of the vector.
theDZ Z component of the vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vector.
anObj = self.BasicOp.MakeVectorDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeVectorDXDYDZ", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "vector")
return anObj
## Create a vector between two points.
# @param thePnt1 Start point for the vector.
# @param thePnt2 End point for the vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vector.
#
# @ref tui_creation_vector "Example"
- def MakeVector(self,thePnt1, thePnt2):
+ def MakeVector(self, thePnt1, thePnt2, theName=None):
"""
Create a vector between two points.
Parameters:
thePnt1 Start point for the vector.
thePnt2 End point for the vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vector.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakeVectorTwoPnt(thePnt1, thePnt2)
RaiseIfFailed("MakeVectorTwoPnt", self.BasicOp)
+ self._autoPublish(anObj, theName, "vector")
return anObj
## Create a line, passing through the given point
# and parrallel to the given direction
# @param thePnt Point. The resulting line will pass through it.
# @param theDir Direction. The resulting line will be parallel to it.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created line.
#
# @ref tui_creation_line "Example"
- def MakeLine(self,thePnt, theDir):
+ def MakeLine(self, thePnt, theDir, theName=None):
"""
Create a line, passing through the given point
and parrallel to the given direction
Parameters:
thePnt Point. The resulting line will pass through it.
theDir Direction. The resulting line will be parallel to it.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created line.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakeLine(thePnt, theDir)
RaiseIfFailed("MakeLine", self.BasicOp)
+ self._autoPublish(anObj, theName, "line")
return anObj
## Create a line, passing through the given points
# @param thePnt1 First of two points, defining the line.
# @param thePnt2 Second of two points, defining the line.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created line.
#
# @ref tui_creation_line "Example"
- def MakeLineTwoPnt(self,thePnt1, thePnt2):
+ def MakeLineTwoPnt(self, thePnt1, thePnt2, theName=None):
"""
Create a line, passing through the given points
Parameters:
thePnt1 First of two points, defining the line.
thePnt2 Second of two points, defining the line.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created line.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakeLineTwoPnt(thePnt1, thePnt2)
RaiseIfFailed("MakeLineTwoPnt", self.BasicOp)
+ self._autoPublish(anObj, theName, "line")
return anObj
## Create a line on two faces intersection.
# @param theFace1 First of two faces, defining the line.
# @param theFace2 Second of two faces, defining the line.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created line.
#
# @ref swig_MakeLineTwoFaces "Example"
- def MakeLineTwoFaces(self, theFace1, theFace2):
+ def MakeLineTwoFaces(self, theFace1, theFace2, theName=None):
"""
Create a line on two faces intersection.
Parameters:
theFace1 First of two faces, defining the line.
theFace2 Second of two faces, defining the line.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created line.
# Example: see GEOM_TestAll.py
anObj = self.BasicOp.MakeLineTwoFaces(theFace1, theFace2)
RaiseIfFailed("MakeLineTwoFaces", self.BasicOp)
+ self._autoPublish(anObj, theName, "line")
return anObj
## Create a plane, passing through the given point
# @param thePnt Point, the plane has to pass through.
# @param theVec Vector, defining the plane normal direction.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
- def MakePlane(self,thePnt, theVec, theTrimSize):
+ def MakePlane(self, thePnt, theVec, theTrimSize, theName=None):
"""
Create a plane, passing through the given point
and normal to the given vector.
thePnt Point, the plane has to pass through.
theVec Vector, defining the plane normal direction.
theTrimSize Half size of a side of quadrangle face, representing the plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created plane.
anObj = self.BasicOp.MakePlanePntVec(thePnt, theVec, theTrimSize)
RaiseIfFailed("MakePlanePntVec", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "plane")
return anObj
## Create a plane, passing through the three given points
# @param thePnt2 Second of three points, defining the plane.
# @param thePnt3 Fird of three points, defining the plane.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
- def MakePlaneThreePnt(self,thePnt1, thePnt2, thePnt3, theTrimSize):
+ def MakePlaneThreePnt(self, thePnt1, thePnt2, thePnt3, theTrimSize, theName=None):
"""
Create a plane, passing through the three given points
thePnt2 Second of three points, defining the plane.
thePnt3 Fird of three points, defining the plane.
theTrimSize Half size of a side of quadrangle face, representing the plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created plane.
anObj = self.BasicOp.MakePlaneThreePnt(thePnt1, thePnt2, thePnt3, theTrimSize)
RaiseIfFailed("MakePlaneThreePnt", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "plane")
return anObj
## Create a plane, similar to the existing one, but with another size of representing face.
# @param theFace Referenced plane or LCS(Marker).
# @param theTrimSize New half size of a side of quadrangle face, representing the plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
- def MakePlaneFace(self,theFace, theTrimSize):
+ def MakePlaneFace(self, theFace, theTrimSize, theName=None):
"""
Create a plane, similar to the existing one, but with another size of representing face.
Parameters:
theFace Referenced plane or LCS(Marker).
theTrimSize New half size of a side of quadrangle face, representing the plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created plane.
anObj = self.BasicOp.MakePlaneFace(theFace, theTrimSize)
RaiseIfFailed("MakePlaneFace", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "plane")
return anObj
## Create a plane, passing through the 2 vectors
# @param theVec1 Vector, defining center point and plane direction.
# @param theVec2 Vector, defining the plane normal direction.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
- def MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
+ def MakePlane2Vec(self, theVec1, theVec2, theTrimSize, theName=None):
"""
Create a plane, passing through the 2 vectors
with center in a start point of the first vector.
theVec1 Vector, defining center point and plane direction.
theVec2 Vector, defining the plane normal direction.
theTrimSize Half size of a side of quadrangle face, representing the plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created plane.
anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
RaiseIfFailed("MakePlane2Vec", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "plane")
return anObj
## Create a plane, based on a Local coordinate system.
# @param theLCS coordinate system, defining plane.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
# @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
- def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
+ def MakePlaneLCS(self, theLCS, theTrimSize, theOrientation, theName=None):
"""
Create a plane, based on a Local coordinate system.
theLCS coordinate system, defining plane.
theTrimSize Half size of a side of quadrangle face, representing the plane.
theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created plane.
anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
RaiseIfFailed("MakePlaneLCS", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "plane")
return anObj
## Create a local coordinate system.
# @param OX,OY,OZ Three coordinates of coordinate system origin.
# @param XDX,XDY,XDZ Three components of OX direction
# @param YDX,YDY,YDZ Three components of OY direction
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created coordinate system.
#
# @ref swig_MakeMarker "Example"
- def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
+ def MakeMarker(self, OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ, theName=None):
"""
Create a local coordinate system.
OX,OY,OZ Three coordinates of coordinate system origin.
XDX,XDY,XDZ Three components of OX direction
YDX,YDY,YDZ Three components of OY direction
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
anObj = self.BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
RaiseIfFailed("MakeMarker", self.BasicOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "lcs")
return anObj
## Create a local coordinate system from shape.
# @param theShape The initial shape to detect the coordinate system.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created coordinate system.
#
# @ref tui_creation_lcs "Example"
- def MakeMarkerFromShape(self, theShape):
+ def MakeMarkerFromShape(self, theShape, theName=None):
"""
Create a local coordinate system from shape.
Parameters:
theShape The initial shape to detect the coordinate system.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
"""
anObj = self.BasicOp.MakeMarkerFromShape(theShape)
RaiseIfFailed("MakeMarkerFromShape", self.BasicOp)
+ self._autoPublish(anObj, theName, "lcs")
return anObj
## Create a local coordinate system from point and two vectors.
# @param theOrigin Point of coordinate system origin.
# @param theXVec Vector of X direction
# @param theYVec Vector of Y direction
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created coordinate system.
#
# @ref tui_creation_lcs "Example"
- def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec):
+ def MakeMarkerPntTwoVec(self, theOrigin, theXVec, theYVec, theName=None):
"""
Create a local coordinate system from point and two vectors.
theOrigin Point of coordinate system origin.
theXVec Vector of X direction
theYVec Vector of Y direction
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created coordinate system.
"""
anObj = self.BasicOp.MakeMarkerPntTwoVec(theOrigin, theXVec, theYVec)
RaiseIfFailed("MakeMarkerPntTwoVec", self.BasicOp)
+ self._autoPublish(anObj, theName, "lcs")
return anObj
# end of l3_basic_go
# @param thePnt1 Start point of the arc.
# @param thePnt2 Middle point of the arc.
# @param thePnt3 End point of the arc.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created arc.
#
# @ref swig_MakeArc "Example"
- def MakeArc(self,thePnt1, thePnt2, thePnt3):
+ def MakeArc(self, thePnt1, thePnt2, thePnt3, theName=None):
"""
Create an arc of circle, passing through three given points.
thePnt1 Start point of the arc.
thePnt2 Middle point of the arc.
thePnt3 End point of the arc.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created arc.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeArc(thePnt1, thePnt2, thePnt3)
RaiseIfFailed("MakeArc", self.CurvesOp)
+ self._autoPublish(anObj, theName, "arc")
return anObj
## Create an arc of circle from a center and 2 points.
# @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
# @param thePnt3 End point of the arc (Gives also a direction)
# @param theSense Orientation of the arc
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created arc.
#
# @ref swig_MakeArc "Example"
- def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False):
+ def MakeArcCenter(self, thePnt1, thePnt2, thePnt3, theSense=False, theName=None):
"""
Create an arc of circle from a center and 2 points.
thePnt2 Start point of the arc. (Gives also the radius of the arc)
thePnt3 End point of the arc (Gives also a direction)
theSense Orientation of the arc
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created arc.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
RaiseIfFailed("MakeArcCenter", self.CurvesOp)
+ self._autoPublish(anObj, theName, "arc")
return anObj
## Create an arc of ellipse, of center and two points.
# @param theCenter Center of the arc.
# @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
# @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created arc.
#
# @ref swig_MakeArc "Example"
- def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
+ def MakeArcOfEllipse(self, theCenter, thePnt1, thePnt2, theName=None):
"""
Create an arc of ellipse, of center and two points.
theCenter Center of the arc.
thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created arc.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
+ self._autoPublish(anObj, theName, "arc")
return anObj
## Create a circle with given center, normal vector and radius.
# @param thePnt Circle center.
# @param theVec Vector, normal to the plane of the circle.
# @param theR Circle radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created circle.
#
# @ref tui_creation_circle "Example"
- def MakeCircle(self, thePnt, theVec, theR):
+ def MakeCircle(self, thePnt, theVec, theR, theName=None):
"""
Create a circle with given center, normal vector and radius.
thePnt Circle center.
theVec Vector, normal to the plane of the circle.
theR Circle radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created circle.
anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "circle")
return anObj
## Create a circle with given radius.
# Center of the circle will be in the origin of global
# coordinate system and normal vector will be codirected with Z axis
# @param theR Circle radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created circle.
- def MakeCircleR(self, theR):
+ def MakeCircleR(self, theR, theName=None):
"""
Create a circle with given radius.
Center of the circle will be in the origin of global
Parameters:
theR Circle radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created circle.
"""
anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
+ self._autoPublish(anObj, theName, "circle")
return anObj
## Create a circle, passing through three given points
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created circle.
#
# @ref tui_creation_circle "Example"
- def MakeCircleThreePnt(self,thePnt1, thePnt2, thePnt3):
+ def MakeCircleThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
"""
Create a circle, passing through three given points
Parameters:
thePnt1,thePnt2,thePnt3 Points, defining the circle.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created circle.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeCircleThreePnt(thePnt1, thePnt2, thePnt3)
RaiseIfFailed("MakeCircleThreePnt", self.CurvesOp)
+ self._autoPublish(anObj, theName, "circle")
return anObj
## Create a circle, with given point1 as center,
# passing through the point2 as radius and laying in the plane,
# defined by all three given points.
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created circle.
#
# @ref swig_MakeCircle "Example"
- def MakeCircleCenter2Pnt(self,thePnt1, thePnt2, thePnt3):
+ def MakeCircleCenter2Pnt(self, thePnt1, thePnt2, thePnt3, theName=None):
"""
Create a circle, with given point1 as center,
passing through the point2 as radius and laying in the plane,
Parameters:
thePnt1,thePnt2,thePnt3 Points, defining the circle.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created circle.
# Example: see GEOM_example6.py
anObj = self.CurvesOp.MakeCircleCenter2Pnt(thePnt1, thePnt2, thePnt3)
RaiseIfFailed("MakeCircleCenter2Pnt", self.CurvesOp)
+ self._autoPublish(anObj, theName, "circle")
return anObj
## Create an ellipse with given center, normal vector and radiuses.
# @param theRMajor Major ellipse radius.
# @param theRMinor Minor ellipse radius.
# @param theVecMaj Vector, direction of the ellipse's main axis.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created ellipse.
#
# @ref tui_creation_ellipse "Example"
- def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None):
+ def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor, theVecMaj=None, theName=None):
"""
Create an ellipse with given center, normal vector and radiuses.
theRMajor Major ellipse radius.
theRMinor Minor ellipse radius.
theVecMaj Vector, direction of the ellipse's main axis.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created ellipse.
pass
RaiseIfFailed("MakeEllipse", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "ellipse")
return anObj
## Create an ellipse with given radiuses.
# coordinate system and normal vector will be codirected with Z axis
# @param theRMajor Major ellipse radius.
# @param theRMinor Minor ellipse radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created ellipse.
- def MakeEllipseRR(self, theRMajor, theRMinor):
+ def MakeEllipseRR(self, theRMajor, theRMinor, theName=None):
"""
Create an ellipse with given radiuses.
Center of the ellipse will be in the origin of global
Parameters:
theRMajor Major ellipse radius.
theRMinor Minor ellipse radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
- New GEOM.GEOM_Object, containing the created ellipse.
+ New GEOM.GEOM_Object, containing the created ellipse.
"""
anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
RaiseIfFailed("MakeEllipse", self.CurvesOp)
+ self._autoPublish(anObj, theName, "ellipse")
return anObj
## Create a polyline on the set of points.
# @param thePoints Sequence of points for the polyline.
# @param theIsClosed If True, build a closed wire.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created polyline.
#
# @ref tui_creation_curve "Example"
- def MakePolyline(self, thePoints, theIsClosed=False):
+ def MakePolyline(self, thePoints, theIsClosed=False, theName=None):
"""
Create a polyline on the set of points.
Parameters:
thePoints Sequence of points for the polyline.
theIsClosed If True, build a closed wire.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created polyline.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakePolyline(thePoints, theIsClosed)
RaiseIfFailed("MakePolyline", self.CurvesOp)
+ self._autoPublish(anObj, theName, "polyline")
return anObj
## Create bezier curve on the set of points.
# @param thePoints Sequence of points for the bezier curve.
# @param theIsClosed If True, build a closed curve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created bezier curve.
#
# @ref tui_creation_curve "Example"
- def MakeBezier(self, thePoints, theIsClosed=False):
+ def MakeBezier(self, thePoints, theIsClosed=False, theName=None):
"""
Create bezier curve on the set of points.
Parameters:
thePoints Sequence of points for the bezier curve.
theIsClosed If True, build a closed curve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created bezier curve.
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeSplineBezier(thePoints, theIsClosed)
RaiseIfFailed("MakeSplineBezier", self.CurvesOp)
+ self._autoPublish(anObj, theName, "bezier")
return anObj
## Create B-Spline curve on the set of points.
# @param theIsClosed If True, build a closed curve.
# @param theDoReordering If TRUE, the algo does not follow the order of
# \a thePoints but searches for the closest vertex.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created B-Spline curve.
#
# @ref tui_creation_curve "Example"
- def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False):
+ def MakeInterpol(self, thePoints, theIsClosed=False, theDoReordering=False, theName=None):
"""
Create B-Spline curve on the set of points.
theIsClosed If True, build a closed curve.
theDoReordering If True, the algo does not follow the order of
thePoints but searches for the closest vertex.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created B-Spline curve.
"""
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeSplineInterpolation(thePoints, theIsClosed, theDoReordering)
- RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+ RaiseIfFailed("MakeInterpol", self.CurvesOp)
+ self._autoPublish(anObj, theName, "bspline")
return anObj
+ ## Create B-Spline curve on the set of points.
+ # @param thePoints Sequence of points for the B-Spline curve.
+ # @param theFirstVec Vector object, defining the curve direction at its first point.
+ # @param theLastVec Vector object, defining the curve direction at its last point.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the created B-Spline curve.
+ #
+ # @ref tui_creation_curve "Example"
+ def MakeInterpolWithTangents(self, thePoints, theFirstVec, theLastVec, theName=None):
+ """
+ Create B-Spline curve on the set of points.
+
+ Parameters:
+ thePoints Sequence of points for the B-Spline curve.
+ theFirstVec Vector object, defining the curve direction at its first point.
+ theLastVec Vector object, defining the curve direction at its last point.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created B-Spline curve.
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.CurvesOp.MakeSplineInterpolWithTangents(thePoints, theFirstVec, theLastVec)
+ RaiseIfFailed("MakeInterpolWithTangents", self.CurvesOp)
+ self._autoPublish(anObj, theName, "bspline")
+ return anObj
## Creates a curve using the parametric definition of the basic points.
# @param thexExpr parametric equation of the coordinates X.
# @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
# @param theCurveType the type of the curve.
# @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created curve.
#
# @ref tui_creation_curve "Example"
def MakeCurveParametric(self, thexExpr, theyExpr, thezExpr,
- theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False ):
+ theParamMin, theParamMax, theParamStep, theCurveType, theNewMethod=False, theName=None ):
"""
Creates a curve using the parametric definition of the basic points.
theCurveType the type of the curve.
theNewMethod flag for switching to the new method if the flag is set to false a deprecated
method is used which can lead to a bug.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created curve.
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "curve")
return anObj
-
-
# end of l4_curves
## @}
# coordinates of the working plane.
# @param theWorkingPlane Nine double values, defining origin,
# OZ and OX directions of the working plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created wire.
#
# @ref tui_sketcher_page "Example"
- def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0]):
+ def MakeSketcher(self, theCommand, theWorkingPlane = [0,0,0, 0,0,1, 1,0,0], theName=None):
"""
Create a sketcher (wire or face), following the textual description, passed
through theCommand argument.
coordinates of the working plane.
theWorkingPlane Nine double values, defining origin,
OZ and OX directions of the working plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created wire.
anObj = self.CurvesOp.MakeSketcher(theCommand, theWorkingPlane)
RaiseIfFailed("MakeSketcher", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "wire")
return anObj
## Create a sketcher (wire or face), following the textual description,
# @param theCommand String, defining the sketcher in local
# coordinates of the working plane.
# @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created wire.
#
# @ref tui_sketcher_page "Example"
- def MakeSketcherOnPlane(self, theCommand, theWorkingPlane):
+ def MakeSketcherOnPlane(self, theCommand, theWorkingPlane, theName=None):
"""
Create a sketcher (wire or face), following the textual description,
passed through theCommand argument.
theCommand String, defining the sketcher in local
coordinates of the working plane.
theWorkingPlane Planar Face or LCS(Marker) of the working plane.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created wire.
anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "wire")
return anObj
## Create a sketcher wire, following the numerical description,
# passed through <VAR>theCoordinates</VAR> argument. \n
# @param theCoordinates double values, defining points to create a wire,
# passing from it.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created wire.
#
# @ref tui_3dsketcher_page "Example"
- def Make3DSketcher(self, theCoordinates):
+ def Make3DSketcher(self, theCoordinates, theName=None):
"""
Create a sketcher wire, following the numerical description,
passed through theCoordinates argument.
Parameters:
theCoordinates double values, defining points to create a wire,
passing from it.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing the created wire.
anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
RaiseIfFailed("Make3DSketcher", self.CurvesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "wire")
return anObj
## Obtain a 3D sketcher interface
#
# @param x1,y1,z1 double values, defining first point it.
# @param x2,y2,z2 double values, defining first point it.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created box.
+ #
# @ref tui_creation_box "Example"
- def MakeBox (self, x1,y1,z1, x2,y2,z2):
+ def MakeBox(self, x1, y1, z1, x2, y2, z2, theName=None):
"""
Create a box by coordinates of two opposite vertices.
Parameters:
x1,y1,z1 double values, defining first point.
x2,y2,z2 double values, defining second point.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created box.
# Example: see GEOM_TestAll.py
pnt1 = self.MakeVertex(x1,y1,z1)
pnt2 = self.MakeVertex(x2,y2,z2)
- return self.MakeBoxTwoPnt(pnt1,pnt2)
+ # note: auto-publishing is done in self.MakeBoxTwoPnt()
+ return self.MakeBoxTwoPnt(pnt1, pnt2, theName)
## Create a box with specified dimensions along the coordinate axes
# and with edges, parallel to the coordinate axes.
# @param theDX Length of Box edges, parallel to OX axis.
# @param theDY Length of Box edges, parallel to OY axis.
# @param theDZ Length of Box edges, parallel to OZ axis.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created box.
#
# @ref tui_creation_box "Example"
- def MakeBoxDXDYDZ(self,theDX, theDY, theDZ):
+ def MakeBoxDXDYDZ(self, theDX, theDY, theDZ, theName=None):
"""
Create a box with specified dimensions along the coordinate axes
and with edges, parallel to the coordinate axes.
theDX Length of Box edges, parallel to OX axis.
theDY Length of Box edges, parallel to OY axis.
theDZ Length of Box edges, parallel to OZ axis.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created box.
anObj = self.PrimOp.MakeBoxDXDYDZ(theDX, theDY, theDZ)
RaiseIfFailed("MakeBoxDXDYDZ", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "box")
return anObj
## Create a box with two specified opposite vertices,
# and with edges, parallel to the coordinate axes
# @param thePnt1 First of two opposite vertices.
# @param thePnt2 Second of two opposite vertices.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created box.
#
# @ref tui_creation_box "Example"
- def MakeBoxTwoPnt(self,thePnt1, thePnt2):
+ def MakeBoxTwoPnt(self, thePnt1, thePnt2, theName=None):
"""
Create a box with two specified opposite vertices,
and with edges, parallel to the coordinate axes
Parameters:
thePnt1 First of two opposite vertices.
thePnt2 Second of two opposite vertices.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created box.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakeBoxTwoPnt(thePnt1, thePnt2)
RaiseIfFailed("MakeBoxTwoPnt", self.PrimOp)
+ self._autoPublish(anObj, theName, "box")
return anObj
## Create a face with specified dimensions with edges parallel to coordinate axes.
# @param theH height of Face.
# @param theW width of Face.
# @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
- def MakeFaceHW(self,theH, theW, theOrientation):
+ def MakeFaceHW(self, theH, theW, theOrientation, theName=None):
"""
Create a face with specified dimensions with edges parallel to coordinate axes.
theH height of Face.
theW width of Face.
theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
anObj = self.PrimOp.MakeFaceHW(theH, theW, theOrientation)
RaiseIfFailed("MakeFaceHW", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "rectangle")
return anObj
## Create a face from another plane and two sizes,
# the face object.
# @param theH Height (vertical size).
# @param theW Width (horisontal size).
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
- def MakeFaceObjHW(self, theObj, theH, theW):
+ def MakeFaceObjHW(self, theObj, theH, theW, theName=None):
"""
Create a face from another plane and two sizes,
vertical size and horisontal size.
the face object.
theH Height (vertical size).
theW Width (horisontal size).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing the created face.
anObj = self.PrimOp.MakeFaceObjHW(theObj, theH, theW)
RaiseIfFailed("MakeFaceObjHW", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "rectangle")
return anObj
## Create a disk with given center, normal vector and radius.
# @param thePnt Disk center.
# @param theVec Vector, normal to the plane of the disk.
# @param theR Disk radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created disk.
#
# @ref tui_creation_disk "Example"
- def MakeDiskPntVecR(self,thePnt, theVec, theR):
+ def MakeDiskPntVecR(self, thePnt, theVec, theR, theName=None):
"""
Create a disk with given center, normal vector and radius.
thePnt Disk center.
theVec Vector, normal to the plane of the disk.
theR Disk radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created disk.
anObj = self.PrimOp.MakeDiskPntVecR(thePnt, theVec, theR)
RaiseIfFailed("MakeDiskPntVecR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "disk")
return anObj
## Create a disk, passing through three given points
# @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created disk.
#
# @ref tui_creation_disk "Example"
- def MakeDiskThreePnt(self,thePnt1, thePnt2, thePnt3):
+ def MakeDiskThreePnt(self, thePnt1, thePnt2, thePnt3, theName=None):
"""
Create a disk, passing through three given points
Parameters:
thePnt1,thePnt2,thePnt3 Points, defining the disk.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created disk.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakeDiskThreePnt(thePnt1, thePnt2, thePnt3)
RaiseIfFailed("MakeDiskThreePnt", self.PrimOp)
+ self._autoPublish(anObj, theName, "disk")
return anObj
## Create a disk with specified dimensions along OX-OY coordinate axes.
# @param theR Radius of Face.
# @param theOrientation set the orientation belong axis OXY or OYZ or OZX
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created disk.
#
# @ref tui_creation_face "Example"
- def MakeDiskR(self,theR, theOrientation):
+ def MakeDiskR(self, theR, theOrientation, theName=None):
"""
Create a disk with specified dimensions along OX-OY coordinate axes.
Parameters:
theR Radius of Face.
theOrientation set the orientation belong axis OXY or OYZ or OZX
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created disk.
anObj = self.PrimOp.MakeDiskR(theR, theOrientation)
RaiseIfFailed("MakeDiskR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "disk")
return anObj
## Create a cylinder with given base point, axis, radius and height.
# @param theAxis Cylinder axis.
# @param theR Cylinder radius.
# @param theH Cylinder height.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created cylinder.
#
# @ref tui_creation_cylinder "Example"
- def MakeCylinder(self,thePnt, theAxis, theR, theH):
+ def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
"""
Create a cylinder with given base point, axis, radius and height.
theAxis Cylinder axis.
theR Cylinder radius.
theH Cylinder height.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created cylinder.
anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cylinder")
return anObj
## Create a cylinder with given radius and height at
# will be collinear to the OZ axis of the coordinate system.
# @param theR Cylinder radius.
# @param theH Cylinder height.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created cylinder.
#
# @ref tui_creation_cylinder "Example"
- def MakeCylinderRH(self,theR, theH):
+ def MakeCylinderRH(self, theR, theH, theName=None):
"""
Create a cylinder with given radius and height at
the origin of coordinate system. Axis of the cylinder
Parameters:
theR Cylinder radius.
theH Cylinder height.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created cylinder.
anObj = self.PrimOp.MakeCylinderRH(theR, theH)
RaiseIfFailed("MakeCylinderRH", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cylinder")
return anObj
## Create a sphere with given center and radius.
# @param thePnt Sphere center.
# @param theR Sphere radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created sphere.
#
# @ref tui_creation_sphere "Example"
- def MakeSpherePntR(self, thePnt, theR):
+ def MakeSpherePntR(self, thePnt, theR, theName=None):
"""
Create a sphere with given center and radius.
Parameters:
thePnt Sphere center.
theR Sphere radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created sphere.
anObj = self.PrimOp.MakeSpherePntR(thePnt, theR)
RaiseIfFailed("MakeSpherePntR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "sphere")
return anObj
## Create a sphere with given center and radius.
# @param x,y,z Coordinates of sphere center.
# @param theR Sphere radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created sphere.
#
# @ref tui_creation_sphere "Example"
- def MakeSphere(self, x, y, z, theR):
+ def MakeSphere(self, x, y, z, theR, theName=None):
"""
Create a sphere with given center and radius.
Parameters:
x,y,z Coordinates of sphere center.
theR Sphere radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created sphere.
"""
# Example: see GEOM_TestAll.py
point = self.MakeVertex(x, y, z)
- anObj = self.MakeSpherePntR(point, theR)
+ # note: auto-publishing is done in self.MakeSpherePntR()
+ anObj = self.MakeSpherePntR(point, theR, theName)
return anObj
## Create a sphere with given radius at the origin of coordinate system.
# @param theR Sphere radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created sphere.
#
# @ref tui_creation_sphere "Example"
- def MakeSphereR(self, theR):
+ def MakeSphereR(self, theR, theName=None):
"""
Create a sphere with given radius at the origin of coordinate system.
Parameters:
theR Sphere radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created sphere.
anObj = self.PrimOp.MakeSphereR(theR)
RaiseIfFailed("MakeSphereR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "sphere")
return anObj
## Create a cone with given base point, axis, height and radiuses.
# \note If both radiuses are non-zero, the cone will be truncated.
# \note If the radiuses are equal, a cylinder will be created instead.
# @param theH Cone height.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created cone.
#
# @ref tui_creation_cone "Example"
- def MakeCone(self,thePnt, theAxis, theR1, theR2, theH):
+ def MakeCone(self, thePnt, theAxis, theR1, theR2, theH, theName=None):
"""
Create a cone with given base point, axis, height and radiuses.
theR1 Radius of the first cone base.
theR2 Radius of the second cone base.
theH Cone height.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
If both radiuses are non-zero, the cone will be truncated.
anObj = self.PrimOp.MakeConePntVecR1R2H(thePnt, theAxis, theR1, theR2, theH)
RaiseIfFailed("MakeConePntVecR1R2H", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cone")
return anObj
## Create a cone with given height and radiuses at
# \note If both radiuses are non-zero, the cone will be truncated.
# \note If the radiuses are equal, a cylinder will be created instead.
# @param theH Cone height.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created cone.
#
# @ref tui_creation_cone "Example"
- def MakeConeR1R2H(self,theR1, theR2, theH):
+ def MakeConeR1R2H(self, theR1, theR2, theH, theName=None):
"""
Create a cone with given height and radiuses at
the origin of coordinate system. Axis of the cone will
theR1 Radius of the first cone base.
theR2 Radius of the second cone base.
theH Cone height.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
If both radiuses are non-zero, the cone will be truncated.
anObj = self.PrimOp.MakeConeR1R2H(theR1, theR2, theH)
RaiseIfFailed("MakeConeR1R2H", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "cone")
return anObj
## Create a torus with given center, normal vector and radiuses.
# @param theVec Torus axis of symmetry.
# @param theRMajor Torus major radius.
# @param theRMinor Torus minor radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created torus.
#
# @ref tui_creation_torus "Example"
- def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor):
+ def MakeTorus(self, thePnt, theVec, theRMajor, theRMinor, theName=None):
"""
Create a torus with given center, normal vector and radiuses.
theVec Torus axis of symmetry.
theRMajor Torus major radius.
theRMinor Torus minor radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created torus.
anObj = self.PrimOp.MakeTorusPntVecRR(thePnt, theVec, theRMajor, theRMinor)
RaiseIfFailed("MakeTorusPntVecRR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "torus")
return anObj
## Create a torus with given radiuses at the origin of coordinate system.
# @param theRMajor Torus major radius.
# @param theRMinor Torus minor radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created torus.
#
# @ref tui_creation_torus "Example"
- def MakeTorusRR(self, theRMajor, theRMinor):
+ def MakeTorusRR(self, theRMajor, theRMinor, theName=None):
"""
Create a torus with given radiuses at the origin of coordinate system.
Parameters:
theRMajor Torus major radius.
theRMinor Torus minor radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created torus.
anObj = self.PrimOp.MakeTorusRR(theRMajor, theRMinor)
RaiseIfFailed("MakeTorusRR", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "torus")
return anObj
# end of l3_3d_primitives
# @param thePoint2 Second end of extrusion vector.
# @param theScaleFactor Use it to make prism with scaled second base.
# Nagative value means not scaled second base.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0):
+ def MakePrism(self, theBase, thePoint1, thePoint2, theScaleFactor = -1.0, theName=None):
"""
Create a shape by extrusion of the base shape along a vector, defined by two points.
thePoint2 Second end of extrusion vector.
theScaleFactor Use it to make prism with scaled second base.
Nagative value means not scaled second base.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
anObj = self.PrimOp.MakePrismTwoPnt(theBase, thePoint1, thePoint2)
RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by extrusion of the base shape along a
# @param theBase Base shape to be extruded.
# @param thePoint1 First end of extrusion vector.
# @param thePoint2 Second end of extrusion vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrism2Ways(self, theBase, thePoint1, thePoint2):
+ def MakePrism2Ways(self, theBase, thePoint1, thePoint2, theName=None):
"""
Create a shape by extrusion of the base shape along a
vector, defined by two points, in 2 Ways (forward/backward).
theBase Base shape to be extruded.
thePoint1 First end of extrusion vector.
thePoint2 Second end of extrusion vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakePrismTwoPnt2Ways(theBase, thePoint1, thePoint2)
RaiseIfFailed("MakePrismTwoPnt", self.PrimOp)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by extrusion of the base shape along the vector,
# @param theH Prism dimension along theVec.
# @param theScaleFactor Use it to make prism with scaled second base.
# Negative value means not scaled second base.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0):
+ def MakePrismVecH(self, theBase, theVec, theH, theScaleFactor = -1.0, theName=None):
"""
Create a shape by extrusion of the base shape along the vector,
i.e. all the space, transfixed by the base shape during its translation
theH Prism dimension along theVec.
theScaleFactor Use it to make prism with scaled second base.
Negative value means not scaled second base.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
anObj = self.PrimOp.MakePrismVecH(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by extrusion of the base shape along the vector,
# @param theBase Base shape to be extruded.
# @param theVec Direction of extrusion.
# @param theH Prism dimension along theVec in forward direction.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismVecH2Ways(self, theBase, theVec, theH):
+ def MakePrismVecH2Ways(self, theBase, theVec, theH, theName=None):
"""
Create a shape by extrusion of the base shape along the vector,
i.e. all the space, transfixed by the base shape during its translation
theBase Base shape to be extruded.
theVec Direction of extrusion.
theH Prism dimension along theVec in forward direction.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
anObj = self.PrimOp.MakePrismVecH2Ways(theBase, theVec, theH)
RaiseIfFailed("MakePrismVecH2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# @param theDX, theDY, theDZ Directions of extrusion.
# @param theScaleFactor Use it to make prism with scaled second base.
# Nagative value means not scaled second base.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0):
+ def MakePrismDXDYDZ(self, theBase, theDX, theDY, theDZ, theScaleFactor = -1.0, theName=None):
"""
Create a shape by extrusion of the base shape along the dx, dy, dz direction
theDX, theDY, theDZ Directions of extrusion.
theScaleFactor Use it to make prism with scaled second base.
Nagative value means not scaled second base.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
anObj = self.PrimOp.MakePrismDXDYDZ(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
# along the vector on the given distance in 2 Ways (forward/backward).
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
- def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ):
+ def MakePrismDXDYDZ2Ways(self, theBase, theDX, theDY, theDZ, theName=None):
"""
Create a shape by extrusion of the base shape along the dx, dy, dz direction
i.e. all the space, transfixed by the base shape during its translation
Parameters:
theBase Base shape to be extruded.
theDX, theDY, theDZ Directions of extrusion.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created prism.
anObj = self.PrimOp.MakePrismDXDYDZ2Ways(theBase, theDX, theDY, theDZ)
RaiseIfFailed("MakePrismDXDYDZ2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "prism")
return anObj
## Create a shape by revolution of the base shape around the axis
# @param theBase Base shape to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created revolution.
#
# @ref tui_creation_revolution "Example"
- def MakeRevolution(self, theBase, theAxis, theAngle):
+ def MakeRevolution(self, theBase, theAxis, theAngle, theName=None):
"""
Create a shape by revolution of the base shape around the axis
on the given angle, i.e. all the space, transfixed by the base
theBase Base shape to be rotated.
theAxis Rotation axis.
theAngle Rotation angle in radians.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created revolution.
anObj = self.PrimOp.MakeRevolutionAxisAngle(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "revolution")
return anObj
## Create a shape by revolution of the base shape around the axis
# @param theBase Base shape to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created revolution.
#
# @ref tui_creation_revolution "Example"
- def MakeRevolution2Ways(self, theBase, theAxis, theAngle):
+ def MakeRevolution2Ways(self, theBase, theAxis, theAngle, theName=None):
"""
Create a shape by revolution of the base shape around the axis
on the given angle, i.e. all the space, transfixed by the base
theBase Base shape to be rotated.
theAxis Rotation axis.
theAngle Rotation angle in radians.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created revolution.
anObj = self.PrimOp.MakeRevolutionAxisAngle2Ways(theBase, theAxis, theAngle)
RaiseIfFailed("MakeRevolutionAxisAngle2Ways", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "revolution")
return anObj
## Create a filling from the given compound of contours.
# the surface is created using given curves. The usage of
# Approximation makes the algorithm work slower, but allows
# building the surface for rather complex cases.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created filling surface.
#
# @ref tui_creation_filling "Example"
def MakeFilling(self, theShape, theMinDeg=2, theMaxDeg=5, theTol2D=0.0001,
- theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0):
+ theTol3D=0.0001, theNbIter=0, theMethod=GEOM.FOM_Default, isApprox=0, theName=None):
"""
Create a filling from the given compound of contours.
the surface is created using given curves. The usage of
Approximation makes the algorithm work slower, but allows
building the surface for rather complex cases
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created filling surface.
theMethod, isApprox)
RaiseIfFailed("MakeFilling", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "filling")
return anObj
# @param theMinDeg a minimal degree of BSpline surface to create
# @param theMaxDeg a maximal degree of BSpline surface to create
# @param theTol3D a 3d tolerance to be reached
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created filling surface.
#
# @ref tui_creation_filling "Example"
- def MakeFillingNew(self, theShape, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001):
+ def MakeFillingNew(self, theShape, theMinDeg=2, theMaxDeg=5, theTol3D=0.0001, theName=None):
"""
Create a filling from the given compound of contours.
This method corresponds to MakeFilling with isApprox=True
theMinDeg a minimal degree of BSpline surface to create
theMaxDeg a maximal degree of BSpline surface to create
theTol3D a 3d tolerance to be reached
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created filling surface.
0, theTol3D, 0, GEOM.FOM_Default, True)
RaiseIfFailed("MakeFillingNew", self.PrimOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "filling")
return anObj
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
# @param theModeSolid - mode defining building solid or shell
# @param thePreci - precision 3D used for smoothing
# @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created shell or solid.
#
# @ref swig_todo "Example"
- def MakeThruSections(self,theSeqSections,theModeSolid,thePreci,theRuled):
+ def MakeThruSections(self, theSeqSections, theModeSolid, thePreci, theRuled, theName=None):
"""
Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
theModeSolid - mode defining building solid or shell
thePreci - precision 3D used for smoothing
theRuled - mode defining type of the result surfaces (ruled or smoothed).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created shell or solid.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakeThruSections(theSeqSections,theModeSolid,thePreci,theRuled)
RaiseIfFailed("MakeThruSections", self.PrimOp)
+ self._autoPublish(anObj, theName, "filling")
return anObj
## Create a shape by extrusion of the base shape along
# the path shape. The path shape can be a wire or an edge.
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created pipe.
#
# @ref tui_creation_pipe "Example"
- def MakePipe(self,theBase, thePath):
+ def MakePipe(self, theBase, thePath, theName=None):
"""
Create a shape by extrusion of the base shape along
the path shape. The path shape can be a wire or an edge.
Parameters:
theBase Base shape to be extruded.
thePath Path shape to extrude the base shape along it.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created pipe.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakePipe(theBase, thePath)
RaiseIfFailed("MakePipe", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
return anObj
## Create a shape by extrusion of the profile shape along
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created pipe.
#
# @ref tui_creation_pipe_with_diff_sec "Example"
def MakePipeWithDifferentSections(self, theSeqBases,
theLocations, thePath,
- theWithContact, theWithCorrection):
+ theWithContact, theWithCorrection, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. The path shape can be a wire or an edge.
contact with the spine(0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created pipe.
theLocations, thePath,
theWithContact, theWithCorrection)
RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
return anObj
## Create a shape by extrusion of the profile shape along
# contact with the spine.
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created solids.
#
# @ref tui_creation_pipe_with_shell_sec "Example"
- def MakePipeWithShellSections(self,theSeqBases, theSeqSubBases,
+ def MakePipeWithShellSections(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection):
+ theWithContact, theWithCorrection, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. The path shape can be a wire or a edge.
contact with the spine (0/1)
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point (0/1)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solids.
theLocations, thePath,
theWithContact, theWithCorrection)
RaiseIfFailed("MakePipeWithShellSections", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
return anObj
## Create a shape by extrusion of the profile shape along
# creating pipe between each pair of sections step by step.
def MakePipeWithShellSectionsBySteps(self, theSeqBases, theSeqSubBases,
theLocations, thePath,
- theWithContact, theWithCorrection):
+ theWithContact, theWithCorrection, theName=None):
"""
Create a shape by extrusion of the profile shape along
the path shape. This function is used only for debug pipe
resc = self.MakeCompound(res)
#resc = self.MakeSewing(res, 0.001)
#print "resc: ",resc
+ self._autoPublish(resc, theName, "pipe")
return resc
## Create solids between given sections
# @param theSeqBases - list of sections (shell or face).
# @param theLocations - list of corresponding vertexes
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created solids.
#
# @ref tui_creation_pipe_without_path "Example"
- def MakePipeShellsWithoutPath(self, theSeqBases, theLocations):
+ def MakePipeShellsWithoutPath(self, theSeqBases, theLocations, theName=None):
"""
Create solids between given sections
Parameters:
theSeqBases - list of sections (shell or face).
theLocations - list of corresponding vertexes
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solids.
"""
anObj = self.PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
RaiseIfFailed("MakePipeShellsWithoutPath", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
return anObj
## Create a shape by extrusion of the base shape along
# @param theVec Vector defines a constant binormal direction to keep the
# same angle beetween the direction and the sections
# along the sweep surface.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created pipe.
#
# @ref tui_creation_pipe "Example"
- def MakePipeBiNormalAlongVector(self,theBase, thePath, theVec):
+ def MakePipeBiNormalAlongVector(self, theBase, thePath, theVec, theName=None):
"""
Create a shape by extrusion of the base shape along
the path shape with constant bi-normal direction along the given vector.
theVec Vector defines a constant binormal direction to keep the
same angle beetween the direction and the sections
along the sweep surface.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created pipe.
# Example: see GEOM_TestAll.py
anObj = self.PrimOp.MakePipeBiNormalAlongVector(theBase, thePath, theVec)
RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
return anObj
## Build a middle path of a pipe-like shape.
# or a pipe-like solid.
# @param theBase1, theBase2 Two bases of the supposed pipe. This
# should be wires or faces of theShape.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @note It is not assumed that exact or approximate copy of theShape
# can be obtained by applying existing Pipe operation on the
# resulting "Path" wire taking theBase1 as the base - it is not
# always possible; though in some particular cases it might work
# it is not guaranteed. Thus, RestorePath function should not be
# considered as an exact reverse operation of the Pipe.
+ #
# @return New GEOM.GEOM_Object, containing an edge or wire that represent
# source pipe's "path".
#
# @ref tui_creation_pipe_path "Example"
- def RestorePath (self, theShape, theBase1, theBase2):
+ def RestorePath (self, theShape, theBase1, theBase2, theName=None):
"""
Build a middle path of a pipe-like shape.
The path shape can be a wire or an edge.
or a pipe-like solid.
theBase1, theBase2 Two bases of the supposed pipe. This
should be wires or faces of theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing an edge or wire that represent
"""
anObj = self.PrimOp.RestorePath(theShape, theBase1, theBase2)
RaiseIfFailed("RestorePath", self.PrimOp)
+ self._autoPublish(anObj, theName, "path")
return anObj
## Build a middle path of a pipe-like shape.
# or a pipe-like solid.
# @param listEdges1, listEdges2 Two bases of the supposed pipe. This
# should be lists of edges of theShape.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @note It is not assumed that exact or approximate copy of theShape
# can be obtained by applying existing Pipe operation on the
# resulting "Path" wire taking theBase1 as the base - it is not
# always possible; though in some particular cases it might work
# it is not guaranteed. Thus, RestorePath function should not be
# considered as an exact reverse operation of the Pipe.
+ #
# @return New GEOM.GEOM_Object, containing an edge or wire that represent
# source pipe's "path".
#
# @ref tui_creation_pipe_path "Example"
- def RestorePathEdges (self, theShape, listEdges1, listEdges2):
+ def RestorePathEdges (self, theShape, listEdges1, listEdges2, theName=None):
"""
Build a middle path of a pipe-like shape.
The path shape can be a wire or an edge.
or a pipe-like solid.
listEdges1, listEdges2 Two bases of the supposed pipe. This
should be lists of edges of theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing an edge or wire that represent
"""
anObj = self.PrimOp.RestorePathEdges(theShape, listEdges1, listEdges2)
RaiseIfFailed("RestorePath", self.PrimOp)
+ self._autoPublish(anObj, theName, "path")
return anObj
# end of l3_complex
## Create a linear edge with specified ends.
# @param thePnt1 Point for the first end of edge.
# @param thePnt2 Point for the second end of edge.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_creation_edge "Example"
- def MakeEdge(self,thePnt1, thePnt2):
+ def MakeEdge(self, thePnt1, thePnt2, theName=None):
"""
Create a linear edge with specified ends.
Parameters:
thePnt1 Point for the first end of edge.
thePnt2 Point for the second end of edge.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created edge.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeEdge(thePnt1, thePnt2)
RaiseIfFailed("MakeEdge", self.ShapesOp)
+ self._autoPublish(anObj, theName, "edge")
return anObj
## Create a new edge, corresponding to the given length on the given curve.
# @param theStartPoint Any point can be selected for it, the new edge will begin
# at the end of \a theRefCurve, close to the selected point.
# If None, start from the first point of \a theRefCurve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_creation_edge "Example"
- def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
+ def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None, theName=None):
"""
Create a new edge, corresponding to the given length on the given curve.
theStartPoint Any point can be selected for it, the new edge will begin
at the end of theRefCurve, close to the selected point.
If None, start from the first point of theRefCurve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created edge.
anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
RaiseIfFailed("MakeEdgeOnCurveByLength", self.ShapesOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "edge")
return anObj
## Create an edge from specified wire.
# @param theWire source Wire
# @param theLinearTolerance linear tolerance value (default = 1e-07)
# @param theAngularTolerance angular tolerance value (default = 1e-12)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_creation_edge "Example"
- def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12):
+ def MakeEdgeWire(self, theWire, theLinearTolerance = 1e-07, theAngularTolerance = 1e-12, theName=None):
"""
Create an edge from specified wire.
theWire source Wire
theLinearTolerance linear tolerance value (default = 1e-07)
theAngularTolerance angular tolerance value (default = 1e-12)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created edge.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeEdgeWire(theWire, theLinearTolerance, theAngularTolerance)
RaiseIfFailed("MakeEdgeWire", self.ShapesOp)
+ self._autoPublish(anObj, theName, "edge")
return anObj
## Create a wire from the set of edges and wires.
# @param theEdgesAndWires List of edges and/or wires.
# @param theTolerance Maximum distance between vertices, that will be merged.
# Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created wire.
#
# @ref tui_creation_wire "Example"
- def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07):
+ def MakeWire(self, theEdgesAndWires, theTolerance = 1e-07, theName=None):
"""
Create a wire from the set of edges and wires.
theEdgesAndWires List of edges and/or wires.
theTolerance Maximum distance between vertices, that will be merged.
Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion()).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created wire.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeWire(theEdgesAndWires, theTolerance)
RaiseIfFailed("MakeWire", self.ShapesOp)
+ self._autoPublish(anObj, theName, "wire")
return anObj
## Create a face on the given wire.
# than 1e-06, this face will be returned, otherwise the
# algorithm tries to build any suitable face on the given
# wire and prints a warning message.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
- def MakeFace(self, theWire, isPlanarWanted):
+ def MakeFace(self, theWire, isPlanarWanted, theName=None):
"""
Create a face on the given wire.
than 1e-06, this face will be returned, otherwise the
algorithm tries to build any suitable face on the given
wire and prints a warning message.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built."
else:
RaiseIfFailed("MakeFace", self.ShapesOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Create a face on the given wires set.
# than 1e-06, this face will be returned, otherwise the
# algorithm tries to build any suitable face on the given
# wire and prints a warning message.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
- def MakeFaceWires(self, theWires, isPlanarWanted):
+ def MakeFaceWires(self, theWires, isPlanarWanted, theName=None):
"""
Create a face on the given wires set.
than 1e-06, this face will be returned, otherwise the
algorithm tries to build any suitable face on the given
wire and prints a warning message.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
print "WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built."
else:
RaiseIfFailed("MakeFaceWires", self.ShapesOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## See MakeFaceWires() method for details.
#
# @ref tui_creation_face "Example 1"
# \n @ref swig_MakeFaces "Example 2"
- def MakeFaces(self, theWires, isPlanarWanted):
+ def MakeFaces(self, theWires, isPlanarWanted, theName=None):
"""
See geompy.MakeFaceWires() method for details.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.MakeFaceWires(theWires, isPlanarWanted)
+ # note: auto-publishing is done in self.MakeFaceWires()
+ anObj = self.MakeFaceWires(theWires, isPlanarWanted, theName)
return anObj
## Create a shell from the set of faces and shells.
# @param theFacesAndShells List of faces and/or shells.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created shell.
#
# @ref tui_creation_shell "Example"
- def MakeShell(self,theFacesAndShells):
+ def MakeShell(self, theFacesAndShells, theName=None):
"""
Create a shell from the set of faces and shells.
Parameters:
theFacesAndShells List of faces and/or shells.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created shell.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeShell(theFacesAndShells)
RaiseIfFailed("MakeShell", self.ShapesOp)
+ self._autoPublish(anObj, theName, "shell")
return anObj
## Create a solid, bounded by the given shells.
# @param theShells Sequence of bounding shells.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created solid.
#
# @ref tui_creation_solid "Example"
- def MakeSolid(self, theShells):
+ def MakeSolid(self, theShells, theName=None):
"""
Create a solid, bounded by the given shells.
Parameters:
theShells Sequence of bounding shells.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solid.
raise RuntimeError, "MakeSolidShells : Unable to create solid from unclosed shape"
anObj = self.ShapesOp.MakeSolidShells(theShells)
RaiseIfFailed("MakeSolidShells", self.ShapesOp)
+ self._autoPublish(anObj, theName, "solid")
return anObj
## Create a compound of the given shapes.
# @param theShapes List of shapes to put in compound.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created compound.
#
# @ref tui_creation_compound "Example"
- def MakeCompound(self,theShapes):
+ def MakeCompound(self, theShapes, theName=None):
"""
Create a compound of the given shapes.
Parameters:
theShapes List of shapes to put in compound.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created compound.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeCompound(theShapes)
RaiseIfFailed("MakeCompound", self.ShapesOp)
+ self._autoPublish(anObj, theName, "compound")
return anObj
# end of l3_advanced
## Reverses an orientation the given shape.
# @param theShape Shape to be reversed.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return The reversed copy of theShape.
#
# @ref swig_ChangeOrientation "Example"
- def ChangeOrientation(self,theShape):
+ def ChangeOrientation(self, theShape, theName=None):
"""
Reverses an orientation the given shape.
Parameters:
theShape Shape to be reversed.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
The reversed copy of theShape.
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.ChangeOrientation(theShape)
RaiseIfFailed("ChangeOrientation", self.ShapesOp)
+ self._autoPublish(anObj, theName, "reversed")
return anObj
## See ChangeOrientation() method for details.
#
# @ref swig_OrientationChange "Example"
- def OrientationChange(self,theShape):
+ def OrientationChange(self, theShape, theName=None):
"""
See geompy.ChangeOrientation method for details.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.ChangeOrientation(theShape)
+ # note: auto-publishing is done in self.ChangeOrientation()
+ anObj = self.ChangeOrientation(theShape, theName)
return anObj
# end of l3_healing
# @param theShape1 Shape to find sub-shapes in.
# @param theShape2 Shape to find shared sub-shapes with.
# @param theShapeType Type of sub-shapes to be retrieved.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of sub-shapes of theShape1, shared with theShape2.
#
# @ref swig_GetSharedShapes "Example"
- def GetSharedShapes(self,theShape1, theShape2, theShapeType):
+ def GetSharedShapes(self, theShape1, theShape2, theShapeType, theName=None):
"""
Get all sub-shapes of theShape1 of the given type, shared with theShape2.
theShape1 Shape to find sub-shapes in.
theShape2 Shape to find shared sub-shapes with.
theShapeType Type of sub-shapes to be retrieved.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of sub-shapes of theShape1, shared with theShape2.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
RaiseIfFailed("GetSharedShapes", self.ShapesOp)
+ self._autoPublish(aList, theName, "shared")
return aList
## Get all sub-shapes, shared by all shapes in the list <VAR>theShapes</VAR>.
# @param theShapes Shapes to find common sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of objects, that are sub-shapes of all given shapes.
#
# @ref swig_GetSharedShapes "Example"
- def GetSharedShapesMulti(self, theShapes, theShapeType):
+ def GetSharedShapesMulti(self, theShapes, theShapeType, theName=None):
"""
Get all sub-shapes, shared by all shapes in the list theShapes.
Parameters:
theShapes Shapes to find common sub-shapes of.
theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM.GEOM_Object, that are sub-shapes of all given shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetSharedShapesMulti(theShapes, theShapeType)
RaiseIfFailed("GetSharedShapesMulti", self.ShapesOp)
+ self._autoPublish(aList, theName, "shared")
return aList
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction and location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnPlane "Example"
- def GetShapesOnPlane(self,theShape, theShapeType, theAx1, theState):
+ def GetShapesOnPlane(self, theShape, theShapeType, theAx1, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified plane by the certain way,
theAx1 Vector (or line, or linear edge), specifying normal
direction and location of the plane to find shapes on.
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnPlane(theShape, theShapeType, theAx1, theState)
RaiseIfFailed("GetShapesOnPlane", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnPlane")
return aList
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction and location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnPlaneIDs "Example"
- def GetShapesOnPlaneIDs(self,theShape, theShapeType, theAx1, theState):
+ def GetShapesOnPlaneIDs(self, theShape, theShapeType, theAx1, theState):
"""
Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified plane by the certain way,
# direction of the plane to find shapes on.
# @param thePnt Point specifying location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnPlaneWithLocation "Example"
- def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState):
+ def GetShapesOnPlaneWithLocation(self, theShape, theShapeType, theAx1, thePnt, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified plane by the certain way,
direction and location of the plane to find shapes on.
thePnt Point specifying location of the plane to find shapes on.
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
aList = self.ShapesOp.GetShapesOnPlaneWithLocation(theShape, theShapeType,
theAx1, thePnt, theState)
RaiseIfFailed("GetShapesOnPlaneWithLocation", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnPlane")
return aList
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# direction of the plane to find shapes on.
# @param thePnt Point specifying location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
# axis of the cylinder to find shapes on.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnCylinder "Example"
- def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState):
+ def GetShapesOnCylinder(self, theShape, theShapeType, theAxis, theRadius, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified cylinder by the certain way, defined through theState parameter.
axis of the cylinder to find shapes on.
theRadius Radius of the cylinder to find shapes on.
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius, theState)
RaiseIfFailed("GetShapesOnCylinder", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnCylinder")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# axis of the cylinder to find shapes on.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnCylinderIDs "Example"
# @param thePnt Point specifying location of the bottom of the cylinder.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnCylinderWithLocation "Example"
- def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState):
+ def GetShapesOnCylinderWithLocation(self, theShape, theShapeType, theAxis, thePnt, theRadius, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified cylinder by the certain way, defined through theState parameter.
axis of the cylinder to find shapes on.
theRadius Radius of the cylinder to find shapes on.
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnCylinderWithLocation(theShape, theShapeType, theAxis, thePnt, theRadius, theState)
RaiseIfFailed("GetShapesOnCylinderWithLocation", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnCylinder")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# @param thePnt Point specifying location of the bottom of the cylinder.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices
#
# @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
# @param theCenter Point, specifying center of the sphere to find shapes on.
# @param theRadius Radius of the sphere to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnSphere "Example"
- def GetShapesOnSphere(self,theShape, theShapeType, theCenter, theRadius, theState):
+ def GetShapesOnSphere(self, theShape, theShapeType, theCenter, theRadius, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified sphere by the certain way, defined through theState parameter.
theCenter Point, specifying center of the sphere to find shapes on.
theRadius Radius of the sphere to find shapes on.
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius, theState)
RaiseIfFailed("GetShapesOnSphere", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnSphere")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# @param theCenter Point, specifying center of the sphere to find shapes on.
# @param theRadius Radius of the sphere to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnSphereIDs "Example"
- def GetShapesOnSphereIDs(self,theShape, theShapeType, theCenter, theRadius, theState):
+ def GetShapesOnSphereIDs(self, theShape, theShapeType, theCenter, theRadius, theState):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified sphere by the certain way, defined through theState parameter.
# @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
# @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnQuadrangle "Example"
def GetShapesOnQuadrangle(self, theShape, theShapeType,
theTopLeftPoint, theTopRigthPoint,
- theBottomLeftPoint, theBottomRigthPoint, theState):
+ theBottomLeftPoint, theBottomRigthPoint, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified quadrangle by the certain way, defined through theState parameter.
theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
theTopLeftPoint, theTopRigthPoint,
theBottomLeftPoint, theBottomRigthPoint, theState)
RaiseIfFailed("GetShapesOnQuadrangle", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnQuadrangle")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
# @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnQuadrangleIDs "Example"
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnBox "Example"
- def GetShapesOnBox(self, theBox, theShape, theShapeType, theState):
+ def GetShapesOnBox(self, theBox, theShape, theShapeType, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType, situated relatively
the specified theBox by the certain way, defined through theState parameter.
theShape Shape to find sub-shapes of.
theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnBox(theBox, theShape, theShapeType, theState)
RaiseIfFailed("GetShapesOnBox", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnBox")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnBoxIDs "Example"
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnShape "Example"
- def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState):
+ def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified theCheckShape by the
theShape Shape to find sub-shapes of.
theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of all found sub-shapes.
aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
theShapeType, theState)
RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
+ self._autoPublish(aList, theName, "shapeOnShape")
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType,
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return All found sub-shapes as compound.
#
# @ref swig_GetShapesOnShapeAsCompound "Example"
- def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState):
+ def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None):
"""
Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified theCheckShape by the
theShape Shape to find sub-shapes of.
theShapeType Type of sub-shapes to be retrieved (see geompy.ShapeType)
theState The state of the sub-shapes to find (see GEOM::shape_state)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
All found sub-shapes as compound.
anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
theShapeType, theState)
RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
+ self._autoPublish(anObj, theName, "shapeOnShape")
return anObj
## Find in \a theShape all sub-shapes of type \a theShapeType,
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
+ #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnShapeIDs "Example"
# @param theShapeWhat Shape, specifying what to find.
# @param isNewImplementation implementation of GetInPlace functionality
# (default = False, old alghorithm based on shape properties)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return Group of all found sub-shapes or a single found sub-shape.
#
# @note This function has a restriction on argument shapes.
# @image html get_in_place_lost_part.png
#
# @ref swig_GetInPlace "Example"
- def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False):
+ def GetInPlace(self, theShapeWhere, theShapeWhat, isNewImplementation = False, theName=None):
"""
Get sub-shape(s) of theShapeWhere, which are
coincident with theShapeWhat or could be a part of it.
theShapeWhat Shape, specifying what to find.
isNewImplementation Implementation of GetInPlace functionality
(default = False, old alghorithm based on shape properties)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
Group of all found sub-shapes or a single found sub-shape.
anObj = self.ShapesOp.GetInPlaceOld(theShapeWhere, theShapeWhat)
pass
RaiseIfFailed("GetInPlace", self.ShapesOp)
+ self._autoPublish(anObj, theName, "inplace")
return anObj
## Get sub-shape(s) of \a theShapeWhere, which are
# @param theShapeWhere Shape to find sub-shapes of.
# @param theShapeWhat Shape, specifying what to find (must be in the
# building history of the ShapeWhere).
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return Group of all found sub-shapes or a single found sub-shape.
#
# @ref swig_GetInPlace "Example"
- def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat):
+ def GetInPlaceByHistory(self, theShapeWhere, theShapeWhat, theName=None):
"""
Implementation of this method is based on a saved history of an operation,
produced theShapeWhere. The theShapeWhat must be among this operation's
theShapeWhere Shape to find sub-shapes of.
theShapeWhat Shape, specifying what to find (must be in the
building history of the ShapeWhere).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
Group of all found sub-shapes or a single found sub-shape.
# Example: see GEOM_TestOthers.py
anObj = self.ShapesOp.GetInPlaceByHistory(theShapeWhere, theShapeWhat)
RaiseIfFailed("GetInPlaceByHistory", self.ShapesOp)
+ self._autoPublish(anObj, theName, "inplace")
return anObj
## Get sub-shape of theShapeWhere, which is
# equal to \a theShapeWhat.
# @param theShapeWhere Shape to find sub-shape of.
# @param theShapeWhat Shape, specifying what to find.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object for found sub-shape.
#
# @ref swig_GetSame "Example"
- def GetSame(self,theShapeWhere, theShapeWhat):
+ def GetSame(self, theShapeWhere, theShapeWhat, theName=None):
"""
Get sub-shape of theShapeWhere, which is
equal to theShapeWhat.
Parameters:
theShapeWhere Shape to find sub-shape of.
theShapeWhat Shape, specifying what to find.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object for found sub-shape.
"""
anObj = self.ShapesOp.GetSame(theShapeWhere, theShapeWhat)
RaiseIfFailed("GetSame", self.ShapesOp)
+ self._autoPublish(anObj, theName, "sameShape")
return anObj
# @return List of all found sub-shapes indices.
#
# @ref swig_GetSame "Example"
- def GetSameIDs(self,theShapeWhere, theShapeWhat):
+ def GetSameIDs(self, theShapeWhere, theShapeWhat):
"""
Get sub-shape indices of theShapeWhere, which is
equal to theShapeWhat.
# of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
# @param aShape Shape to get sub-shape of.
# @param ListOfID List of sub-shapes indices.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return Found sub-shape.
#
# @ref swig_all_decompose "Example"
- def GetSubShape(self, aShape, ListOfID):
+ def GetSubShape(self, aShape, ListOfID, theName=None):
"""
Obtain a composite sub-shape of aShape, composed from sub-shapes
of aShape, selected by their unique IDs inside aShape
Parameters:
- aShape Shape to get sub-shape of.
- ListOfID List of sub-shapes indices.
+ aShape Shape to get sub-shape of.
+ ListOfID List of sub-shapes indices.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
Found sub-shape.
"""
# Example: see GEOM_TestAll.py
anObj = self.AddSubShape(aShape,ListOfID)
+ self._autoPublish(anObj, theName, "subshape")
return anObj
## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
anID = self.LocalOp.GetSubShapeIndex(aShape, aSubShape)
RaiseIfFailed("GetSubShapeIndex", self.LocalOp)
return anID
+
+ ## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
+ # This function is provided for performance purpose. The complexity is O(n) with n
+ # the number of subobjects of aShape
+ # @param aShape Shape to get sub-shape of.
+ # @param aSubShapes Sub-shapes of aShape.
+ # @return list of IDs of found sub-shapes.
+ #
+ # @ref swig_all_decompose "Example"
+ def GetSubShapesIDs(self, aShape, aSubShapes):
+ """
+ Obtain a list of IDs of sub-shapes aSubShapes inside aShape
+ This function is provided for performance purpose. The complexity is O(n) with n
+ the number of subobjects of aShape
+
+ Parameters:
+ aShape Shape to get sub-shape of.
+ aSubShapes Sub-shapes of aShape.
+
+ Returns:
+ List of IDs of found sub-shape.
+ """
+ # Example: see GEOM_TestAll.py
+ anIDs = self.ShapesOp.GetSubShapesIndices(aShape, aSubShapes)
+ RaiseIfFailed("GetSubShapesIndices", self.ShapesOp)
+ return anIDs
# end of l4_access
## @}
# If the shape itself matches the type, it is also returned.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_all_decompose "Example"
- def SubShapeAll(self, aShape, aType):
+ def SubShapeAll(self, aShape, aType, theName=None):
"""
Explode a shape on sub-shapes of a given type.
If the shape itself matches the type, it is also returned.
Parameters:
aShape Shape to be exploded.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of sub-shapes of type theShapeType, contained in theShape.
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), False)
RaiseIfFailed("SubShapeAll", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "subshape")
return ListObj
## Explode a shape on sub-shapes of a given type.
# @param aShape Shape to get sub-shape of.
# @param ListOfInd List of sub-shapes indices.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return A compound of sub-shapes of aShape.
#
# @ref swig_all_decompose "Example"
- def SubShape(self, aShape, aType, ListOfInd):
+ def SubShape(self, aShape, aType, ListOfInd, theName=None):
"""
Obtain a compound of sub-shapes of aShape,
selected by they indices in list of all sub-shapes of type aType.
aShape Shape to get sub-shape of.
ListOfID List of sub-shapes indices.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
A compound of sub-shapes of aShape.
AllShapeIDsList = self.SubShapeAllIDs(aShape, EnumToLong( aType ))
for ind in ListOfInd:
ListOfIDs.append(AllShapeIDsList[ind - 1])
- anObj = self.GetSubShape(aShape, ListOfIDs)
+ # note: auto-publishing is done in self.GetSubShape()
+ anObj = self.GetSubShape(aShape, ListOfIDs, theName)
return anObj
## Explode a shape on sub-shapes of a given type.
# If the shape itself matches the type, it is also returned.
# @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
# @ref swig_SubShapeAllSorted "Example"
- def SubShapeAllSortedCentres(self, aShape, aType):
+ def SubShapeAllSortedCentres(self, aShape, aType, theName=None):
"""
Explode a shape on sub-shapes of a given type.
Sub-shapes will be sorted by coordinates of their gravity centers.
Parameters:
aShape Shape to be exploded.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of sub-shapes of type theShapeType, contained in theShape.
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeAllSubShapes(aShape, EnumToLong( aType ), True)
RaiseIfFailed("SubShapeAllSortedCentres", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "subshape")
return ListObj
## Explode a shape on sub-shapes of a given type.
# @param aShape Shape to get sub-shape of.
# @param ListOfInd List of sub-shapes indices.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return A compound of sub-shapes of aShape.
#
# @ref swig_all_decompose "Example"
- def SubShapeSortedCentres(self, aShape, aType, ListOfInd):
+ def SubShapeSortedCentres(self, aShape, aType, ListOfInd, theName=None):
"""
Obtain a compound of sub-shapes of aShape,
selected by they indices in sorted list of all sub-shapes of type aType.
aShape Shape to get sub-shape of.
ListOfID List of sub-shapes indices.
aType Type of sub-shapes to be retrieved (see geompy.ShapeType)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
A compound of sub-shapes of aShape.
AllShapeIDsList = self.SubShapeAllSortedCentresIDs(aShape, EnumToLong( aType ))
for ind in ListOfInd:
ListOfIDs.append(AllShapeIDsList[ind - 1])
- anObj = self.GetSubShape(aShape, ListOfIDs)
+ # note: auto-publishing is done in self.GetSubShape()
+ anObj = self.GetSubShape(aShape, ListOfIDs, theName)
return anObj
## Extract shapes (excluding the main shape) of given type.
# @param aShape The shape.
# @param aType The shape type (see ShapeType())
# @param isSorted Boolean flag to switch sorting on/off.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of sub-shapes of type aType, contained in aShape.
#
# @ref swig_FilletChamfer "Example"
- def ExtractShapes(self, aShape, aType, isSorted = False):
+ def ExtractShapes(self, aShape, aType, isSorted = False, theName=None):
"""
Extract shapes (excluding the main shape) of given type.
aShape The shape.
aType The shape type (see geompy.ShapeType)
isSorted Boolean flag to switch sorting on/off.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of sub-shapes of type aType, contained in aShape.
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.ExtractSubShapes(aShape, EnumToLong( aType ), isSorted)
RaiseIfFailed("ExtractSubShapes", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "subshape")
return ListObj
## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
# @param aShape Main shape.
# @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
# @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
#
# @ref swig_all_decompose "Example"
- def SubShapes(self, aShape, anIDs):
+ def SubShapes(self, aShape, anIDs, theName=None):
"""
Get a set of sub-shapes defined by their unique IDs inside theMainShape
Parameters:
aShape Main shape.
anIDs List of unique IDs of sub-shapes inside theMainShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM.GEOM_Object, corresponding to found sub-shapes.
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.MakeSubShapes(aShape, anIDs)
RaiseIfFailed("SubShapes", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "subshape")
return ListObj
# end of l4_decompose
## Deprecated method
# It works like SubShapeAllSortedCentres(), but wrongly
# defines centres of faces, shells and solids.
- def SubShapeAllSorted(self, aShape, aType):
+ def SubShapeAllSorted(self, aShape, aType, theName=None):
"""
Deprecated method
It works like geompy.SubShapeAllSortedCentres, but wrongly
"""
ListObj = self.ShapesOp.MakeExplode(aShape, EnumToLong( aType ), True)
RaiseIfFailed("MakeExplode", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "subshape")
return ListObj
## Deprecated method
## Deprecated method
# It works like SubShapeSortedCentres(), but has a bug
# (wrongly defines centres of faces, shells and solids).
- def SubShapeSorted(self, aShape, aType, ListOfInd):
+ def SubShapeSorted(self, aShape, aType, ListOfInd, theName=None):
"""
Deprecated method
It works like geompy.SubShapeSortedCentres, but has a bug
AllShapeIDsList = self.SubShapeAllSortedIDs(aShape, EnumToLong( aType ))
for ind in ListOfInd:
ListOfIDs.append(AllShapeIDsList[ind - 1])
- anObj = self.GetSubShape(aShape, ListOfIDs)
+ # note: auto-publishing is done in self.GetSubShape()
+ anObj = self.GetSubShape(aShape, ListOfIDs, theName)
return anObj
# end of l4_decompose_d
# ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
# @param theValues List of values of parameters, in the same order
# as parameters are listed in <VAR>theParameters</VAR> list.
- #
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
#
# <b> Operators and Parameters: </b> \n
#
# @return New GEOM.GEOM_Object, containing processed shape.
#
# \n @ref tui_shape_processing "Example"
- def ProcessShape(self, theShape, theOperators, theParameters, theValues):
+ def ProcessShape(self, theShape, theOperators, theParameters, theValues, theName=None):
"""
Apply a sequence of Shape Healing operators to the given object.
theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
theParameters List of names of parameters
("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
- Operators and Parameters:
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Operators and Parameters:
* FixShape - corrects invalid shapes.
* FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them.
Parameters = ":" + Parameters
pass
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "healed")
return anObj
## Remove faces from the given object (shape).
# @param theObject Shape to be processed.
# @param theFaces Indices of faces to be removed, if EMPTY then the method
# removes ALL faces of the given object.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_suppress_faces "Example"
- def SuppressFaces(self,theObject, theFaces):
+ def SuppressFaces(self, theObject, theFaces, theName=None):
"""
Remove faces from the given object (shape).
theObject Shape to be processed.
theFaces Indices of faces to be removed, if EMPTY then the method
removes ALL faces of the given object.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.SuppressFaces(theObject, theFaces)
RaiseIfFailed("SuppressFaces", self.HealOp)
+ self._autoPublish(anObj, theName, "suppressFaces")
return anObj
## Sewing of some shapes into single shape.
# @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_sewing "Example"
- def MakeSewing(self, ListShape, theTolerance):
+ def MakeSewing(self, ListShape, theTolerance, theName=None):
"""
Sewing of some shapes into single shape.
Parameters:
ListShape Shapes to be processed.
theTolerance Required tolerance value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
# Example: see GEOM_TestHealing.py
comp = self.MakeCompound(ListShape)
- anObj = self.Sew(comp, theTolerance)
+ # note: auto-publishing is done in self.Sew()
+ anObj = self.Sew(comp, theTolerance, theName)
return anObj
## Sewing of the given object.
# @param theObject Shape to be processed.
# @param theTolerance Required tolerance value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
- def Sew(self, theObject, theTolerance):
+ def Sew(self, theObject, theTolerance, theName=None):
"""
Sewing of the given object.
Parameters:
theObject Shape to be processed.
theTolerance Required tolerance value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
anObj = self.HealOp.Sew(theObject, theTolerance)
RaiseIfFailed("Sew", self.HealOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "sewed")
return anObj
## Remove internal wires and edges from the given object (face).
# @param theObject Shape to be processed.
# @param theWires Indices of wires to be removed, if EMPTY then the method
# removes ALL internal wires of the given object.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_suppress_internal_wires "Example"
- def SuppressInternalWires(self,theObject, theWires):
+ def SuppressInternalWires(self, theObject, theWires, theName=None):
"""
Remove internal wires and edges from the given object (face).
theObject Shape to be processed.
theWires Indices of wires to be removed, if EMPTY then the method
removes ALL internal wires of the given object.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.RemoveIntWires(theObject, theWires)
RaiseIfFailed("RemoveIntWires", self.HealOp)
+ self._autoPublish(anObj, theName, "suppressWires")
return anObj
## Remove internal closed contours (holes) from the given object.
# @param theObject Shape to be processed.
# @param theWires Indices of wires to be removed, if EMPTY then the method
# removes ALL internal holes of the given object
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_suppress_holes "Example"
- def SuppressHoles(self,theObject, theWires):
+ def SuppressHoles(self, theObject, theWires, theName=None):
"""
Remove internal closed contours (holes) from the given object.
theObject Shape to be processed.
theWires Indices of wires to be removed, if EMPTY then the method
removes ALL internal holes of the given object
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.FillHoles(theObject, theWires)
RaiseIfFailed("FillHoles", self.HealOp)
+ self._autoPublish(anObj, theName, "suppressHoles")
return anObj
## Close an open wire.
# if [ ], then <VAR>theObject</VAR> itself is a wire.
# @param isCommonVertex If True : closure by creation of a common vertex,
# If False : closure by creation of an edge between ends.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_close_contour "Example"
- def CloseContour(self,theObject, theWires, isCommonVertex):
+ def CloseContour(self,theObject, theWires, isCommonVertex, theName=None):
"""
Close an open wire.
if [ ], then theObject itself is a wire.
isCommonVertex If True : closure by creation of a common vertex,
If False : closure by creation of an edge between ends.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.CloseContour(theObject, theWires, isCommonVertex)
RaiseIfFailed("CloseContour", self.HealOp)
+ self._autoPublish(anObj, theName, "closeContour")
return anObj
## Addition of a point to a given edge object.
# depending on \a isByParameter.
# @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
# if FALSE : \a theValue is treated as a length parameter [0..1]
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_add_point_on_edge "Example"
- def DivideEdge(self,theObject, theEdgeIndex, theValue, isByParameter):
+ def DivideEdge(self, theObject, theEdgeIndex, theValue, isByParameter, theName=None):
"""
Addition of a point to a given edge object.
depending on isByParameter.
isByParameter If TRUE : theValue is treated as a curve parameter [0..1],
if FALSE : theValue is treated as a length parameter [0..1]
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
anObj = self.HealOp.DivideEdge(theObject, theEdgeIndex, theValue, isByParameter)
RaiseIfFailed("DivideEdge", self.HealOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "divideEdge")
return anObj
## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
# @param theWire Wire to minimize the number of C1 continuous edges in.
# @param theVertices A list of vertices to suppress. If the list
# is empty, all vertices in a wire will be assumed.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object with modified wire.
#
# @ref tui_fuse_collinear_edges "Example"
- def FuseCollinearEdgesWithinWire(self, theWire, theVertices = []):
+ def FuseCollinearEdgesWithinWire(self, theWire, theVertices = [], theName=None):
"""
Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
theWire Wire to minimize the number of C1 continuous edges in.
theVertices A list of vertices to suppress. If the list
is empty, all vertices in a wire will be assumed.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object with modified wire.
"""
anObj = self.HealOp.FuseCollinearEdgesWithinWire(theWire, theVertices)
RaiseIfFailed("FuseCollinearEdgesWithinWire", self.HealOp)
+ self._autoPublish(anObj, theName, "fuseEdges")
return anObj
## Change orientation of the given object. Updates given shape.
## Change orientation of the given object.
# @param theObject Shape to be processed.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref swig_todo "Example"
- def ChangeOrientationShellCopy(self, theObject):
+ def ChangeOrientationShellCopy(self, theObject, theName=None):
"""
Change orientation of the given object.
Parameters:
theObject Shape to be processed.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
anObj = self.HealOp.ChangeOrientationCopy(theObject)
RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
+ self._autoPublish(anObj, theName, "reversed")
return anObj
## Try to limit tolerance of the given object by value \a theTolerance.
# @param theObject Shape to be processed.
# @param theTolerance Required tolerance value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_limit_tolerance "Example"
- def LimitTolerance(self, theObject, theTolerance = 1e-07):
+ def LimitTolerance(self, theObject, theTolerance = 1e-07, theName=None):
"""
Try to limit tolerance of the given object by value theTolerance.
Parameters:
theObject Shape to be processed.
theTolerance Required tolerance value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing processed shape.
"""
anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
RaiseIfFailed("LimitTolerance", self.HealOp)
+ self._autoPublish(anObj, theName, "limitTolerance")
return anObj
## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
# that constitute a free boundary of the given shape.
# @param theObject Shape to get free boundary of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return [\a status, \a theClosedWires, \a theOpenWires]
# \n \a status: FALSE, if an error(s) occured during the method execution.
# \n \a theClosedWires: Closed wires on the free boundary of the given shape.
# \n \a theOpenWires: Open wires on the free boundary of the given shape.
#
# @ref tui_measurement_tools_page "Example"
- def GetFreeBoundary(self, theObject):
+ def GetFreeBoundary(self, theObject, theName=None):
"""
Get a list of wires (wrapped in GEOM.GEOM_Object-s),
that constitute a free boundary of the given shape.
Parameters:
theObject Shape to get free boundary of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
[status, theClosedWires, theOpenWires]
# Example: see GEOM_TestHealing.py
anObj = self.HealOp.GetFreeBoundary(theObject)
RaiseIfFailed("GetFreeBoundary", self.HealOp)
+ self._autoPublish(anObj[1], theName, "closedWire")
+ self._autoPublish(anObj[2], theName, "openWire")
return anObj
## Replace coincident faces in theShape by one face.
# @param theTolerance Maximum distance between faces, which can be considered as coincident.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing a copy of theShape without coincident faces.
#
# @ref tui_glue_faces "Example"
- def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True):
+ def MakeGlueFaces(self, theShape, theTolerance, doKeepNonSolids=True, theName=None):
"""
Replace coincident faces in theShape by one face.
theTolerance Maximum distance between faces, which can be considered as coincident.
doKeepNonSolids If FALSE, only solids will present in the result,
otherwise all initial shapes.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape without coincident faces.
if anObj is None:
raise RuntimeError, "MakeGlueFaces : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "glueFaces")
return anObj
## Find coincident faces in theShape for possible gluing.
# @param theShape Initial shape.
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return GEOM.ListOfGO
#
# @ref tui_glue_faces "Example"
- def GetGlueFaces(self, theShape, theTolerance):
+ def GetGlueFaces(self, theShape, theTolerance, theName=None):
"""
Find coincident faces in theShape for possible gluing.
theShape Initial shape.
theTolerance Maximum distance between faces,
which can be considered as coincident.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueFaces(theShape, theTolerance)
RaiseIfFailed("GetGlueFaces", self.ShapesOp)
+ self._autoPublish(anObj, theName, "facesToGlue")
return anObj
## Replace coincident faces in theShape by one face
# @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
# will be glued, otherwise only the edges,
# belonging to <VAR>theFaces</VAR>.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing a copy of theShape
# without some faces.
#
# @ref tui_glue_faces "Example"
def MakeGlueFacesByList(self, theShape, theTolerance, theFaces,
- doKeepNonSolids=True, doGlueAllEdges=True):
+ doKeepNonSolids=True, doGlueAllEdges=True, theName=None):
"""
Replace coincident faces in theShape by one face
in compliance with given list of faces
doGlueAllEdges If TRUE, all coincident edges of theShape
will be glued, otherwise only the edges,
belonging to theFaces.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape
doKeepNonSolids, doGlueAllEdges)
if anObj is None:
raise RuntimeError, "MakeGlueFacesByList : " + self.ShapesOp.GetErrorCode()
+ self._autoPublish(anObj, theName, "glueFaces")
return anObj
## Replace coincident edges in theShape by one edge.
# @param theShape Initial shape.
# @param theTolerance Maximum distance between edges, which can be considered as coincident.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing a copy of theShape without coincident edges.
#
# @ref tui_glue_edges "Example"
- def MakeGlueEdges(self, theShape, theTolerance):
+ def MakeGlueEdges(self, theShape, theTolerance, theName=None):
"""
Replace coincident edges in theShape by one edge.
Parameters:
theShape Initial shape.
theTolerance Maximum distance between edges, which can be considered as coincident.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape without coincident edges.
if anObj is None:
raise RuntimeError, "MakeGlueEdges : " + self.ShapesOp.GetErrorCode()
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "glueEdges")
return anObj
## Find coincident edges in theShape for possible gluing.
# @param theShape Initial shape.
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return GEOM.ListOfGO
#
# @ref tui_glue_edges "Example"
- def GetGlueEdges(self, theShape, theTolerance):
+ def GetGlueEdges(self, theShape, theTolerance, theName=None):
"""
Find coincident edges in theShape for possible gluing.
theShape Initial shape.
theTolerance Maximum distance between edges,
which can be considered as coincident.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
GEOM.ListOfGO
"""
anObj = self.ShapesOp.GetGlueEdges(theShape, theTolerance)
RaiseIfFailed("GetGlueEdges", self.ShapesOp)
+ self._autoPublish(anObj, theName, "edgesToGlue")
return anObj
## Replace coincident edges in theShape by one edge
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theEdges List of edges for gluing.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing a copy of theShape
# without some edges.
#
# @ref tui_glue_edges "Example"
- def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges):
+ def MakeGlueEdgesByList(self, theShape, theTolerance, theEdges, theName=None):
"""
Replace coincident edges in theShape by one edge
in compliance with given list of edges.
theTolerance Maximum distance between edges,
which can be considered as coincident.
theEdges List of edges for gluing.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a copy of theShape
anObj = self.ShapesOp.MakeGlueEdgesByList(theShape, theTolerance, theEdges)
if anObj is None:
raise RuntimeError, "MakeGlueEdgesByList : " + self.ShapesOp.GetErrorCode()
+ self._autoPublish(anObj, theName, "glueEdges")
return anObj
# end of l3_healing
# @param theShape2 Second argument for boolean operation.
# @param theOperation Indicates the operation to be done:\n
# 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fuse "Example"
- def MakeBoolean(self,theShape1, theShape2, theOperation):
+ def MakeBoolean(self, theShape1, theShape2, theOperation, theName=None):
"""
Perform one of boolean operations on two given shapes.
theShape2 Second argument for boolean operation.
theOperation Indicates the operation to be done:
1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
# Example: see GEOM_TestAll.py
anObj = self.BoolOp.MakeBoolean(theShape1, theShape2, theOperation)
RaiseIfFailed("MakeBoolean", self.BoolOp)
+ def_names = { 1: "common", 2: "cut", 3: "fuse", 4: "section" }
+ self._autoPublish(anObj, theName, def_names[theOperation])
return anObj
## Perform Common boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2"
- def MakeCommon(self, theShape1, theShape2):
+ def MakeCommon(self, theShape1, theShape2, theName=None):
"""
Perform Common boolean operation on two given shapes.
Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
- return self.MakeBoolean(theShape1, theShape2, 1)
+ # note: auto-publishing is done in self.MakeBoolean()
+ return self.MakeBoolean(theShape1, theShape2, 1, theName)
## Perform Cut boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2"
- def MakeCut(self, theShape1, theShape2):
+ def MakeCut(self, theShape1, theShape2, theName=None):
"""
Perform Cut boolean operation on two given shapes.
Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
- return self.MakeBoolean(theShape1, theShape2, 2)
+ # note: auto-publishing is done in self.MakeBoolean()
+ return self.MakeBoolean(theShape1, theShape2, 2, theName)
## Perform Fuse boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2"
- def MakeFuse(self, theShape1, theShape2):
+ def MakeFuse(self, theShape1, theShape2, theName=None):
"""
Perform Fuse boolean operation on two given shapes.
Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
- return self.MakeBoolean(theShape1, theShape2, 3)
+ # note: auto-publishing is done in self.MakeBoolean()
+ return self.MakeBoolean(theShape1, theShape2, 3, theName)
## Perform Section boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_section "Example 1"
# \n @ref swig_MakeCommon "Example 2"
- def MakeSection(self, theShape1, theShape2):
+ def MakeSection(self, theShape1, theShape2, theName=None):
"""
Perform Section boolean operation on two given shapes.
Parameters:
theShape1 First argument for boolean operation.
theShape2 Second argument for boolean operation.
-
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
Returns:
New GEOM.GEOM_Object, containing the result shape.
"""
# Example: see GEOM_TestOthers.py
- return self.MakeBoolean(theShape1, theShape2, 4)
+ # note: auto-publishing is done in self.MakeBoolean()
+ return self.MakeBoolean(theShape1, theShape2, 4, theName)
# end of l3_boolean
## @}
# target type (equal to Limit) are kept in the result,
# else standalone shapes of lower dimension
# are kept also (if they exist).
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @note Each compound from ListShapes and ListTools will be exploded
# in order to avoid possible intersection between shapes from this compound.
#
# @ref tui_partition "Example"
def MakePartition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
- KeepNonlimitShapes=0):
+ KeepNonlimitShapes=0, theName=None):
"""
Perform partition operation.
target type (equal to Limit) are kept in the result,
else standalone shapes of lower dimension
are kept also (if they exist).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Each compound from ListShapes and ListTools will be exploded
in order to avoid possible intersection between shapes from
Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes);
RaiseIfFailed("MakePartition", self.BoolOp)
+ self._autoPublish(anObj, theName, "partition")
return anObj
## Perform partition operation.
def MakePartitionNonSelfIntersectedShape(self, ListShapes, ListTools=[],
ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0,
- ListMaterials=[], KeepNonlimitShapes=0):
+ ListMaterials=[], KeepNonlimitShapes=0,
+ theName=None):
"""
Perform partition operation.
This method may be useful if it is needed to make a partition for
Limit, RemoveWebs, ListMaterials,
KeepNonlimitShapes);
RaiseIfFailed("MakePartitionNonSelfIntersectedShape", self.BoolOp)
+ self._autoPublish(anObj, theName, "partition")
return anObj
## See method MakePartition() for more information.
# \n @ref swig_Partition "Example 2"
def Partition(self, ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["AUTO"], RemoveWebs=0, ListMaterials=[],
- KeepNonlimitShapes=0):
+ KeepNonlimitShapes=0, theName=None):
"""
See method geompy.MakePartition for more information.
"""
# Example: see GEOM_TestOthers.py
+ # note: auto-publishing is done in self.MakePartition()
anObj = self.MakePartition(ListShapes, ListTools,
ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials,
- KeepNonlimitShapes);
+ KeepNonlimitShapes, theName);
return anObj
## Perform partition of the Shape with the Plane
# @param theShape Shape to be intersected.
# @param thePlane Tool shape, to intersect theShape.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_partition "Example"
- def MakeHalfPartition(self,theShape, thePlane):
+ def MakeHalfPartition(self, theShape, thePlane, theName=None):
"""
Perform partition of the Shape with the Plane
Parameters:
theShape Shape to be intersected.
thePlane Tool shape, to intersect theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
# Example: see GEOM_TestAll.py
anObj = self.BoolOp.MakeHalfPartition(theShape, thePlane)
RaiseIfFailed("MakeHalfPartition", self.BoolOp)
+ self._autoPublish(anObj, theName, "partition")
return anObj
# end of l3_basic_op
## @addtogroup l3_transform
## @{
+ ## Translate the given object along the vector, specified
+ # by its end points.
+ # @param theObject The object to be translated.
+ # @param thePoint1 Start point of translation vector.
+ # @param thePoint2 End point of translation vector.
+ # @param theCopy Flag used to translate object itself or create a copy.
+ # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
+ def TranslateTwoPoints(self, theObject, thePoint1, thePoint2, theCopy=False):
+ """
+ Translate the given object along the vector, specified by its end points.
+
+ Parameters:
+ theObject The object to be translated.
+ thePoint1 Start point of translation vector.
+ thePoint2 End point of translation vector.
+ theCopy Flag used to translate object itself or create a copy.
+
+ Returns:
+ Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
+ """
+ if theCopy:
+ anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
+ else:
+ anObj = self.TrsfOp.TranslateTwoPoints(theObject, thePoint1, thePoint2)
+ RaiseIfFailed("TranslateTwoPoints", self.TrsfOp)
+ return anObj
+
## Translate the given object along the vector, specified
# by its end points, creating its copy before the translation.
# @param theObject The object to be translated.
# @param thePoint1 Start point of translation vector.
# @param thePoint2 End point of translation vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the translated object.
#
# @ref tui_translation "Example 1"
# \n @ref swig_MakeTranslationTwoPoints "Example 2"
- def MakeTranslationTwoPoints(self,theObject, thePoint1, thePoint2):
+ def MakeTranslationTwoPoints(self, theObject, thePoint1, thePoint2, theName=None):
"""
Translate the given object along the vector, specified
by its end points, creating its copy before the translation.
theObject The object to be translated.
thePoint1 Start point of translation vector.
thePoint2 End point of translation vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the translated object.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.TranslateTwoPointsCopy(theObject, thePoint1, thePoint2)
RaiseIfFailed("TranslateTwoPointsCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "translated")
return anObj
## Translate the given object along the vector, specified by its components.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
- # @return Translated GEOM.GEOM_Object.
+ # @param theCopy Flag used to translate object itself or create a copy.
+ # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
#
# @ref tui_translation "Example"
- def TranslateDXDYDZ(self,theObject, theDX, theDY, theDZ):
+ def TranslateDXDYDZ(self, theObject, theDX, theDY, theDZ, theCopy=False):
"""
Translate the given object along the vector, specified by its components.
Parameters:
theObject The object to be translated.
theDX,theDY,theDZ Components of translation vector.
+ theCopy Flag used to translate object itself or create a copy.
Returns:
- Translated GEOM.GEOM_Object.
+ Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
"""
# Example: see GEOM_TestAll.py
theDX, theDY, theDZ, Parameters = ParseParameters(theDX, theDY, theDZ)
- anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
+ if theCopy:
+ anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
+ else:
+ anObj = self.TrsfOp.TranslateDXDYDZ(theObject, theDX, theDY, theDZ)
anObj.SetParameters(Parameters)
RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
return anObj
# by its components, creating its copy before the translation.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the translated object.
#
# @ref tui_translation "Example"
- def MakeTranslation(self,theObject, theDX, theDY, theDZ):
+ def MakeTranslation(self,theObject, theDX, theDY, theDZ, theName=None):
"""
Translate the given object along the vector, specified
by its components, creating its copy before the translation.
Parameters:
theObject The object to be translated.
theDX,theDY,theDZ Components of translation vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the translated object.
anObj = self.TrsfOp.TranslateDXDYDZCopy(theObject, theDX, theDY, theDZ)
anObj.SetParameters(Parameters)
RaiseIfFailed("TranslateDXDYDZ", self.TrsfOp)
+ self._autoPublish(anObj, theName, "translated")
return anObj
- ## Translate the given object along the given vector,
- # creating its copy before the translation.
+ ## Translate the given object along the given vector.
# @param theObject The object to be translated.
# @param theVector The translation vector.
- # @return New GEOM.GEOM_Object, containing the translated object.
- #
+ # @param theCopy Flag used to translate object itself or create a copy.
+ # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
+ def TranslateVector(self, theObject, theVector, theCopy=False):
+ """
+ Translate the given object along the given vector.
+
+ Parameters:
+ theObject The object to be translated.
+ theVector The translation vector.
+ theCopy Flag used to translate object itself or create a copy.
+
+ Returns:
+ Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
+ """
+ if theCopy:
+ anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
+ else:
+ anObj = self.TrsfOp.TranslateVector(theObject, theVector)
+ RaiseIfFailed("TranslateVector", self.TrsfOp)
+ return anObj
+
+ ## Translate the given object along the given vector,
+ # creating its copy before the translation.
+ # @param theObject The object to be translated.
+ # @param theVector The translation vector.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the translated object.
+ #
# @ref tui_translation "Example"
- def MakeTranslationVector(self,theObject, theVector):
+ def MakeTranslationVector(self, theObject, theVector, theName=None):
"""
Translate the given object along the given vector,
creating its copy before the translation.
Parameters:
theObject The object to be translated.
theVector The translation vector.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the translated object.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.TranslateVectorCopy(theObject, theVector)
RaiseIfFailed("TranslateVectorCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "translated")
return anObj
## Translate the given object along the given vector on given distance.
# @param theVector The translation vector.
# @param theDistance The translation distance.
# @param theCopy Flag used to translate object itself or create a copy.
- # @return New GEOM.GEOM_Object, containing the translated object.
+ # @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
#
# @ref tui_translation "Example"
- def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy):
+ def TranslateVectorDistance(self, theObject, theVector, theDistance, theCopy=False):
"""
Translate the given object along the given vector on given distance.
theCopy Flag used to translate object itself or create a copy.
Returns:
- New GEOM.GEOM_Object, containing the translated object.
+ Translated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the translated object if theCopy flag is True.
"""
# Example: see GEOM_TestAll.py
theDistance,Parameters = ParseParameters(theDistance)
# @param theObject The object to be translated.
# @param theVector The translation vector.
# @param theDistance The translation distance.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the translated object.
#
# @ref tui_translation "Example"
- def MakeTranslationVectorDistance(self, theObject, theVector, theDistance):
+ def MakeTranslationVectorDistance(self, theObject, theVector, theDistance, theName=None):
"""
Translate the given object along the given vector on given distance,
creating its copy before the translation.
theObject The object to be translated.
theVector The translation vector.
theDistance The translation distance.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the translated object.
anObj = self.TrsfOp.TranslateVectorDistance(theObject, theVector, theDistance, 1)
RaiseIfFailed("TranslateVectorDistance", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "translated")
return anObj
## Rotate the given object around the given axis on the given angle.
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
- # @return New GEOM.GEOM_Object, containing the rotated object.
+ # @param theCopy Flag used to rotate object itself or create a copy.
+ #
+ # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
#
# @ref tui_rotation "Example"
- def Rotate(self,theObject, theAxis, theAngle):
+ def Rotate(self, theObject, theAxis, theAngle, theCopy=False):
"""
Rotate the given object around the given axis on the given angle.
theObject The object to be rotated.
theAxis Rotation axis.
theAngle Rotation angle in radians.
+ theCopy Flag used to rotate object itself or create a copy.
- Returns:
- New GEOM.GEOM_Object, containing the rotated object.
+ Returns:
+ Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
"""
# Example: see GEOM_TestAll.py
flag = False
theAngle, Parameters = ParseParameters(theAngle)
if flag:
theAngle = theAngle*math.pi/180.0
- anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
- RaiseIfFailed("RotateCopy", self.TrsfOp)
+ if theCopy:
+ anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
+ else:
+ anObj = self.TrsfOp.Rotate(theObject, theAxis, theAngle)
+ RaiseIfFailed("Rotate", self.TrsfOp)
anObj.SetParameters(Parameters)
return anObj
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the rotated object.
#
# @ref tui_rotation "Example"
- def MakeRotation(self,theObject, theAxis, theAngle):
+ def MakeRotation(self, theObject, theAxis, theAngle, theName=None):
"""
Rotate the given object around the given axis
on the given angle, creating its copy before the rotatation.
theObject The object to be rotated.
theAxis Rotation axis.
theAngle Rotation angle in radians.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the rotated object.
anObj = self.TrsfOp.RotateCopy(theObject, theAxis, theAngle)
RaiseIfFailed("RotateCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "rotated")
+ return anObj
+
+ ## Rotate given object around vector perpendicular to plane
+ # containing three points.
+ # @param theObject The object to be rotated.
+ # @param theCentPoint central point the axis is the vector perpendicular to the plane
+ # containing the three points.
+ # @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
+ # @param theCopy Flag used to rotate object itself or create a copy.
+ # @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
+ def RotateThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theCopy=False):
+ """
+ Rotate given object around vector perpendicular to plane
+ containing three points.
+
+ Parameters:
+ theObject The object to be rotated.
+ theCentPoint central point the axis is the vector perpendicular to the plane
+ containing the three points.
+ thePoint1,thePoint2 points in a perpendicular plane of the axis.
+ theCopy Flag used to rotate object itself or create a copy.
+
+ Returns:
+ Rotated theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the rotated object if theCopy flag is True.
+ """
+ if theCopy:
+ anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
+ else:
+ anObj = self.TrsfOp.RotateThreePoints(theObject, theCentPoint, thePoint1, thePoint2)
+ RaiseIfFailed("RotateThreePoints", self.TrsfOp)
return anObj
## Rotate given object around vector perpendicular to plane
# @param theCentPoint central point the axis is the vector perpendicular to the plane
# containing the three points.
# @param thePoint1,thePoint2 in a perpendicular plane of the axis.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the rotated object.
#
# @ref tui_rotation "Example"
- def MakeRotationThreePoints(self,theObject, theCentPoint, thePoint1, thePoint2):
+ def MakeRotationThreePoints(self, theObject, theCentPoint, thePoint1, thePoint2, theName=None):
"""
Rotate given object around vector perpendicular to plane
containing three points, creating its copy before the rotatation.
theCentPoint central point the axis is the vector perpendicular to the plane
containing the three points.
thePoint1,thePoint2 in a perpendicular plane of the axis.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the rotated object.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.RotateThreePointsCopy(theObject, theCentPoint, thePoint1, thePoint2)
RaiseIfFailed("RotateThreePointsCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "rotated")
+ return anObj
+
+ ## Scale the given object by the specified factor.
+ # @param theObject The object to be scaled.
+ # @param thePoint Center point for scaling.
+ # Passing None for it means scaling relatively the origin of global CS.
+ # @param theFactor Scaling factor value.
+ # @param theCopy Flag used to scale object itself or create a copy.
+ # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
+ def Scale(self, theObject, thePoint, theFactor, theCopy=False):
+ """
+ Scale the given object by the specified factor.
+
+ Parameters:
+ theObject The object to be scaled.
+ thePoint Center point for scaling.
+ Passing None for it means scaling relatively the origin of global CS.
+ theFactor Scaling factor value.
+ theCopy Flag used to scale object itself or create a copy.
+
+ Returns:
+ Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
+ """
+ # Example: see GEOM_TestAll.py
+ theFactor, Parameters = ParseParameters(theFactor)
+ if theCopy:
+ anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
+ else:
+ anObj = self.TrsfOp.ScaleShape(theObject, thePoint, theFactor)
+ RaiseIfFailed("Scale", self.TrsfOp)
+ anObj.SetParameters(Parameters)
return anObj
## Scale the given object by the factor, creating its copy before the scaling.
# @param thePoint Center point for scaling.
# Passing None for it means scaling relatively the origin of global CS.
# @param theFactor Scaling factor value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the scaled shape.
#
# @ref tui_scale "Example"
- def MakeScaleTransform(self, theObject, thePoint, theFactor):
+ def MakeScaleTransform(self, theObject, thePoint, theFactor, theName=None):
"""
Scale the given object by the factor, creating its copy before the scaling.
thePoint Center point for scaling.
Passing None for it means scaling relatively the origin of global CS.
theFactor Scaling factor value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the scaled shape.
anObj = self.TrsfOp.ScaleShapeCopy(theObject, thePoint, theFactor)
RaiseIfFailed("ScaleShapeCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "scaled")
+ return anObj
+
+ ## Scale the given object by different factors along coordinate axes.
+ # @param theObject The object to be scaled.
+ # @param thePoint Center point for scaling.
+ # Passing None for it means scaling relatively the origin of global CS.
+ # @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
+ # @param theCopy Flag used to scale object itself or create a copy.
+ # @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
+ def ScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theCopy=False):
+ """
+ Scale the given object by different factors along coordinate axes.
+
+ Parameters:
+ theObject The object to be scaled.
+ thePoint Center point for scaling.
+ Passing None for it means scaling relatively the origin of global CS.
+ theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
+ theCopy Flag used to scale object itself or create a copy.
+
+ Returns:
+ Scaled theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the scaled object if theCopy flag is True.
+ """
+ # Example: see GEOM_TestAll.py
+ theFactorX, theFactorY, theFactorZ, Parameters = ParseParameters(theFactorX, theFactorY, theFactorZ)
+ if theCopy:
+ anObj = self.TrsfOp.ScaleShapeAlongAxesCopy(theObject, thePoint,
+ theFactorX, theFactorY, theFactorZ)
+ else:
+ anObj = self.TrsfOp.ScaleShapeAlongAxes(theObject, thePoint,
+ theFactorX, theFactorY, theFactorZ)
+ RaiseIfFailed("ScaleAlongAxes", self.TrsfOp)
+ anObj.SetParameters(Parameters)
return anObj
## Scale the given object by different factors along coordinate axes,
# @param thePoint Center point for scaling.
# Passing None for it means scaling relatively the origin of global CS.
# @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the scaled shape.
#
# @ref swig_scale "Example"
- def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ):
+ def MakeScaleAlongAxes(self, theObject, thePoint, theFactorX, theFactorY, theFactorZ, theName=None):
"""
Scale the given object by different factors along coordinate axes,
creating its copy before the scaling.
thePoint Center point for scaling.
Passing None for it means scaling relatively the origin of global CS.
theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the scaled shape.
theFactorX, theFactorY, theFactorZ)
RaiseIfFailed("MakeScaleAlongAxes", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "scaled")
+ return anObj
+
+ ## Mirror an object relatively the given plane.
+ # @param theObject The object to be mirrored.
+ # @param thePlane Plane of symmetry.
+ # @param theCopy Flag used to mirror object itself or create a copy.
+ # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
+ def MirrorByPlane(self, theObject, thePlane, theCopy=False):
+ """
+ Mirror an object relatively the given plane.
+
+ Parameters:
+ theObject The object to be mirrored.
+ thePlane Plane of symmetry.
+ theCopy Flag used to mirror object itself or create a copy.
+
+ Returns:
+ Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
+ """
+ if theCopy:
+ anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
+ else:
+ anObj = self.TrsfOp.MirrorPlane(theObject, thePlane)
+ RaiseIfFailed("MirrorByPlane", self.TrsfOp)
return anObj
## Create an object, symmetrical
# to the given one relatively the given plane.
# @param theObject The object to be mirrored.
# @param thePlane Plane of symmetry.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the mirrored shape.
#
# @ref tui_mirror "Example"
- def MakeMirrorByPlane(self,theObject, thePlane):
+ def MakeMirrorByPlane(self, theObject, thePlane, theName=None):
"""
Create an object, symmetrical to the given one relatively the given plane.
Parameters:
theObject The object to be mirrored.
thePlane Plane of symmetry.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the mirrored shape.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.MirrorPlaneCopy(theObject, thePlane)
RaiseIfFailed("MirrorPlaneCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "mirrored")
+ return anObj
+
+ ## Mirror an object relatively the given axis.
+ # @param theObject The object to be mirrored.
+ # @param theAxis Axis of symmetry.
+ # @param theCopy Flag used to mirror object itself or create a copy.
+ # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
+ def MirrorByAxis(self, theObject, theAxis, theCopy=False):
+ """
+ Mirror an object relatively the given axis.
+
+ Parameters:
+ theObject The object to be mirrored.
+ theAxis Axis of symmetry.
+ theCopy Flag used to mirror object itself or create a copy.
+
+ Returns:
+ Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
+ """
+ if theCopy:
+ anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
+ else:
+ anObj = self.TrsfOp.MirrorAxis(theObject, theAxis)
+ RaiseIfFailed("MirrorByAxis", self.TrsfOp)
return anObj
## Create an object, symmetrical
# to the given one relatively the given axis.
# @param theObject The object to be mirrored.
# @param theAxis Axis of symmetry.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the mirrored shape.
#
# @ref tui_mirror "Example"
- def MakeMirrorByAxis(self,theObject, theAxis):
+ def MakeMirrorByAxis(self, theObject, theAxis, theName=None):
"""
Create an object, symmetrical to the given one relatively the given axis.
Parameters:
theObject The object to be mirrored.
theAxis Axis of symmetry.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the mirrored shape.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.MirrorAxisCopy(theObject, theAxis)
RaiseIfFailed("MirrorAxisCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "mirrored")
+ return anObj
+
+ ## Mirror an object relatively the given point.
+ # @param theObject The object to be mirrored.
+ # @param thePoint Point of symmetry.
+ # @param theCopy Flag used to mirror object itself or create a copy.
+ # @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
+ def MirrorByPoint(self, theObject, thePoint, theCopy=False):
+ """
+ Mirror an object relatively the given point.
+
+ Parameters:
+ theObject The object to be mirrored.
+ thePoint Point of symmetry.
+ theCopy Flag used to mirror object itself or create a copy.
+
+ Returns:
+ Mirrored theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the mirrored object if theCopy flag is True.
+ """
+ # Example: see GEOM_TestAll.py
+ if theCopy:
+ anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
+ else:
+ anObj = self.TrsfOp.MirrorPoint(theObject, thePoint)
+ RaiseIfFailed("MirrorByPoint", self.TrsfOp)
return anObj
## Create an object, symmetrical
# to the given one relatively the given point.
# @param theObject The object to be mirrored.
# @param thePoint Point of symmetry.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the mirrored shape.
#
# @ref tui_mirror "Example"
- def MakeMirrorByPoint(self,theObject, thePoint):
+ def MakeMirrorByPoint(self, theObject, thePoint, theName=None):
"""
Create an object, symmetrical
to the given one relatively the given point.
Parameters:
theObject The object to be mirrored.
thePoint Point of symmetry.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the mirrored shape.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.MirrorPointCopy(theObject, thePoint)
RaiseIfFailed("MirrorPointCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "mirrored")
+ return anObj
+
+ ## Modify the location of the given object.
+ # @param theObject The object to be displaced.
+ # @param theStartLCS Coordinate system to perform displacement from it.\n
+ # If \a theStartLCS is NULL, displacement
+ # will be performed from global CS.\n
+ # If \a theObject itself is used as \a theStartLCS,
+ # its location will be changed to \a theEndLCS.
+ # @param theEndLCS Coordinate system to perform displacement to it.
+ # @param theCopy Flag used to displace object itself or create a copy.
+ # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
+ def Position(self, theObject, theStartLCS, theEndLCS, theCopy=False):
+ """
+ Modify the Location of the given object by LCS, creating its copy before the setting.
+
+ Parameters:
+ theObject The object to be displaced.
+ theStartLCS Coordinate system to perform displacement from it.
+ If theStartLCS is NULL, displacement
+ will be performed from global CS.
+ If theObject itself is used as theStartLCS,
+ its location will be changed to theEndLCS.
+ theEndLCS Coordinate system to perform displacement to it.
+ theCopy Flag used to displace object itself or create a copy.
+
+ Returns:
+ Displaced theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the displaced object if theCopy flag is True.
+ """
+ # Example: see GEOM_TestAll.py
+ if theCopy:
+ anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
+ else:
+ anObj = self.TrsfOp.PositionShape(theObject, theStartLCS, theEndLCS)
+ RaiseIfFailed("Displace", self.TrsfOp)
return anObj
## Modify the Location of the given object by LCS,
# If \a theObject itself is used as \a theStartLCS,
# its location will be changed to \a theEndLCS.
# @param theEndLCS Coordinate system to perform displacement to it.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the displaced shape.
#
# @ref tui_modify_location "Example"
- def MakePosition(self,theObject, theStartLCS, theEndLCS):
+ def MakePosition(self, theObject, theStartLCS, theEndLCS, theName=None):
"""
Modify the Location of the given object by LCS, creating its copy before the setting.
If theObject itself is used as theStartLCS,
its location will be changed to theEndLCS.
theEndLCS Coordinate system to perform displacement to it.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the displaced shape.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.PositionShapeCopy(theObject, theStartLCS, theEndLCS)
RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "displaced")
return anObj
- ## Modify the Location of the given object by Path,
+ ## Modify the Location of the given object by Path.
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
# @param theCopy is to create a copy objects if true.
# @param theReverse 0 - for usual direction, 1 - to reverse path direction.
- # @return New GEOM.GEOM_Object, containing the displaced shape.
+ # @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
+ # new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
#
# @ref tui_modify_location "Example"
def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
"""
- Modify the Location of the given object by Path
+ Modify the Location of the given object by Path.
Parameters:
theObject The object to be displaced.
theReverse 0 - for usual direction, 1 - to reverse path direction.
Returns:
- New GEOM.GEOM_Object, containing the displaced shape.
+ Displaced theObject (GEOM.GEOM_Object) if theCopy is False or
+ new GEOM.GEOM_Object, containing the displaced shape if theCopy is True.
Example of usage:
position = geompy.PositionAlongPath(cylinder, circle, 0.75, 1, 1)
RaiseIfFailed("PositionAlongPath", self.TrsfOp)
return anObj
+ ## Modify the Location of the given object by Path, creating its copy before the operation.
+ # @param theObject The object to be displaced.
+ # @param thePath Wire or Edge along that the object will be translated.
+ # @param theDistance progress of Path (0 = start location, 1 = end of path location).
+ # @param theReverse 0 - for usual direction, 1 - to reverse path direction.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the displaced shape.
+ def MakePositionAlongPath(self, theObject, thePath, theDistance, theReverse, theName=None):
+ """
+ Modify the Location of the given object by Path, creating its copy before the operation.
+
+ Parameters:
+ theObject The object to be displaced.
+ thePath Wire or Edge along that the object will be translated.
+ theDistance progress of Path (0 = start location, 1 = end of path location).
+ theReverse 0 - for usual direction, 1 - to reverse path direction.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the displaced shape.
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, 1, theReverse)
+ RaiseIfFailed("PositionAlongPath", self.TrsfOp)
+ self._autoPublish(anObj, theName, "displaced")
+ return anObj
+
+ ## Offset given shape.
+ # @param theObject The base object for the offset.
+ # @param theOffset Offset value.
+ # @param theCopy Flag used to offset object itself or create a copy.
+ # @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
+ # new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
+ def Offset(self, theObject, theOffset, theCopy=False):
+ """
+ Offset given shape.
+
+ Parameters:
+ theObject The base object for the offset.
+ theOffset Offset value.
+ theCopy Flag used to offset object itself or create a copy.
+
+ Returns:
+ Modified theObject (GEOM.GEOM_Object) if theCopy flag is False (default) or
+ new GEOM.GEOM_Object, containing the result of offset operation if theCopy flag is True.
+ """
+ theOffset, Parameters = ParseParameters(theOffset)
+ if theCopy:
+ anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
+ else:
+ anObj = self.TrsfOp.OffsetShape(theObject, theOffset)
+ RaiseIfFailed("Offset", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
## Create new object as offset of the given one.
# @param theObject The base object for the offset.
# @param theOffset Offset value.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the offset object.
#
# @ref tui_offset "Example"
- def MakeOffset(self,theObject, theOffset):
+ def MakeOffset(self, theObject, theOffset, theName=None):
"""
Create new object as offset of the given one.
Parameters:
theObject The base object for the offset.
theOffset Offset value.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the offset object.
anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "offset")
return anObj
## Create new object as projection of the given one on a 2D surface.
# @param theSource The source object for the projection. It can be a point, edge or wire.
# @param theTarget The target object. It can be planar or cylindrical face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the projection.
#
# @ref tui_projection "Example"
- def MakeProjection(self, theSource, theTarget):
+ def MakeProjection(self, theSource, theTarget, theName=None):
"""
Create new object as projection of the given one on a 2D surface.
Parameters:
theSource The source object for the projection. It can be a point, edge or wire.
theTarget The target object. It can be planar or cylindrical face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the projection.
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.ProjectShapeCopy(theSource, theTarget)
RaiseIfFailed("ProjectShapeCopy", self.TrsfOp)
+ self._autoPublish(anObj, theName, "projection")
return anObj
# -----------------------------------------------------------------------------
## Translate the given object along the given vector a given number times
# @param theObject The object to be translated.
- # @param theVector Direction of the translation.
+ # @param theVector Direction of the translation. DX if None.
# @param theStep Distance to translate on.
# @param theNbTimes Quantity of translations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing compound of all
# the shapes, obtained after each translation.
#
# @ref tui_multi_translation "Example"
- def MakeMultiTranslation1D(self,theObject, theVector, theStep, theNbTimes):
+ def MakeMultiTranslation1D(self, theObject, theVector, theStep, theNbTimes, theName=None):
"""
Translate the given object along the given vector a given number times
Parameters:
theObject The object to be translated.
- theVector Direction of the translation.
+ theVector Direction of the translation. DX if None.
theStep Distance to translate on.
theNbTimes Quantity of translations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing compound of all
anObj = self.TrsfOp.MultiTranslate1D(theObject, theVector, theStep, theNbTimes)
RaiseIfFailed("MultiTranslate1D", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multitranslation")
return anObj
## Conseqently apply two specified translations to theObject specified number of times.
# @param theObject The object to be translated.
- # @param theVector1 Direction of the first translation.
+ # @param theVector1 Direction of the first translation. DX if None.
# @param theStep1 Step of the first translation.
# @param theNbTimes1 Quantity of translations to be done along theVector1.
- # @param theVector2 Direction of the second translation.
+ # @param theVector2 Direction of the second translation. DY if None.
# @param theStep2 Step of the second translation.
# @param theNbTimes2 Quantity of translations to be done along theVector2.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing compound of all
# the shapes, obtained after each translation.
#
# @ref tui_multi_translation "Example"
- def MakeMultiTranslation2D(self,theObject, theVector1, theStep1, theNbTimes1,
- theVector2, theStep2, theNbTimes2):
+ def MakeMultiTranslation2D(self, theObject, theVector1, theStep1, theNbTimes1,
+ theVector2, theStep2, theNbTimes2, theName=None):
"""
Conseqently apply two specified translations to theObject specified number of times.
Parameters:
theObject The object to be translated.
- theVector1 Direction of the first translation.
+ theVector1 Direction of the first translation. DX if None.
theStep1 Step of the first translation.
theNbTimes1 Quantity of translations to be done along theVector1.
- theVector2 Direction of the second translation.
+ theVector2 Direction of the second translation. DY if None.
theStep2 Step of the second translation.
theNbTimes2 Quantity of translations to be done along theVector2.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing compound of all
theVector2, theStep2, theNbTimes2)
RaiseIfFailed("MultiTranslate2D", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multitranslation")
return anObj
## Rotate the given object around the given axis a given number times.
# Rotation angle will be 2*PI/theNbTimes.
# @param theObject The object to be rotated.
- # @param theAxis The rotation axis.
+ # @param theAxis The rotation axis. DZ if None.
# @param theNbTimes Quantity of rotations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing compound of all the
# shapes, obtained after each rotation.
#
# @ref tui_multi_rotation "Example"
- def MultiRotate1D(self,theObject, theAxis, theNbTimes):
+ def MultiRotate1DNbTimes (self, theObject, theAxis, theNbTimes, theName=None):
"""
Rotate the given object around the given axis a given number times.
Rotation angle will be 2*PI/theNbTimes.
Parameters:
theObject The object to be rotated.
- theAxis The rotation axis.
+ theAxis The rotation axis. DZ if None.
theNbTimes Quantity of rotations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing compound of all the
shapes, obtained after each rotation.
Example of usage:
- rot1d = geompy.MultiRotate1D(prism, vect, 4)
+ rot1d = geompy.MultiRotate1DNbTimes(prism, vect, 4)
"""
# Example: see GEOM_TestAll.py
- theAxis, theNbTimes, Parameters = ParseParameters(theAxis, theNbTimes)
+ theNbTimes, Parameters = ParseParameters(theNbTimes)
anObj = self.TrsfOp.MultiRotate1D(theObject, theAxis, theNbTimes)
- RaiseIfFailed("MultiRotate1D", self.TrsfOp)
+ RaiseIfFailed("MultiRotate1DNbTimes", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## Rotate the given object around the given axis
+ # a given number times on the given angle.
+ # @param theObject The object to be rotated.
+ # @param theAxis The rotation axis. DZ if None.
+ # @param theAngleStep Rotation angle in radians.
+ # @param theNbTimes Quantity of rotations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing compound of all the
+ # shapes, obtained after each rotation.
+ #
+ # @ref tui_multi_rotation "Example"
+ def MultiRotate1DByStep(self, theObject, theAxis, theAngleStep, theNbTimes, theName=None):
+ """
+ Rotate the given object around the given axis
+ a given number times on the given angle.
+
+ Parameters:
+ theObject The object to be rotated.
+ theAxis The rotation axis. DZ if None.
+ theAngleStep Rotation angle in radians.
+ theNbTimes Quantity of rotations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing compound of all the
+ shapes, obtained after each rotation.
+
+ Example of usage:
+ rot1d = geompy.MultiRotate1DByStep(prism, vect, math.pi/4, 4)
+ """
+ # Example: see GEOM_TestAll.py
+ theAngleStep, theNbTimes, Parameters = ParseParameters(theAngleStep, theNbTimes)
+ anObj = self.TrsfOp.MultiRotate1DByStep(theObject, theAxis, theAngleStep, theNbTimes)
+ RaiseIfFailed("MultiRotate1DByStep", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## Rotate the given object around the given axis a given
+ # number times and multi-translate each rotation result.
+ # Rotation angle will be 2*PI/theNbTimes1.
+ # Translation direction passes through center of gravity
+ # of rotated shape and its projection on the rotation axis.
+ # @param theObject The object to be rotated.
+ # @param theAxis Rotation axis. DZ if None.
+ # @param theNbTimes1 Quantity of rotations to be done.
+ # @param theRadialStep Translation distance.
+ # @param theNbTimes2 Quantity of translations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing compound of all the
+ # shapes, obtained after each transformation.
+ #
+ # @ref tui_multi_rotation "Example"
+ def MultiRotate2DNbTimes(self, theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
+ """
+ Rotate the given object around the
+ given axis on the given angle a given number
+ times and multi-translate each rotation result.
+ Translation direction passes through center of gravity
+ of rotated shape and its projection on the rotation axis.
+
+ Parameters:
+ theObject The object to be rotated.
+ theAxis Rotation axis. DZ if None.
+ theNbTimes1 Quantity of rotations to be done.
+ theRadialStep Translation distance.
+ theNbTimes2 Quantity of translations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing compound of all the
+ shapes, obtained after each transformation.
+
+ Example of usage:
+ rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
+ """
+ # Example: see GEOM_TestAll.py
+ theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theNbTimes1, theRadialStep, theNbTimes2)
+ anObj = self.TrsfOp.MultiRotate2DNbTimes(theObject, theAxis, theNbTimes1, theRadialStep, theNbTimes2)
+ RaiseIfFailed("MultiRotate2DNbTimes", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
return anObj
## Rotate the given object around the
# Translation direction passes through center of gravity
# of rotated shape and its projection on the rotation axis.
# @param theObject The object to be rotated.
- # @param theAxis Rotation axis.
- # @param theAngle Rotation angle in graduces.
+ # @param theAxis Rotation axis. DZ if None.
+ # @param theAngleStep Rotation angle in radians.
# @param theNbTimes1 Quantity of rotations to be done.
- # @param theStep Translation distance.
+ # @param theRadialStep Translation distance.
# @param theNbTimes2 Quantity of translations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing compound of all the
# shapes, obtained after each transformation.
#
# @ref tui_multi_rotation "Example"
- def MultiRotate2D(self,theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2):
+ def MultiRotate2DByStep (self, theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, theName=None):
"""
Rotate the given object around the
given axis on the given angle a given number
Parameters:
theObject The object to be rotated.
- theAxis Rotation axis.
- theAngle Rotation angle in graduces.
+ theAxis Rotation axis. DZ if None.
+ theAngleStep Rotation angle in radians.
theNbTimes1 Quantity of rotations to be done.
- theStep Translation distance.
+ theRadialStep Translation distance.
theNbTimes2 Quantity of translations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing compound of all the
shapes, obtained after each transformation.
Example of usage:
- rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
+ rot2d = geompy.MultiRotate2D(prism, vect, math.pi/3, 4, 50, 5)
"""
# Example: see GEOM_TestAll.py
- theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
- anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
- RaiseIfFailed("MultiRotate2D", self.TrsfOp)
+ theAngleStep, theNbTimes1, theRadialStep, theNbTimes2, Parameters = ParseParameters(theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
+ anObj = self.TrsfOp.MultiRotate2DByStep(theObject, theAxis, theAngleStep, theNbTimes1, theRadialStep, theNbTimes2)
+ RaiseIfFailed("MultiRotate2DByStep", self.TrsfOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
return anObj
- ## The same, as MultiRotate1D(), but axis is given by direction and point
+ ## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation1DNbTimes(self, aShape, aDir, aPoint, aNbTimes, theName=None):
+ """
+ The same, as geompy.MultiRotate1DNbTimes, but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot1D = geompy.MakeMultiRotation1DNbTimes(prism, vy, pz, 6)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate1D()
+ anObj = self.MultiRotate1DNbTimes(aShape, aVec, aNbTimes, theName)
+ return anObj
+
+ ## The same, as MultiRotate1DByStep(), but axis is given by direction and point
#
# @ref swig_MakeMultiRotation "Example"
- def MakeMultiRotation1D(self,aShape,aDir,aPoint,aNbTimes):
+ def MakeMultiRotation1DByStep(self, aShape, aDir, aPoint, anAngle, aNbTimes, theName=None):
"""
The same, as geompy.MultiRotate1D, but axis is given by direction and point
Example of usage:
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
- MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
+ MultiRot1D = geompy.MakeMultiRotation1DByStep(prism, vy, pz, math.pi/3, 6)
"""
# Example: see GEOM_TestOthers.py
aVec = self.MakeLine(aPoint,aDir)
- anObj = self.MultiRotate1D(aShape,aVec,aNbTimes)
+ # note: auto-publishing is done in self.MultiRotate1D()
+ anObj = self.MultiRotate1DByStep(aShape, aVec, anAngle, aNbTimes, theName)
return anObj
- ## The same, as MultiRotate2D(), but axis is given by direction and point
+ ## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
#
# @ref swig_MakeMultiRotation "Example"
- def MakeMultiRotation2D(self,aShape,aDir,aPoint,anAngle,nbtimes1,aStep,nbtimes2):
+ def MakeMultiRotation2DNbTimes(self, aShape, aDir, aPoint, nbtimes1, aStep, nbtimes2, theName=None):
"""
- The same, as MultiRotate2D(), but axis is given by direction and point
+ The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
Example of usage:
pz = geompy.MakeVertex(0, 0, 100)
vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
- MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
+ MultiRot2D = geompy.MakeMultiRotation2DNbTimes(f12, vy, pz, 6, 30, 3)
"""
# Example: see GEOM_TestOthers.py
aVec = self.MakeLine(aPoint,aDir)
- anObj = self.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
+ # note: auto-publishing is done in self.MultiRotate2DNbTimes()
+ anObj = self.MultiRotate2DNbTimes(aShape, aVec, nbtimes1, aStep, nbtimes2, theName)
+ return anObj
+
+ ## The same, as MultiRotate2DByStep(), but axis is given by direction and point
+ #
+ # @ref swig_MakeMultiRotation "Example"
+ def MakeMultiRotation2DByStep(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
+ """
+ The same, as MultiRotate2DByStep(), but axis is given by direction and point
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot2D = geompy.MakeMultiRotation2DByStep(f12, vy, pz, math.pi/4, 6, 30, 3)
+ """
+ # Example: see GEOM_TestOthers.py
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate2D()
+ anObj = self.MultiRotate2DByStep(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
return anObj
# end of l3_transform
## @}
+ ## @addtogroup l3_transform_d
+ ## @{
+
+ ## Deprecated method. Use MultiRotate1DNbTimes instead.
+ def MultiRotate1D(self, theObject, theAxis, theNbTimes, theName=None):
+ """
+ Deprecated method. Use MultiRotate1DNbTimes instead.
+ """
+ print "The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead."
+ return self.MultiRotate1DNbTimes(theObject, theAxis, theNbTimes, theName)
+
+ ## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
+ # This method is DEPRECATED. Use MultiRotate2DByStep() instead.
+ def MultiRotate2D(self, theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2, theName=None):
+ """
+ The same, as MultiRotate2DByStep(), but theAngle is in degrees.
+ This method is DEPRECATED. Use MultiRotate2DByStep() instead.
+
+ Example of usage:
+ rot2d = geompy.MultiRotate2D(prism, vect, 60, 4, 50, 5)
+ """
+ print "The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead."
+ theAngle, theNbTimes1, theStep, theNbTimes2, Parameters = ParseParameters(theAngle, theNbTimes1, theStep, theNbTimes2)
+ anObj = self.TrsfOp.MultiRotate2D(theObject, theAxis, theAngle, theNbTimes1, theStep, theNbTimes2)
+ RaiseIfFailed("MultiRotate2D", self.TrsfOp)
+ anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "multirotation")
+ return anObj
+
+ ## The same, as MultiRotate1D(), but axis is given by direction and point
+ # This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
+ def MakeMultiRotation1D(self, aShape, aDir, aPoint, aNbTimes, theName=None):
+ """
+ The same, as geompy.MultiRotate1D, but axis is given by direction and point.
+ This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot1D = geompy.MakeMultiRotation1D(prism, vy, pz, 6)
+ """
+ print "The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead."
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate1D()
+ anObj = self.MultiRotate1D(aShape, aVec, aNbTimes, theName)
+ return anObj
+
+ ## The same, as MultiRotate2D(), but axis is given by direction and point
+ # This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
+ def MakeMultiRotation2D(self, aShape, aDir, aPoint, anAngle, nbtimes1, aStep, nbtimes2, theName=None):
+ """
+ The same, as MultiRotate2D(), but axis is given by direction and point
+ This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
+
+ Example of usage:
+ pz = geompy.MakeVertex(0, 0, 100)
+ vy = geompy.MakeVectorDXDYDZ(0, 100, 0)
+ MultiRot2D = geompy.MakeMultiRotation2D(f12, vy, pz, 45, 6, 30, 3)
+ """
+ print "The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead."
+ aVec = self.MakeLine(aPoint,aDir)
+ # note: auto-publishing is done in self.MultiRotate2D()
+ anObj = self.MultiRotate2D(aShape, aVec, anAngle, nbtimes1, aStep, nbtimes2, theName)
+ return anObj
+
+ # end of l3_transform_d
+ ## @}
+
## @addtogroup l3_local
## @{
## Perform a fillet on all edges of the given shape.
# @param theShape Shape, to perform fillet on.
# @param theR Fillet radius.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fillet "Example 1"
# \n @ref swig_MakeFilletAll "Example 2"
- def MakeFilletAll(self,theShape, theR):
+ def MakeFilletAll(self, theShape, theR, theName=None):
"""
Perform a fillet on all edges of the given shape.
Parameters:
theShape Shape, to perform fillet on.
theR Fillet radius.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
anObj = self.LocalOp.MakeFilletAll(theShape, theR)
RaiseIfFailed("MakeFilletAll", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "fillet")
return anObj
## Perform a fillet on the specified edges/faces of the given shape
# @param theR Fillet radius.
# @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
# @param theListShapes Global indices of edges/faces to perform fillet on.
- # \note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fillet "Example"
- def MakeFillet(self,theShape, theR, theShapeType, theListShapes):
+ def MakeFillet(self, theShape, theR, theShapeType, theListShapes, theName=None):
"""
Perform a fillet on the specified edges/faces of the given shape
theR Fillet radius.
theShapeType Type of shapes in theListShapes (see geompy.ShapeTypes)
theListShapes Global indices of edges/faces to perform fillet on.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
anObj = self.LocalOp.MakeFilletFaces(theShape, theR, theListShapes)
RaiseIfFailed("MakeFilletFaces", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "fillet")
return anObj
## The same that MakeFillet() but with two Fillet Radius R1 and R2
- def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes):
+ def MakeFilletR1R2(self, theShape, theR1, theR2, theShapeType, theListShapes, theName=None):
"""
The same that geompy.MakeFillet but with two Fillet Radius R1 and R2
anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "fillet")
return anObj
## Perform a fillet on the specified edges of the given shape
# the fillet point, and such two (or more) edges can be united to allow
# bigger radius. Set this flag to TRUE to allow collinear edges union,
# thus ignoring the secant vertex (vertices).
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fillet2d "Example"
- def MakeFillet1D(self,theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True):
+ def MakeFillet1D(self, theShape, theR, theListOfVertexes, doIgnoreSecantVertices = True, theName=None):
"""
Perform a fillet on the specified edges of the given shape
the fillet point, and such two (or more) edges can be united to allow
bigger radius. Set this flag to TRUE to allow collinear edges union,
thus ignoring the secant vertex (vertices).
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
anObj = self.LocalOp.MakeFillet1D(theShape, theR, theListOfVertexes, doIgnoreSecantVertices)
RaiseIfFailed("MakeFillet1D", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "fillet")
return anObj
## Perform a fillet at the specified vertices of the given face/shell.
# @param theShape Face or Shell shape to perform fillet on.
# @param theR Fillet radius.
# @param theListOfVertexes Global indices of vertexes to perform fillet on.
- # \note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fillet2d "Example"
- def MakeFillet2D(self, theShape, theR, theListOfVertexes):
+ def MakeFillet2D(self, theShape, theR, theListOfVertexes, theName=None):
"""
Perform a fillet at the specified vertices of the given face/shell.
theShape Face or Shell shape to perform fillet on.
theR Fillet radius.
theListOfVertexes Global indices of vertexes to perform fillet on.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
RaiseIfFailed("MakeFillet2D", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "fillet")
return anObj
## Perform a symmetric chamfer on all edges of the given shape.
# @param theShape Shape, to perform chamfer on.
# @param theD Chamfer size along each face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_chamfer "Example 1"
# \n @ref swig_MakeChamferAll "Example 2"
- def MakeChamferAll(self,theShape, theD):
+ def MakeChamferAll(self, theShape, theD, theName=None):
"""
Perform a symmetric chamfer on all edges of the given shape.
Parameters:
theShape Shape, to perform chamfer on.
theD Chamfer size along each face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
anObj = self.LocalOp.MakeChamferAll(theShape, theD)
RaiseIfFailed("MakeChamferAll", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## Perform a chamfer on edges, common to the specified faces,
# @param theD1 Chamfer size along \a theFace1.
# @param theD2 Chamfer size along \a theFace2.
# @param theFace1,theFace2 Global indices of two faces of \a theShape.
- # \note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_chamfer "Example"
- def MakeChamferEdge(self,theShape, theD1, theD2, theFace1, theFace2):
+ def MakeChamferEdge(self, theShape, theD1, theD2, theFace1, theFace2, theName=None):
"""
Perform a chamfer on edges, common to the specified faces,
with distance D1 on the Face1
theD1 Chamfer size along theFace1.
theD2 Chamfer size along theFace2.
theFace1,theFace2 Global indices of two faces of theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
anObj = self.LocalOp.MakeChamferEdge(theShape, theD1, theD2, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdge", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## Perform a chamfer on edges
# @param theD Chamfer length
# @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
# @param theFace1,theFace2 Global indices of two faces of \a theShape.
- # \note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
- def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2):
+ def MakeChamferEdgeAD(self, theShape, theD, theAngle, theFace1, theFace2, theName=None):
"""
Perform a chamfer on edges
theD1 Chamfer size along theFace1.
theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees).
theFace1,theFace2 Global indices of two faces of theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Global index of sub-shape can be obtained, using method geompy.GetSubShapeID
anObj = self.LocalOp.MakeChamferEdgeAD(theShape, theD, theAngle, theFace1, theFace2)
RaiseIfFailed("MakeChamferEdgeAD", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## Perform a chamfer on all edges of the specified faces,
# will be get along face, which is nearer to \a theFaces beginning.
# @param theD2 Chamfer size along another of two faces, connected to the edge.
# @param theFaces Sequence of global indices of faces of \a theShape.
- # \note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Global index of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_chamfer "Example"
- def MakeChamferFaces(self,theShape, theD1, theD2, theFaces):
+ def MakeChamferFaces(self, theShape, theD1, theD2, theFaces, theName=None):
"""
Perform a chamfer on all edges of the specified faces,
with distance D1 on the first specified face (if several for one edge)
will be get along face, which is nearer to theFaces beginning.
theD2 Chamfer size along another of two faces, connected to the edge.
theFaces Sequence of global indices of faces of theShape.
-
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note: Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
anObj = self.LocalOp.MakeChamferFaces(theShape, theD1, theD2, theFaces)
RaiseIfFailed("MakeChamferFaces", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## The Same that MakeChamferFaces() but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
#
# @ref swig_FilletChamfer "Example"
- def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces):
+ def MakeChamferFacesAD(self, theShape, theD, theAngle, theFaces, theName=None):
"""
The Same that geompy.MakeChamferFaces but with params theD is chamfer lenght and
theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
anObj = self.LocalOp.MakeChamferFacesAD(theShape, theD, theAngle, theFaces)
RaiseIfFailed("MakeChamferFacesAD", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## Perform a chamfer on edges,
# @param theShape Shape, to perform chamfer on.
# @param theD1,theD2 Chamfer size
# @param theEdges Sequence of edges of \a theShape.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref swig_FilletChamfer "Example"
- def MakeChamferEdges(self, theShape, theD1, theD2, theEdges):
+ def MakeChamferEdges(self, theShape, theD1, theD2, theEdges, theName=None):
"""
Perform a chamfer on edges,
with distance D1 on the first specified face (if several for one edge)
theShape Shape, to perform chamfer on.
theD1,theD2 Chamfer size
theEdges Sequence of edges of theShape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
anObj = self.LocalOp.MakeChamferEdges(theShape, theD1, theD2, theEdges)
RaiseIfFailed("MakeChamferEdges", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
## The Same that MakeChamferEdges() but with params theD is chamfer lenght and
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
- def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges):
+ def MakeChamferEdgesAD(self, theShape, theD, theAngle, theEdges, theName=None):
"""
The Same that geompy.MakeChamferEdges but with params theD is chamfer lenght and
theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
anObj = self.LocalOp.MakeChamferEdgesAD(theShape, theD, theAngle, theEdges)
RaiseIfFailed("MakeChamferEdgesAD", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "chamfer")
return anObj
- ## /sa MakeChamferEdge() and MakeChamferFaces()
+ ## @sa MakeChamferEdge(), MakeChamferFaces()
#
# @ref swig_MakeChamfer "Example"
- def MakeChamfer(self,aShape,d1,d2,aShapeType,ListShape):
+ def MakeChamfer(self, aShape, d1, d2, aShapeType, ListShape, theName=None):
"""
See geompy.MakeChamferEdge() and geompy.MakeChamferFaces() functions for more information.
"""
# Example: see GEOM_TestOthers.py
anObj = None
+ # note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
if aShapeType == ShapeType["EDGE"]:
- anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1])
+ anObj = self.MakeChamferEdge(aShape,d1,d2,ListShape[0],ListShape[1],theName)
else:
- anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape)
+ anObj = self.MakeChamferFaces(aShape,d1,d2,ListShape,theName)
return anObj
## Remove material from a solid by extrusion of the base shape on the given distance.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the initial shape with removed material
#
# @ref tui_creation_prism "Example"
- def MakeExtrudedCut(self, theInit, theBase, theH, theAngle):
+ def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the initial shape with removed material.
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "extrudedCut")
return anObj
## Add material to a solid by extrusion of the base shape on the given distance.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the initial shape with added material
#
# @ref tui_creation_prism "Example"
- def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle):
+ def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theName=None):
"""
Add material to a solid by extrusion of the base shape on the given distance.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the initial shape with added material.
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "extrudedBoss")
return anObj
# end of l3_local
# @param theWeight Weight og the shape.
# @param theWaterDensity Density of the water.
# @param theMeshDeflection Deflection of the mesh, using to compute the section.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing a section of \a theShape
# by a plane, corresponding to water level.
#
# @ref tui_archimede "Example"
- def Archimede(self,theShape, theWeight, theWaterDensity, theMeshDeflection):
+ def Archimede(self, theShape, theWeight, theWaterDensity, theMeshDeflection, theName=None):
"""
Perform an Archimde operation on the given shape with given parameters.
The object presenting the resulting face is returned.
theWeight Weight og the shape.
theWaterDensity Density of the water.
theMeshDeflection Deflection of the mesh, using to compute the section.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing a section of theShape
anObj = self.LocalOp.MakeArchimede(theShape, theWeight, theWaterDensity, theMeshDeflection)
RaiseIfFailed("MakeArchimede", self.LocalOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "archimede")
return anObj
# end of l3_basic_op
# Example: see GEOM_TestMeasures.py
aTuple = self.MeasuOp.PointCoordinates(Point)
RaiseIfFailed("PointCoordinates", self.MeasuOp)
- return aTuple
+ return aTuple
+
+ ## Get vector coordinates
+ # @return [x, y, z]
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def VectorCoordinates(self,Vector):
+ """
+ Get vector coordinates
+
+ Returns:
+ [x, y, z]
+ """
+
+ p1=self.GetFirstVertex(Vector)
+ p2=self.GetLastVertex(Vector)
+
+ X1=self.PointCoordinates(p1)
+ X2=self.PointCoordinates(p2)
+
+ return (X2[0]-X1[0],X2[1]-X1[1],X2[2]-X1[2])
+
+
+ ## Compute cross product
+ # @return vector w=u^v
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def CrossProduct(self, Vector1, Vector2):
+ """
+ Compute cross product
+
+ Returns: vector w=u^v
+ """
+ u=self.VectorCoordinates(Vector1)
+ v=self.VectorCoordinates(Vector2)
+ w=self.MakeVectorDXDYDZ(u[1]*v[2]-u[2]*v[1], u[2]*v[0]-u[0]*v[2], u[0]*v[1]-u[1]*v[0])
+
+ return w
+
+ ## Compute cross product
+ # @return dot product p=u.v
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def DotProduct(self, Vector1, Vector2):
+ """
+ Compute cross product
+
+ Returns: dot product p=u.v
+ """
+ u=self.VectorCoordinates(Vector1)
+ v=self.VectorCoordinates(Vector2)
+ p=u[0]*v[0]+u[1]*v[1]+u[2]*v[2]
+
+ return p
+
## Get summarized length of all wires,
# area of surface and volume of the given shape.
# Zmin,Zmax: Limits of shape along OZ axis.
#
# @ref tui_measurement_tools_page "Example"
- def BoundingBox(self,theShape):
+ def BoundingBox (self, theShape):
"""
Get parameters of bounding box of the given shape
RaiseIfFailed("GetBoundingBox", self.MeasuOp)
return aTuple
+ ## Get bounding box of the given shape
+ # @param theShape Shape to obtain bounding box of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM.GEOM_Object, containing the created box.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def MakeBoundingBox (self, theShape, theName=None):
+ """
+ Get bounding box of the given shape
+
+ Parameters:
+ theShape Shape to obtain bounding box of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the created box.
+ """
+ # Example: see GEOM_TestMeasures.py
+ anObj = self.MeasuOp.MakeBoundingBox(theShape)
+ RaiseIfFailed("MakeBoundingBox", self.MeasuOp)
+ self._autoPublish(anObj, theName, "bndbox")
+ return anObj
+
## Get inertia matrix and moments of inertia of theShape.
# @param theShape Shape to calculate inertia of.
# @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
- # @return Value of the minimal distance between the given shapes.
+ # @return Value of the minimal distance between the given shapes, in form of list
+ # [Distance, DX, DY, DZ].
#
# @ref swig_all_measure "Example"
def MinDistanceComponents(self, theShape1, theShape2):
theShape1,theShape2 Shapes to find minimal distance between.
Returns:
- Value of the minimal distance between the given shapes.
+ Value of the minimal distance between the given shapes, in form of list
+ [Distance, DX, DY, DZ]
"""
# Example: see GEOM_TestMeasures.py
aTuple = self.MeasuOp.GetMinDistance(theShape1, theShape2)
aRes = [aTuple[0], aTuple[4] - aTuple[1], aTuple[5] - aTuple[2], aTuple[6] - aTuple[3]]
return aRes
+ ## Get closest points of the given shapes.
+ # @param theShape1,theShape2 Shapes to find closest points of.
+ # @return The number of found solutions (-1 in case of infinite number of
+ # solutions) and a list of (X, Y, Z) coordinates for all couples of points.
+ #
+ # @ref tui_measurement_tools_page "Example"
+ def ClosestPoints (self, theShape1, theShape2):
+ """
+ Get closest points of the given shapes.
+
+ Parameters:
+ theShape1,theShape2 Shapes to find closest points of.
+
+ Returns:
+ The number of found solutions (-1 in case of infinite number of
+ solutions) and a list of (X, Y, Z) coordinates for all couples of points.
+ """
+ # Example: see GEOM_TestMeasures.py
+ aTuple = self.MeasuOp.ClosestPoints(theShape1, theShape2)
+ RaiseIfFailed("ClosestPoints", self.MeasuOp)
+ return aTuple
+
## Get angle between the given shapes in degrees.
# @param theShape1,theShape2 Lines or linear edges to find angle between.
# @note If both arguments are vectors, the angle is computed in accordance
## Get a point, situated at the centre of mass of theShape.
# @param theShape Shape to define centre of mass of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_measurement_tools_page "Example"
- def MakeCDG(self,theShape):
+ def MakeCDG(self, theShape, theName=None):
"""
Get a point, situated at the centre of mass of theShape.
Parameters:
theShape Shape to define centre of mass of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created point.
# Example: see GEOM_TestMeasures.py
anObj = self.MeasuOp.GetCentreOfMass(theShape)
RaiseIfFailed("GetCentreOfMass", self.MeasuOp)
+ self._autoPublish(anObj, theName, "centerOfMass")
return anObj
## Get a vertex sub-shape by index depended with orientation.
# @param theShape Shape to find sub-shape.
# @param theIndex Index to find vertex by this index (starting from zero)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
- def GetVertexByIndex(self,theShape, theIndex):
+ def GetVertexByIndex(self, theShape, theIndex, theName=None):
"""
Get a vertex sub-shape by index depended with orientation.
Parameters:
theShape Shape to find sub-shape.
theIndex Index to find vertex by this index (starting from zero)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vertex.
# Example: see GEOM_TestMeasures.py
anObj = self.MeasuOp.GetVertexByIndex(theShape, theIndex)
RaiseIfFailed("GetVertexByIndex", self.MeasuOp)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Get the first vertex of wire/edge depended orientation.
# @param theShape Shape to find first vertex.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
- def GetFirstVertex(self,theShape):
+ def GetFirstVertex(self, theShape, theName=None):
"""
Get the first vertex of wire/edge depended orientation.
Parameters:
theShape Shape to find first vertex.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vertex.
"""
# Example: see GEOM_TestMeasures.py
- anObj = self.GetVertexByIndex(theShape, 0)
+ # note: auto-publishing is done in self.GetVertexByIndex()
+ anObj = self.GetVertexByIndex(theShape, 0, theName)
RaiseIfFailed("GetFirstVertex", self.MeasuOp)
return anObj
## Get the last vertex of wire/edge depended orientation.
# @param theShape Shape to find last vertex.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
- def GetLastVertex(self,theShape):
+ def GetLastVertex(self, theShape, theName=None):
"""
Get the last vertex of wire/edge depended orientation.
Parameters:
theShape Shape to find last vertex.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vertex.
"""
# Example: see GEOM_TestMeasures.py
nb_vert = self.ShapesOp.NumberOfSubShapes(theShape, ShapeType["VERTEX"])
- anObj = self.GetVertexByIndex(theShape, (nb_vert-1))
+ # note: auto-publishing is done in self.GetVertexByIndex()
+ anObj = self.GetVertexByIndex(theShape, (nb_vert-1), theName)
RaiseIfFailed("GetLastVertex", self.MeasuOp)
return anObj
# the normale is calculated at the center of mass.
# @param theFace Face to define normale of.
# @param theOptionalPoint Point to compute the normale at.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created vector.
#
# @ref swig_todo "Example"
- def GetNormal(self, theFace, theOptionalPoint = None):
+ def GetNormal(self, theFace, theOptionalPoint = None, theName=None):
"""
Get a normale to the given face. If the point is not given,
the normale is calculated at the center of mass.
Parameters:
theFace Face to define normale of.
theOptionalPoint Point to compute the normale at.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created vector.
# Example: see GEOM_TestMeasures.py
anObj = self.MeasuOp.GetNormal(theFace, theOptionalPoint)
RaiseIfFailed("GetNormal", self.MeasuOp)
+ self._autoPublish(anObj, theName, "normal")
return anObj
## Check a topology of the given shape.
# If format 'IGES_SCALE' is used instead of 'IGES' or
# format 'STEP_SCALE' is used instead of 'STEP',
# length unit will be set to 'meter' and result model will be scaled.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportFile(self, theFileName, theFormatName):
+ def ImportFile(self, theFileName, theFormatName, theName=None):
"""
Import a shape from the BREP or IGES or STEP file
(depends on given format) with given name.
If format 'IGES_SCALE' is used instead of 'IGES' or
format 'STEP_SCALE' is used instead of 'STEP',
length unit will be set to 'meter' and result model will be scaled.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
- RaiseIfFailed("Import", self.InsertOp)
+ RaiseIfFailed("ImportFile", self.InsertOp)
+ self._autoPublish(anObj, theName, "imported")
return anObj
## Deprecated analog of ImportFile()
- def Import(self, theFileName, theFormatName):
+ def Import(self, theFileName, theFormatName, theName=None):
"""
- Deprecated analog of geompy.ImportFile
+ Deprecated analog of geompy.ImportFile, kept for backward compatibility only.
"""
print "WARNING: Function Import is deprecated, use ImportFile instead"
- anObj = self.InsertOp.ImportFile(theFileName, theFormatName)
- RaiseIfFailed("Import", self.InsertOp)
- return anObj
+ # note: auto-publishing is done in self.ImportFile()
+ return self.ImportFile(theFileName, theFormatName, theName)
## Shortcut to ImportFile() for BREP format.
# Import a shape from the BREP file with given name.
# @param theFileName The file, containing the shape.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportBREP(self, theFileName):
+ def ImportBREP(self, theFileName, theName=None):
"""
geompy.ImportFile(...) function for BREP format
Import a shape from the BREP file with given name.
Parameters:
theFileName The file, containing the shape.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
- return self.ImportFile(theFileName, "BREP")
+ # note: auto-publishing is done in self.ImportFile()
+ return self.ImportFile(theFileName, "BREP", theName)
## Shortcut to ImportFile() for IGES format
# Import a shape from the IGES file with given name.
# @param ignoreUnits If True, file length units will be ignored (set to 'meter')
# and result model will be scaled, if its units are not meters.
# If False (default), file length units will be taken into account.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportIGES(self, theFileName, ignoreUnits = False):
+ def ImportIGES(self, theFileName, ignoreUnits = False, theName=None):
"""
geompy.ImportFile(...) function for IGES format
ignoreUnits If True, file length units will be ignored (set to 'meter')
and result model will be scaled, if its units are not meters.
If False (default), file length units will be taken into account.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
+ # note: auto-publishing is done in self.ImportFile()
if ignoreUnits:
- return self.ImportFile(theFileName, "IGES_SCALE")
- return self.ImportFile(theFileName, "IGES")
+ return self.ImportFile(theFileName, "IGES_SCALE", theName)
+ return self.ImportFile(theFileName, "IGES", theName)
## Return length unit from given IGES file
# @param theFileName The file, containing the shape.
# @param ignoreUnits If True, file length units will be ignored (set to 'meter')
# and result model will be scaled, if its units are not meters.
# If False (default), file length units will be taken into account.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportSTEP(self, theFileName, ignoreUnits = False):
+ def ImportSTEP(self, theFileName, ignoreUnits = False, theName=None):
"""
geompy.ImportFile(...) function for STEP format
ignoreUnits If True, file length units will be ignored (set to 'meter')
and result model will be scaled, if its units are not meters.
If False (default), file length units will be taken into account.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
+ # note: auto-publishing is done in self.ImportFile()
if ignoreUnits:
- return self.ImportFile(theFileName, "STEP_SCALE")
- return self.ImportFile(theFileName, "STEP")
+ return self.ImportFile(theFileName, "STEP_SCALE", theName)
+ return self.ImportFile(theFileName, "STEP", theName)
## Return length unit from given IGES or STEP file
# @param theFileName The file, containing the shape.
# @note This method will not be dumped to the python script by DumpStudy functionality.
# @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
# @param theStream The BRep binary stream.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing the shape, read from theStream.
#
# @ref swig_Import_Export "Example"
- def RestoreShape (self, theStream):
+ def RestoreShape (self, theStream, theName=None):
"""
Read a shape from the binary stream, containing its bounding representation (BRep).
Parameters:
theStream The BRep binary stream.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing the shape, read from theStream.
# Example: see GEOM_TestOthers.py
anObj = self.InsertOp.RestoreShape(theStream)
RaiseIfFailed("RestoreShape", self.InsertOp)
+ self._autoPublish(anObj, theName, "restored")
return anObj
## Export the given shape into a file with given name.
# @param theObject Shape to be stored in the file.
# @param theFileName Name of the file to store the given shape in.
# @param theFormatName Specify format for the shape storage.
- # Available formats can be obtained with InsertOp.ImportTranslators() method.
+ # Available formats can be obtained with
+ # geompy.InsertOp.ExportTranslators()[0] method.
#
# @ref swig_Import_Export "Example"
def Export(self, theObject, theFileName, theFormatName):
theObject Shape to be stored in the file.
theFileName Name of the file to store the given shape in.
theFormatName Specify format for the shape storage.
- Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
+ Available formats can be obtained with
+ geompy.InsertOp.ExportTranslators()[0] method.
"""
# Example: see GEOM_TestOthers.py
self.InsertOp.Export(theObject, theFileName, theFormatName)
## Create a quadrangle face from four edges. Order of Edges is not
# important. It is not necessary that edges share the same vertex.
# @param E1,E2,E3,E4 Edges for the face bound.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_building_by_blocks_page "Example"
- def MakeQuad(self,E1, E2, E3, E4):
+ def MakeQuad(self, E1, E2, E3, E4, theName=None):
"""
Create a quadrangle face from four edges. Order of Edges is not
important. It is not necessary that edges share the same vertex.
Parameters:
E1,E2,E3,E4 Edges for the face bound.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.MakeQuad(E1, E2, E3, E4)
RaiseIfFailed("MakeQuad", self.BlocksOp)
+ self._autoPublish(anObj, theName, "quad")
return anObj
## Create a quadrangle face on two edges.
# The missing edges will be built by creating the shortest ones.
# @param E1,E2 Two opposite edges for the face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_building_by_blocks_page "Example"
- def MakeQuad2Edges(self,E1, E2):
+ def MakeQuad2Edges(self, E1, E2, theName=None):
"""
Create a quadrangle face on two edges.
The missing edges will be built by creating the shortest ones.
Parameters:
E1,E2 Two opposite edges for the face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.MakeQuad2Edges(E1, E2)
RaiseIfFailed("MakeQuad2Edges", self.BlocksOp)
+ self._autoPublish(anObj, theName, "quad")
return anObj
## Create a quadrangle face with specified corners.
# The missing edges will be built by creating the shortest ones.
# @param V1,V2,V3,V4 Corner vertices for the face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeQuad4Vertices "Example 2"
- def MakeQuad4Vertices(self,V1, V2, V3, V4):
+ def MakeQuad4Vertices(self, V1, V2, V3, V4, theName=None):
"""
Create a quadrangle face with specified corners.
The missing edges will be built by creating the shortest ones.
Parameters:
V1,V2,V3,V4 Corner vertices for the face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.MakeQuad4Vertices(V1, V2, V3, V4)
RaiseIfFailed("MakeQuad4Vertices", self.BlocksOp)
+ self._autoPublish(anObj, theName, "quad")
return anObj
## Create a hexahedral solid, bounded by the six given faces. Order of
# faces is not important. It is not necessary that Faces share the same edge.
# @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created solid.
#
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeHexa "Example 2"
- def MakeHexa(self,F1, F2, F3, F4, F5, F6):
+ def MakeHexa(self, F1, F2, F3, F4, F5, F6, theName=None):
"""
Create a hexahedral solid, bounded by the six given faces. Order of
faces is not important. It is not necessary that Faces share the same edge.
Parameters:
F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solid.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.MakeHexa(F1, F2, F3, F4, F5, F6)
RaiseIfFailed("MakeHexa", self.BlocksOp)
+ self._autoPublish(anObj, theName, "hexa")
return anObj
## Create a hexahedral solid between two given faces.
# The missing faces will be built by creating the smallest ones.
# @param F1,F2 Two opposite faces for the hexahedral solid.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the created solid.
#
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeHexa2Faces "Example 2"
- def MakeHexa2Faces(self,F1, F2):
+ def MakeHexa2Faces(self, F1, F2, theName=None):
"""
Create a hexahedral solid between two given faces.
The missing faces will be built by creating the smallest ones.
Parameters:
F1,F2 Two opposite faces for the hexahedral solid.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solid.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.MakeHexa2Faces(F1, F2)
RaiseIfFailed("MakeHexa2Faces", self.BlocksOp)
+ self._autoPublish(anObj, theName, "hexa")
return anObj
# end of l3_blocks
# @param theX,theY,theZ Coordinates of the sought vertex.
# @param theEpsilon Maximum allowed distance between the resulting
# vertex and point with the given coordinates.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found vertex.
#
# @ref swig_GetPoint "Example"
- def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
+ def GetPoint(self, theShape, theX, theY, theZ, theEpsilon, theName=None):
"""
Get a vertex, found in the given shape by its coordinates.
theX,theY,theZ Coordinates of the sought vertex.
theEpsilon Maximum allowed distance between the resulting
vertex and point with the given coordinates.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found vertex.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
RaiseIfFailed("GetPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Find a vertex of the given shape, which has minimal distance to the given point.
# @param theShape Any shape.
# @param thePoint Point, close to the desired vertex.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found vertex.
#
# @ref swig_GetVertexNearPoint "Example"
- def GetVertexNearPoint(self, theShape, thePoint):
+ def GetVertexNearPoint(self, theShape, thePoint, theName=None):
"""
Find a vertex of the given shape, which has minimal distance to the given point.
Parameters:
theShape Any shape.
thePoint Point, close to the desired vertex.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found vertex.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "vertex")
return anObj
## Get an edge, found in the given shape by two given vertices.
# @param theShape Block or a compound of blocks.
# @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found edge.
#
# @ref swig_GetEdge "Example"
- def GetEdge(self, theShape, thePoint1, thePoint2):
+ def GetEdge(self, theShape, thePoint1, thePoint2, theName=None):
"""
Get an edge, found in the given shape by two given vertices.
Parameters:
theShape Block or a compound of blocks.
thePoint1,thePoint2 Points, close to the ends of the desired edge.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found edge.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
RaiseIfFailed("GetEdge", self.BlocksOp)
+ self._autoPublish(anObj, theName, "edge")
return anObj
## Find an edge of the given shape, which has minimal distance to the given point.
# @param theShape Block or a compound of blocks.
# @param thePoint Point, close to the desired edge.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found edge.
#
# @ref swig_GetEdgeNearPoint "Example"
- def GetEdgeNearPoint(self, theShape, thePoint):
+ def GetEdgeNearPoint(self, theShape, thePoint, theName=None):
"""
Find an edge of the given shape, which has minimal distance to the given point.
Parameters:
theShape Block or a compound of blocks.
thePoint Point, close to the desired edge.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found edge.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "edge")
return anObj
## Returns a face, found in the given shape by four given corner vertices.
# @param theShape Block or a compound of blocks.
# @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found face.
#
# @ref swig_todo "Example"
- def GetFaceByPoints(self,theShape, thePoint1, thePoint2, thePoint3, thePoint4):
+ def GetFaceByPoints(self, theShape, thePoint1, thePoint2, thePoint3, thePoint4, theName=None):
"""
Returns a face, found in the given shape by four given corner vertices.
Parameters:
theShape Block or a compound of blocks.
thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
RaiseIfFailed("GetFaceByPoints", self.BlocksOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Get a face of block, found in the given shape by two given edges.
# @param theShape Block or a compound of blocks.
# @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found face.
#
# @ref swig_todo "Example"
- def GetFaceByEdges(self,theShape, theEdge1, theEdge2):
+ def GetFaceByEdges(self, theShape, theEdge1, theEdge2, theName=None):
"""
Get a face of block, found in the given shape by two given edges.
Parameters:
theShape Block or a compound of blocks.
theEdge1,theEdge2 Edges, close to the edges of the desired face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
RaiseIfFailed("GetFaceByEdges", self.BlocksOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Find a face, opposite to the given one in the given block.
# @param theBlock Must be a hexahedral solid.
# @param theFace Face of \a theBlock, opposite to the desired face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found face.
#
# @ref swig_GetOppositeFace "Example"
- def GetOppositeFace(self,theBlock, theFace):
+ def GetOppositeFace(self, theBlock, theFace, theName=None):
"""
Find a face, opposite to the given one in the given block.
Parameters:
theBlock Must be a hexahedral solid.
theFace Face of theBlock, opposite to the desired face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetOppositeFace(theBlock, theFace)
RaiseIfFailed("GetOppositeFace", self.BlocksOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Find a face of the given shape, which has minimal distance to the given point.
# @param theShape Block or a compound of blocks.
# @param thePoint Point, close to the desired face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found face.
#
# @ref swig_GetFaceNearPoint "Example"
- def GetFaceNearPoint(self, theShape, thePoint):
+ def GetFaceNearPoint(self, theShape, thePoint, theName=None):
"""
Find a face of the given shape, which has minimal distance to the given point.
Parameters:
theShape Block or a compound of blocks.
thePoint Point, close to the desired face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Find a face of block, whose outside normale has minimal angle with the given vector.
# @param theBlock Block or a compound of blocks.
# @param theVector Vector, close to the normale of the desired face.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found face.
#
# @ref swig_todo "Example"
- def GetFaceByNormale(self, theBlock, theVector):
+ def GetFaceByNormale(self, theBlock, theVector, theName=None):
"""
Find a face of block, whose outside normale has minimal angle with the given vector.
Parameters:
theBlock Block or a compound of blocks.
theVector Vector, close to the normale of the desired face.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found face.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetFaceByNormale(theBlock, theVector)
RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
+ self._autoPublish(anObj, theName, "face")
return anObj
## Find all sub-shapes of type \a theShapeType of the given shape,
# @param theTolerance The tolerance for distances comparison. All shapes
# with distances to the given point in interval
# [minimal_distance, minimal_distance + theTolerance] will be gathered.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing a group of all found shapes.
#
# @ref swig_GetShapesNearPoint "Example"
- def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
+ def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07, theName=None):
"""
Find all sub-shapes of type theShapeType of the given shape,
which have minimal distance to the given point.
theTolerance The tolerance for distances comparison. All shapes
with distances to the given point in interval
[minimal_distance, minimal_distance + theTolerance] will be gathered.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing a group of all found shapes.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "group")
return anObj
# end of l3_blocks_op
## Retrieve all non blocks solids and faces from \a theShape.
# @param theShape The shape to explore.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return A tuple of two GEOM_Objects. The first object is a group of all
# non block solids (= not 6 faces, or with 6 faces, but with the
# presence of non-quadrangular faces). The second object is a
#
# @ref tui_measurement_tools_page "Example 1"
# \n @ref swig_GetNonBlocks "Example 2"
- def GetNonBlocks (self, theShape):
+ def GetNonBlocks (self, theShape, theName=None):
"""
Retrieve all non blocks solids and faces from theShape.
Parameters:
theShape The shape to explore.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
A tuple of two GEOM_Objects. The first object is a group of all
# Example: see GEOM_Spanner.py
aTuple = self.BlocksOp.GetNonBlocks(theShape)
RaiseIfFailed("GetNonBlocks", self.BlocksOp)
+ self._autoPublish(aTuple, theName, ("groupNonHexas", "groupNonQuads"))
return aTuple
## Remove all seam and degenerated edges from \a theShape.
# @param theShape The compound or single solid to remove irregular edges from.
# @param doUnionFaces If True, then unite faces. If False (the default value),
# do not unite faces.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return Improved shape.
#
# @ref swig_RemoveExtraEdges "Example"
- def RemoveExtraEdges(self, theShape, doUnionFaces=False):
+ def RemoveExtraEdges(self, theShape, doUnionFaces=False, theName=None):
"""
Remove all seam and degenerated edges from theShape.
Unite faces and edges, sharing one surface. It means that
theShape The compound or single solid to remove irregular edges from.
doUnionFaces If True, then unite faces. If False (the default value),
do not unite faces.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
Improved shape.
if doUnionFaces is True: nbFacesOptimum = 0 # 0 means unite faces
anObj = self.BlocksOp.RemoveExtraEdges(theShape, nbFacesOptimum)
RaiseIfFailed("RemoveExtraEdges", self.BlocksOp)
+ self._autoPublish(anObj, theName, "removeExtraEdges")
return anObj
## Check, if the given shape is a blocks compound.
# Fix all detected errors.
# \note Single block can be also fixed by this method.
# @param theShape The compound to check and improve.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return Improved compound.
#
# @ref swig_CheckAndImprove "Example"
- def CheckAndImprove(self,theShape):
+ def CheckAndImprove(self, theShape, theName=None):
"""
Check, if the given shape is a blocks compound.
Fix all detected errors.
Parameters:
theShape The compound to check and improve.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
Improved compound.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.CheckAndImprove(theShape)
RaiseIfFailed("CheckAndImprove", self.BlocksOp)
+ self._autoPublish(anObj, theName, "improved")
return anObj
# end of l4_blocks_measure
# @param theCompound The compound to explode.
# @param theMinNbFaces If solid has lower number of faces, it is not a block.
# @param theMaxNbFaces If solid has higher number of faces, it is not a block.
- # \note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
+ #
# @return List of GEOM.GEOM_Object, containing the retrieved blocks.
#
# @ref tui_explode_on_blocks "Example 1"
# \n @ref swig_MakeBlockExplode "Example 2"
- def MakeBlockExplode(self,theCompound, theMinNbFaces, theMaxNbFaces):
+ def MakeBlockExplode(self, theCompound, theMinNbFaces, theMaxNbFaces, theName=None):
"""
Get all the blocks, contained in the given compound.
theCompound The compound to explode.
theMinNbFaces If solid has lower number of faces, it is not a block.
theMaxNbFaces If solid has higher number of faces, it is not a block.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
If theMaxNbFaces = 0, the maximum number of faces is not restricted.
for anObj in aList:
anObj.SetParameters(Parameters)
pass
+ self._autoPublish(aList, theName, "block")
return aList
## Find block, containing the given point inside its volume or on boundary.
# @param theCompound Compound, to find block in.
# @param thePoint Point, close to the desired block. If the point lays on
# boundary between some blocks, we return block with nearest center.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found block.
#
# @ref swig_todo "Example"
- def GetBlockNearPoint(self,theCompound, thePoint):
+ def GetBlockNearPoint(self, theCompound, thePoint, theName=None):
"""
Find block, containing the given point inside its volume or on boundary.
theCompound Compound, to find block in.
thePoint Point, close to the desired block. If the point lays on
boundary between some blocks, we return block with nearest center.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the found block.
# Example: see GEOM_Spanner.py
anObj = self.BlocksOp.GetBlockNearPoint(theCompound, thePoint)
RaiseIfFailed("GetBlockNearPoint", self.BlocksOp)
+ self._autoPublish(anObj, theName, "block")
return anObj
## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
# @param theCompound Compound, to find block in.
# @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the found block.
#
# @ref swig_GetBlockByParts "Example"
- def GetBlockByParts(self,theCompound, theParts):
+ def GetBlockByParts(self, theCompound, theParts, theName=None):
"""
Find block, containing all the elements, passed as the parts, or maximum quantity of them.
Parameters:
theCompound Compound, to find block in.
theParts List of faces and/or edges and/or vertices to be parts of the found block.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing the found block.
# Example: see GEOM_TestOthers.py
anObj = self.BlocksOp.GetBlockByParts(theCompound, theParts)
RaiseIfFailed("GetBlockByParts", self.BlocksOp)
+ self._autoPublish(anObj, theName, "block")
return anObj
## Return all blocks, containing all the elements, passed as the parts.
# @param theCompound Compound, to find blocks in.
# @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of GEOM.GEOM_Object, containing the found blocks.
#
# @ref swig_todo "Example"
- def GetBlocksByParts(self,theCompound, theParts):
+ def GetBlocksByParts(self, theCompound, theParts, theName=None):
"""
Return all blocks, containing all the elements, passed as the parts.
Parameters:
theCompound Compound, to find blocks in.
theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM.GEOM_Object, containing the found blocks.
# Example: see GEOM_Spanner.py
aList = self.BlocksOp.GetBlocksByParts(theCompound, theParts)
RaiseIfFailed("GetBlocksByParts", self.BlocksOp)
+ self._autoPublish(aList, theName, "block")
return aList
## Multi-transformate block and glue the result.
# @param DirFace1 ID of First direction face.
# @param DirFace2 ID of Second direction face.
# @param NbTimes Quantity of transformations to be done.
- # \note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_multi_transformation "Example"
- def MakeMultiTransformation1D(self,Block, DirFace1, DirFace2, NbTimes):
+ def MakeMultiTransformation1D(self, Block, DirFace1, DirFace2, NbTimes, theName=None):
"""
Multi-transformate block and glue the result.
Transformation is defined so, as to superpose direction faces.
DirFace1 ID of First direction face.
DirFace2 ID of Second direction face.
NbTimes Quantity of transformations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Note:
Unique ID of sub-shape can be obtained, using method GetSubShapeID().
anObj = self.BlocksOp.MakeMultiTransformation1D(Block, DirFace1, DirFace2, NbTimes)
RaiseIfFailed("MakeMultiTransformation1D", self.BlocksOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "transformed")
return anObj
## Multi-transformate block and glue the result.
# @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
# @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
# @param NbTimesU,NbTimesV Quantity of transformations to be done.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_multi_transformation "Example"
- def MakeMultiTransformation2D(self,Block, DirFace1U, DirFace2U, NbTimesU,
- DirFace1V, DirFace2V, NbTimesV):
+ def MakeMultiTransformation2D(self, Block, DirFace1U, DirFace2U, NbTimesU,
+ DirFace1V, DirFace2V, NbTimesV, theName=None):
"""
Multi-transformate block and glue the result.
DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
NbTimesU,NbTimesV Quantity of transformations to be done.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the result shape.
DirFace1V, DirFace2V, NbTimesV)
RaiseIfFailed("MakeMultiTransformation2D", self.BlocksOp)
anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "transformed")
return anObj
## Build all possible propagation groups.
# edge of this group directly or through other opposite edges.
# Notion of Opposite Edge make sence only on quadrangle face.
# @param theShape Shape to build propagation groups on.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of GEOM.GEOM_Object, each of them is a propagation group.
#
# @ref swig_Propagate "Example"
- def Propagate(self,theShape):
+ def Propagate(self, theShape, theName=None):
"""
Build all possible propagation groups.
Propagation group is a set of all edges, opposite to one (main)
Parameters:
theShape Shape to build propagation groups on.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM.GEOM_Object, each of them is a propagation group.
# Example: see GEOM_TestOthers.py
listChains = self.BlocksOp.Propagate(theShape)
RaiseIfFailed("Propagate", self.BlocksOp)
+ self._autoPublish(listChains, theName, "propagate")
return listChains
# end of l3_blocks_op
## Creates a new group which will store sub-shapes of theMainShape
# @param theMainShape is a GEOM object on which the group is selected
# @param theShapeType defines a shape type of the group (see GEOM::shape_type)
- # @return a newly created GEOM group
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return a newly created GEOM group (GEOM.GEOM_Object)
#
# @ref tui_working_with_groups_page "Example 1"
# \n @ref swig_CreateGroup "Example 2"
- def CreateGroup(self,theMainShape, theShapeType):
+ def CreateGroup(self, theMainShape, theShapeType, theName=None):
"""
Creates a new group which will store sub-shapes of theMainShape
theMainShape is a GEOM object on which the group is selected
theShapeType defines a shape type of the group:"COMPOUND", "COMPSOLID",
"SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX", "SHAPE".
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group
# Example: see GEOM_TestOthers.py
anObj = self.GroupOp.CreateGroup(theMainShape, theShapeType)
RaiseIfFailed("CreateGroup", self.GroupOp)
+ self._autoPublish(anObj, theName, "group")
return anObj
## Adds a sub-object with ID theSubShapeId to the group
# which are present in groups theGroup1 and theGroup2.
# @param theGroup1, theGroup2 are the initial GEOM groups
# to create the united group from.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_union_groups_anchor "Example"
- def UnionGroups (self, theGroup1, theGroup2):
+ def UnionGroups (self, theGroup1, theGroup2, theName=None):
"""
Union of two groups.
New group is created. It will contain all entities
Parameters:
theGroup1, theGroup2 are the initial GEOM groups
to create the united group from.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.UnionGroups(theGroup1, theGroup2)
RaiseIfFailed("UnionGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Intersection of two groups.
# New group is created. It will contain only those entities
# which are present in both groups theGroup1 and theGroup2.
# @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_intersect_groups_anchor "Example"
- def IntersectGroups (self, theGroup1, theGroup2):
+ def IntersectGroups (self, theGroup1, theGroup2, theName=None):
"""
Intersection of two groups.
New group is created. It will contain only those entities
Parameters:
theGroup1, theGroup2 are the initial GEOM groups to get common part of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.IntersectGroups(theGroup1, theGroup2)
RaiseIfFailed("IntersectGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Cut of two groups.
# present in group theGroup1 but are not present in group theGroup2.
# @param theGroup1 is a GEOM group to include elements of.
# @param theGroup2 is a GEOM group to exclude elements of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_cut_groups_anchor "Example"
- def CutGroups (self, theGroup1, theGroup2):
+ def CutGroups (self, theGroup1, theGroup2, theName=None):
"""
Cut of two groups.
New group is created. It will contain entities which are
Parameters:
theGroup1 is a GEOM group to include elements of.
theGroup2 is a GEOM group to exclude elements of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.CutGroups(theGroup1, theGroup2)
RaiseIfFailed("CutGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Union of list of groups.
# New group is created. It will contain all entities that are
# present in groups listed in theGList.
# @param theGList is a list of GEOM groups to create the united group from.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_union_groups_anchor "Example"
- def UnionListOfGroups (self, theGList):
+ def UnionListOfGroups (self, theGList, theName=None):
"""
Union of list of groups.
New group is created. It will contain all entities that are
Parameters:
theGList is a list of GEOM groups to create the united group from.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.UnionListOfGroups(theGList)
RaiseIfFailed("UnionListOfGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Cut of lists of groups.
# are not present in groups from theGList2.
# @param theGList1 is a list of GEOM groups to include elements of.
# @param theGList2 is a list of GEOM groups to exclude elements of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_intersect_groups_anchor "Example"
- def IntersectListOfGroups (self, theGList):
+ def IntersectListOfGroups (self, theGList, theName=None):
"""
Cut of lists of groups.
New group is created. It will contain only entities
Parameters:
theGList1 is a list of GEOM groups to include elements of.
theGList2 is a list of GEOM groups to exclude elements of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.IntersectListOfGroups(theGList)
RaiseIfFailed("IntersectListOfGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Cut of lists of groups.
# are not present in groups from theGList2.
# @param theGList1 is a list of GEOM groups to include elements of.
# @param theGList2 is a list of GEOM groups to exclude elements of.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group.
+ #
# @ref tui_cut_groups_anchor "Example"
- def CutListOfGroups (self, theGList1, theGList2):
+ def CutListOfGroups (self, theGList1, theGList2, theName=None):
"""
Cut of lists of groups.
New group is created. It will contain only entities
Parameters:
theGList1 is a list of GEOM groups to include elements of.
theGList2 is a list of GEOM groups to exclude elements of.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group.
# Example: see GEOM_TestOthers.py
aGroup = self.GroupOp.CutListOfGroups(theGList1, theGList2)
RaiseIfFailed("CutListOfGroups", self.GroupOp)
+ self._autoPublish(aGroup, theName, "group")
return aGroup
## Returns a list of sub-objects ID stored in the group
# @param max_length maximum length of edges of theShape
# @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
# @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return a newly created GEOM group of edges
+ #
# @@ref swig_todo "Example"
- def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1):
+ def GetEdgesByLength (self, theShape, min_length, max_length, include_min = 1, include_max = 1, theName=None):
"""
Create group of edges of theShape, whose length is in range [min_length, max_length].
If include_min/max == 0, edges with length == min/max_length will not be included in result.
max_length maximum length of edges of theShape
include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
a newly created GEOM group of edges.
if len(edges_in_range) <= 0:
print "No edges found by given criteria"
- return 0
+ return None
- group_edges = self.CreateGroup(theShape, ShapeType["EDGE"])
+ # note: auto-publishing is done in self.CreateGroup()
+ group_edges = self.CreateGroup(theShape, ShapeType["EDGE"], theName)
self.UnionList(group_edges, edges_in_range)
return group_edges
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of GEOM.GEOM_Object, containing the created shape and propagation groups.
#
# @ref tui_creation_pipetshape "Example"
- def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ def MakePipeTShape(self, theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None):
"""
Create a T-shape object with specified caracteristics for the main
and the incident pipes (radius, width, half-length).
theP1 1st junction point of main pipe
theP2 2nd junction point of main pipe
theP3 Junction point of incident pipe
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM_Object, containing the created shape and propagation groups.
anObj = self.AdvOp.MakePipeTShape(theR1, theW1, theL1, theR2, theW2, theL2, theHexMesh)
RaiseIfFailed("MakePipeTShape", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
+ def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ]
+ self._autoPublish(anObj, _toListOfNames(theName, len(anObj)), def_names)
return anObj
## Create a T-shape object with chamfer and with specified caracteristics for the main
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of GEOM.GEOM_Object, containing the created shape and propagation groups.
#
# @ref tui_creation_pipetshape "Example"
- def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ def MakePipeTShapeChamfer(self, theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None):
"""
Create a T-shape object with chamfer and with specified caracteristics for the main
and the incident pipes (radius, width, half-length). The chamfer is
theP1 1st junction point of main pipe
theP2 2nd junction point of main pipe
theP3 Junction point of incident pipe
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM_Object, containing the created shape and propagation groups.
anObj = self.AdvOp.MakePipeTShapeChamfer(theR1, theW1, theL1, theR2, theW2, theL2, theH, theW, theHexMesh)
RaiseIfFailed("MakePipeTShapeChamfer", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
+ def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ]
+ self._autoPublish(anObj, _toListOfNames(theName, len(anObj)), def_names)
return anObj
## Create a T-shape object with fillet and with specified caracteristics for the main
# @param theP1 1st junction point of main pipe
# @param theP2 2nd junction point of main pipe
# @param theP3 Junction point of incident pipe
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return List of GEOM.GEOM_Object, containing the created shape and propagation groups.
#
# @ref tui_creation_pipetshape "Example"
- def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None):
+ def MakePipeTShapeFillet(self, theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh=True, theP1=None, theP2=None, theP3=None, theName=None):
"""
Create a T-shape object with fillet and with specified caracteristics for the main
and the incident pipes (radius, width, half-length). The fillet is
theP1 1st junction point of main pipe
theP2 2nd junction point of main pipe
theP3 Junction point of incident pipe
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
List of GEOM_Object, containing the created shape and propagation groups.
anObj = self.AdvOp.MakePipeTShapeFillet(theR1, theW1, theL1, theR2, theW2, theL2, theRF, theHexMesh)
RaiseIfFailed("MakePipeTShapeFillet", self.AdvOp)
if Parameters: anObj[0].SetParameters(Parameters)
+ def_names = [ "pipeTShape" ] + [ "pipeTShape_grp_%d" % i for i in range(1, len(anObj)) ]
+ self._autoPublish(anObj, _toListOfNames(theName, len(anObj)), def_names)
return anObj
## This function allows creating a disk already divided into blocks. It
# @param theOrientation Orientation of the plane on which the disk will be built
# 1 = XOY, 2 = OYZ, 3 = OZX
# @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing the created shape.
#
# @ref tui_creation_divideddisk "Example"
- def MakeDividedDisk(self, theR, theOrientation, thePattern ):
+ def MakeDividedDisk(self, theR, theOrientation, thePattern, theName=None):
+ """
+ Creates a disk, divided into blocks. It can be used to create divided pipes
+ for later meshing in hexaedra.
+
+ Parameters:
+ theR Radius of the disk
+ theOrientation Orientation of the plane on which the disk will be built:
+ 1 = XOY, 2 = OYZ, 3 = OZX
+ thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM_Object, containing the created shape.
+ """
theR, Parameters = ParseParameters(theR)
anObj = self.AdvOp.MakeDividedDisk(theR, 67.0, theOrientation, thePattern)
RaiseIfFailed("MakeDividedDisk", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "dividedDisk")
return anObj
## This function allows creating a disk already divided into blocks. It
# @param theVector Normal vector to the plane of the created disk
# @param theRadius Radius of the disk
# @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing the created shape.
#
# @ref tui_creation_divideddisk "Example"
- def MakeDividedDiskPntVecR(self, theCenter, theVector, theRadius, thePattern):
+ def MakeDividedDiskPntVecR(self, theCenter, theVector, theRadius, thePattern, theName=None):
+ """
+ Creates a disk already divided into blocks. It can be used to create divided pipes
+ for later meshing in hexaedra.
+
+ Parameters:
+ theCenter Center of the disk
+ theVector Normal vector to the plane of the created disk
+ theRadius Radius of the disk
+ thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM_Object, containing the created shape.
+ """
theRadius, Parameters = ParseParameters(theRadius)
anObj = self.AdvOp.MakeDividedDiskPntVecR(theCenter, theVector, theRadius, 67.0, thePattern)
RaiseIfFailed("MakeDividedDiskPntVecR", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "dividedDisk")
return anObj
## Builds a cylinder prepared for hexa meshes
# @param theR Radius of the cylinder
# @param theH Height of the cylinder
# @param thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing the created shape.
#
# @ref tui_creation_dividedcylinder "Example"
- def MakeDividedCylinder(self, theR, theH, thePattern):
+ def MakeDividedCylinder(self, theR, theH, thePattern, theName=None):
+ """
+ Builds a cylinder prepared for hexa meshes
+
+ Parameters:
+ theR Radius of the cylinder
+ theH Height of the cylinder
+ thePattern Division pattern. It can be GEOM.SQUARE or GEOM.HEXAGON
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ New GEOM_Object, containing the created shape.
+ """
theR, theH, Parameters = ParseParameters(theR, theH)
anObj = self.AdvOp.MakeDividedCylinder(theR, theH, thePattern)
RaiseIfFailed("MakeDividedCylinder", self.AdvOp)
if Parameters: anObj.SetParameters(Parameters)
+ self._autoPublish(anObj, theName, "dividedCylinder")
return anObj
#@@ insert new functions before this line @@ do not remove this line @@#
## Create a copy of the given object
#
# @param theOriginal geometry object for copy
- # @return unique object identifier
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
+ # @return New GEOM_Object, containing the copied shape.
+ #
# @ingroup l1_geompy_auxiliary
# @ref swig_MakeCopy "Example"
- def MakeCopy(self,theOriginal):
+ def MakeCopy(self, theOriginal, theName=None):
"""
Create a copy of the given object
Paremeters:
theOriginal geometry object for copy
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
Returns:
- unique object identifier
+ New GEOM_Object, containing the copied shape.
Example of usage: Copy = geompy.MakeCopy(Box)
"""
# Example: see GEOM_TestAll.py
anObj = self.InsertOp.MakeCopy(theOriginal)
RaiseIfFailed("MakeCopy", self.InsertOp)
+ self._autoPublish(anObj, theName, "copy")
return anObj
## Add Path to load python scripts from
pass
## Obtain the sketcher result.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ #
# @return New GEOM_Object, containing the created wire
- def wire (self):
+ def wire (self, theName=None):
"""
Obtain the sketcher result.
+ Parameters:
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
Returns:
New GEOM_Object, containing the created wire.
self.myCommand = "3DSketcher"
RaiseIfFailed("Sketcher3D", self.geompyD.CurvesOp)
wire.SetParameters(Parameters)
+ self.geompyD._autoPublish(wire, theName, "wire")
return wire
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../GEOMGUI \
-I$(srcdir)/../GEOMToolsGUI \
+ -I$(srcdir)/../Material \
-I$(top_builddir)/idl
_libGEOM_Swig_la_LDFLAGS = -module
_libGEOM_Swig_la_LIBADD = \
../GEOMGUI/libGEOM.la \
../GEOMToolsGUI/libGEOMToolsGUI.la \
+ ../Material/libMaterial.la \
$(PYTHON_LIBS)
swig_wrap.cpp : $(SWIG_SOURCES)
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
-// GEOM GEOMGUI : GUI for Geometry component
// File : libGEOM_Swig.cxx
// Author : Nicolas REJNERI, Paul RASCLE
-//
+
#include "libGEOM_Swig.h"
#include "GeometryGUI.h"
-#include "GEOMToolsGUI.h"
-
-#include "SUIT_Desktop.h"
-#include "SUIT_Session.h"
-#include "SalomeApp_Application.h"
-#include "SalomeApp_Study.h"
-
-#include "OB_Browser.h"
-
-#include "OCCViewer_ViewWindow.h"
-#include "OCCViewer_ViewManager.h"
-#include "SOCC_ViewModel.h"
-#include <SOCC_Prs.h>
-
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_View.h"
-#include "SVTK_Renderer.h"
-#include <SVTK_Prs.h>
-
-#include "GEOM_Actor.h"
-#include "GEOM_Client.hxx"
-#include "GEOM_AISShape.hxx"
-#include "GEOM_InteractiveObject.hxx"
#include "GEOM_Displayer.h"
#include "GEOM_Constants.h"
+#include "Material_Model.h"
-#include "SALOME_Event.h"
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewModel.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <OCCViewer_ViewFrame.h>
+#include <SVTK_ViewWindow.h>
-// OCCT Includes
-#include <TopAbs.hxx>
-#include <TopoDS_Shape.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <AIS_Drawer.hxx>
-#include <Prs3d_IsoAspect.hxx>
-#include <BRepTools.hxx>
+#include <SALOME_Event.h>
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include <vtkRenderer.h>
-
-static SHAPE_READER(ShapeReader);
-
-inline OCCViewer_Viewer* GetOCCViewer(SUIT_Application* theApp){
- SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
- if(window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()){
- OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( window );
- if ( vw ) {
- OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
- if ( vm )
- return vm->getOCCViewer();
- }
- }
-
- return 0;
-}
-
-inline SVTK_ViewWindow* GetSVTKViewWindow(SUIT_Application* theApp){
- SUIT_ViewWindow* window = theApp->desktop()->activeWindow();
- if(window && window->getViewManager()->getType() == SVTK_Viewer::Type())
- return dynamic_cast<SVTK_ViewWindow*>( window );
-
- return 0;
-}
-
+/*!
+ \brief Constructor
+*/
GEOM_Swig::GEOM_Swig()
{
- // MESSAGE("Constructeur");
+ init();
}
+/*!
+ \brief Destructor
+*/
GEOM_Swig::~GEOM_Swig()
{
- // MESSAGE("Destructeur");
}
-void GEOM_Swig::createAndDisplayGO (const char* Entry, bool isUpdated)
+/*!
+ \brief Internal initialization
+*/
+void GEOM_Swig::init()
{
class TEvent: public SALOME_Event
{
- std::string myEntry;
- bool myUpdateViewer;
public:
- TEvent(const char* theEntry, bool toUpdateViewer):
- myEntry(theEntry),
- myUpdateViewer(toUpdateViewer)
+ TEvent()
{}
virtual void Execute()
{
+ // check active study
SUIT_Application* app = SUIT_Session::session()->activeApplication();
if (!app) return;
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
- SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if (!ActiveStudy) return;
-
- _PTR(Study) aStudy(ActiveStudy->studyDS());
- _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
+ _PTR(Study) studyDS( study->studyDS() );
+ _PTR(StudyBuilder) builder = studyDS->NewBuilder();
- GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
- if (CORBA::is_nil(Geom)) {
- GeometryGUI::InitGeomGen();
- Geom = GeometryGUI::GetGeomGen();
- }
- if (CORBA::is_nil(Geom))
+ // get/init GEOM engine
+ GEOM::GEOM_Gen_var engine = GeometryGUI::GetGeomGen();
+ if ( CORBA::is_nil( engine ) )
return;
- std::string aFatherIOR;
- _PTR(SComponent) father = aStudy->FindComponent("GEOM");
- if (!father)
- return;
- if (!father->ComponentIOR(aFatherIOR)) {
- CORBA::String_var objStr = SalomeApp_Application::orb()->object_to_string(Geom);
- aStudyBuilder->LoadWith(father, objStr.in());
- father->ComponentIOR(aFatherIOR);
- }
-
- _PTR(SObject) obj = aStudy->FindObjectID(myEntry);
- if (!obj)
+ // find GEOM component in the study
+ _PTR(SComponent) component = studyDS->FindComponent( "GEOM" );
+ if ( !component )
return;
- // Create new actor
- _PTR(GenericAttribute) anAttr;
- if (!obj->FindAttribute(anAttr, "AttributeIOR"))
- return;
- _PTR(AttributeIOR) anIOR(anAttr);
- std::string anIORValue = anIOR->Value();
-
- GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(anIORValue.c_str());
- TopoDS_Shape Shape = ShapeReader.GetShape(Geom,aShape);
- if (!Shape.IsNull()) {
- if (obj->FindAttribute(anAttr, "AttributeName")) {
- _PTR(AttributeName) aName (anAttr);
- std::string aNameValue = aName->Value();
- // open transaction
- /*SUIT_Operation* op = new SalomeApp_ImportOperation (app);
- op->start();
-
- _PTR(SObject) newObj1 = aStudyBuilder->NewObject(father);
- aStudyBuilder->Addreference(newObj1, obj);
- // commit transaction
- op->commit();*/
- Handle(GEOM_InteractiveObject) anIO =
- new GEOM_InteractiveObject (const_cast<char*>(anIORValue.c_str()),
- const_cast<char*>(aFatherIOR.c_str()),
- "GEOM",
- const_cast<char*>( obj->GetID().c_str()));
-
- GEOM_Displayer(ActiveStudy).Display(anIO, myUpdateViewer);
- /*if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
- SVTK_View* aView = aViewWindow->getView();
- int aMode = aView->GetDisplayMode();
-
- vtkActorCollection* theActors =
- GEOM_AssemblyBuilder::BuildActors(Shape,0,aMode,true);
- theActors->InitTraversal();
- while (vtkActor* anActor = theActors->GetNextActor()) {
- GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
- GActor->setName(const_cast<char*>(aNameValue.c_str()));
- GActor->setIO(anIO);
- aView->Display(GActor);
- }
- aView->Repaint();
- } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
- Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
- Handle(GEOM_AISShape) aSh =
- new GEOM_AISShape (Shape,const_cast<char*>(aNameValue.c_str()));
- aSh->setName(const_cast<char*>(aNameValue.c_str()));
- aSh->setIO(anIO);
- ic->Display(aSh);
- ic->AddOrRemoveCurrentObject(aSh,true);
- }*/
- // update object browser
- SalomeApp_Application* app = NULL; //dynamic_cast<SalomeApp_Application*>(app);
- if (app) {
- CAM_Module* module = app->module("Geometry");
- SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
- if (appMod)
- appMod->updateObjBrowser(true);
- }
- }
+ // load GEOM data (if it is not done yet)
+ std::string ior;
+ if ( !component->ComponentIOR( ior ) ) {
+ CORBA::String_var engineIOR = SalomeApp_Application::orb()->object_to_string( engine );
+ builder->LoadWith( component, engineIOR.in() );
}
+
+ // update Object browser
+ if ( dynamic_cast<SalomeApp_Application*>( app ) )
+ dynamic_cast<SalomeApp_Application*>( app )->updateObjectBrowser( true );
}
};
- // MESSAGE("createAndDisplayGO");
- ProcessVoidEvent(new TEvent (Entry, isUpdated));
+ ProcessVoidEvent( new TEvent() );
+}
- class TEventUpdateBrowser: public SALOME_Event
+/*!
+ \brief Display the presenation in the currently active view
+ \param theEntry geometry object's entry
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::createAndDisplayGO( const char* theEntry, bool theUpdateViewer )
+{
+ class TEvent: public SALOME_Event
+ {
+ std::string myEntry;
+ bool myUpdateViewer;
+ public:
+ TEvent( const char* _entry, bool _update ):
+ myEntry( _entry ), myUpdateViewer( _update )
+ {}
+ virtual void Execute()
{
- public:
- TEventUpdateBrowser() {}
- virtual void Execute() {
- SalomeApp_Application* app =
- dynamic_cast<SalomeApp_Application*>(SUIT_Session::session()->activeApplication());
- if (app) {
- CAM_Module* module = app->module("Geometry");
- SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>(module);
- if (appMod) appMod->updateObjBrowser(true);
- }
- }
- };
-
- if (isUpdated)
- ProcessVoidEvent(new TEventUpdateBrowser ());
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
+
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( myEntry.c_str(), "GEOM", "" );
+
+ GEOM_Displayer( study ).Display( io, myUpdateViewer );
+ }
+ };
+
+ ProcessVoidEvent( new TEvent( theEntry, theUpdateViewer ) );
}
-void GEOM_Swig::createAndDisplayFitAllGO (const char* Entry)
+/*!
+ \brief Same as createAndDisplayGO, but also fits the active view to the contents
+ \param theEntry geometry object's entry
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::createAndDisplayFitAllGO( const char* theEntry )
{
+ // display object
+ createAndDisplayGO( theEntry );
+
+ // fit all the view
class TEventFitAll: public SALOME_Event
{
- public:
- TEventFitAll() {}
- virtual void Execute() {
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if (!app) return;
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app))
- {
- SVTK_View* aView = aViewWindow->getView();
- aView->GetRenderer()->OnFitAll();
- }
- else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app))
- {
- Handle(V3d_Viewer) aViewer3d = occViewer->getViewer3d();
- aViewer3d->InitActiveViews();
-
- if (aViewer3d->MoreActiveViews())
- aViewer3d->ActiveView()->FitAll();
- }
+ public:
+ TEventFitAll() {}
+ virtual void Execute()
+ {
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( app ) {
+ SUIT_ViewWindow* window = app->desktop()->activeWindow();
+ if ( dynamic_cast<SVTK_ViewWindow*>( window ) )
+ dynamic_cast<SVTK_ViewWindow*>( window )->onFitAll();
+ else if ( dynamic_cast<OCCViewer_ViewFrame*>( window ) )
+ dynamic_cast<OCCViewer_ViewFrame*>( window )->onViewFitAll();
}
+ }
+ };
+
+ ProcessVoidEvent( new TEventFitAll() );
+}
+
+/*!
+ \brief Erase presentation in the currently active viewer
+ \param theEntry geometry object's entry
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::eraseGO( const char* theEntry, bool theUpdateViewer )
+{
+ class TEvent: public SALOME_Event
+ {
+ std::string myEntry;
+ bool myUpdateViewer;
+ public:
+ TEvent( const char* _entry, bool _update ):
+ myEntry( _entry ), myUpdateViewer( _update )
+ {}
+ virtual void Execute()
+ {
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return;
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
+
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( myEntry.c_str(), "GEOM", "" );
+
+ GEOM_Displayer( study ).Erase( io, true, myUpdateViewer );
+ }
};
- createAndDisplayGO(Entry);
- ProcessVoidEvent(new TEventFitAll());
+ ProcessVoidEvent( new TEvent( theEntry, theUpdateViewer ) );
}
+/*!
+ \brief Update active viewer contents
+*/
void GEOM_Swig::UpdateViewer()
{
class TEventUpdateViewer: public SALOME_Event
{
- public:
- TEventUpdateViewer() {}
- virtual void Execute() {
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if (!app) return;
- SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if (!ActiveStudy) return;
-
- GEOM_Displayer(ActiveStudy).UpdateViewer();
- }
+ public:
+ TEventUpdateViewer()
+ {}
+ virtual void Execute()
+ {
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return;
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
+
+ GEOM_Displayer( study ).UpdateViewer();
+ }
};
ProcessVoidEvent(new TEventUpdateViewer());
}
-int GEOM_Swig::getIndexTopology(const char* SubIOR, const char* IOR)
+/*!
+ \brief Get sub-shape index inside main shape
+ \param theSubIOR sub-shape geometry object's IOR
+ \param theMainIOR main shape geometry object's IOR
+ \return sub-shape index (-1 in case of error)
+*/
+int GEOM_Swig::getIndexTopology( const char* theSubIOR, const char* theMainIOR )
{
- GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
- if (CORBA::is_nil(aGeomGen))
- return -1;
+ int index = -1;
- GEOM::GEOM_Object_var aMainShape = aGeomGen->GetIORFromString(IOR);
- GEOM::GEOM_Object_var aSubShape = aGeomGen->GetIORFromString(SubIOR);
- if (CORBA::is_nil(aMainShape) || CORBA::is_nil(aSubShape))
- return -1;
+ // get geom engine
+ GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
- GEOM::GEOM_IShapesOperations_var anIShapesOperations =
- aGeomGen->GetIShapesOperations(aMainShape->GetStudyID());
- if (CORBA::is_nil(anIShapesOperations))
- return -1;
+ // get main shape's geom object by IOR
+ CORBA::Object_var anObject = SalomeApp_Application::orb()->string_to_object( theMainIOR );
+ GEOM::GEOM_Object_var aMainShape = GEOM::GEOM_Object::_narrow( anObject.in() );
+ // get sub-shape's geom object by IOR
+ anObject = SalomeApp_Application::orb()->string_to_object( theSubIOR );
+ GEOM::GEOM_Object_var aSubShape = GEOM::GEOM_Object::_narrow( anObject.in() );
+
+ if ( !CORBA::is_nil( aGeomGen ) && !CORBA::is_nil( aMainShape ) && !CORBA::is_nil( aSubShape ) ) {
+ // get shapes operations interface
+ GEOM::GEOM_IShapesOperations_var anIShapesOperations =
+ aGeomGen->GetIShapesOperations( aMainShape->GetStudyID() );
+ if ( !CORBA::is_nil( anIShapesOperations ) )
+ index = anIShapesOperations->GetTopologyIndex( aMainShape, aSubShape );
+ }
- return anIShapesOperations->GetTopologyIndex(aMainShape, aSubShape);
+ return index;
}
-const char* GEOM_Swig::getShapeTypeString(const char* IOR)
+/*!
+ \brief Get shape type name
+ \param theIOR geometry object's IOR
+ \return shape type name ("Shape of unknown type" in case of error)
+*/
+const char* GEOM_Swig::getShapeTypeString( const char* theIOR )
{
- TCollection_AsciiString aTypeName ("Shape of unknown type");
+ QString aTypeName = "Shape of unknown type";
+ // get geom engine
GEOM::GEOM_Gen_var aGeomGen = GeometryGUI::GetGeomGen();
- if (!CORBA::is_nil(aGeomGen))
- {
- GEOM::GEOM_Object_var aShape = aGeomGen->GetIORFromString(IOR);
- if (!CORBA::is_nil(aShape))
- {
- GEOM::GEOM_IShapesOperations_var anIShapesOperations =
- aGeomGen->GetIShapesOperations(aShape->GetStudyID());
- if (!CORBA::is_nil(anIShapesOperations))
- {
- aTypeName = anIShapesOperations->GetShapeTypeString(aShape);
- }
- }
+
+ // get shape's geom object by IOR
+ CORBA::Object_var anObject = SalomeApp_Application::orb()->string_to_object( theIOR );
+ GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow( anObject.in() );
+
+ if ( !CORBA::is_nil( aGeomGen ) && !CORBA::is_nil( aShape ) ) {
+ // get shapes operations interface
+ GEOM::GEOM_IShapesOperations_var anIShapesOperations =
+ aGeomGen->GetIShapesOperations( aShape->GetStudyID() );
+ if ( !CORBA::is_nil( anIShapesOperations ) )
+ aTypeName = anIShapesOperations->GetShapeTypeString( aShape );
}
- return CORBA::string_dup(aTypeName.ToCString());
+ return strdup( qPrintable( aTypeName ) );
}
-
-const char* GEOM_Swig::getShapeTypeIcon(const char* IOR)
+/*!
+ \brief Get shape's icon ID (specified by its type)
+ \param theIOR geometry object's IOR
+ \return icon ID ("None" in case of error)
+*/
+const char* GEOM_Swig::getShapeTypeIcon( const char* theIOR )
{
- GEOM::GEOM_Gen_var Geom = GeometryGUI::GetGeomGen();
- if ( CORBA::is_nil( Geom ) )
- return "None";
+ static const char* icons[] = {
+ "ICON_OBJBROWSER_COMPOUND",
+ "ICON_OBJBROWSER_COMPSOLID",
+ "ICON_OBJBROWSER_SOLID",
+ "ICON_OBJBROWSER_SHELL",
+ "ICON_OBJBROWSER_FACE",
+ "ICON_OBJBROWSER_WIRE",
+ "ICON_OBJBROWSER_EDGE",
+ "ICON_OBJBROWSER_VERTEX"
+ };
- GEOM::GEOM_Object_var aShape = Geom->GetIORFromString(IOR);
- TopoDS_Shape shape = ShapeReader.GetShape(Geom, aShape);
+ const char* anIcon = "None";
- if( shape.IsNull() ) {
- return "None" ;
+ try {
+ CORBA::Object_var anObject = SalomeApp_Application::orb()->string_to_object( theIOR );
+ if ( !CORBA::is_nil( anObject ) ) {
+ GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow( anObject.in() );
+ if ( !CORBA::is_nil( aShape ) ) {
+ GEOM::shape_type aType = aShape->GetShapeType();
+ if ( aType >= GEOM::COMPOUND && aType < GEOM::SHAPE )
+ anIcon = icons[ (int)aType ];
+ }
+ }
+ }
+ catch ( CORBA::Exception& ) {
}
- switch (shape.ShapeType() )
- {
- case TopAbs_COMPOUND:
- { return "ICON_OBJBROWSER_COMPOUND" ;}
- case TopAbs_COMPSOLID:
- { return "ICON_OBJBROWSER_COMPSOLID" ;}
- case TopAbs_SOLID:
- { return "ICON_OBJBROWSER_SOLID" ;}
- case TopAbs_SHELL:
- { return "ICON_OBJBROWSER_SHELL" ;}
- case TopAbs_FACE:
- { return "ICON_OBJBROWSER_FACE" ;}
- case TopAbs_WIRE:
- { return "ICON_OBJBROWSER_WIRE" ;}
- case TopAbs_EDGE:
- { return "ICON_OBJBROWSER_EDGE" ;}
- case TopAbs_VERTEX:
- { return "ICON_OBJBROWSER_VERTEX" ;}
- }
+ return anIcon;
+}
- return "None";
+class TSetPropertyEvent: public SALOME_Event
+{
+ QString myEntry;
+ QString myProperty;
+ QVariant myValue;
+ bool myUpdateViewer;
+
+public:
+ TSetPropertyEvent( const QString& _entry,
+ const QString& _property,
+ const QVariant& _value,
+ bool _update = true );
+ virtual void Execute();
+};
+
+TSetPropertyEvent::TSetPropertyEvent( const QString& _entry,
+ const QString& _property,
+ const QVariant& _value,
+ bool _update ):
+ myEntry( _entry ),
+ myProperty( _property ),
+ myValue( _value ),
+ myUpdateViewer( _update )
+{
}
-void GEOM_Swig::setDisplayMode(const char* theEntry, int theMode, bool isUpdated)
+void TSetPropertyEvent::Execute()
{
- class TEvent: public SALOME_Event {
- std::string myEntry;
- int myMode;
- bool myUpdateViewer;
- public:
- TEvent(const char* theEntryArg, int theModeArg, bool theUpdated):
- myEntry(theEntryArg), myMode(theModeArg), myUpdateViewer(theUpdated)
- {}
- virtual void Execute() {
- SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
- if (!anApp) return;
-
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
- SVTK_View* aView = aViewWindow->getView();
- aView->SetDisplayMode(anIO, myMode);
- if (myUpdateViewer)
- aView->Repaint();
- }
- else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
- if (soccViewer)
- soccViewer->switchRepresentation(anIO, myMode, myUpdateViewer);
- }
- }
- };
+ SUIT_Application* app = SUIT_Session::session()->activeApplication();
+ if ( !app ) return;
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !study ) return;
+
+ GEOM_Displayer displayer( study );
+
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ int mgrId = dynamic_cast<SUIT_ViewModel*>( window )->getViewManager()->getGlobalId();
- ProcessVoidEvent(new TEvent (theEntry, theMode, isUpdated));
+ study->setObjectProperty( mgrId, myEntry, myProperty, myValue );
+
+ Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( myEntry.toLatin1().data(), "GEOM" );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, myUpdateViewer );
}
-void GEOM_Swig::setVectorsMode(const char* theEntry, bool isOn, bool isUpdated)
+/*!
+ \brief Set display mode to the presentation
+ \param theEntry geometry object's entry
+ \param theMode display mode: 0 - wireframe, 1 - shading, 2 - shading+edges, 3-textured
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer )
{
- class TEvent: public SALOME_Event {
- std::string myEntry;
- bool myOn;
- bool myUpdateViewer;
- public:
- TEvent(const char* theEntryArg, bool theOn, bool theUpdated):
- myEntry(theEntryArg), myOn(theOn), myUpdateViewer(theUpdated)
- {}
- virtual void Execute() {
- SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
- if (!anApp) return;
-
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
- SVTK_View* aView = aViewWindow->getView();
- SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( myEntry.c_str() ) );
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- while (vtkActor* anAct = anActors->GetNextActor()) {
- GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
- aGeomActor->SetVectorMode(!aGeomActor->GetVectorMode());
- }
- if (myUpdateViewer)
- aView->Repaint();
- }
- else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
- Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
- if (soccViewer) {
- SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
- if ( occPrs && !occPrs->IsNull() ) {
- AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
- AIS_ListIteratorOfListOfInteractive interIter( shapes );
- for ( ; interIter.More(); interIter.Next() ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
- aSh->SetDisplayVectors(myOn);
- ic->RecomputePrsOnly(interIter.Value());
- }
- }
- }
- }
- }
- };
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::DisplayMode ),
+ theMode, theUpdateViewer ) );
+}
- ProcessVoidEvent(new TEvent (theEntry, isOn, isUpdated));
+/*!
+ \brief Show / hide edges direction vectors for the presentation
+ \param theEntry geometry object's entry
+ \param theOn \c true to show edges direction vectors or \c false otherwise
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer )
+{
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::EdgesDirection ),
+ theOn, theUpdateViewer ) );
}
-void GEOM_Swig::setColor(const char* theEntry, int red, int green, int blue, bool isUpdated)
+/*!
+ \brief Change color of the presentation
+ \param theEntry geometry object's entry
+ \param theRed red component of the component (0-255)
+ \param theGreen green component of the component (0-255)
+ \param theBlue blue component of the component (0-255)
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer )
{
- class TEvent: public SALOME_Event {
- QString myEntry;
- int myRed;
- int myGreen;
- int myBlue;
- bool myUpdateViewer;
- public:
- TEvent(const char* theEntryArg, int theR, int theG, int theB, bool theUpdated):
- myEntry(theEntryArg), myRed(theR), myGreen(theG), myBlue(theB), myUpdateViewer(theUpdated)
- {}
- virtual void Execute() {
- SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
- if (!anApp) return;
- GEOMToolsGUI::SetColor( myEntry, QColor( myRed, myGreen, myBlue), myUpdateViewer );
- }
- };
- ProcessVoidEvent(new TEvent(theEntry, red, green, blue, isUpdated));
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Color ),
+ QColor( theRed, theGreen, theBlue ), theUpdateViewer ) );
}
-void GEOM_Swig::setIsos(const char* Entry, int nbU, int nbV, bool isUpdated )
+/*!
+ \brief Set number of iso-lines to the presentation
+ \param theEntry geometry object's entry
+ \param theNbU number of iso-lines along U axis (interger value >= 0)
+ \param theNbV number of iso-lines along V axis (interger value >= 0)
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer )
{
- class TEvent: public SALOME_Event {
- std::string myEntry;
- int myNbU, myNbV;
- bool myUpdateViewer;
- public:
- TEvent(const char* theEntry, int theNbU, int theNbV, bool theUpdated):
- myEntry(theEntry), myNbU(theNbU), myNbV(theNbV), myUpdateViewer(theUpdated)
- {}
- virtual void Execute() {
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if (!app) return;
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if (!study) return;
-
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(app)) {
- SVTK_Viewer* aView = dynamic_cast<SVTK_Viewer*>(aViewWindow->getViewManager()->getViewModel());
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aView->CreatePrs( myEntry.c_str() ) );
- if ( vtkPrs ) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- GEOM_Actor* anActor = GEOM_Actor::SafeDownCast( anActors->GetNextActor() );
- if ( anActor ) {
- int aIsos[2]={myNbU,myNbV};
- anActor->SetNbIsos(aIsos);
- anActor->StoreIsoNumbers();
- QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
- int aMgrId = aView->getViewManager()->getGlobalId();
- study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
- }
- }
-
- if (myUpdateViewer)
- aView->Repaint();
- }
- else if (OCCViewer_Viewer* occViewer = GetOCCViewer(app)) {
- Handle(AIS_InteractiveContext) ic = occViewer->getAISContext();
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
- if (soccViewer) {
- int aMgrId = soccViewer->getViewManager()->getGlobalId();
- SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( myEntry.c_str() ) );
- if ( occPrs && !occPrs->IsNull() ) {
- AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes );
- AIS_ListIteratorOfListOfInteractive interIter( shapes );
- for ( ; interIter.More(); interIter.Next() ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() );
- if ( !aSh.IsNull() ) {
- Handle(AIS_Drawer) drawer = aSh->Attributes();
- QVariant v = study->getObjectProperty( aMgrId, myEntry.c_str(), EDGE_WIDTH_PROP, QVariant() );
- int width = v.isValid() ? v.toInt() : 1;
- drawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbU) );
- drawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width, myNbV) );
- aSh->storeIsoNumbers();
- ic->SetLocalAttributes(aSh, drawer);
- ic->Redisplay(aSh);
- QString anIsos = QString("%1%2%3").arg(myNbU).arg(DIGIT_SEPARATOR).arg(myNbV);
- study->setObjectProperty(aMgrId, myEntry.c_str(), ISOS_PROP, anIsos);
- }
- }
- }
- }
- }
- }
- };
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::NbIsos ),
+ QString( "%1%2%3" ).arg( theNbU ).arg( GEOM::subSectionSeparator() ).arg( theNbV ),
+ theUpdateViewer ) );
+}
- ProcessVoidEvent(new TEvent (Entry, nbU, nbV, isUpdated));
+/*!
+ \brief Set transparency of the presentation
+ \param theEntry geometry object's entry
+ \param theTransparency transparency (floating point value between 0 and 1)
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer )
+{
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Transparency ),
+ theTransparency, theUpdateViewer ) );
}
-void GEOM_Swig::setTransparency(const char* theEntry, float transp, bool isUpdated)
+/*!
+ \brief Set deflection coefficient of the presentation
+ \param theEntry geometry object's entry
+ \param theDeflection deflection coefficient (floating point value)
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setDeflection( const char* theEntry, float theDeflection, bool theUpdateViewer )
{
- class TEvent: public SALOME_Event {
- std::string myEntry;
- float myParam;
- bool myUpdateViewer;
- public:
- TEvent(const char* theEntryArg, float theParam, bool theUpdated):
- myEntry(theEntryArg), myParam(theParam), myUpdateViewer(theUpdated)
- {}
- virtual void Execute() {
- SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
- if (!anApp) return;
-
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
- SVTK_View* aView = aViewWindow->getView();
- aView->SetTransparency(anIO, myParam);
- if (myUpdateViewer)
- aView->Repaint();
- } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
- SOCC_Viewer* soccViewer = dynamic_cast<SOCC_Viewer*>(occViewer);
- if (soccViewer)
- soccViewer->setTransparency(anIO, myParam, myUpdateViewer);
- }
- }
- };
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Deflection ),
+ theDeflection, theUpdateViewer ) );
+}
- ProcessVoidEvent(new TEvent (theEntry, transp, isUpdated));
+/*!
+ \brief Set material to the presentation
+ \param theEntry geometry object's entry
+ \param theMaterial material name (string)
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setMaterial( const char* theEntry, const char* theMaterial, bool theUpdateViewer )
+{
+ Material_Model material;
+ material.fromResources( theMaterial );
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Material ),
+ material.toProperties(), theUpdateViewer ) );
}
+/*!
+ \brief Set material property to the presentation
+ \param theEntry geometry object's entry
+ \param theMaterial material property string
+ \param theUpdateViewer \c true to update active view's contents
+*/
+void GEOM_Swig::setMaterialProperty( const char* theEntry, const char* theMaterial, bool theUpdateViewer )
+{
+ ProcessVoidEvent( new TSetPropertyEvent( theEntry, GEOM::propertyName( GEOM::Material ),
+ theMaterial, theUpdateViewer ) );
+}
-class TInitGeomGenEvent: public SALOME_Event {
+class TInitGeomGenEvent: public SALOME_Event
+{
public:
typedef bool TResult;
TResult myResult;
- TInitGeomGenEvent() : myResult(false) {}
- virtual void Execute() {
+ TInitGeomGenEvent() : myResult(false)
+ {}
+ virtual void Execute()
+ {
myResult = GeometryGUI::InitGeomGen();
}
};
-bool GEOM_Swig::initGeomGen()
-{
- return ProcessEvent(new TInitGeomGenEvent());
-}
-
-
-void GEOM_Swig::eraseGO (const char* Entry, bool allWindows)
-{
- class TEvent: public SALOME_Event
- {
- std::string myEntry;
- bool myFromAllWindows;
- public:
- TEvent(const char* theEntry, bool fromAllWindows):
- myEntry(theEntry), myFromAllWindows(fromAllWindows)
- {}
- virtual void Execute()
- {
- SUIT_Application* app = SUIT_Session::session()->activeApplication();
- if (!app) return;
- SalomeApp_Study* ActiveStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if (!ActiveStudy) return;
-
- Handle (SALOME_InteractiveObject) aIO = new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- GEOM_Displayer(ActiveStudy).Erase(aIO, true);
- /* if (myFromAllWindows) {
- QPtrList<SUIT_ViewWindow> aWindows = app->desktop()->windows();
- SUIT_ViewWindow* aWin = 0;
- for (aWin = aWindows.first(); aWin; aWin = aWindows.next()) {
- EraseObject(aWin, aIO);
- }
- } else {
- SUIT_ViewWindow* aWin = app->desktop()->activeWindow();
- if (aWin)
- EraseObject(aWin, aIO);
- }*/
- }
-
- /* private:
- void EraseObject(SUIT_ViewWindow* theWin, Handle (SALOME_InteractiveObject) theIO)
- {
- if (theWin->getViewManager()->getType() == OCCViewer_Viewer::Type()){
- OCCViewer_ViewWindow* vw = dynamic_cast<OCCViewer_ViewWindow*>( theWin );
- if ( vw ) {
- OCCViewer_ViewManager* vm = dynamic_cast<OCCViewer_ViewManager*>( vw->getViewManager() );
- if ( vm ) {
- SOCC_Viewer* aViewer = dynamic_cast<SOCC_Viewer*>(vm->getOCCViewer());
- if (aViewer) {
- SALOME_Prs* aPrs = aViewer->CreatePrs(myEntry.c_str());
- if (aPrs) {
- SALOME_OCCPrs* aOccPrs = dynamic_cast<SALOME_OCCPrs*>(aPrs);
- if (aOccPrs) {
- aViewer->Erase(aOccPrs);
- aViewer->Repaint();
- }
- }
- }
- }
- }
- } else if (theWin->getViewManager()->getType() == SVTK_Viewer::Type()){
- SVTK_ViewWindow* aViewWindow = dynamic_cast<SVTK_ViewWindow*>( theWin );
- if (aViewWindow) {
- aViewWindow->Erase(theIO);
- }
- }
- }*/
-
- };
- ProcessVoidEvent(new TEvent(Entry, allWindows));
-}
-
-
-
-void GEOM_Swig::setDeflection(const char* theEntry, float theDeflect)
+/*!
+ \brief Initialize GEOM module's engine
+ \return \c true if initialization succeedes or \c false otherwise
+*/
+bool GEOM_Swig::initGeomGen()
{
- class TEvent: public SALOME_Event {
- std::string myEntry;
- float myParam;
- public:
- TEvent(const char* theEntryArg, float theParam):
- myEntry(theEntryArg), myParam(theParam)
- {}
- virtual void Execute() {
- SUIT_Application* anApp = SUIT_Session::session()->activeApplication();
- if (!anApp) return;
-
- Handle(SALOME_InteractiveObject) anIO =
- new SALOME_InteractiveObject(myEntry.c_str(), "GEOM", "");
-
- if (SVTK_ViewWindow* aViewWindow = GetSVTKViewWindow(anApp)) {
- vtkActorCollection* aActors = aViewWindow->getRenderer()->GetActors();
- aActors->InitTraversal();
- while (vtkActor* aAct = aActors->GetNextActor()) {
- if (GEOM_Actor* aGeomActor = dynamic_cast<GEOM_Actor*>(aAct)) {
- if (aGeomActor->hasIO()) {
- Handle(SALOME_InteractiveObject) aNextIO = aGeomActor->getIO();
- if (aNextIO->isSame(anIO)) {
- aGeomActor->setDeflection(myParam);
- aViewWindow->Repaint();
- return;
- }
- }
- }
- }
- // aView->SetTransparency(anIO, myParam);
- //aView->Repaint();
- } else if (OCCViewer_Viewer* occViewer = GetOCCViewer(anApp)) {
- Handle(AIS_InteractiveContext) aContext = occViewer->getAISContext();
- AIS_ListOfInteractive aAISList;
- aContext->DisplayedObjects(aAISList);
- AIS_ListIteratorOfListOfInteractive it(aAISList);
- for (; it.More(); it.Next()) {
- Handle(SALOME_InteractiveObject) aObj =
- Handle(SALOME_InteractiveObject)::DownCast(it.Value()->GetOwner());
- if ((!aObj.IsNull()) && aObj->hasEntry() && aObj->isSame(anIO)) {
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast(it.Value());
- if (!aShape.IsNull()) {
- TopoDS_Shape aSh = aShape->Shape();
- if (!aSh.IsNull())
- BRepTools::Clean(aSh);
-
- aShape->SetOwnDeviationCoefficient( myParam );
- aShape->SetOwnHLRDeviationAngle( 1.57 );
- aContext->Redisplay(aShape);
- return;
- }
- }
- }
- }
- }
- };
-
- ProcessVoidEvent(new TEvent (theEntry, theDeflect));
+ return ProcessEvent( new TInitGeomGenEvent() );
}
-
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
-// GEOM GEOMGUI : GUI for Geometry component
// File : libGEOM_Swig.h
// Author : Nicolas REJNERI, Paul RASCLE
-//
-#ifndef GEOMETRYGUI_SWIG_HXX
-#define GEOMETRYGUI_SWIG_HXX
+#ifndef LIBGEOM_SWIG_H
+#define LIBGEOM_SWIG_H
#include "GEOM_GEOMGUI.hxx"
-// IDL Headers
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(GEOM_Gen)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
class GEOMGUI_EXPORT GEOM_Swig
{
public:
GEOM_Swig();
~GEOM_Swig();
- void createAndDisplayGO(const char* Entry, bool isUpdated = true);
- void eraseGO(const char* Entry, bool allWindows);
- void createAndDisplayFitAllGO(const char* Entry);
+ void createAndDisplayGO( const char* theEntry, bool theUpdateViewer = true );
+ void createAndDisplayFitAllGO( const char* theEntry );
+ void eraseGO( const char* theEntry, bool theUpdateViewer = true );
+
void UpdateViewer();
- void setDisplayMode(const char* Entry, int mode, bool isUpdated = true);
- void setVectorsMode(const char* Entry, bool isSet, bool isUpdated = true);
- void setColor(const char* Entry, int red, int green, int blue, bool isUpdated = true);
- void setTransparency(const char* Entry, float transp, bool isUpdated = true);
- void setIsos(const char* Entry, int nbU, int nbV, bool isUpdated =true);
- void setDeflection(const char* Entry, float deflect);
- int getIndexTopology(const char *SubEntry, const char *Entry);
- const char* getShapeTypeString(const char *Entry);
- const char* getShapeTypeIcon(const char *Ior);
+ void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
+ void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+ void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
+ void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
+ void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
+ void setDeflection( const char* theEntry, float theDeflection, bool theUpdateViewer = true );
+ void setMaterial( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
+ void setMaterialProperty( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
+
+ int getIndexTopology( const char* theSubIOR, const char* theMainIOR );
+ const char* getShapeTypeString( const char* theIOR );
+ const char* getShapeTypeIcon( const char* theIOR );
bool initGeomGen();
+private:
+
+ void init();
};
-#endif // GEOMETRYGUI_SWIG_HXX
+#endif // LIBGEOM_SWIG_H
// Author : Nicolas REJNERI, Paul RASCLE
// Project : SALOME
// Module : GEOM
-// $Header$
//
%module libGEOM_Swig
GEOM_Swig();
~GEOM_Swig();
- void createAndDisplayGO(const char* Entry, bool isUpdated =true);
- void eraseGO(const char* Entry, bool allWindows);
- void createAndDisplayFitAllGO(const char* Entry);
+ void createAndDisplayGO( const char* theEntry, bool theUpdateViewer = true );
+ void createAndDisplayFitAllGO( const char* theEntry );
+ void eraseGO( const char* theEntry, bool theUpdateViewer = true );
+
void UpdateViewer();
- int getIndexTopology(const char *SubEntry, const char *Entry);
- const char* getShapeTypeString(const char *Entry);
- void setDisplayMode(const char* Entry, int mode, bool isUpdated =true);
- void setVectorsMode(const char* Entry, bool isSet, bool isUpdated =true);
- void setColor(const char* Entry, int red, int green, int blue, bool isUpdated =true);
- void setTransparency(const char* Entry, float transp, bool isUpdated =true);
- void setIsos(const char* Entry, int nbU, int nbV, bool isUpdated =true);
- void setDeflection(const char* Entry, float deflect);
- const char* getShapeTypeIcon(const char *Ior);
+ void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
+ void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
+ void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
+ void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
+ void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
+ void setDeflection( const char* theEntry, float theDeflection, bool theUpdateViewer = true );
+ void setMaterial( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
+ void setMaterialProperty( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
+
+ int getIndexTopology( const char* theSubIOR, const char* theMainIOR );
+ const char* getShapeTypeString( const char* theIOR );
+ const char* getShapeTypeIcon( const char* theIOR );
bool initGeomGen();
};
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
+#include <SalomeApp_Tools.h>
#include <LightApp_SelectionMgr.h>
#include <GEOMImpl_Types.hxx>
+#define GROUP_IDLST_COLOR Qt::blue // Specific color for the IDs of subShapes in the dialog box
+#define GROUP_NEWIDLST_COLOR Qt::red // Specific color for the new IDs of subShapes in the dialog box
+
enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
{
+ GEOM_Displayer* aDisplayer = getDisplayer();
if (myIsHiddenMain) {
- GEOM_Displayer* aDisplayer = getDisplayer();
aDisplayer->Display(myMainObj);
myIsHiddenMain = false;
}
+ aDisplayer->Display(myGroup);
+ myDmMode = -1;
}
//=================================================================================
//=================================================================================
void GroupGUI_GroupDlg::Init()
{
+ myDmMode = -1;
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
//unset shape type to avoid preparation of selection before exact user shape type selection
setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup));
GEOM::ListOfLong_var aCurrList = anOper->GetObjects(myGroup);
- for (int i = 0, n = aCurrList->length(); i < n; i++)
- myIdList->addItem(new QListWidgetItem(QString("%1").arg(aCurrList[i])));
-
+ for (int i = 0, n = aCurrList->length(); i < n; i++) {
+ QListWidgetItem* itm = new QListWidgetItem( QString( "%1" ).arg( aCurrList[ i ] ) );
+ myGroupIdList.append( aCurrList[ i ] );
+ itm->setTextColor( QColor( GROUP_IDLST_COLOR ) );
+ myIdList->addItem( itm );
+ }
myEditCurrentArgument = 0;
}
connect(mySelBtn2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
//=================================================================================
bool GroupGUI_GroupDlg::ClickOnApply()
{
- if(!isApplyAndClose())
+ if(!isApplyAndClose()) {
setIsDisableBrowsing( true );
+ setIsDisplayResult( false );
+ }
- if (!onAccept(myMode == CreateGroup, true,isApplyAndClose()))
+ if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
return false;
- if(!isApplyAndClose())
+ if(!isApplyAndClose()) {
setIsDisableBrowsing( false );
+ setIsDisplayResult( true );
+ }
if (myMode == CreateGroup)
{
ConstructorsClicked(getConstructorId());
}
else
+ {
+ int n = myIdList->count();
+ myGroupIdList.clear();
+ if (n > 0)
+ {
+ for (int i = 0; i < n; i++) {
+ QListWidgetItem* anItem = myIdList->item( i );
+ myGroupIdList.append( anItem->text().toInt() );
+ anItem->setTextColor( GROUP_IDLST_COLOR );
+ }
+ }
activateSelection();
-
+ }
return true;
}
if (aSubShapes->length() > 0) {
if (subSelectionWay() == ALL_SUBSHAPES)
{
- myIdList->clear(); // for sorted final list?
+// myIdList->clear(); // for sorted final list?
if (!aShOp->IsDone())
return;
QListWidgetItem* anItem = 0;
QString text = QString("%1").arg(anIndex);
- if (!myInPlaceObj->_is_nil()) {
+// if (!myInPlaceObj->_is_nil()) {
QList<QListWidgetItem*> found = myIdList->findItems(text, Qt::MatchExactly);
if (found.count()) anItem = found[0];
- }
+// }
if (!anItem) {
anItem = new QListWidgetItem(text);
+ anItem->setTextColor( myGroupIdList.contains(anIndex) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
myIdList->addItem(anItem);
}
anItem->setSelected(true);
continue;
QListWidgetItem* anItem = new QListWidgetItem(QString("%1").arg(aMapIndex(i)));
+ anItem->setTextColor( myGroupIdList.contains( aMapIndex( i ) ) ? QColor( GROUP_IDLST_COLOR ) : QColor( GROUP_NEWIDLST_COLOR ) );
myIdList->addItem(anItem);
anItem->setSelected(true);
}
void GroupGUI_GroupDlg::activateSelection()
{
bool isApply = ((QPushButton*)sender() == buttonApply());
- if(!isApply)
+ if(!isApplyAndClose())
erasePreview(false);
// local selection
myIsShapeType) // check if shape type is already choosen by user
{
GEOM_Displayer* aDisplayer = getDisplayer();
-
- // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
- if (getShapeType() == TopAbs_VERTEX) {
- if (myIsHiddenMain)
- aDisplayer->Display(myMainObj);
- }
- else {
- SALOME_View* view = GEOM_Displayer::GetActiveView();
+
+ //display mode for main shape
+ if ( myDmMode == -1 ) {
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
if (view) {
CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
Handle(SALOME_InteractiveObject) io =
new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
- if (view->isVisible(io)) {
- aDisplayer->Erase(myMainObj, false, false);
- myIsHiddenMain = true;
+ if ( view->isVisible( io ) ) {
+ Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIOinGEOMAISShape( io, true );
+ if(!aSh.IsNull()) {
+ myDmMode = aSh->isTopLevel() ? aSh->prevDisplayMode() : aSh->DisplayMode();
+ }
+ // Hide main shape, if explode on VERTEX
+ if(getShapeType() != TopAbs_VERTEX) {
+ aDisplayer->Erase(myMainObj, false, false);
+ myIsHiddenMain = true;
+ }
}
+ else
+ myDmMode = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "display_mode" );
}
}
- if(!isApply) {
- int prevDisplayMode = aDisplayer->SetDisplayMode(0);
+ aDisplayer->SetDisplayMode(myDmMode);
+
+ // Mantis issue 0021421: do not hide main shape, if explode on VERTEX
+ if (getShapeType() == TopAbs_VERTEX) {
+ if (myIsHiddenMain)
+ aDisplayer->Display(myMainObj);
+ }
+ aDisplayer->Erase(myGroup, false, false);
+
+ QColor aColor = SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", "editgroup_color" );
+ Quantity_NameOfColor aCol = SalomeApp_Tools::color( aColor ).Name();
+ if(!isApplyAndClose()) {
SUIT_ViewWindow* aViewWindow = 0;
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
if (activeStudy)
for (; anExp.More(); anExp.Next()) {
TopoDS_Shape aSubShape = anExp.Current();
int index = aSubShapesMap.FindIndex(aSubShape);
- QString anEntry = anEntryBase + QString("_%1").arg(index);
-
+ QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
+ Handle(SALOME_InteractiveObject) io =
+ new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
+ if ( myGroupIdList.contains( index ) ) {
+ aDisplayer->SetColor( aCol );
+ }
+ else {
+ aDisplayer->UnsetColor();
+ }
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) {
displayPreview(aPrs, true, false); // append, do not update
for (; aM2IPit.More(); aM2IPit.Next()) {
int index = aM2IPit.Key();
TopoDS_Shape aSubShape = aSubShapesMap.FindKey(index);
- QString anEntry = anEntryBase + QString("_%1").arg(index);
+ QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
+
+ if ( myGroupIdList.contains( index ) ) {
+ aDisplayer->SetColor( aCol );
+ }
+ else {
+ aDisplayer->UnsetColor();
+ }
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) {
}
}
else ;
-
+ aDisplayer->UnsetDisplayMode();
+ aDisplayer->UnsetColor();
aDisplayer->UpdateViewer();
- aDisplayer->SetDisplayMode(prevDisplayMode);
}
}
GEOM::GEOM_Object_var myInPlaceObj;
int myInPlaceObjSelectState;
TColStd_DataMapOfIntegerInteger myMain2InPlaceIndices;
+ QList<int> myGroupIdList;
+ int myDmMode;
QPushButton* mySelBtn;
QLineEdit* myMainName;
# Author : Pavel TELKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# Author : Pavel TELKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# 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 : Alexander BORODIN, Open CASCADE S.A.S. (alexander.borodin@opencascade.com)
# Package : src (source files directory)
-SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \
- BREPExport BREPImport IGESExport IGESImport STEPExport \
- STEPImport STLExport VTKExport ShHealOper GEOMImpl GEOM_I \
+SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER OCC2VTK GEOM \
+ BREPExport BREPImport IGESExport IGESImport STEPExport STEPImport \
+ STLExport VTKExport ShHealOper GEOMUtils GEOMImpl GEOM_I \
GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY
if WITH_OPENCV
endif
if GEOM_ENABLE_GUI
- 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
+ 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
endif
-DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo \
- SKETCHER OCC2VTK GEOM BREPExport \
- BREPImport IGESExport IGESImport STEPExport STEPImport STLExport \
- VTKExport ShHealOper GEOMImpl GEOM_I GEOMClient GEOM_I_Superv \
- GEOM_SWIG OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \
+DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools BlockFix GEOMAlgo SKETCHER \
+ OCC2VTK GEOM BREPExport BREPImport IGESExport IGESImport \
+ STEPExport STEPImport STLExport VTKExport ShHealOper GEOMUtils \
+ GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG OBJECT \
+ DlgRef GEOMFiltersSelection Material GEOMGUI GEOMBase \
GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \
EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \
- RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \
+ RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \
GEOM_SWIG_WITHIHM GEOM_PY ShapeRecognition
Material_Model.cxx \
Material_ResourceMgr.cxx
+MOC_FILES = \
+ Material_ResourceMgr_moc.cxx
+
+nodist_libMaterial_la_SOURCES = \
+ $(MOC_FILES)
+
# additional information to compile and link file
libMaterial_la_CPPFLAGS = \
$(QT_INCLUDES) \
#include "GEOM_VTKPropertyMaterial.hxx"
#include "Material_ResourceMgr.h"
+#include <QMutexLocker>
+
/*!
\brief Constructor
else if ( key == "emissivecolor" && Qtx::stringToColor( data, colorValue ) ) {
setColor( Emissive, colorValue );
}
- else if ( key == "ambientcoefficient" && dblOk ) {
+ else if ( key == "frontambientcoefficient" && dblOk ) {
setReflection( Ambient, dblValue );
}
- else if ( key == "diffusecoefficient" && dblOk ) {
+ else if ( key == "backambientcoefficient" && dblOk ) {
+ setReflection( Ambient, dblValue, false );
+ }
+ else if ( key == "frontdiffusecoefficient" && dblOk ) {
setReflection( Diffuse, dblValue );
}
- else if ( key == "specularcoefficient" && dblOk ) {
+ else if ( key == "backdiffusecoefficient" && dblOk ) {
+ setReflection( Diffuse, dblValue, false );
+ }
+ else if ( key == "frontspecularcoefficient" && dblOk ) {
setReflection( Specular, dblValue );
}
- else if ( key == "emissivecoefficient" && dblOk ) {
+ else if ( key == "backspecularcoefficient" && dblOk ) {
+ setReflection( Specular, dblValue, false );
+ }
+ else if ( key == "frontemissivecoefficient" && dblOk ) {
setReflection( Emissive, dblValue );
}
- else if ( key == "shininess" && dblOk ) {
+ else if ( key == "backemissivecoefficient" && dblOk ) {
+ setReflection( Emissive, dblValue, false );
+ }
+ else if ( key == "frontshininess" && dblOk ) {
setShininess( dblValue );
}
+ else if ( key == "backshininess" && dblOk ) {
+ setShininess( dblValue, false );
+ }
else if ( key == "transparency" && dblOk ) {
setTransparency( dblValue );
}
props << fmt.arg( "Physical" ).arg( isPhysical() );
// shininess
- props << fmt.arg( "Shininess" ).arg( shininess() );
+ props << fmt.arg( "FrontShininess" ).arg( QString::number ( shininess( true ), 'g', 4 ) ) << fmt.arg( "BackShininess" ).arg( QString::number ( shininess( false ), 'g', 4 ) );
//transparency
props << fmt.arg( "Transparency" ).arg( transparency() );
props << fmt.arg( "Ambient" ).arg( hasReflection( Ambient ) );
if ( color( Ambient ).isValid() )
props << fmt.arg( "AmbientColor" ).arg( Qtx::colorToString( color( Ambient ) ) );
- props << fmt.arg( "AmbientCoefficient" ).arg( reflection( Ambient ) );
+ props << fmt.arg( "FrontAmbientCoefficient" ).arg( QString::number ( reflection( Ambient, true ), 'g', 4 ) ) << fmt.arg( "BackAmbientCoefficient" ).arg( QString::number ( reflection( Ambient, false ), 'g', 4 ) );
// diffuse reflection
props << fmt.arg( "Diffuse" ).arg( hasReflection( Diffuse ) );
if ( color( Diffuse ).isValid() )
props << fmt.arg( "DiffuseColor" ).arg( Qtx::colorToString( color( Diffuse ) ) );
- props << fmt.arg( "DiffuseCoefficient" ).arg( reflection( Diffuse ) );
+ props << fmt.arg( "FrontDiffuseCoefficient" ).arg( QString::number ( reflection( Diffuse, true ), 'g', 4 ) ) << fmt.arg( "BackDiffuseCoefficient" ).arg( QString::number ( reflection( Diffuse, false ), 'g', 4 ) );
// specular reflection
props << fmt.arg( "Specular" ).arg( hasReflection( Specular ) );
if ( color( Specular ).isValid() )
props << fmt.arg( "SpecularColor" ).arg( Qtx::colorToString( color( Specular ) ) );
- props << fmt.arg( "SpecularCoefficient" ).arg( reflection( Specular ) );
+ props << fmt.arg( "FrontSpecularCoefficient" ).arg( QString::number ( reflection( Specular, true ), 'g', 4 ) ) << fmt.arg( "BackSpecularCoefficient" ).arg( QString::number ( reflection( Specular, false ), 'g', 4 ) );
// emissive reflection
props << fmt.arg( "Emissive" ).arg( hasReflection( Emissive ) );
if ( color( Emissive ).isValid() )
props << fmt.arg( "EmissiveColor" ).arg( Qtx::colorToString( color( Emissive ) ) );
- props << fmt.arg( "EmissiveCoefficient" ).arg( reflection( Emissive ) );
+ props << fmt.arg( "FrontEmissiveCoefficient" ).arg( QString::number ( reflection( Emissive, true ), 'g', 4 ) ) << fmt.arg( "BackEmissiveCoefficient" ).arg( QString::number ( reflection( Emissive, false ), 'g', 4 ) );
return props.join( ":" );
}
\param resMgr resource manager (if not specified, new resources manager is created)
\sa toResources()
*/
-void Material_Model::fromResources( const QString& material, QtxResourceMgr* resMgr )
+void Material_Model::fromResources( const QString& material, Material_ResourceMgr* resMgr )
{
static QString common = "[common]";
// material name is not specified: use default values
if ( material.isEmpty() ) return;
- bool ownResourcesMgr = resMgr == 0;
-
- if ( ownResourcesMgr )
- resMgr = new Material_ResourceMgr();
+ if ( !resMgr )
+ resMgr = Material_ResourceMgr::resourceMgr();
+
+ // lock resources manager
+ QMutexLocker lock( &resMgr->myMutex );
// read common section
if ( material != common && resMgr->hasSection( common ) )
- fromResources( common, resMgr );
+ read( common, resMgr );
+
+ // read material section
+ read( material, resMgr );
+}
+void Material_Model::read( const QString& material, Material_ResourceMgr* resMgr )
+{
// physical
if ( resMgr->hasValue( material, "physical" ) ) {
setPhysical( resMgr->booleanValue( material, "physical" ) );
}
// shininess
- if ( resMgr->hasValue( material, "shininess" ) ) {
- setShininess( resMgr->doubleValue( material, "shininess" ) );
+ if ( resMgr->hasValue( material, "front_shininess" ) ) {
+ setShininess( resMgr->doubleValue( material, "front_shininess" ) );
+ }
+ if ( resMgr->hasValue( material, "back_shininess" ) ) {
+ setShininess( resMgr->doubleValue( material, "back_shininess" ), false );
}
// transparency
if ( resMgr->hasValue( material, "ambient-color" ) ) {
setColor( Ambient, resMgr->colorValue( material, "ambient-color" ) );
}
- if ( resMgr->hasValue( material, "ambient-coefficient" ) ) {
- setReflection( Ambient, resMgr->doubleValue( material, "ambient-coefficient" ) );
+ if ( resMgr->hasValue( material, "front_ambient-coefficient" ) ) {
+ setReflection( Ambient, resMgr->doubleValue( material, "front_ambient-coefficient" ) );
+ }
+ if ( resMgr->hasValue( material, "back_ambient-coefficient" ) ) {
+ setReflection( Ambient, resMgr->doubleValue( material, "back_ambient-coefficient" ), false );
}
if ( resMgr->hasValue( material, "ambient" ) ) {
setReflection( Ambient, resMgr->booleanValue( material, "ambient" ) );
if ( resMgr->hasValue( material, "diffuse-color" ) ) {
setColor( Diffuse, resMgr->colorValue( material, "diffuse-color" ) );
}
- if ( resMgr->hasValue( material, "diffuse-coefficient" ) ) {
- setReflection( Diffuse, resMgr->doubleValue( material, "diffuse-coefficient" ) );
+ if ( resMgr->hasValue( material, "front_diffuse-coefficient" ) ) {
+ setReflection( Diffuse, resMgr->doubleValue( material, "front_diffuse-coefficient" ) );
+ }
+ if ( resMgr->hasValue( material, "back_diffuse-coefficient" ) ) {
+ setReflection( Diffuse, resMgr->doubleValue( material, "back_diffuse-coefficient" ), false );
}
if ( resMgr->hasValue( material, "diffuse" ) ) {
setReflection( Diffuse, resMgr->booleanValue( material, "diffuse" ) );
if ( resMgr->hasValue( material, "specular-color" ) ) {
setColor( Specular, resMgr->colorValue( material, "specular-color" ) );
}
- if ( resMgr->hasValue( material, "specular-coefficient" ) ) {
- setReflection( Specular, resMgr->doubleValue( material, "specular-coefficient" ) );
+ if ( resMgr->hasValue( material, "front_specular-coefficient" ) ) {
+ setReflection( Specular, resMgr->doubleValue( material, "front_specular-coefficient" ) );
+ }
+ if ( resMgr->hasValue( material, "back_specular-coefficient" ) ) {
+ setReflection( Specular, resMgr->doubleValue( material, "back_specular-coefficient" ), false );
}
if ( resMgr->hasValue( material, "specular" ) ) {
setReflection( Specular, resMgr->booleanValue( material, "specular" ) );
if ( resMgr->hasValue( material, "emissive-color" ) ) {
setColor( Emissive, resMgr->colorValue( material, "emissive-color" ) );
}
- if ( resMgr->hasValue( material, "emissive-coefficient" ) ) {
- setReflection( Emissive, resMgr->doubleValue( material, "emissive-coefficient" ) );
+ if ( resMgr->hasValue( material, "front_emissive-coefficient" ) ) {
+ setReflection( Emissive, resMgr->doubleValue( material, "front_emissive-coefficient" ) );
+ }
+ if ( resMgr->hasValue( material, "back_emissive-coefficient" ) ) {
+ setReflection( Emissive, resMgr->doubleValue( material, "back_emissive-coefficient" ), false );
}
if ( resMgr->hasValue( material, "emissive" ) ) {
setReflection( Emissive, resMgr->booleanValue( material, "emissive" ) );
}
-
- if ( ownResourcesMgr )
- delete resMgr;
}
/*!
\param resMgr resource manager
\sa fromResources()
*/
-void Material_Model::toResources( const QString& material, QtxResourceMgr* resMgr )
+void Material_Model::toResources( const QString& material, Material_ResourceMgr* resMgr )
{
if ( resMgr && !material.isEmpty() ) {
+ // lock resources manager
+ QMutexLocker lock( &resMgr->myMutex );
+
// remove resources section (to clean-up all previous properties)
resMgr->remove( material );
resMgr->setValue( material, "physical", isPhysical() );
// shininess
- resMgr->setValue( material, "shininess", shininess() );
+ resMgr->setValue( material, "front_shininess", shininess( true) );
+ resMgr->setValue( material, "back_shininess", shininess( false ) );
// transparency
resMgr->setValue( material, "transparency", transparency() );
// ambient reflection
if ( color( Ambient ).isValid() )
resMgr->setValue( material, "ambient-color", color( Ambient ) );
- resMgr->setValue( material, "ambient-coefficient", reflection( Ambient ) );
+ resMgr->setValue( material, "front_ambient-coefficient", reflection( Ambient ) );
+ resMgr->setValue( material, "back_ambient-coefficient", reflection( Ambient, false ) );
resMgr->setValue( material, "ambient", hasReflection( Ambient ) );
// diffuse reflection
if ( color( Diffuse ).isValid() )
resMgr->setValue( material, "diffuse-color", color( Diffuse ) );
- resMgr->setValue( material, "diffuse-coefficient", reflection( Diffuse ) );
+ resMgr->setValue( material, "front_diffuse-coefficient", reflection( Diffuse ) );
+ resMgr->setValue( material, "back_diffuse-coefficient", reflection( Diffuse, false ) );
resMgr->setValue( material, "diffuse", hasReflection( Diffuse ) );
// Specular reflection
if ( color( Specular ).isValid() )
resMgr->setValue( material, "specular-color", color( Specular ) );
- resMgr->setValue( material, "specular-coefficient", reflection( Specular ) );
+ resMgr->setValue( material, "front_specular-coefficient", reflection( Specular ) );
+ resMgr->setValue( material, "back_specular-coefficient", reflection( Specular, false ) );
resMgr->setValue( material, "specular", hasReflection( Specular ) );
// Emissive reflection
if ( color( Emissive ).isValid() )
resMgr->setValue( material, "emissive-color", color( Emissive ) );
- resMgr->setValue( material, "emissive-coefficient", reflection( Emissive ) );
+ resMgr->setValue( material, "front_emissive-coefficient", reflection( Emissive ) );
+ resMgr->setValue( material, "back_emissive-coefficient", reflection( Emissive, false ) );
resMgr->setValue( material, "emissive", hasReflection( Emissive ) );
}
}
-/*!
- \brief Initialize material model from the preferences
-
- The material name is retrieved from the "material" parameter of the "Geometry" section
- of the specified resources manager.
-
- \param resMgr resources manager
- \sa fromResources(), toResources()
-*/
-// void Material_Model::fromPreferences( QtxResourceMgr* resMgr )
-// {
-// if ( resMgr ) {
-// // default material is Plastic
-// fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) );
-// }
-// }
-
/*!
\brief Get material type
\return \c true if material is physical or \c false otherwise
/*!
\brief Get coefficient value for the given reflection type
\param type reflection type
+ \param theIsFront boolean flag for choosing side
\return coefficient value for the specified reflection type
- \sa setReflection(ReflectionType, double)
+ \sa setReflection(ReflectionType, double, bool = true)
*/
-double Material_Model::reflection( ReflectionType type ) const
+double Material_Model::reflection( ReflectionType type, bool theIsFront ) const
{
double value = 0.0;
if ( type >= 0 && type < 4 )
- value = myReflection[ type ].coef;
+ if ( theIsFront )
+ value = myReflection[ type ].front_coef;
+ else
+ value = myReflection[ type ].back_coef;
return value;
}
\brief Set coefficient value for the given reflection type
\param type reflection type
\param value coefficient to be used by the given reflection type
- \sa reflection()
+ \param theIsFront boolean flag for choosing side
+ \sa reflection( bool = true)
*/
-void Material_Model::setReflection( ReflectionType type, double value )
+void Material_Model::setReflection( ReflectionType type, double value, bool theIsFront )
{
if ( type >= 0 && type < 4 )
- myReflection[ type ].coef = value;
+ if ( theIsFront )
+ myReflection[ type ].front_coef = value;
+ else
+ myReflection[ type ].back_coef = value;
}
/*!
\brief Get shininess value
+ \param theIsFront boolean flag for choosing side
\return shininess value of the material
- \sa setShininess()
+ \sa setShininess( double, bool = true )
*/
-double Material_Model::shininess() const
+double Material_Model::shininess( bool theIsFront ) const
{
- return myShininess;
+ if ( theIsFront )
+ return myFrontShininess;
+ else
+ return myBackShininess;
}
/*!
\brief Set shininess value
\param value new shininess value
- \sa shininess()
+ \param theIsFront boolean flag for choosing side
+ \sa shininess( bool = true )
*/
-void Material_Model::setShininess( double value )
+void Material_Model::setShininess( double value, bool theIsFront )
{
- myShininess = value;
+ if ( theIsFront )
+ myFrontShininess = value;
+ else
+ myBackShininess = value;
}
/*!
setPhysical( false );
// shininess
setShininess( 0.039 );
+ setShininess( 0.039, false );
// transparency
setTransparency( 0.0 );
// ambient reflection (enabled by default)
Qtx::stringToColor( "#333333", c );
setColor( Ambient, c );
- setReflection( Ambient, 0.3 );
+ setReflection( Ambient, 0.3, true );
+ setReflection( Ambient, 0.3, false );
setReflection( Ambient, true );
// diffuse reflection (enabled by default)
Qtx::stringToColor( "#000000", c );
setColor( Diffuse, c );
setReflection( Diffuse, 0.65 );
+ setReflection( Diffuse, 0.65, false );
setReflection( Diffuse, true );
// specular reflection (enabled by default)
Qtx::stringToColor( "#ffffff", c );
setColor( Specular, c );
- setReflection( Specular, 0.0 );
+ setReflection( Specular, 0.0 );
+ setReflection( Specular, 0.0, false );
setReflection( Specular, true );
// emissive reflection (disabled by default)
Qtx::stringToColor( "#000000", c );
setColor( Emissive, c );
- setReflection( Emissive, 0.0 );
+ setReflection( Emissive, 0.0 );
+ setReflection( Emissive, 0.0, false );
setReflection( Emissive, false );
}
/*!
\brief Construct OCCT material aspect from material model
+ \param theIsFront boolean flag for choosing side
\return material aspect object with corresponding properties
*/
-Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect()
+Graphic3d_MaterialAspect Material_Model::getMaterialOCCAspect( bool theIsFront )
{
// Get material aspect from the current model
Graphic3d_MaterialAspect aspect;
c = color( Ambient );
aspect.SetAmbientColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
}
- aspect.SetAmbient( reflection( Ambient ));
+ aspect.SetAmbient( reflection( Ambient, theIsFront ));
if ( hasReflection( Ambient ) )
aspect.SetReflectionModeOn( Graphic3d_TOR_AMBIENT );
else
c = color( Diffuse );
aspect.SetDiffuseColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
}
- aspect.SetDiffuse( reflection( Diffuse ));
+ aspect.SetDiffuse( reflection( Diffuse, theIsFront ));
if ( hasReflection( Diffuse ) )
aspect.SetReflectionModeOn( Graphic3d_TOR_DIFFUSE );
else
c = color( Specular );
aspect.SetSpecularColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
}
- aspect.SetSpecular( reflection( Specular ));
+ aspect.SetSpecular( reflection( Specular, theIsFront ));
if ( hasReflection( Specular ) )
aspect.SetReflectionModeOn( Graphic3d_TOR_SPECULAR );
else
c = color( Emissive );
aspect.SetEmissiveColor( Quantity_Color( c.redF(), c.greenF(), c.blueF(), Quantity_TOC_RGB ) );
}
- aspect.SetEmissive( reflection( Emissive ));
+ aspect.SetEmissive( reflection( Emissive, theIsFront ));
if ( hasReflection( Emissive ) )
aspect.SetReflectionModeOn( Graphic3d_TOR_EMISSION );
else
aspect.SetReflectionModeOff( Graphic3d_TOR_EMISSION );
// shininess
- aspect.SetShininess( shininess() );
+ aspect.SetShininess( shininess( theIsFront ) );
// transparency
aspect.SetTransparency( transparency() );
/*!
\brief Construct VTK property from material model
+ \param theIsFront boolean flag for choosing side
\return VTK property with correspondent material properties
*/
-GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty()
+GEOM_VTKPropertyMaterial* Material_Model::getMaterialVTKProperty( bool theIsFront )
{
// NOTE: In VTK it's impossible to switch on/off specific reflection type
// NOTE: In VTK emissive reflection type is not supported
if ( color( Ambient ).isValid() && hasReflection( Ambient ) ) {
c = color( Ambient );
prop->SetAmbientColor( c.redF(), c.greenF(), c.blueF() );
- prop->SetAmbient( reflection( Ambient ) );
+ prop->SetAmbient( reflection( Ambient, theIsFront ) );
}
// diffuse reflection
if ( color( Diffuse ).isValid() && hasReflection( Diffuse ) ) {
c = color( Diffuse );
prop->SetDiffuseColor( c.redF(), c.greenF(), c.blueF() );
- prop->SetDiffuse( reflection( Diffuse ) );
+ prop->SetDiffuse( reflection( Diffuse, theIsFront ) );
}
// specular reflection
if ( color( Specular ).isValid() && hasReflection( Specular ) ) {
c = color( Specular );
prop->SetSpecularColor( c.redF(), c.greenF(), c.blueF() );
- prop->SetSpecular( reflection( Specular ) );
+ prop->SetSpecular( reflection( Specular, theIsFront ) );
}
// shininess
- prop->SetSpecularPower( shininess()*100.0 );
+ prop->SetSpecularPower( shininess( theIsFront )*100.0 );
// transparency
prop->SetOpacity( 1 - transparency() );
#include <Graphic3d_MaterialAspect.hxx>
-class QtxResourceMgr;
+class Material_ResourceMgr;
class GEOM_VTKPropertyMaterial;
class MATERIAL_SALOME_EXPORT Material_Model
void fromProperties( const QString& );
QString toProperties();
- void fromResources( const QString& = QString(), QtxResourceMgr* = 0 );
- void toResources( const QString&, QtxResourceMgr* );
+ void fromResources( const QString& = QString(), Material_ResourceMgr* = 0 );
+ void toResources( const QString&, Material_ResourceMgr* );
bool isPhysical() const;
void setPhysical( bool );
QColor color( ReflectionType ) const;
void setColor( ReflectionType, const QColor& );
- double reflection( ReflectionType ) const;
- void setReflection( ReflectionType, double );
+ double reflection( ReflectionType, bool = true ) const;
+ void setReflection( ReflectionType, double, bool = true );
- double shininess() const;
- void setShininess( double );
+ double shininess( bool = true) const;
+ void setShininess( double, bool = true );
double transparency() const;
void setTransparency( double );
- Graphic3d_MaterialAspect getMaterialOCCAspect();
- GEOM_VTKPropertyMaterial* getMaterialVTKProperty();
+ Graphic3d_MaterialAspect getMaterialOCCAspect( bool = true );
+ GEOM_VTKPropertyMaterial* getMaterialVTKProperty( bool = true );
private:
void init();
+ void read( const QString&, Material_ResourceMgr* );
private:
typedef struct {
QColor color;
- double coef;
+ double front_coef;
+ double back_coef;
bool enabled;
} ReflectionData;
typedef QVector<ReflectionData> ReflectionList;
bool myIsPhysical;
- double myShininess;
+ double myFrontShininess;
+ double myBackShininess;
double myTransparency;
ReflectionList myReflection;
};
#include "Material_ResourceMgr.h"
+#include <QFileSystemWatcher>
+#include <QThread>
+
+/*!
+ \class Material_ResourceMgr::Updater
+ \brief Updates the contents of the resource manager as soon as
+ user materials database file is changed
+ \internal
+*/
+class Material_ResourceMgr::Updater : public QThread
+{
+public:
+ Material_ResourceMgr* myResourceMgr;
+ Updater( Material_ResourceMgr* resMgr ) : myResourceMgr( resMgr )
+ {
+ start();
+ }
+ void run()
+ {
+ QMutexLocker lock( &myResourceMgr->myMutex );
+ myResourceMgr->clear();
+ myResourceMgr->load();
+ }
+};
+
/*!
\class Material_ResourceMgr
\brief Material properties resources manager.
\brief Constructor
*/
Material_ResourceMgr::Material_ResourceMgr()
- : QtxResourceMgr( "SalomeMaterial", "%1Config" )
+ : QtxResourceMgr( "SalomeMaterial", "%1Config" ),
+ myWatcher( 0 )
{
if ( dirList().isEmpty() && ::getenv( "GEOM_ROOT_DIR" ) )
setDirList( QStringList() << Qtx::addSlash( ::getenv( "GEOM_ROOT_DIR" ) ) + "share/salome/resources/geom" );
*/
Material_ResourceMgr::~Material_ResourceMgr()
{
+ watchUserFile( false );
+}
+
+/*!
+ \brief Get shared instance of resources manager
+
+ This instance of resource manager is global for the application;
+ it watches for changes in the user materials database file to
+ maintain the fresh version of the materials data.
+*/
+Material_ResourceMgr* Material_ResourceMgr::resourceMgr()
+{
+ static Material_ResourceMgr* resMgr = 0;
+ if ( !resMgr ) {
+ resMgr = new Material_ResourceMgr();
+ resMgr->watchUserFile( true );
+ }
+ return resMgr;
}
/*!
*/
QStringList Material_ResourceMgr::materials( MaterialType theType, bool theSort )
{
+ QMutexLocker lock( &myMutex );
+
// store original working mode
WorkingMode m = workingMode();
return result;
}
+
+/*!
+ \brief Start/stop this resource manager watching the user materials database file.
+ \internal
+*/
+void Material_ResourceMgr::watchUserFile( bool on )
+{
+ if ( on ) {
+ if ( !myWatcher ) {
+ myWatcher = new QFileSystemWatcher( this );
+ myWatcher->addPath( userFileName( appName() ) );
+ connect( myWatcher, SIGNAL( fileChanged( QString ) ), this, SLOT( update() ) );
+ }
+ }
+ else {
+ if ( myWatcher ) {
+ delete myWatcher;
+ myWatcher = 0;
+ }
+ }
+}
+
+/*!
+ \brief Update user database slot
+ \internal
+*/
+void Material_ResourceMgr::update()
+{
+ Updater( this ).wait();
+ emit changed();
+}
#include "Material.h"
+#include <QObject>
+#include <QMutex>
#include <QtxResourceMgr.h>
-class MATERIAL_SALOME_EXPORT Material_ResourceMgr : public QtxResourceMgr
+class QFileSystemWatcher;
+
+class MATERIAL_SALOME_EXPORT Material_ResourceMgr : public QObject, public QtxResourceMgr
{
+ Q_OBJECT;
+
+ class Updater;
+
public:
//! Material type
typedef enum {
Material_ResourceMgr();
~Material_ResourceMgr();
+ static Material_ResourceMgr* resourceMgr();
+
QStringList materials( MaterialType = All, bool = true );
-
+
+signals:
+ void changed();
+
+private:
+ void watchUserFile( bool );
+
+private slots:
+ void update();
+
+private:
+ QFileSystemWatcher* myWatcher;
+ QMutex myMutex;
+
+ friend class Material_Model;
};
#endif // MATERIAL_RESOURCEMGR_H
-->
<document>
<section name="[common]" >
- <parameter name="physical" value="false" />
- <parameter name="shininess" value="0.039" />
- <parameter name="ambient" value="true" />
- <parameter name="ambient-coefficient" value="0.3" />
- <parameter name="ambient-color" value="#333333" />
- <parameter name="diffuse" value="true" />
- <parameter name="diffuse-coefficient" value="0.65" />
- <parameter name="diffuse-color" value="#000000" />
- <parameter name="specular" value="true" />
- <parameter name="specular-coefficient" value="0.0" />
- <parameter name="specular-color" value="#ffffff" />
- <parameter name="emissive" value="false" />
- <parameter name="emissive-coefficient" value="0.0" />
- <parameter name="emissive-color" value="#000000" />
- <parameter name="transparency" value="0.0" />
+ <parameter name="physical" value="false" />
+ <parameter name="front_shininess" value="0.039" />
+ <parameter name="back_shininess" value="0.039" />
+ <parameter name="ambient" value="true" />
+ <parameter name="front_ambient-coefficient" value="0.3" />
+ <parameter name="back_ambient-coefficient" value="0.3" />
+ <parameter name="ambient-color" value="#333333" />
+ <parameter name="diffuse" value="true" />
+ <parameter name="front_diffuse-coefficient" value="0.65" />
+ <parameter name="back_diffuse-coefficient" value="0.65" />
+ <parameter name="diffuse-color" value="#000000" />
+ <parameter name="specular" value="true" />
+ <parameter name="front_specular-coefficient" value="0.0" />
+ <parameter name="back_specular-coefficient" value="0.0" />
+ <parameter name="specular-color" value="#ffffff" />
+ <parameter name="emissive" value="false" />
+ <parameter name="front_emissive-coefficient" value="0.0" />
+ <parameter name="back_emissive-coefficient" value="0.0" />
+ <parameter name="emissive-color" value="#000000" />
+ <parameter name="transparency" value="0.0" />
</section>
<section name="Plastic" >
- <parameter name="shininess" value="0.0078125" />
- <parameter name="ambient-coefficient" value="0.5" />
- <parameter name="diffuse-coefficient" value="0.24" />
- <parameter name="specular-coefficient" value="0.06" />
+ <parameter name="front_shininess" value="0.0078" />
+ <parameter name="back_shininess" value="0.0078" />
+ <parameter name="front_ambient-coefficient" value="0.5" />
+ <parameter name="back_ambient-coefficient" value="0.35" />
+ <parameter name="front_diffuse-coefficient" value="0.24" />
+ <parameter name="back_diffuse-coefficient" value="0.24" />
+ <parameter name="front_specular-coefficient" value="0.06" />
+ <parameter name="back_specular-coefficient" value="0.06" />
</section>
<section name="Shiny plastic" >
- <parameter name="shininess" value="1.0" />
- <parameter name="ambient-coefficient" value="0.44" />
- <parameter name="diffuse-coefficient" value="0.5" />
- <parameter name="specular-coefficient" value="1.0" />
+ <parameter name="front_shininess" value="1.0" />
+ <parameter name="back_shininess" value="1.0" />
+ <parameter name="front_ambient-coefficient" value="0.44" />
+ <parameter name="back_ambient-coefficient" value="0.36" />
+ <parameter name="front_diffuse-coefficient" value="0.5" />
+ <parameter name="back_diffuse-coefficient" value="0.4" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
</section>
<section name="Satin" >
- <parameter name="shininess" value="0.09375" />
- <parameter name="ambient-coefficient" value="0.33" />
- <parameter name="diffuse-coefficient" value="0.4" />
- <parameter name="specular-coefficient" value="0.44" />
+ <parameter name="front_shininess" value="0.0938" />
+ <parameter name="back_shininess" value="0.0938" />
+ <parameter name="front_ambient-coefficient" value="0.33" />
+ <parameter name="back_ambient-coefficient" value="0.28" />
+ <parameter name="front_diffuse-coefficient" value="0.4" />
+ <parameter name="back_diffuse-coefficient" value="0.35" />
+ <parameter name="front_specular-coefficient" value="0.44" />
+ <parameter name="back_specular-coefficient" value="0.44" />
</section>
<section name="Neon" >
- <parameter name="shininess" value="0.05" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="specular-coefficient" value="0.62" />
- <parameter name="emissive-coefficient" value="1.0" />
- <parameter name="ambient" value="false" />
- <parameter name="emissive" value="true" />
+ <parameter name="front_shininess" value="0.05" />
+ <parameter name="back_shininess" value="0.05" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.6" />
+ <parameter name="front_specular-coefficient" value="0.62" />
+ <parameter name="back_specular-coefficient" value="0.27" />
+ <parameter name="front_emissive-coefficient" value="1.0" />
+ <parameter name="back_emissive-coefficient" value="0.5" />
+ <parameter name="ambient" value="false" />
+ <parameter name="emissive" value="true" />
</section>
<section name="Metalized" >
- <parameter name="shininess" value="0.13" />
- <parameter name="ambient" value="false" />
- <parameter name="ambient-coefficient" value="0.9" />
- <parameter name="diffuse-coefficient" value="0.47" />
- <parameter name="specular-coefficient" value="0.45" />
+ <parameter name="front_shininess" value="0.08" />
+ <parameter name="back_shininess" value="0.13" />
+ <parameter name="ambient" value="false" />
+ <parameter name="front_ambient-coefficient" value="0.9" />
+ <parameter name="back_ambient-coefficient" value="0.7" />
+ <parameter name="front_diffuse-coefficient" value="0.57" />
+ <parameter name="back_diffuse-coefficient" value="0.42" />
+ <parameter name="front_specular-coefficient" value="0.45" />
+ <parameter name="back_specular-coefficient" value="0.45" />
</section>
<section name="Brass">
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.21794844" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#543907" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#c7911d" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#fdf0ce" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.2179" />
+ <parameter name="back_shininess" value="0.2179" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#543907" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.9" />
+ <parameter name="diffuse-color" value="#c7911d" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#fdf0ce" />
</section>
<section name="Bronze">
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.2" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#36200d" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#b66d2e" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#64452a" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.2" />
+ <parameter name="back_shininess" value="0.2" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#36200d" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.9" />
+ <parameter name="diffuse-color" value="#b66d2e" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="0.95" />
+ <parameter name="specular-color" value="#64452a" />
</section>
<section name="Copper" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.93" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#54423a" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#801c00" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#f3ba00" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.93" />
+ <parameter name="back_shininess" value="0.93" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#54423a" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="1.0" />
+ <parameter name="diffuse-color" value="#801c00" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#f3ba00" />
</section>
<section name="Gold" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.0625" />
- <parameter name="ambient-coefficient" value="0.3" />
- <parameter name="ambient-color" value="#ffc451" />
- <parameter name="diffuse-coefficient" value="0.4" />
- <parameter name="diffuse-color" value="#ffb000" />
- <parameter name="specular-coefficient" value="0.9" />
- <parameter name="specular-color" value="#fffac7" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.0625" />
+ <parameter name="back_shininess" value="0.0625" />
+ <parameter name="front_ambient-coefficient" value="0.3" />
+ <parameter name="back_ambient-coefficient" value="0.25" />
+ <parameter name="ambient-color" value="#ffc451" />
+ <parameter name="front_diffuse-coefficient" value="0.4" />
+ <parameter name="back_diffuse-coefficient" value="0.3" />
+ <parameter name="diffuse-color" value="#ffb000" />
+ <parameter name="front_specular-coefficient" value="0.9" />
+ <parameter name="back_specular-coefficient" value="0.9" />
+ <parameter name="specular-color" value="#fffac7" />
</section>
<section name="Pewter" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.076923047" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#1b0f1d" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#6d788a" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#555585" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.0769" />
+ <parameter name="back_shininess" value="0.0769" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#1b0f1d" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.9" />
+ <parameter name="diffuse-color" value="#6d788a" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#555585" />
</section>
<section name="Plaster" >
- <parameter name="shininess" value="0.0078125" />
- <parameter name="ambient-coefficient" value="0.26" />
- <parameter name="ambient-color" value="#313131" />
- <parameter name="diffuse-coefficient" value="0.23" />
- <parameter name="diffuse-color" value="#818181" />
- <parameter name="specular-coefficient" value="0.06" />
- <parameter name="specular-color" value="#828282" />
+ <parameter name="front_shininess" value="0.0078" />
+ <parameter name="back_shininess" value="0.0078" />
+ <parameter name="front_ambient-coefficient" value="0.26" />
+ <parameter name="back_ambient-coefficient" value="0.18" />
+ <parameter name="ambient-color" value="#313131" />
+ <parameter name="front_diffuse-coefficient" value="0.23" />
+ <parameter name="back_diffuse-coefficient" value="0.18" />
+ <parameter name="diffuse-color" value="#818181" />
+ <parameter name="front_specular-coefficient" value="0.06" />
+ <parameter name="back_specular-coefficient" value="0.06" />
+ <parameter name="specular-color" value="#828282" />
</section>
<section name="Silver" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.2" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#313131" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#818181" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#828282" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.2" />
+ <parameter name="back_shininess" value="0.2" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#313131" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.95" />
+ <parameter name="diffuse-color" value="#818181" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#828282" />
</section>
<section name="Steel" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.06" />
- <parameter name="ambient-coefficient" value="0.01" />
- <parameter name="diffuse-coefficient" value="0.03" />
- <parameter name="specular-coefficient" value="0.98" />
- <parameter name="specular-color" value="#ffffff" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.06" />
+ <parameter name="back_shininess" value="0.06" />
+ <parameter name="front_ambient-coefficient" value="0.01" />
+ <parameter name="back_ambient-coefficient" value="0.01" />
+ <parameter name="front_diffuse-coefficient" value="0.03" />
+ <parameter name="back_diffuse-coefficient" value="0.01" />
+ <parameter name="front_specular-coefficient" value="0.98" />
+ <parameter name="back_specular-coefficient" value="0.63" />
+ <parameter name="specular-color" value="#ffffff" />
</section>
<section name="Stone" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.17" />
- <parameter name="ambient-coefficient" value="0.19" />
- <parameter name="ambient-color" value="#ffcc9e" />
- <parameter name="diffuse-coefficient" value="0.75" />
- <parameter name="diffuse-color" value="#ffcc9e" />
- <parameter name="specular-coefficient" value="0.08" />
- <parameter name="specular-color" value="#faff99" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.17" />
+ <parameter name="back_shininess" value="0.17" />
+ <parameter name="front_ambient-coefficient" value="0.19" />
+ <parameter name="back_ambient-coefficient" value="0.19" />
+ <parameter name="ambient-color" value="#ffcc9e" />
+ <parameter name="front_diffuse-coefficient" value="0.75" />
+ <parameter name="back_diffuse-coefficient" value="0.5" />
+ <parameter name="diffuse-color" value="#ffcc9e" />
+ <parameter name="front_specular-coefficient" value="0.08" />
+ <parameter name="back_specular-coefficient" value="0.08" />
+ <parameter name="specular-color" value="#faff99" />
</section>
<section name="Chrome" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.1" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#595959" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#666666" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#f9f9f9" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.1" />
+ <parameter name="back_shininess" value="0.1" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#595959" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.95" />
+ <parameter name="diffuse-color" value="#666666" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#f9f9f9" />
</section>
<section name="Neon (physical)" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.05" />
- <parameter name="ambient" value="false" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#ffffff" />
- <parameter name="diffuse" value="false" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#ffffff" />
- <parameter name="specular-coefficient" value="0.62" />
- <parameter name="specular-color" value="#ffffff" />
- <parameter name="emissive" value="true" />
- <parameter name="emissive-coefficient" value="0.9" />
- <parameter name="emissive-color" value="#00ff75" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.05" />
+ <parameter name="back_shininess" value="0.05" />
+ <parameter name="ambient" value="false" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="1.0" />
+ <parameter name="ambient-color" value="#ffffff" />
+ <parameter name="diffuse" value="false" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="1.0" />
+ <parameter name="diffuse-color" value="#ffffff" />
+ <parameter name="front_specular-coefficient" value="0.62" />
+ <parameter name="back_specular-coefficient" value="0.62" />
+ <parameter name="specular-color" value="#ffffff" />
+ <parameter name="emissive" value="true" />
+ <parameter name="front_emissive-coefficient" value="0.9" />
+ <parameter name="back_emissive-coefficient" value="0.72" />
+ <parameter name="emissive-color" value="#00ff75" />
</section>
<section name="Aluminium" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.09" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#4c4c4c" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#4c4c4c" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#b3b3cc" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.09" />
+ <parameter name="back_shininess" value="0.09" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#4c4c4c" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="1.0" />
+ <parameter name="diffuse-color" value="#4c4c4c" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#b3b3cc" />
</section>
<section name="Obsidian" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.3" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#0d0c10" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#2e2b39" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#555458" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.3" />
+ <parameter name="back_shininess" value="0.3" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="1.0" />
+ <parameter name="ambient-color" value="#0d0c10" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.7" />
+ <parameter name="diffuse-color" value="#2e2b39" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="0.9" />
+ <parameter name="specular-color" value="#555458" />
</section>
<section name="Jade" >
- <parameter name="physical" value="true" />
- <parameter name="shininess" value="0.1" />
- <parameter name="ambient-coefficient" value="1.0" />
- <parameter name="ambient-color" value="#223828" />
- <parameter name="diffuse-coefficient" value="1.0" />
- <parameter name="diffuse-color" value="#8ae3a1" />
- <parameter name="specular-coefficient" value="1.0" />
- <parameter name="specular-color" value="#505050" />
+ <parameter name="physical" value="true" />
+ <parameter name="front_shininess" value="0.1" />
+ <parameter name="back_shininess" value="0.1" />
+ <parameter name="front_ambient-coefficient" value="1.0" />
+ <parameter name="back_ambient-coefficient" value="0.6" />
+ <parameter name="ambient-color" value="#223828" />
+ <parameter name="front_diffuse-coefficient" value="1.0" />
+ <parameter name="back_diffuse-coefficient" value="0.85" />
+ <parameter name="diffuse-color" value="#8ae3a1" />
+ <parameter name="front_specular-coefficient" value="1.0" />
+ <parameter name="back_specular-coefficient" value="1.0" />
+ <parameter name="specular-color" value="#505050" />
</section>
</document>
# 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 MEASUREGUI :
# File : Makefile.am
ui_MeasureGUI_1Sel3LineEdit_QTD.h \
ui_MeasureGUI_1Sel6LineEdit_QTD.h \
ui_MeasureGUI_2Sel1LineEdit_QTD.h \
- ui_MeasureGUI_2Sel4LineEdit_QTD.h \
ui_MeasureGUI_SkeletonBox_QTD.h
BUILT_SOURCES = $(UIC_FILES)
+++ /dev/null
-<ui version="4.0" >
- <class>MeasureGUI_2Sel4LineEdit_QTD</class>
- <widget class="QWidget" name="MeasureGUI_2Sel4LineEdit_QTD" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>198</width>
- <height>197</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="GroupBox1" >
- <property name="title" >
- <string/>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="TextLabel1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL1</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QLineEdit" name="LineEdit1" >
- <property name="minimumSize" >
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="TextLabel2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL2</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="PushButton2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="1" column="2" >
- <widget class="QLineEdit" name="LineEdit2" >
- <property name="minimumSize" >
- <size>
- <width>100</width>
- <height>0</height>
- </size>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel3" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL3</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1" colspan="2" >
- <widget class="QLineEdit" name="LineEdit3" />
- </item>
- <item row="3" column="0" >
- <widget class="QLabel" name="TextLabel4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL4</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2" >
- <widget class="QLineEdit" name="LineEdit4" />
- </item>
- <item row="4" column="0" >
- <widget class="QLabel" name="TextLabel5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL5</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="4" column="1" colspan="2" >
- <widget class="QLineEdit" name="LineEdit5" />
- </item>
- <item row="5" column="0" >
- <widget class="QLabel" name="TextLabel6" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>TL6</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item row="5" column="1" colspan="2" >
- <widget class="QLineEdit" name="LineEdit6" />
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
+#include <SUIT_OverrideCursor.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Tools.h>
+#include <LightApp_SelectionMgr.h>
//=================================================================================
// class : MeasureGUI_BndBoxDlg()
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_BndBoxDlg::MeasureGUI_BndBoxDlg (GeometryGUI* GUI, QWidget* parent)
- : MeasureGUI_Skeleton(GUI, parent)
+ : GEOMBase_Skeleton(GUI, parent)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap(
- "GEOM", tr( "ICON_DLG_BOUNDING_BOX" ) ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap(
- "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BOUNDING_BOX")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- setWindowTitle( tr( "GEOM_BNDBOX_TITLE" ) );
+ setWindowTitle(tr("GEOM_BNDBOX_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_BNDBOX" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_BNDBOX"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+ mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_1Sel6LineEdit( centralWidget() );
+ myGrp = new MeasureGUI_1Sel6LineEdit (centralWidget());
myGrp->GroupBox1->setTitle( tr( "GEOM_BNDBOX_OBJDIM" ) );
myGrp->TextLabel1->setText( tr( "GEOM_OBJECT" ) );
myGrp->TextLabel2->setText( tr( "GEOM_MIN" ) );
/***************************************************************/
- myHelpFileName = "using_measurement_tools_page.html#bounding_box_anchor";
+ myHelpFileName = "bounding_box_page.html";
/* Initialisation */
Init();
//=================================================================================
void MeasureGUI_BndBoxDlg::Init()
{
- mySelBtn = myGrp->PushButton1;
- mySelEdit = myGrp->LineEdit1;
- MeasureGUI_Skeleton::Init();
+ myEditCurrentArgument = myGrp->LineEdit1;
+
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+ connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SelectionIntoArgument()));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ initName(tr("GEOM_BNDBOX"));
+ globalSelection();
+ SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void MeasureGUI_BndBoxDlg::ClickOnOk()
+{
+ if (ClickOnApply())
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool MeasureGUI_BndBoxDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
+
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void MeasureGUI_BndBoxDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ globalSelection();
+ redisplayPreview();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void MeasureGUI_BndBoxDlg::enterEvent(QEvent*)
+{
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
}
//=================================================================================
double aXMin, aXMax, aYMin, aYMax, aZMin, aZMax;
if (!getParameters(aXMin, aXMax, aYMin, aYMax, aZMin, aZMax)) {
- mySelEdit->setText("");
+ myEditCurrentArgument->setText("");
myGrp->LineEdit11->setText("");
myGrp->LineEdit12->setText("");
myGrp->LineEdit21->setText("");
return !aShape.IsNull() ? getDisplayer()->BuildPrs(aShape) : 0;
}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed or other case
+//=================================================================================
+void MeasureGUI_BndBoxDlg::SelectionIntoArgument()
+{
+ myEditCurrentArgument->setText("");
+ myObj = GEOM::GEOM_Object::_nil();
+
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ if (aSelList.Extent() != 1) {
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+
+ if (aSelectedObject->_is_nil()) {
+ processObject();
+ erasePreview();
+ return;
+ }
+
+ myObj = aSelectedObject;
+ myEditCurrentArgument->setText(GEOMBase::GetName(myObj));
+ processObject();
+ redisplayPreview();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_BndBoxDlg::createOperation()
+{
+ return getGeomEngine()->GetIMeasureOperations(getStudyId());
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool MeasureGUI_BndBoxDlg::isValid (QString&)
+{
+ return !myObj->_is_nil();
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool MeasureGUI_BndBoxDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ GEOM::GEOM_Object_var anObj = anOper->MakeBoundingBox(myObj);
+
+ if (!anObj->_is_nil())
+ objects.push_back(anObj._retn());
+
+ return true;
+}
+
+//=================================================================================
+// function : redisplayPreview()
+// purpose :
+//=================================================================================
+void MeasureGUI_BndBoxDlg::redisplayPreview()
+{
+ QString aMess;
+ if (!isValid(aMess)) {
+ erasePreview(true);
+ return;
+ }
+
+ erasePreview(false);
+
+ try {
+ SUIT_OverrideCursor();
+
+ getDisplayer()->SetColor(Quantity_NOC_VIOLET);
+ getDisplayer()->SetToActivate(false);
+
+ if (SALOME_Prs* aPrs = buildPrs())
+ displayPreview(aPrs);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ }
+}
// 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 : MeasureGUI_BndBoxDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#ifndef MEASUREGUI_BNDBOXDLG_H
#define MEASUREGUI_BNDBOXDLG_H
-#include "MeasureGUI_Skeleton.h"
+#include "GEOMBase_Skeleton.h"
class MeasureGUI_1Sel6LineEdit;
// class : DialogBox_PROPERTIES
// purpose :
//=================================================================================
-class MeasureGUI_BndBoxDlg : public MeasureGUI_Skeleton
+class MeasureGUI_BndBoxDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
- MeasureGUI_BndBoxDlg( GeometryGUI*, QWidget* );
+ MeasureGUI_BndBoxDlg (GeometryGUI*, QWidget*);
~MeasureGUI_BndBoxDlg();
protected:
- // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
- virtual void processObject();
- virtual SALOME_Prs* buildPrs();
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+
+ void redisplayPreview();
+ virtual void processObject();
+ virtual SALOME_Prs* buildPrs();
private:
- void Init();
- bool getParameters( double&, double&,
- double&, double&,
- double&, double& );
+ void Init();
+ void enterEvent (QEvent*);
+ bool getParameters (double&, double&, double&, double&, double&, double&);
private:
- MeasureGUI_1Sel6LineEdit* myGrp;
+ GEOM::GEOM_Object_var myObj;
+ MeasureGUI_1Sel6LineEdit* myGrp;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SelectionIntoArgument();
+ void ActivateThisDialog();
};
#endif // MEASUREGUI_BNDBOXDLG_H
// 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 : MeasureGUI_DistanceDlg.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#include "MeasureGUI_DistanceDlg.h"
#include "MeasureGUI_Widgets.h"
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
+#include <SUIT_OverrideCursor.h>
#include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <SalomeApp_Tools.h>
// true to construct a modal dialog.
//=================================================================================
MeasureGUI_DistanceDlg::MeasureGUI_DistanceDlg (GeometryGUI* GUI, QWidget* parent)
- : MeasureGUI_Skeleton(GUI, parent)
+ : GEOMBase_Skeleton(GUI, parent)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_MINDIST")));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_DISTANCE"));
mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
- myGrp = new MeasureGUI_2Sel4LineEdit(centralWidget());
+ mainFrame()->GroupBoxName->hide();
+
+ myGrp = new MeasureGUI_DistanceGroup (centralWidget());
myGrp->GroupBox1->setTitle(tr("GEOM_MINDIST_OBJ"));
+
+ // Arguments
myGrp->TextLabel1->setText(tr("GEOM_OBJECT_I").arg("1"));
myGrp->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("2"));
+ myGrp->PushButton1->setIcon(image1);
+ myGrp->PushButton2->setIcon(image1);
+ myGrp->LineEdit1->setReadOnly(true);
+ myGrp->LineEdit2->setReadOnly(true);
+
+ // Solutions combobox
+ myGrp->TextLabel7->setText(tr("GEOM_SOLUTION"));
+
+ // Distance, dx, dy and dz
myGrp->TextLabel3->setText(tr("GEOM_LENGTH"));
myGrp->TextLabel4->setText(tr("GEOM_DX"));
myGrp->TextLabel5->setText(tr("GEOM_DY"));
myGrp->TextLabel6->setText(tr("GEOM_DZ"));
myGrp->LineEdit3->setReadOnly(true);
- myGrp->PushButton1->setIcon(image1);
- myGrp->PushButton2->setIcon(image1);
- myGrp->LineEdit1->setReadOnly(true);
- myGrp->LineEdit2->setReadOnly(true);
myGrp->LineEdit4->setReadOnly(true);
myGrp->LineEdit5->setReadOnly(true);
myGrp->LineEdit6->setReadOnly(true);
-
- QVBoxLayout* layout = new QVBoxLayout(centralWidget());
- layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(myGrp);
/***************************************************************/
- myHelpFileName = "using_measurement_tools_page.html#min_distance_anchor";
+ myHelpFileName = "min_distance_page.html";
// Initialisation
Init();
//=================================================================================
void MeasureGUI_DistanceDlg::Init()
{
- // init variables
- myGrp->LineEdit1->setText("");
- myGrp->LineEdit2->setText("");
- myObj = myObj2 = GEOM::GEOM_Object::_nil();
-
- mySelBtn = myGrp->PushButton1;
- mySelEdit = myGrp->LineEdit1;
-
myEditCurrentArgument = myGrp->LineEdit1;
+ myDbls = new GEOM::ListOfDouble();
// signals and slots connections
- connect(myGrp->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(myGrp->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(myGrp->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- MeasureGUI_Skeleton::Init();
+ connect(myGrp->ComboBox1, SIGNAL(currentIndexChanged(int)), this, SLOT(SolutionSelected(int)));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ globalSelection();
+ SelectionIntoArgument();
}
//=================================================================================
-// function : SelectionIntoArgument()
-// purpose : Called when selection has changed
+// function : ClickOnOk()
+// purpose :
//=================================================================================
-void MeasureGUI_DistanceDlg::SelectionIntoArgument()
+void MeasureGUI_DistanceDlg::ClickOnOk()
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ if (ClickOnApply())
+ ClickOnCancel();
+}
- GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool MeasureGUI_DistanceDlg::ClickOnApply()
+{
+ if (!onAccept())
+ return false;
- if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- }
+ initName();
+ return true;
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::ActivateThisDialog()
+{
+ GEOMBase_Skeleton::ActivateThisDialog();
- // clear selection
- disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
- myGeomGUI->getApp()->selectionMgr()->clearSelected();
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
- if (myEditCurrentArgument == myGrp->LineEdit1) {
- myObj = aSelectedObject;
- if (!myObj->_is_nil() && myObj2->_is_nil())
- myGrp->PushButton2->click();
- }
- else {
- myObj2 = aSelectedObject;
- if (!myObj2->_is_nil() && myObj->_is_nil())
- myGrp->PushButton1->click();
- }
-
- processObject();
+ globalSelection();
+ redisplayPreview();
}
//=================================================================================
-// function : processObject()
-// purpose : Fill dialogs fields in accordance with myObj and myObj2
+// function : enterEvent()
+// purpose :
//=================================================================================
-void MeasureGUI_DistanceDlg::processObject()
+void MeasureGUI_DistanceDlg::enterEvent(QEvent*)
{
- myGrp->LineEdit1->setText(!myObj->_is_nil() ? GEOMBase::GetName(myObj ) : "");
- myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
-
- gp_Pnt aPnt1, aPnt2;
- double aDist = 0.;
- if (getParameters(aDist, aPnt1, aPnt2)) {
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
-
- myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
-
- gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
- myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
- myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
- myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
+}
- redisplayPreview();
- }
- else {
+//=================================================================================
+// function : SolutionSelected()
+// purpose : Called when ComboBox selection has changed
+//=================================================================================
+void MeasureGUI_DistanceDlg::SolutionSelected (int i)
+{
+ if (i < 0 || myDbls->length() < (i+1)*6) {
myGrp->LineEdit3->setText("");
myGrp->LineEdit4->setText("");
myGrp->LineEdit5->setText("");
myGrp->LineEdit6->setText("");
erasePreview();
+ return;
}
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
+
+ gp_Pnt p1 (myDbls[i*6 + 0], myDbls[i*6 + 1], myDbls[i*6 + 2]);
+ gp_Pnt p2 (myDbls[i*6 + 3], myDbls[i*6 + 4], myDbls[i*6 + 5]);
+
+ double aDist = p1.Distance(p2);
+ myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
+
+ gp_XYZ aVec = p2.XYZ() - p1.XYZ();
+ myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
+ myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
+ myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
+
+ redisplayPreview();
}
//=================================================================================
-// function : getParameters()
-// purpose : Get distance between objects
+// function : SelectionIntoArgument()
+// purpose : Called when selection has changed
//=================================================================================
-bool MeasureGUI_DistanceDlg::getParameters (double& theDistance,
- gp_Pnt& thePnt1,
- gp_Pnt& thePnt2)
+void MeasureGUI_DistanceDlg::SelectionIntoArgument()
{
- QString msg;
- if (isValid(msg)) {
- GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow( getOperation() );
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
- try {
- double x1, y1, z1, x2, y2, z2;
- theDistance = anOper->GetMinDistance(myObj, myObj2, x1, y1, z1, x2, y2, z2);
+ GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
- thePnt1.SetCoord(x1, y1, z1);
- thePnt2.SetCoord(x2, y2, z2);
- }
- catch(const SALOME::SALOME_Exception& e) {
- SalomeApp_Tools::QtCatchCorbaException(e);
- return false;
- }
+ if (aSelList.Extent() > 0) {
+ aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
+ }
- return anOper->IsDone();
+ // clear selection
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->getApp()->selectionMgr()->clearSelected();
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ if (myEditCurrentArgument == myGrp->LineEdit1) {
+ myObj1 = aSelectedObject;
+ if (!myObj1->_is_nil() && myObj2->_is_nil())
+ myGrp->PushButton2->click();
+ }
+ else {
+ myObj2 = aSelectedObject;
+ if (!myObj2->_is_nil() && myObj1->_is_nil())
+ myGrp->PushButton1->click();
}
- return false;
+ processObject();
}
//=================================================================================
}
//=================================================================================
-// function : LineEditReturnPressed()
-// purpose :
+// function : processObject()
+// purpose : Fill dialogs fields in accordance with myObj1 and myObj2
//=================================================================================
-void MeasureGUI_DistanceDlg::LineEditReturnPressed()
+void MeasureGUI_DistanceDlg::processObject()
{
- QLineEdit* send = (QLineEdit*)sender();
+ myGrp->LineEdit1->setText(!myObj1->_is_nil() ? GEOMBase::GetName(myObj1) : "");
+ myGrp->LineEdit2->setText(!myObj2->_is_nil() ? GEOMBase::GetName(myObj2) : "");
+
+ myGrp->ComboBox1->clear();
+ myDbls->length(0);
+ erasePreview();
- if (send == myGrp->LineEdit1 || send == myGrp->LineEdit2) {
- myEditCurrentArgument = send;
+ int nbSols = 0;
+
+ QString msg;
+ if (!isValid(msg)) return;
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ try {
+ nbSols = anOper->ClosestPoints(myObj1, myObj2, myDbls);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ return;
+ }
- if (GEOMBase::SelectionByNameInDialogs(this, myGrp->LineEdit1->text(), aSelList))
- myGrp->LineEdit1->setText(myGrp->LineEdit1->text());
+ if (!anOper->IsDone())
+ myGrp->ComboBox1->addItem(tr(anOper->GetErrorCode()));
+ else if (nbSols <= 0)
+ myGrp->ComboBox1->addItem(tr("GEOM_MINDIST_NO_SOL"));
+ else {
+ for (int i = 0; i < nbSols; i++) {
+ myGrp->ComboBox1->addItem(tr("GEOM_SOLUTION_I").arg(i + 1));
+ }
+ myGrp->ComboBox1->setCurrentIndex(0);
}
}
//=================================================================================
SALOME_Prs* MeasureGUI_DistanceDlg::buildPrs()
{
- double aDist = 0.;
- gp_Pnt aPnt1(0, 0, 0), aPnt2(0, 0, 0);
-
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
- if (myObj->_is_nil() || myObj2->_is_nil() ||
- !getParameters(aDist, aPnt1, aPnt2) ||
- vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
+ int currSol = myGrp->ComboBox1->currentIndex();
+
+ if (myObj1->_is_nil() || myObj2->_is_nil() ||
+ currSol == -1 || (currSol+1)*6 > myDbls->length() ||
+ vw->getViewManager()->getType() != OCCViewer_Viewer::Type())
return 0;
+ gp_Pnt aPnt1 (myDbls[currSol*6 + 0], myDbls[currSol*6 + 1], myDbls[currSol*6 + 2]);
+ gp_Pnt aPnt2 (myDbls[currSol*6 + 3], myDbls[currSol*6 + 4], myDbls[currSol*6 + 5]);
+
+ double aDist = aPnt1.Distance(aPnt2);
+
try
{
if (aDist <= 1.e-9) {
- BRepBuilderAPI_MakeVertex aMaker(aPnt1);
+ BRepBuilderAPI_MakeVertex aMaker (aPnt1);
return getDisplayer()->BuildPrs(aMaker.Vertex());
}
else {
- BRepBuilderAPI_MakeEdge MakeEdge(aPnt1, aPnt2);
+ BRepBuilderAPI_MakeEdge MakeEdge (aPnt1, aPnt2);
TopoDS_Vertex aVert1 = BRepBuilderAPI_MakeVertex(aPnt1);
TopoDS_Vertex aVert2 = BRepBuilderAPI_MakeVertex(aPnt2);
QString aLabel;
aLabel.sprintf("%.1f", aDist);
- gp_Pnt aPnt3((aPnt1.X() + aPnt2.X()) / 2,
+ gp_Pnt aPnt3 ((aPnt1.X() + aPnt2.X()) / 2,
(aPnt1.Y() + aPnt2.Y()) / 2,
(aPnt1.Z() + aPnt2.Z()) / 2);
- gp_Vec va(aPnt3, aPnt1);
- gp_Vec vb(aPnt3, aPnt2);
+ gp_Vec va (aPnt3, aPnt1);
+ gp_Vec vb (aPnt3, aPnt2);
if (va.IsParallel(vb, Precision::Angular())) {
aPnt3.SetY((aPnt1.Y() + aPnt2.Y()) / 2 + 100);
aPnt3.SetZ((aPnt1.Z() + aPnt2.Z()) / 2);
}
- gce_MakePln gce_MP(aPnt1, aPnt2, aPnt3);
- Handle(Geom_Plane) P = new Geom_Plane(gce_MP.Value());
+ gce_MakePln gce_MP (aPnt1, aPnt2, aPnt3);
+ Handle(Geom_Plane) P = new Geom_Plane (gce_MP.Value());
- Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension(
- aVert1, aVert2, P, aDist, TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
+ Handle(AIS_LengthDimension) anIO = new AIS_LengthDimension
+ (aVert1, aVert2, P, aDist,
+ TCollection_ExtendedString((Standard_CString)aLabel.toLatin1().constData()));
anIO->SetArrowSize(aDist/20);
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
return aPrs;
}
}
- catch(Standard_Failure) {
+ catch (Standard_Failure) {
return 0;
}
}
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_DistanceDlg::createOperation()
+{
+ return getGeomEngine()->GetIMeasureOperations(getStudyId());
+}
+
//=================================================================================
// function : isValid()
// purpose :
//=================================================================================
bool MeasureGUI_DistanceDlg::isValid (QString& msg)
{
- return MeasureGUI_Skeleton::isValid(msg) && !myObj2->_is_nil();
+ return !myObj1->_is_nil() && !myObj2->_is_nil();
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool MeasureGUI_DistanceDlg::execute (ObjectList& objects)
+{
+ GEOM::GEOM_IMeasureOperations_var anOper = GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+ GEOM::GEOM_IBasicOperations_var aBasicOper = getGeomEngine()->GetIBasicOperations(getStudyId());
+
+ GEOM::ListOfDouble_var aDbls;
+ int nbSols = anOper->ClosestPoints(myObj1, myObj2, aDbls);
+
+ if (anOper->IsDone()) {
+ for (int i = 0; i < nbSols; i++) {
+ GEOM::GEOM_Object_var anObj1 = aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]);
+ GEOM::GEOM_Object_var anObj2 = aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]);
+
+ if (!anObj1->_is_nil() && !anObj2->_is_nil()) {
+ objects.push_back(anObj1._retn());
+ objects.push_back(anObj2._retn());
+ }
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================
+// function : redisplayPreview()
+// purpose :
+//=================================================================================
+void MeasureGUI_DistanceDlg::redisplayPreview()
+{
+ QString aMess;
+ if (!isValid(aMess)) {
+ erasePreview(true);
+ return;
+ }
+
+ erasePreview(false);
+
+ try {
+ SUIT_OverrideCursor();
+
+ getDisplayer()->SetColor(Quantity_NOC_VIOLET);
+ getDisplayer()->SetToActivate(false);
+
+ if (SALOME_Prs* aPrs = buildPrs())
+ displayPreview(aPrs);
+ }
+ catch (const SALOME::SALOME_Exception& e) {
+ SalomeApp_Tools::QtCatchCorbaException(e);
+ }
+}
+
+//================================================================
+// Function : getNewObjectName
+// Purpose : Redefine this method to return proper name for a new object
+//================================================================
+QString MeasureGUI_DistanceDlg::getNewObjectName (int currObj) const
+{
+ QString aName = tr("GEOM_MINDIST_NAME") + QString("_%1_").arg((currObj+1)/2);
+ aName += GEOMBase::GetName(currObj%2 ? myObj1 : myObj2);
+
+ return aName;
+}
+
+//=================================================================================
+// function : MeasureGUI_DistanceGroup
+// purpose :
+//=================================================================================
+MeasureGUI_DistanceGroup::MeasureGUI_DistanceGroup (QWidget *parent)
+{
+ gridLayout = new QGridLayout (parent);
+ gridLayout->setSpacing(6);
+ gridLayout->setContentsMargins(11, 11, 11, 11);
+ gridLayout->setHorizontalSpacing(0);
+ gridLayout->setVerticalSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
+
+ GroupBox1 = new QGroupBox (parent);
+
+ gridLayout1 = new QGridLayout (GroupBox1);
+ gridLayout1->setSpacing(6);
+ gridLayout1->setContentsMargins(11, 11, 11, 11);
+ gridLayout1->setHorizontalSpacing(6);
+ gridLayout1->setVerticalSpacing(6);
+ gridLayout1->setContentsMargins(9, 9, 9, 9);
+
+ // 2Sel
+ TextLabel1 = new QLabel(GroupBox1);
+ TextLabel2 = new QLabel(GroupBox1);
+
+ PushButton1 = new QPushButton (GroupBox1);
+ PushButton2 = new QPushButton (GroupBox1);
+
+ LineEdit1 = new QLineEdit(GroupBox1);
+ LineEdit2 = new QLineEdit(GroupBox1);
+
+ gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
+ gridLayout1->addWidget(PushButton1, 0, 1, 1, 1);
+ gridLayout1->addWidget(PushButton2, 1, 1, 1, 1);
+ gridLayout1->addWidget(LineEdit1, 0, 2, 1, 1);
+ gridLayout1->addWidget(LineEdit2, 1, 2, 1, 1);
+
+ // 1Combo
+ TextLabel7 = new QLabel (GroupBox1);
+
+ ComboBox1 = new QComboBox (GroupBox1);
+
+ gridLayout1->addWidget(TextLabel7, 2, 0, 1, 1);
+ gridLayout1->addWidget(ComboBox1, 2, 1, 1, 2);
+
+ // 4Text
+ TextLabel3 = new QLabel (GroupBox1);
+ TextLabel4 = new QLabel (GroupBox1);
+ TextLabel5 = new QLabel (GroupBox1);
+ TextLabel6 = new QLabel (GroupBox1);
+
+ LineEdit3 = new QLineEdit(GroupBox1);
+ LineEdit4 = new QLineEdit(GroupBox1);
+ LineEdit5 = new QLineEdit(GroupBox1);
+ LineEdit6 = new QLineEdit(GroupBox1);
+
+ gridLayout1->addWidget(TextLabel3, 3, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel4, 4, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel5, 5, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel6, 6, 0, 1, 1);
+
+ gridLayout1->addWidget(LineEdit3, 3, 1, 1, 2);
+ gridLayout1->addWidget(LineEdit4, 4, 1, 1, 2);
+ gridLayout1->addWidget(LineEdit5, 5, 1, 1, 2);
+ gridLayout1->addWidget(LineEdit6, 6, 1, 1, 2);
+
+ gridLayout->addWidget(GroupBox1, 0, 0, 1, 1);
+}
+
+//=================================================================================
+// function : ~MeasureGUI_DistanceGroup()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+MeasureGUI_DistanceGroup::~MeasureGUI_DistanceGroup()
+{
+ // no need to delete child widgets, Qt does it all for us
}
// 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 : MeasureGUI_DistanceDlg.h
// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
+
#ifndef MEASUREGUI_DISTANCEDLG_H
#define MEASUREGUI_DISTANCEDLG_H
-#include "MeasureGUI_Skeleton.h"
+#include <GEOMBase_Skeleton.h>
+
+// IDL Headers
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QComboBox>
-class MeasureGUI_2Sel4LineEdit;
class gp_Pnt;
//=================================================================================
-// class : MeasureGUI_DistanceDlg
+// class : MeasureGUI_DistanceGroup
// purpose :
//=================================================================================
+class MeasureGUI_DistanceGroup : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ MeasureGUI_DistanceGroup (QWidget *parent);
+ ~MeasureGUI_DistanceGroup();
+
+ public:
+ QGridLayout *gridLayout;
+ QGroupBox *GroupBox1;
+ QGridLayout *gridLayout1;
+
+ // 2Sel
+ QLabel *TextLabel1;
+ QLabel *TextLabel2;
+ QPushButton *PushButton1;
+ QPushButton *PushButton2;
+ QLineEdit *LineEdit1;
+ QLineEdit *LineEdit2;
+
+ // 1Combo
+ QLabel *TextLabel7;
+ QComboBox *ComboBox1;
-class MeasureGUI_DistanceDlg : public MeasureGUI_Skeleton
-{
+ // 4Text
+ QLabel *TextLabel3;
+ QLabel *TextLabel4;
+ QLabel *TextLabel5;
+ QLabel *TextLabel6;
+ QLineEdit *LineEdit3;
+ QLineEdit *LineEdit4;
+ QLineEdit *LineEdit5;
+ QLineEdit *LineEdit6;
+};
+
+//=================================================================================
+// class : MeasureGUI_DistanceDlg
+// purpose :
+//=================================================================================
+class MeasureGUI_DistanceDlg : public GEOMBase_Skeleton
+{
Q_OBJECT
-
+
public:
- MeasureGUI_DistanceDlg( GeometryGUI*, QWidget* );
+ MeasureGUI_DistanceDlg (GeometryGUI*, QWidget*);
~MeasureGUI_DistanceDlg();
protected:
- // redefined from GEOMBase_Helper and MeasureGUI_Skeleton
+ // redefined from GEOMBase_Helper and GEOMBase_Skeleton
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+ virtual QString getNewObjectName (int CurrObj = -1) const;
+
+ void redisplayPreview();
virtual void processObject();
virtual SALOME_Prs* buildPrs();
- virtual void SelectionIntoArgument();
- virtual void LineEditReturnPressed();
- virtual void SetEditCurrentArgument();
- virtual bool isValid( QString& );
private:
void Init();
- bool getParameters( double&,
- gp_Pnt&,
- gp_Pnt& );
+ void enterEvent (QEvent*);
+
private:
- QLineEdit* myEditCurrentArgument;
- QLineEdit* mySelEdit2;
- QPushButton* mySelBtn2;
-
- MeasureGUI_2Sel4LineEdit* myGrp;
+ GEOM::GEOM_Object_var myObj1;
GEOM::GEOM_Object_var myObj2;
+
+ MeasureGUI_DistanceGroup* myGrp;
+ GEOM::ListOfDouble_var myDbls;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void ActivateThisDialog();
+ void SelectionIntoArgument();
+ void SetEditCurrentArgument();
+ void SolutionSelected (int i);
};
#endif // MEASUREGUI_DISTANCEDLG_H
// 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 : MeasureGUI_Widgets.cxx
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
+
#include "MeasureGUI_Widgets.h"
//////////////////////////////////////////
{
}
-//////////////////////////////////////////
-// MeasureGUI_2Sel4LineEdit
-//////////////////////////////////////////
-
-MeasureGUI_2Sel4LineEdit::MeasureGUI_2Sel4LineEdit( QWidget* parent, Qt::WindowFlags f )
-: QWidget( parent, f )
-{
- setupUi( this );
-}
-
-MeasureGUI_2Sel4LineEdit::~MeasureGUI_2Sel4LineEdit()
-{
-}
-
//////////////////////////////////////////
// MeasureGUI_SkeletonBox
//////////////////////////////////////////
// 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 : MeasureGUI_Widgets.h
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
-//
+
#ifndef MEASUREGUI_WIDGETS_H
#define MEASUREGUI_WIDGETS_H
~MeasureGUI_2Sel1LineEdit();
};
-//////////////////////////////////////////
-// MeasureGUI_2Sel4LineEdit
-//////////////////////////////////////////
-
-#include "ui_MeasureGUI_2Sel4LineEdit_QTD.h"
-
-class MeasureGUI_2Sel4LineEdit : public QWidget,
- public Ui::MeasureGUI_2Sel4LineEdit_QTD
-{
- Q_OBJECT
-
-public:
- MeasureGUI_2Sel4LineEdit( QWidget* = 0, Qt::WindowFlags = 0 );
- ~MeasureGUI_2Sel4LineEdit();
-};
-
//////////////////////////////////////////
// MeasureGUI_SkeletonBox
//////////////////////////////////////////
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
}
- myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
}
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
Handle(AIS_InteractiveContext) anIC = GetContext();
// StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
- bool isTopLev = (isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor);
+ bool isTopLev = isTopLevel() && switchTopLevel();
switch (aMode) {
case 0://StdSelect_DM_Wireframe:
{
// aPrs->ReCompute(); // for hidden line recomputation if necessary...
}
-void GEOM_AISShape::SetTransparency(const Standard_Real aValue)
-{
- if(aValue<0.0 || aValue>1.0) return;
-
- if(aValue<=0.05)
- {
- UnsetTransparency();
- return;
- }
-
- Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
- FMat.SetTransparency(aValue);
- myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
- myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(FMat);
- myCurrentMaterial = FMat;
- myTransparency = aValue;
-}
-
void GEOM_AISShape::SetShadingColor(const Quantity_Color &aCol)
{
myShadingColor = aCol;
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
- aMatAspect.SetTransparency(myTransparency);
- myCurrentMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
- myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
- myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentMaterial );
-
- //Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
- // P->SetPrimitivesAspect(a4bis);
- // G->SetGroupPrimitivesAspect(a4bis);
- //a4bis->SetInteriorColor(myShadingColor);
- if( isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor )
+ aMatAspect.SetTransparency(Transparency());
+ Graphic3d_MaterialAspect currentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
+ Graphic3d_MaterialAspect currentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
+ myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : currentFrontMaterial );
+ myDrawer->ShadingAspect()->Aspect()->SetBackMaterial ( isTopLevel() ? aMatAspect : currentBackMaterial );
+
+ if( isTopLevel() && switchTopLevel() )
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
else {
if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight );
~GEOM_AISShape();
- void SetTransparency(const Standard_Real aValue);
void SetShadingColor(const Quantity_Color &aCol);
void SetEdgesInShadingColor(const Quantity_Color &aCol);
void SetDisplayVectors(bool isShow);
TCollection_AsciiString myName;
bool myDisplayVectors;
Standard_Boolean myTopLevel;
- Graphic3d_MaterialAspect myCurrentMaterial;
Standard_Integer myPrevDisplayMode;
static TopLevelDispMode myTopLevelDm;
// GEOM OBJECT : interactive object for Geometry entities visualization
// File : GEOM_AISVector.cxx
// Author : Julia DOROVSKIKH
-// $Header$
//
#include <GEOM_AISVector.hxx>
// File : GEOM_Actor.cxx
// Author : Christophe ATTANASIO
// Module : GEOM
-// $Header$
//
/*!
\class GEOM_Actor GEOM_Actor.h
myHighlightProp(vtkProperty::New()),
myPreHighlightProp(vtkProperty::New()),
- myShadingFaceProp(vtkProperty::New())
+ myShadingFaceProp(vtkProperty::New()),
+ myShadingBackFaceProp(vtkProperty::New())
{
#ifdef MYDEBUG
MESSAGE (this<< " GEOM_Actor::GEOM_Actor");
myIsolatedEdgeActor->SetInput(myIsolatedEdgeSource->GetOutput(),false);
aProperty = myIsolatedEdgeActor->GetProperty();
aProperty->SetRepresentation(VTK_WIREFRAME);
- aProperty->SetColor(1, 0, 0);
+ myIsolatedEdgeColor[0] = 1; myIsolatedEdgeColor[1] = 0; myIsolatedEdgeColor[2] = 0;
+ aProperty->SetColor(myIsolatedEdgeColor[0], myIsolatedEdgeColor[1], myIsolatedEdgeColor[2]);
myAppendFilter->AddInput(myOneFaceEdgeSource->GetOutput());
myOneFaceEdgeActor->SetInput(myOneFaceEdgeSource->GetOutput(),false);
aProperty = myOneFaceEdgeActor->GetProperty();
aProperty->SetRepresentation(VTK_WIREFRAME);
- aProperty->SetColor(0, 1, 0);
+ myOneFaceEdgeColor[0] = 0; myOneFaceEdgeColor[1] = 1; myOneFaceEdgeColor[2] = 0;
+ aProperty->SetColor(myOneFaceEdgeColor[0], myOneFaceEdgeColor[1], myOneFaceEdgeColor[2]);
myAppendFilter->AddInput(mySharedEdgeSource->GetOutput());
mySharedEdgeActor->SetInput(mySharedEdgeSource->GetOutput(),false);
aProperty = mySharedEdgeActor->GetProperty();
aProperty->SetRepresentation(VTK_WIREFRAME);
- aProperty->SetColor(1, 1, 0);
+ mySharedEdgeColor[0] = 1; mySharedEdgeColor[1] = 1; mySharedEdgeColor[2] = 0;
+ aProperty->SetColor(mySharedEdgeColor[0], mySharedEdgeColor[1], mySharedEdgeColor[2]);
myAppendFilter->AddInput(myWireframeFaceSource->GetOutput());
myWireframeFaceActor->SetInput(myWireframeFaceSource->GetOutput(),false);
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
- StoreBoundaryColors();
-
myNbIsos[0] = -1;
myNbIsos[1] = -1;
myHighlightProp->Delete();
myPreHighlightProp->Delete();
myShadingFaceProp->Delete();
+ myShadingBackFaceProp->Delete();
}
GEOM_Actor*
MESSAGE ( "GEOM_Actor::setDisplayMode = "<<theMode );
#endif
- if ( theMode == (int)eWireframe ) {
- RestoreIsoNumbers();
- // Restore wireframe edges colors
- RestoreBoundaryColors();
- }
- else if ( theMode == (int)eShading || theMode == (int)eShadingWithEdges ) {
+ if ( theMode == (int)eShading || theMode == (int)eShadingWithEdges ) {
// Temporary store number of iso lines in order to recover its later
- // when display mode is achnged to 'Wirefame' or 'Shading'.
- // Iso lines are not displayed in 'Shading with edges' mode.
+ // when display mode is changed to 'Wirefame'
+ // Iso lines are not displayed in 'Shading' and 'Shading with edges' modes.
StoreIsoNumbers();
// Reset number of iso lines to 0
ResetIsoNumbers();
+ }
- if ( theMode == (int)eShadingWithEdges ) {
- // Store wireframe edges colors
- StoreBoundaryColors();
-
- // Coloring edges
- myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
- myEdgesInShadingColor[1],
- myEdgesInShadingColor[2]);
- myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
- myEdgesInShadingColor[1],
- myEdgesInShadingColor[2]);
- mySharedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
+ if ( theMode == (int)eShadingWithEdges ) {
+ // Coloring edges
+ myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
myEdgesInShadingColor[1],
myEdgesInShadingColor[2]);
- //SetModified();
- } else {
- myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
- myEdgesInWireframeColor[1],
- myEdgesInWireframeColor[2]);
- }
+ myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
+ myEdgesInShadingColor[1],
+ myEdgesInShadingColor[2]);
+ mySharedEdgeActor->GetProperty()->SetColor(myEdgesInShadingColor[0],
+ myEdgesInShadingColor[1],
+ myEdgesInShadingColor[2]);
+ }
+ else {
+ // Restore number of iso-lines
+ RestoreIsoNumbers();
+
+ // Coloring edges
+ myIsolatedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
+ myIsolatedEdgeColor[1],
+ myIsolatedEdgeColor[2]);
+ mySharedEdgeActor->GetProperty()->SetColor(myIsolatedEdgeColor[0],
+ myIsolatedEdgeColor[1],
+ myIsolatedEdgeColor[2]);
+ myOneFaceEdgeActor->GetProperty()->SetColor(myOneFaceEdgeColor[0],
+ myOneFaceEdgeColor[1],
+ myOneFaceEdgeColor[2]);
}
VTKViewer_Actor::setDisplayMode(theMode);
return myWireframeFaceActor->GetProperty();
}
+vtkProperty* GEOM_Actor::GetIsolatedEdgeProperty()
+{
+ return myIsolatedEdgeActor->GetProperty();
+}
+
+vtkProperty* GEOM_Actor::GetVertexProperty()
+{
+ return myVertexActor->GetProperty();
+}
+
+vtkProperty* GEOM_Actor::GetSharedEdgeProperty()
+{
+ return mySharedEdgeActor->GetProperty();
+}
+
+vtkProperty* GEOM_Actor::GetFaceEdgeProperty()
+{
+ return myOneFaceEdgeActor->GetProperty();
+}
+
void GEOM_Actor::SetShadingProperty(vtkProperty* Prop)
{
#ifdef MYDEBUG
myPreHighlightProp->SetRepresentationToSurface();
myHighlightProp->SetRepresentationToSurface();
myShadingFaceProp->SetRepresentationToSurface();
+ myShadingBackFaceProp->SetRepresentationToSurface();
break;
}
if(myIsPreselected){
this->myHighlightActor->SetProperty(myPreHighlightProp.GetPointer());
myShadingFaceActor->SetProperty(myPreHighlightProp.GetPointer());
+ myShadingFaceActor->SetBackfaceProperty(myPreHighlightProp.GetPointer());
} else {
this->myHighlightActor->SetProperty(myShadingFaceProp.GetPointer());
myShadingFaceActor->SetProperty(myShadingFaceProp.GetPointer());
+ myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
}
}
else{
this->myHighlightActor->SetProperty(myHighlightProp.GetPointer());
myShadingFaceActor->SetProperty(myHighlightProp.GetPointer());
+ myShadingFaceActor->SetBackfaceProperty(myHighlightProp.GetPointer());
}
this->Property->Render(this, ren);
{
// enk:tested OK
myShadingFaceProp->SetOpacity(opa);
+ myShadingBackFaceProp->SetOpacity(opa);
myHighlightProp->SetOpacity(opa);
myPreHighlightProp->SetOpacity(opa);
myVertexActor->GetProperty()->SetOpacity(opa);
void GEOM_Actor::SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b)
{
- // enk:tested OK
- myShadingFaceProp->SetColor(r,g,b); // shading color (Shading)
- myVertexActor->GetProperty()->SetColor(r,g,b); // vertex actor (Shading/Wireframe)
- if ( myDisplayMode != (int)eShadingWithEdges ) {
- myIsolatedEdgeActor->GetProperty()->SetColor(r,g,b); // standalone edge color (Wireframe)
- myOneFaceEdgeActor->GetProperty()->SetColor(r,g,b); // standalone face edge color (Wireframe)
- mySharedEdgeActor->GetProperty()->SetColor(r,g,b); // share edge color (Wireframe)
- }
-
- StoreBoundaryColors();
+ // set the same color to all sub-actors:
+ // - points
+ // - standalone edges
+ // - shared edges
+ // - free edges
+ // - shading color (front and back faces)
+ SetPointColor(r, g, b);
+ SetIsolatedEdgeColor(r, g, b);
+ SetSharedEdgeColor(r, g, b);
+ SetFreeEdgeColor(r, g, b);
+ myShadingFaceProp->SetColor(r,g,b); // shading color
+ myShadingBackFaceProp->SetColor(r,g,b); // back face shading color
}
void GEOM_Actor::GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b)
{
- // enk:tested OK
vtkFloatingPointType aRGB[3];
myShadingFaceProp->GetColor(aRGB);
r = aRGB[0];
b = aRGB[2];
}
+/*!
+ \brief Set color of points
+ Points actor is shown in Wireframe mode only, see SetVisibility()
+*/
+void GEOM_Actor::SetPointColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
+{
+ myVertexActor->GetProperty()->SetColor(r, g, b);
+}
+
+/*!
+ \brief Set color of standalone edges, wires, vectors
+ This actor is shown in all display mode, see SetVisibility()
+ TODO: check - this color seems to be used not only for standalone edges
+*/
+void GEOM_Actor::SetIsolatedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
+{
+ myIsolatedEdgeColor[0] = r; myIsolatedEdgeColor[1] = g; myIsolatedEdgeColor[2] = b;
+ if ( myDisplayMode != (int)eShadingWithEdges )
+ myIsolatedEdgeActor->GetProperty()->SetColor(r, g, b);
+}
+
+/*!
+ \brief Set color of shared edges
+ This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
+ TODO: check - this seems to be not working currently
+*/
+void GEOM_Actor::SetSharedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
+{
+ mySharedEdgeColor[0] = r; mySharedEdgeColor[1] = g; mySharedEdgeColor[2] = b;
+ if ( myDisplayMode != (int)eShadingWithEdges )
+ mySharedEdgeActor->GetProperty()->SetColor(r, g, b);
+}
+
+/*!
+ \brief Set color of edges for standalone faces
+ This actor is shown only in wireframe and shading+edges display modes, see SetVisibility()
+ TODO: this color should be used not only for faces
+*/
+void GEOM_Actor::SetFreeEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
+{
+ myOneFaceEdgeColor[0] = r; myOneFaceEdgeColor[1] = g; myOneFaceEdgeColor[2] = b;
+ if ( myDisplayMode != (int)eShadingWithEdges )
+ myOneFaceEdgeActor->GetProperty()->SetColor(r, g, b);
+}
+
+/*!
+ \brief Set color of iso-lines
+ This actor is shown only in wireframe display mode, see SetVisibility()
+*/
+void GEOM_Actor::SetIsosColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b)
+{
+ myWireframeFaceActor->GetProperty()->SetColor(r, g, b);
+}
+
void GEOM_Actor::SetMaterial(std::vector<vtkProperty*> theProps)
{
// we set material properties as back and front material
+ int aSize = theProps.size();
+
+ if ( aSize < 1 || aSize > 2)
+ return;
+
+ // theProps[0] -- front material properties
+ // theProps[1] -- back material properties (if exist)
+
double aCoefnt;
// Set reflection coefficients
aCoefnt = theProps[0]->GetAmbient();
myShadingFaceProp->SetAmbient(aCoefnt);
myVertexActor->GetProperty()->SetAmbient(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetAmbient();
+ myShadingBackFaceProp->SetAmbient(aCoefnt);
// Set diffuse coefficients
aCoefnt = theProps[0]->GetDiffuse();
myShadingFaceProp->SetDiffuse(aCoefnt);
myVertexActor->GetProperty()->SetDiffuse(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetDiffuse();
+ myShadingBackFaceProp->SetDiffuse(aCoefnt);
// Set specular coefficients
aCoefnt = theProps[0]->GetSpecular();
myShadingFaceProp->SetSpecular(aCoefnt);
myVertexActor->GetProperty()->SetSpecular(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetSpecular();
+ myShadingBackFaceProp->SetSpecular(aCoefnt);
+
double* aColor;
aColor = theProps[0]->GetAmbientColor();
myShadingFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
myVertexActor->GetProperty()->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetAmbientColor();
+ myShadingBackFaceProp->SetAmbientColor(aColor[0], aColor[1], aColor[2]);
// Set diffuse colors
aColor = theProps[0]->GetDiffuseColor();
myShadingFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
myVertexActor->GetProperty()->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetDiffuseColor();
+ myShadingBackFaceProp->SetDiffuseColor(aColor[0], aColor[1], aColor[2]);
// Set specular colors
aColor = theProps[0]->GetSpecularColor();
myShadingFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
myVertexActor->GetProperty()->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
+ if ( aSize == 2 )
+ aColor = theProps[1]->GetSpecularColor();
+ myShadingBackFaceProp->SetSpecularColor(aColor[0], aColor[1], aColor[2]);
// Set shininess
aCoefnt = theProps[0]->GetSpecularPower();
myShadingFaceProp->SetSpecularPower(aCoefnt);
myVertexActor->GetProperty()->SetSpecularPower(aCoefnt);
+ if ( aSize == 2 )
+ aCoefnt = theProps[1]->GetSpecularPower();
+ myShadingBackFaceProp->SetSpecularPower(aCoefnt);
+
+ // Set back face material property
+ myShadingFaceActor->SetBackfaceProperty(myShadingBackFaceProp.GetPointer());
}
-vtkProperty* GEOM_Actor::GetMaterial()
+vtkProperty* GEOM_Actor::GetFrontMaterial()
{
return myShadingFaceProp;
}
+vtkProperty* GEOM_Actor::GetBackMaterial()
+{
+ return myShadingBackFaceProp;
+}
+
bool GEOM_Actor::IsInfinitive()
{
return ((bool)myShape.Infinite() || isOnlyVertex);
int aNb[2] = {0, 0};
myWireframeFaceSource->SetNbIso(aNb);
}
-
-void GEOM_Actor::StoreBoundaryColors()
-{
- myShadingFaceProp->GetColor(myEdgesInWireframeColor);
-
-}
-
-void GEOM_Actor::RestoreBoundaryColors()
-{
- myIsolatedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
- myEdgesInWireframeColor[1],
- myEdgesInWireframeColor[2]);
- myOneFaceEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
- myEdgesInWireframeColor[1],
- myEdgesInWireframeColor[2]);
- mySharedEdgeActor->GetProperty()->SetColor(myEdgesInWireframeColor[0],
- myEdgesInWireframeColor[1],
- myEdgesInWireframeColor[2]);
-}
// File : GEOM_Actor.h
// Author : Christophe ATTANASIO
// Module : GEOM
-// $Header$
//
#ifndef GEOM_ACTOR_H
#define GEOM_ACTOR_H
vtkProperty* GetWireframeProperty();
vtkProperty* GetShadingProperty();
+ vtkProperty* GetIsolatedEdgeProperty();
+ vtkProperty* GetVertexProperty();
+ vtkProperty* GetSharedEdgeProperty();
+ vtkProperty* GetFaceEdgeProperty();
void setDeflection(double adef);
virtual void setDisplayMode(int thenewmode);
void SetOpacity(vtkFloatingPointType opa);
vtkFloatingPointType GetOpacity();
- // Color
- void SetColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
- void GetColor(vtkFloatingPointType& r,vtkFloatingPointType& g,vtkFloatingPointType& b);
+ // Color (same to all sub-actors/display modes)
+ void SetColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ void GetColor(vtkFloatingPointType& r, vtkFloatingPointType& g, vtkFloatingPointType& b);
+ // Color of points
+ void SetPointColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ // Color of standalone edges, wires, vectors
+ void SetIsolatedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ // Color of shared edges
+ void SetSharedEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ // Color of free edges
+ void SetFreeEdgeColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ // Color of edges in shading+edges display mode
+ void SetEdgesInShadingColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+ // Color of iso-lines
+ void SetIsosColor(vtkFloatingPointType r, vtkFloatingPointType g, vtkFloatingPointType b);
+
// Material
void SetMaterial(std::vector<vtkProperty*> theProps);
- vtkProperty* GetMaterial();
-
+ vtkProperty* GetFrontMaterial();
+ vtkProperty* GetBackMaterial();
virtual bool IsInfinitive();
// overloaded functions
bool
GetVectorMode();
- //! Edges in shading color management
- void SetEdgesInShadingColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b);
-
void
StoreIsoNumbers();
void GetMatrix(vtkCamera* theCam, vtkMatrix4x4 *result);
- void StoreBoundaryColors();
- void RestoreBoundaryColors();
-
GEOM_Actor();
~GEOM_Actor();
vtkSmartPointer<vtkProperty> myHighlightProp;
vtkSmartPointer<vtkProperty> myPreHighlightProp;
vtkSmartPointer<vtkProperty> myShadingFaceProp;
+ vtkSmartPointer<vtkProperty> myShadingBackFaceProp;
PAppendFilter myAppendFilter;
PPolyGeomPainterDataMapper myPolyDataMapper;
vtkFloatingPointType myEdgesInWireframeColor[3];
vtkFloatingPointType myEdgesInShadingColor[3];
+ vtkFloatingPointType myIsolatedEdgeColor[3];
+ vtkFloatingPointType mySharedEdgeColor[3];
+ vtkFloatingPointType myOneFaceEdgeColor[3];
};
#endif //GEOM_ACTOR_H
--- /dev/null
+// Copyright (C) 2007-2012 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
+//
+
+// File : GEOM_Constants.cxx
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "GEOM_Constants.h"
+
+namespace GEOM
+{
+
+ /*!
+ \brief Get minimal allowed value for deflection coefficient
+ */
+ double minDeflection()
+ {
+ return 1e-06; // DEFLECTION_MIN
+ }
+
+ /*!
+ \brief Get character used to separate parameter names
+ */
+ QString sectionSeparator()
+ {
+ return "_"; // NAME_SEPARATOR
+ }
+
+ /*!
+ \brief Get character used to separate numeric parameter values (color = r:g:b)
+ */
+ QString subSectionSeparator()
+ {
+ return ":"; // DIGIT_SEPARATOR
+ }
+
+ QString propertyName( Property type )
+ {
+ static const char* names[] = {
+ // visibility
+ "Visibility", // VISIBILITY_PROP
+ // transparency
+ "Transparency", // TRANSPARENCY_PROP
+ // display mode
+ "DisplayMode", // DISPLAY_MODE_PROP
+ // number of the iso lines (along u and v directions)
+ "Isos", // ISOS_PROP
+ // main / shading color
+ "Color", // COLOR_PROP
+ // "show edges direction" flag
+ "VectorMode", // VECTOR_MODE_PROP
+ // deflection coefficient
+ "DeflectionCoeff", // DEFLECTION_COEFF_PROP
+ // point marker data
+ "MarkerType", // MARKER_TYPE_PROP
+ // material
+ "Material", // MATERIAL_PROP
+ // general line width
+ "EdgeWidth", // EDGE_WIDTH_PROP
+ // isos width
+ "IsosWidth", // ISOS_WIDTH_PROP
+ // top-level flag
+ "TopLevelFlag", // TOP_LEVEL_PROP
+ // opacity
+ "Opacity", // OPACITY_PROP
+ // shading color
+ "ShadingColor", // -
+ // wireframe color
+ "WireframeColor", // -
+ // standalone edges color
+ "LineColor", // -
+ // free boundaries color
+ "FreeBndColor", // -
+ // points color
+ "PointColor", // -
+ // isos color
+ "IsosColor", // -
+ // outlines color
+ "OutlineColor", // -
+ };
+ return ( type >= GEOM::Visibility && type <= GEOM::LastProperty ) ? names[type] : QString();
+ }
+
+} // namespace GEOM
//
// File : GEOM_Constants.h
-// Author : Margarita KARPUNINA
-// Module : GEOM
-//
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
#ifndef GEOM_CONSTANTS_H
#define GEOM_CONSTANTS_H
-// minimum allowed value for deflection coefficient
-#define DEFLECTION_MIN 1e-06
-
-//Define separators
-#define NAME_SEPARATOR '_' // character used to separate parameter names
-#define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b)
-
-#define VISIBILITY_PROP "Visibility" //Object visibility property
-#define OPACITY_PROP "Opacity" //Object opacity property
-#define TRANSPARENCY_PROP "Transparency" //Object transparency property
-#define DISPLAY_MODE_PROP "DisplayMode" //Object display mode property
-#define ISOS_PROP "Isos" //Number of the Isos property of the object
-#define COLOR_PROP "Color" //Color of the object
-#define VECTOR_MODE_PROP "VectorMode" //Vector mode property
-#define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property
-#define MARKER_TYPE_PROP "MarkerType" //Marker type property
-#define MATERIAL_PROP "Material" //Object material property
-#define EDGE_WIDTH_PROP "EdgeWidth" //Width of the edge
-#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines
-#define TOP_LEVEL_PROP "TopLevelFlag" //Top level flag
+#include <QString>
+
+#include "GEOM_OBJECT_defs.hxx"
+
+namespace GEOM
+{
+ enum Property {
+ Visibility,
+ Transparency,
+ DisplayMode,
+ NbIsos,
+ Color,
+ EdgesDirection,
+ Deflection,
+ PointMarker,
+ Material,
+ LineWidth,
+ IsosWidth,
+ TopLevel,
+ LastStudyProperty = TopLevel,
+ Opacity,
+ ShadingColor,
+ WireframeColor,
+ LineColor,
+ FreeBndColor,
+ PointColor,
+ IsosColor,
+ OutlineColor,
+ LastProperty = OutlineColor,
+ };
+
+ GEOM_OBJECT_EXPORT double minDeflection();
+
+ GEOM_OBJECT_EXPORT QString sectionSeparator();
+ GEOM_OBJECT_EXPORT QString subSectionSeparator();
+
+ GEOM_OBJECT_EXPORT QString propertyName( Property );
+}
+
#endif //GEOM_CONSTANTS_H
return myActor->GetProperty();
}
+void \r
+GEOM_DeviceActor:: \r
+SetBackfaceProperty(vtkProperty* theProperty)\r
+{\r
+ myActor->SetBackfaceProperty(theProperty);\r
+}\r
+ \r
+vtkProperty* \r
+GEOM_DeviceActor:: \r
+GetBackfaceProperty()\r
+{\r
+ return myActor->GetBackfaceProperty();\r
+}\r
+
void
GEOM_DeviceActor::
SetVisibility(int theVisibility)
void SetProperty(vtkProperty* theProperty);
vtkProperty* GetProperty();
-
+ \r
+ void SetBackfaceProperty(vtkProperty* theProperty);\r
+ vtkProperty* GetBackfaceProperty();
+
void SetVisibility(int theVisibility);
int GetVisibility();
// File : GEOM_InteractiveObject.cxx
// Author : Christophe ATTANASIO
// Module : GEOM
-// $Header$
//
/*!
\class GEOM_InteractiveObject GEOM_InteractiveObject.hxx
// File : GEOM_OCCReader.h
// Author : Christophe ATTANASIO
// Module : GEOM
-// $Header$
//
/*!
\class GEOM_OCCReader GEOM_OCCReader.h
SetColor(GEOM_AISShape::topLevelColor());
}
+GEOM_TopWireframeShape::~GEOM_TopWireframeShape()
+{
+}
+
Handle(SALOME_InteractiveObject) GEOM_TopWireframeShape::getIO(){
Handle(SALOME_InteractiveObject) IO;
if ( !GetOwner().IsNull() )
#include <Standard_TypeMismatch.hxx>
#endif
-GEOM_TopWireframeShape::~GEOM_TopWireframeShape() {}
-
Standard_EXPORT Handle_Standard_Type& GEOM_TopWireframeShape_Type_()
{
// File : GEOM_VTKTrihedron.cxx
// Author : Sergey LITONIN
// Module : SALOME
-// $Header:
//
#include "GEOM_VTKTrihedron.hxx"
gp_Mat aRot = aTrsf.VectorialPart();
for ( int i = 1; i <= 3; i++ )
+ {
for ( int j = 1; j <= 3; j++ )
myMatrix->SetElement( i - 1, j - 1, aRot( i, j ) );
+
+ // Set Arrow Position
+ myMatrix->SetElement( i - 1 , 3, aPosition[ i - 1 ] );
+ }
myArrowActor->SetUserMatrix( myMatrix );
- myArrowActor->SetPosition( aPosition );
#ifdef IPAL21440
if( vtkCoordinate* aCoord = myLabelActor->GetPositionCoordinate()->GetReferenceCoordinate() )
myAxis[ 1 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theColor[1], theIsDiffuse ? 0.0 : theColor[2] );
myAxis[ 2 ]->SetColor( theIsDiffuse ? 0.0 : theColor[0], theIsDiffuse ? 0.0 : theColor[1], theColor[2] );
}
+
// File : GEOM_VTKTrihedron.h
// Author : Sergey LITONIN
// Module : SALOME
-// $Header:
//
#ifndef GEOM_VTKTrihedron_H
#define GEOM_VTKTrihedron_H
GEOM_VTKPropertyMaterial.cxx \
GEOM_AISVector.cxx \
GEOM_PainterPolyDataMapper.cxx \
- GEOM_DeviceActor.cxx
+ GEOM_DeviceActor.cxx \
+ GEOM_Constants.cxx
libGEOMObject_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
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : RepairGUI_FreeBoundDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
-//
+
#include "RepairGUI_FreeBoundDlg.h"
#include <GEOMBase.h>
+#include <DlgRef.h>
+
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <GEOMImpl_Types.hxx>
#include <QKeyEvent>
#define SPACING 6
-#define MARGIN 9
+#define MARGIN 0
/*!
Class : RepairGUI_FreeBoundDlg
// function : RepairGUI_FreeBoundDlg
// purpose : Constructor
//=================================================================================
-RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg( GeometryGUI* theGUI, QWidget* theParent )
- : QDialog( theParent, 0 ),
- GEOMBase_Helper( dynamic_cast<SUIT_Desktop*>( theParent ) ),
- myGeomGUI( theGUI )
+RepairGUI_FreeBoundDlg::RepairGUI_FreeBoundDlg (GeometryGUI* theGUI, QWidget* theParent)
+ : GEOMBase_Skeleton(theGUI, theParent)
{
- setAttribute( Qt::WA_DeleteOnClose );
-
- setWindowTitle( tr( "CAPTION" ) );
-
- QPixmap iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
-
- QGroupBox* aMainGrp = new QGroupBox( tr( "FREE_BOUND" ), this );
-
- QLabel* lab = new QLabel( tr( "GEOM_OBJECT" ), aMainGrp );
- QPushButton* btn = new QPushButton( aMainGrp );
- btn->setIcon( iconSelect );
- myEdit = new QLineEdit( aMainGrp );
- myEdit->setReadOnly( true );
- myEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- myClosedLbl = new QLabel( tr( "NUMBER_CLOSED" ), aMainGrp );
- myOpenLbl = new QLabel( tr( "NUMBER_OPEN" ), aMainGrp );
- myClosedLbl->setMinimumWidth( 150 );
- myOpenLbl->setMinimumWidth( 150 );
-
- QGridLayout* aMainGrpLayout = new QGridLayout( aMainGrp );
- aMainGrpLayout->setMargin( MARGIN ); aMainGrpLayout->setSpacing( SPACING );
- aMainGrpLayout->addWidget( lab, 0, 0 );
- aMainGrpLayout->addWidget( btn, 0, 1 );
- aMainGrpLayout->addWidget( myEdit, 0, 2 );
- aMainGrpLayout->addWidget( myClosedLbl, 1, 0, 1, 3 );
- aMainGrpLayout->addWidget( myOpenLbl, 2, 0, 1, 3 );
-
- QFrame* aFrame = new QFrame( this );
- aFrame->setFrameStyle( QFrame::Box | QFrame::Sunken );
- QPushButton* aCloseBtn = new QPushButton( tr( "GEOM_BUT_CLOSE" ), aFrame );
- QPushButton* aHelpBtn = new QPushButton( tr( "GEOM_BUT_HELP" ), aFrame );
- QHBoxLayout* aBtnLay = new QHBoxLayout( aFrame );
- aBtnLay->setMargin( MARGIN ); aBtnLay->setSpacing( SPACING );
- aBtnLay->addWidget( aCloseBtn );
- aBtnLay->addSpacing( SPACING ); aBtnLay->addStretch();
- aBtnLay->addWidget( aHelpBtn );
-
- QVBoxLayout* aLay = new QVBoxLayout( this );
- aLay->setSpacing( SPACING );
- aLay->setMargin( MARGIN );
- aLay->addWidget( aMainGrp );
- aLay->addWidget( aFrame );
-
- myHelpFileName = "using_measurement_tools_page.html#boundaries_anchor";
-
- connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
- connect( aHelpBtn, SIGNAL( clicked() ), SLOT( onHelp() ) );
+ QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_FREE_BOUNDS")));
+ QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+ setWindowTitle(tr("CAPTION"));
+
+ /***************************************************************/
+
+ mainFrame()->GroupConstructors->setTitle(tr("FREE_BOUND"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
+ mainFrame()->RadioButton3->close();
+
+ mainFrame()->GroupBoxName->hide();
+
+ QGroupBox* aMainGrp = new QGroupBox (tr("FREE_BOUND"), this);
+
+ QLabel* lab = new QLabel (tr("GEOM_OBJECT"), aMainGrp);
+ QPushButton* btn = new QPushButton (aMainGrp);
+ btn->setIcon(image1);
+ myEdit = new QLineEdit (aMainGrp);
+ myEdit->setReadOnly(true);
+ myEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
+
+ myClosedLbl = new QLabel (tr("NUMBER_CLOSED"), aMainGrp);
+ myOpenLbl = new QLabel (tr("NUMBER_OPEN"), aMainGrp);
+ myClosedLbl->setMinimumWidth(150);
+ myOpenLbl->setMinimumWidth(150);
+
+ QGridLayout* aMainGrpLayout = new QGridLayout (aMainGrp);
+ aMainGrpLayout->addWidget(lab, 0, 0);
+ aMainGrpLayout->addWidget(btn, 0, 1);
+ aMainGrpLayout->addWidget(myEdit, 0, 2);
+ aMainGrpLayout->addWidget(myClosedLbl, 1, 0, 1, 3);
+ aMainGrpLayout->addWidget(myOpenLbl, 2, 0, 1, 3);
+
+ QVBoxLayout* aLay = new QVBoxLayout (centralWidget());
+ aLay->setSpacing(SPACING);
+ aLay->setMargin(MARGIN);
+ aLay->addWidget(aMainGrp);
+
+ resize(minimumSizeHint());
+ /***************************************************************/
+
+ myHelpFileName = "boundaries_page.html";
Init();
}
}
//=================================================================================
-// function : onClose
-// purpose : SLOT. Called when "close" button pressed. Close dialog
+// function : Init
+// purpose : Initialize dialog fields
//=================================================================================
-void RepairGUI_FreeBoundDlg::onClose()
+void RepairGUI_FreeBoundDlg::Init()
{
- globalSelection();
- disconnect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 0, this, 0 );
- myGeomGUI->SetActiveDialogBox( 0 );
- reject();
- erasePreview();
+ myNbClosed = myNbOpen = 0;
+ myObj = GEOM::GEOM_Object::_nil();
+
+ myEditCurrentArgument = myEdit;
+
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
+ activateSelection();
+ SelectionIntoArgument();
}
//=================================================================================
-// function : onHelp()
+// function : ClickOnOk()
// purpose :
//=================================================================================
-void RepairGUI_FreeBoundDlg::onHelp()
+void RepairGUI_FreeBoundDlg::ClickOnOk()
{
- LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() );
- if ( app )
- app->onHelpContextModule( myGeomGUI ? app->moduleName( myGeomGUI->moduleName() ) : QString(""), myHelpFileName );
- else {
- QString platform;
-#ifdef WIN32
- platform = "winapplication";
-#else
- platform = "application";
-#endif
- SUIT_MessageBox::warning( this,
- tr( "WRN_WARNING" ),
- tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg( app->resourceMgr()->stringValue( "ExternalBrowser",
- platform ) ).arg( myHelpFileName ) );
- }
+ if (ClickOnApply())
+ ClickOnCancel();
}
//=================================================================================
-// function : onDeactivate
-// purpose : Deactivate this dialog
+// function : ClickOnApply()
+// purpose :
//=================================================================================
-void RepairGUI_FreeBoundDlg::onDeactivate()
+bool RepairGUI_FreeBoundDlg::ClickOnApply()
{
- setEnabled( false );
- globalSelection();
- disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
- myGeomGUI->SetActiveDialogBox( 0 );
+ if (!onAccept())
+ return false;
+ return true;
}
//=================================================================================
-// function : onActivate
-// purpose : Activate this dialog
+// function : ActivateThisDialog()
+// purpose :
//=================================================================================
-void RepairGUI_FreeBoundDlg::onActivate()
+void RepairGUI_FreeBoundDlg::ActivateThisDialog()
{
- myGeomGUI->EmitSignalDeactivateDialog();
- setEnabled( true );
- myGeomGUI->SetActiveDialogBox( this );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ GEOMBase_Skeleton::ActivateThisDialog();
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
+
activateSelection();
- onSelectionDone();
+ displayPreview(true);
}
//=================================================================================
-// function : onSelectionDone
-// purpose : SLOT. Called when selection changed.
+// function : enterEvent()
+// purpose :
//=================================================================================
-void RepairGUI_FreeBoundDlg::onSelectionDone()
+void RepairGUI_FreeBoundDlg::enterEvent(QEvent*)
{
- LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
- SALOME_ListIO aSelList;
- aSelMgr->selectedObjects(aSelList);
-
- if ( aSelList.Extent() != 1 )
- return;
-
- GEOM::GEOM_Object_var anObj =
- GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
- if ( !GEOMBase::IsShape( anObj ) )
- return;
- else {
- myObj = anObj;
- displayPreview( true, false, true, true, 3 );
- }
+ if (!mainFrame()->GroupConstructors->isEnabled())
+ ActivateThisDialog();
}
//=================================================================================
-// function : Init
-// purpose : Initialize dialog fields
+// function : SelectionIntoArgument
+// purpose : SLOT. Called when selection changed.
//=================================================================================
-void RepairGUI_FreeBoundDlg::Init()
+void RepairGUI_FreeBoundDlg::SelectionIntoArgument()
{
- myNbClosed = myNbOpen = 0;
+ myEditCurrentArgument->setText("");
+ myClosedLbl->setText(tr("NUMBER_CLOSED"));
+ myOpenLbl->setText(tr("NUMBER_OPEN"));
myObj = GEOM::GEOM_Object::_nil();
+ erasePreview();
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), SLOT ( onDeactivate() ) );
- connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
- SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
- activateSelection();
- onSelectionDone();
-}
+ if (aSelList.Extent() != 1)
+ return;
-//=================================================================================
-// function : enterEvent
-// purpose : Activate dialog
-//=================================================================================
-void RepairGUI_FreeBoundDlg::enterEvent( QEvent* )
-{
- onActivate();
-}
+ GEOM::GEOM_Object_var anObj = GEOMBase::ConvertIOinGEOMObject(aSelList.First());
-//=================================================================================
-// function : closeEvent
-// purpose : Close dialog
-//=================================================================================
-void RepairGUI_FreeBoundDlg::closeEvent( QCloseEvent* )
-{
- onClose();
+ if (!GEOMBase::IsShape(anObj))
+ return;
+
+ myObj = anObj;
+ myEditCurrentArgument->setText(GEOMBase::GetName(myObj));
+ displayPreview(true, false, true, true, 3);
}
//=================================================================================
void RepairGUI_FreeBoundDlg::activateSelection()
{
TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_FACE );
- aMap.Add( GEOM_SHELL );
- aMap.Add( GEOM_SOLID );
- aMap.Add( GEOM_COMPOUND );
- globalSelection( aMap );
+ aMap.Add(GEOM_FACE);
+ aMap.Add(GEOM_SHELL);
+ aMap.Add(GEOM_SOLID);
+ aMap.Add(GEOM_COMPOUND);
+ globalSelection(aMap);
}
//=================================================================================
//=================================================================================
GEOM::GEOM_IOperations_ptr RepairGUI_FreeBoundDlg::createOperation()
{
- return getGeomEngine()->GetIHealingOperations( getStudyId() );
+ return getGeomEngine()->GetIHealingOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool RepairGUI_FreeBoundDlg::isValid( QString& )
+bool RepairGUI_FreeBoundDlg::isValid (QString&)
{
return !myObj->_is_nil();
}
// function : execute
// purpose : Get free boundaries
//=================================================================================
-bool RepairGUI_FreeBoundDlg::execute( ObjectList& objects )
+bool RepairGUI_FreeBoundDlg::execute (ObjectList& objects)
{
- if ( !IsPreview() || myObj->_is_nil() )
- return false;
-
GEOM::ListOfGO_var aClosed, anOpen;
- GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow( getOperation() );
- bool result = anOper->GetFreeBoundary( myObj, aClosed, anOpen );
+ GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
+ bool result = anOper->GetFreeBoundary(myObj, aClosed, anOpen);
- if ( result ) {
+ if (result) {
myNbClosed = aClosed->length();
myNbOpen = anOpen->length();
int i;
- for ( i = 0; i < myNbClosed; i++ )
- objects.push_back( aClosed[i]._retn() );
- for ( i = 0; i < myNbOpen; i++ )
- objects.push_back( anOpen[i]._retn() );
-
- myEdit->setText( GEOMBase::GetName( myObj ) );
- QString aLabelText = tr( "NUMBER_CLOSED" ) + QString( "%1" ).arg( myNbClosed );
- myClosedLbl->setText( aLabelText );
- aLabelText = tr( "NUMBER_OPEN" ) + QString( "%1" ).arg( myNbOpen );
- myOpenLbl->setText( aLabelText );
- }
- else {
- myEdit->setText( GEOMBase::GetName( myObj ) );
- myClosedLbl->setText( tr( "NUMBER_CLOSED" ) );
- myOpenLbl->setText( tr( "NUMBER_OPEN" ) );
+ for (i = 0; i < myNbClosed; i++)
+ objects.push_back(aClosed[i]._retn());
+ for (i = 0; i < myNbOpen; i++)
+ objects.push_back(anOpen[i]._retn());
+
+ QString aLabelText = tr("NUMBER_CLOSED") + QString("%1").arg(myNbClosed);
+ myClosedLbl->setText(aLabelText);
+ aLabelText = tr("NUMBER_OPEN") + QString("%1").arg(myNbOpen);
+ myOpenLbl->setText(aLabelText);
}
+ myCurrObj = 1;
return result;
}
-//=================================================================================
-// function : keyPressEvent()
-// purpose :
-//=================================================================================
-void RepairGUI_FreeBoundDlg::keyPressEvent( QKeyEvent* e )
+//================================================================
+// Function : getNewObjectName
+// Purpose : Redefine this method to return proper name for a new object
+//================================================================
+QString RepairGUI_FreeBoundDlg::getNewObjectName (int currObj) const
{
- QDialog::keyPressEvent( e );
- if ( e->isAccepted() )
- return;
+ QString aName = tr("NAME_CLOSED").arg(currObj);
+ if (currObj > myNbClosed)
+ aName = tr("NAME_OPEN").arg(currObj);
+ return aName;
+}
- if ( e->key() == Qt::Key_F1 ) {
- e->accept();
- onHelp();
- }
+//================================================================
+// Function : getFather
+// Purpose : Get father object for object to be added in study
+// (called with addInStudy method)
+//================================================================
+GEOM::GEOM_Object_ptr RepairGUI_FreeBoundDlg::getFather (GEOM::GEOM_Object_ptr)
+{
+ return myObj;
}
// 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 : RepairGUI_FreeBoundDlg.h
// Author : Sergey LITONIN, Open CASCADE S.A.S. (sergey.litonin@opencascade.com)
-//
+
#ifndef REPAIRGUI_FREEBOUNDDLG_H
#define REPAIRGUI_FREEBOUNDDLG_H
#include <QDialog>
-#include <GEOMBase_Helper.h>
+#include <GEOMBase_Skeleton.h>
class QLineEdit;
class QLabel;
// class : RepairGUI_FreeBoundDlg
// purpose : Dialog for displaying free boundaries of selected face, shell or solid
//=================================================================================
-class RepairGUI_FreeBoundDlg : public QDialog,
- public GEOMBase_Helper
+class RepairGUI_FreeBoundDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
- RepairGUI_FreeBoundDlg( GeometryGUI*, QWidget* );
+ RepairGUI_FreeBoundDlg (GeometryGUI*, QWidget*);
~RepairGUI_FreeBoundDlg();
-private slots:
- void onClose();
- void onHelp();
- void onDeactivate();
- void onActivate();
- void onSelectionDone();
+protected:
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
+ virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QString getNewObjectName (int CurrObj = -1) const;
private:
void Init();
- void enterEvent( QEvent* );
- void closeEvent( QCloseEvent* );
- void keyPressEvent( QKeyEvent* );
+ void enterEvent (QEvent*);
void activateSelection();
-
- virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool execute( ObjectList& );
- virtual bool isValid( QString& );
private:
QLineEdit* myEdit;
QLabel* myClosedLbl;
QLabel* myOpenLbl;
+
GEOM::GEOM_Object_var myObj;
- GeometryGUI* myGeomGUI;
int myNbClosed;
int myNbOpen;
- QString myHelpFileName;
+ int myCurrObj;
+
+private slots:
+ void ClickOnOk();
+ bool ClickOnApply();
+ void SelectionIntoArgument();
+ void ActivateThisDialog();
};
#endif // REPAIRGUI_FREEBOUNDDLG_H
# Author : Patrick GOLDBRONN (CEA)
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
// File : Sketcher_Profile.h
// Author : Damien COQUERET
// Module : GEOM
-// $Header:
//
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
# Author : Pavel TELKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header$
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
extern "C"
{
- STEPEXPORT_EXPORT
- int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
+ STEPEXPORT_EXPORT int Export (const TopoDS_Shape& theShape,
+ const TCollection_AsciiString& theFileName,
+ const TCollection_AsciiString& /*theFormatName*/)
{
MESSAGE("Export STEP into file " << theFileName.ToCString());
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# $Header$
-#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files
# Author : Alexander SLADKOV
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
-# $Header:
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
- GroupPoints = new DlgRef_2Sel1SpinInt(centralWidget());
- GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
- GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
- GroupPoints->TextLabel3->setText(tr("GEOM_NB_TIMES"));
- GroupPoints->PushButton1->setIcon(image2);
- GroupPoints->PushButton2->setIcon(image2);
- GroupPoints->LineEdit1->setReadOnly(true);
- GroupPoints->LineEdit2->setReadOnly(true);
-
- GroupDimensions = new DlgRef_2Sel4Spin1Check(centralWidget());
- GroupDimensions->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
- GroupDimensions->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupDimensions->TextLabel2->setText(tr("GEOM_VECTOR"));
- GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
- GroupDimensions->TextLabel4->setText(tr("GEOM_NB_TIMES"));
- GroupDimensions->TextLabel5->setText(tr("GEOM_STEP"));
- GroupDimensions->TextLabel6->setText(tr("GEOM_NB_TIMES"));
- GroupDimensions->CheckButton1->setText(tr("GEOM_REVERSE"));
- GroupDimensions->PushButton1->setIcon(image2);
- GroupDimensions->PushButton2->setIcon(image2);
- GroupDimensions->LineEdit1->setReadOnly(true);
- GroupDimensions->LineEdit2->setReadOnly(true);
-
- QVBoxLayout* layout = new QVBoxLayout(centralWidget());
- layout->setMargin(0); layout->setSpacing(6);
- layout->addWidget(GroupPoints);
- layout->addWidget(GroupDimensions);
+ bool isAngleStep = false;
+
+ GroupArgs = new TransformationGUI_2Sel4Spin1Check (centralWidget());
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
+ GroupArgs->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
+ GroupArgs->TextLabel2->setText(tr("GEOM_VECTOR"));
+ //GroupArgs->TextLabel3->setText(tr("GEOM_ANGLE_STEP"));
+ GroupArgs->CheckAngleStep->setText(tr("GEOM_ANGLE_STEP"));
+ GroupArgs->CheckAngleStep->setChecked(isAngleStep);
+ GroupArgs->TextLabel4->setText(tr("GEOM_NB_TIMES"));
+ GroupArgs->TextLabel5->setText(tr("GEOM_STEP_R"));
+ GroupArgs->TextLabel6->setText(tr("GEOM_NB_TIMES"));
+ GroupArgs->CheckButton1->setText(tr("GEOM_REVERSE"));
+ GroupArgs->PushButton1->setIcon(image2);
+ GroupArgs->PushButton2->setIcon(image2);
+ GroupArgs->LineEdit1->setReadOnly(true);
+ GroupArgs->LineEdit2->setReadOnly(true);
+ GroupArgs->SpinBox_DX1->setEnabled(isAngleStep);
+ GroupArgs->CheckButton1->setEnabled(isAngleStep);
/***************************************************************/
setHelpFileName("multi_rotation_operation_page.html");
//=================================================================================
void TransformationGUI_MultiRotationDlg::Init()
{
+ // init variables
+ myAng = 45.0;
+ myStep = 50.0;
+ myNbTimes1 = myNbTimes2 = 3;
+
// Get setting of step value from file configuration
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
int SpecificStep1 = 5;
int SpecificStep2 = 1;
- // init variables
- myAng = 45.0;
- myStep = 50.0;
- myNbTimes1 = myNbTimes2 = 2;
// min, max, step and decimals for spin boxes & initial values
- initSpinBox(GroupPoints->SpinBox_DX, 1, 999, SpecificStep2);
- GroupPoints->SpinBox_DX->setValue(myNbTimes1);
-
- initSpinBox(GroupDimensions->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision" );
- initSpinBox(GroupDimensions->SpinBox_DY1, 1, 999, SpecificStep2);
- initSpinBox(GroupDimensions->SpinBox_DX2, COORD_MIN, COORD_MAX, step,"length_precision" );
- initSpinBox(GroupDimensions->SpinBox_DY2, 1, 999, SpecificStep2);
- GroupDimensions->SpinBox_DX1->setValue(myAng);
- GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
- GroupDimensions->SpinBox_DX2->setValue(myStep);
- GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
-
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
-
- GroupDimensions->LineEdit1->setText("");
- GroupDimensions->LineEdit2->setText("");
-
- myBase.nullify();
- myVector.nullify();
+ initSpinBox(GroupArgs->SpinBox_DX1, COORD_MIN, COORD_MAX, SpecificStep1, "angle_precision");
+ initSpinBox(GroupArgs->SpinBox_DY1, 1, 999, SpecificStep2);
+ initSpinBox(GroupArgs->SpinBox_DX2, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupArgs->SpinBox_DY2, 1, 999, SpecificStep2);
mainFrame()->GroupBoxPublish->show();
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupDimensions->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupDimensions->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupArgs->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupArgs->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
+ connect(GroupArgs->SpinBox_DX1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupArgs->SpinBox_DY1, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
+ connect(GroupArgs->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupArgs->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int)));
- connect(GroupDimensions->SpinBox_DX1,SIGNAL(textChanged( const QString& )),
- this, SLOT(TextValueChangedInSpinBox( const QString& )));
+ connect(GroupArgs->SpinBox_DX1, SIGNAL(textChanged(const QString&)),
+ this, SLOT(TextValueChangedInSpinBox(const QString&)));
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
- connect(GroupDimensions->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
+ connect(GroupArgs->CheckAngleStep, SIGNAL(toggled(bool)), this, SLOT(CheckAngleStep(bool)));
+ connect(GroupArgs->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseAngle()));
initName(tr("GEOM_MULTIROTATION"));
//=================================================================================
void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step)
{
- GroupDimensions->SpinBox_DX2->setSingleStep(step);
-
- // san: Commented so as not to override specific step settings
- //GroupPoints->SpinBox_DX->setSingleStep((int)step);
- //GroupDimensions->SpinBox_DX1->setSingleStep(step);
- //GroupDimensions->SpinBox_DY1->setSingleStep((int)step);
- //GroupDimensions->SpinBox_DY2->setSingleStep((int)step);
+ GroupArgs->SpinBox_DX2->setSingleStep(step);
}
//=================================================================================
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
- switch (constructorId) {
- case 0: // Rotate simple
- {
- GroupDimensions->hide();
- GroupPoints->show();
+ myBase.nullify();
+ myVector.nullify();
- GroupPoints->LineEdit1->setText("");
- GroupPoints->LineEdit2->setText("");
- myBase.nullify();
- myVector.nullify();
+ GroupArgs->LineEdit1->setText("");
+ GroupArgs->LineEdit2->setText("");
- GroupPoints->SpinBox_DX->setValue(myNbTimes1);
+ GroupArgs->SpinBox_DX1->setValue(myAng);
+ GroupArgs->SpinBox_DY1->setValue(myNbTimes1);
+ GroupArgs->SpinBox_DX2->setValue(myStep);
+ GroupArgs->SpinBox_DY2->setValue(myNbTimes2);
- GroupPoints->PushButton1->click();
+ switch (constructorId) {
+ case 0: // Rotate simple
+ {
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_SIMPLE"));
+ GroupArgs->TextLabel5->hide();
+ GroupArgs->TextLabel6->hide();
+ GroupArgs->SpinBox_DX2->hide();
+ GroupArgs->SpinBox_DY2->hide();
+ GroupArgs->CheckButton1->hide();
}
break;
case 1: // Rotate double
{
- GroupPoints->hide();
- GroupDimensions->show();
-
- GroupDimensions->LineEdit1->setText("");
- GroupDimensions->LineEdit2->setText("");
- myBase.nullify();
- myVector.nullify();
-
- GroupDimensions->SpinBox_DX1->setValue(myAng);
- GroupDimensions->SpinBox_DY1->setValue(myNbTimes1);
- GroupDimensions->SpinBox_DX2->setValue(myStep);
- GroupDimensions->SpinBox_DY2->setValue(myNbTimes2);
-
- GroupDimensions->PushButton1->click();
+ GroupArgs->GroupBox1->setTitle(tr("GEOM_MULTIROTATION_DOUBLE"));
+ GroupArgs->TextLabel5->show();
+ GroupArgs->TextLabel6->show();
+ GroupArgs->SpinBox_DX2->show();
+ GroupArgs->SpinBox_DY2->show();
+ GroupArgs->CheckButton1->show();
}
break;
}
+ GroupArgs->PushButton1->click();
+
qApp->processEvents();
updateGeometry();
resize(minimumSizeHint());
{
erasePreview();
- TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
- myEditCurrentArgument == GroupDimensions->LineEdit2 ) ?
+ TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupArgs->LineEdit2 ) ?
TopAbs_EDGE : TopAbs_SHAPE;
GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
TopoDS_Shape aShape;
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
QString aName = GEOMBase::GetName( aSelectedObject.get() );
myEditCurrentArgument->setText( aName );
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
- myBase = aSelectedObject;
- if ( !myVector )
- GroupPoints->PushButton2->click();
- }
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2) {
- myVector = aSelectedObject;
- if ( !myBase )
- GroupPoints->PushButton1->click();
- }
- else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
+ if ( myEditCurrentArgument == GroupArgs->LineEdit1 ) {
myBase = aSelectedObject;
+
+ // recompute myAng and myStep (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ // angular step
+ double diag = sqrt((Xmax-Xmin)*(Xmax-Xmin) + (Ymax-Ymin)*(Ymax-Ymin));
+ double d = sqrt((0.5*(Xmax+Xmin))*(0.5*(Xmax+Xmin)) + (0.5*(Ymax+Ymin))*(0.5*(Ymax+Ymin)));
+ myAng = floor(2.0 * atan(diag/d) * 180.0 / M_PI);
+ GroupArgs->SpinBox_DX1->setValue(myAng);
+
+ // radial step
+ myStep = Max(floor(1.5*(Xmax-Xmin)), floor(1.5*(Ymax-Ymin)));
+ GroupArgs->SpinBox_DX2->setValue(myStep);
+ }
+
if ( !myVector )
- GroupDimensions->PushButton2->click();
+ GroupArgs->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupDimensions->LineEdit2 ) {
+ else if ( myEditCurrentArgument == GroupArgs->LineEdit2 ) {
myVector = aSelectedObject;
if ( !myBase )
- GroupDimensions->PushButton1->click();
+ GroupArgs->PushButton1->click();
}
// clear selection
this, SLOT(SelectionIntoArgument()));
}
else {
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ||
- myEditCurrentArgument == GroupDimensions->LineEdit1 )
+ if ( myEditCurrentArgument == GroupArgs->LineEdit1 )
myBase.nullify();
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ||
- myEditCurrentArgument == GroupDimensions->LineEdit2 )
+ else if ( myEditCurrentArgument == GroupArgs->LineEdit2 )
myVector.nullify();
myEditCurrentArgument->setText("");
}
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection(GEOM_ALLSHAPES);
- if (send == GroupPoints->PushButton1) {
- myEditCurrentArgument = GroupPoints->LineEdit1;
-
- GroupPoints->PushButton2->setDown(false);
- GroupPoints->LineEdit2->setEnabled(false);
- }
- else if (send == GroupPoints->PushButton2) {
- myEditCurrentArgument = GroupPoints->LineEdit2;
-
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
-
- GroupPoints->PushButton1->setDown(false);
- GroupPoints->LineEdit1->setEnabled(false);
- }
- else if (send == GroupDimensions->PushButton1) {
- myEditCurrentArgument = GroupDimensions->LineEdit1;
+ if (send == GroupArgs->PushButton1) {
+ myEditCurrentArgument = GroupArgs->LineEdit1;
- GroupDimensions->PushButton2->setDown(false);
- GroupDimensions->LineEdit2->setEnabled(false);
+ GroupArgs->PushButton2->setDown(false);
+ GroupArgs->LineEdit2->setEnabled(false);
}
- else if (send == GroupDimensions->PushButton2) {
- myEditCurrentArgument = GroupDimensions->LineEdit2;
+ else if (send == GroupArgs->PushButton2) {
+ myEditCurrentArgument = GroupArgs->LineEdit2;
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
- GroupDimensions->PushButton1->setDown(false);
- GroupDimensions->LineEdit1->setEnabled(false);
+ GroupArgs->PushButton1->setDown(false);
+ GroupArgs->LineEdit1->setEnabled(false);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
// function : TextValueChangedInSpinBox()
// purpose :
//=================================================================================
-void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox(const QString& s){
+void TransformationGUI_MultiRotationDlg::TextValueChangedInSpinBox (const QString& s)
+{
bool isDigit;
s.toDouble(&isDigit);
- if(!isDigit)
- GroupDimensions->CheckButton1->setChecked(false);
- GroupDimensions->CheckButton1->setEnabled(isDigit);
+ if (!isDigit)
+ GroupArgs->CheckButton1->setChecked(false);
+ GroupArgs->CheckButton1->setEnabled(isDigit);
}
//=================================================================================
{
QObject* send = (QObject*)sender();
- if (send == GroupDimensions->SpinBox_DX1)
+ if (send == GroupArgs->SpinBox_DX1)
myAng = newValue;
- else if (send == GroupDimensions->SpinBox_DX2)
+ else if (send == GroupArgs->SpinBox_DX2)
myStep = newValue;
processPreview();
{
QObject* send = (QObject*)sender();
- if (send == GroupPoints->SpinBox_DX || send == GroupDimensions->SpinBox_DY1)
+ if (send == GroupArgs->SpinBox_DY1)
myNbTimes1 = newValue;
- else if (send == GroupDimensions->SpinBox_DY2)
+ else if (send == GroupArgs->SpinBox_DY2)
myNbTimes2 = newValue;
processPreview();
//=================================================================================
// function : ReverseAngle()
-// purpose : 'state' not used here
+// purpose :
//=================================================================================
void TransformationGUI_MultiRotationDlg::ReverseAngle()
{
int aConstructorId = getConstructorId();
if (aConstructorId == 1)
- GroupDimensions->SpinBox_DX1->setValue(myAng);
+ GroupArgs->SpinBox_DX1->setValue(myAng);
processPreview();
}
+//=================================================================================
+// function : CheckAngleStep()
+// purpose :
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::CheckAngleStep (bool isOn)
+{
+ GroupArgs->SpinBox_DX1->setEnabled(isOn);
+ GroupArgs->CheckButton1->setEnabled(isOn);
+ processPreview();
+}
+
//=================================================================================
// function : createOperation
// purpose :
bool TransformationGUI_MultiRotationDlg::isValid (QString& msg)
{
bool ok = false;
- switch(getConstructorId()){
+ switch (getConstructorId()) {
case 0:
- ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myBase && myVector;
+ ok = (GroupArgs->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
+ //myBase && myVector); // myVector = DZ by default
+ myBase);
break;
case 1:
- ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
- GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
- myBase && myVector;
+ ok = (GroupArgs->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
+ GroupArgs->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
+ //myBase && myVector); // myVector = DZ by default
+ myBase);
break;
default:
break;
switch (getConstructorId()) {
case 0:
- if ( myBase && myVector ) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ anObj = anOper->MultiRotate1DByStep(myBase.get(), myVector.get(), myAng * M_PI / 180., myNbTimes1);
+ else
anObj = anOper->MultiRotate1D(myBase.get(), myVector.get(), myNbTimes1);
- if(!IsPreview())
- aParameters<<GroupPoints->SpinBox_DX->text();
- res = true;
+
+ if (!IsPreview()) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ aParameters << GroupArgs->SpinBox_DX1->text();
+ aParameters << GroupArgs->SpinBox_DY1->text();
}
+ res = true;
break;
case 1:
- if ( myBase && myVector ) {
- anObj = anOper->MultiRotate2D(myBase.get(), myVector.get(), myAng, myNbTimes1, myStep, myNbTimes2);
- if(!IsPreview()) {
- aParameters<<GroupDimensions->SpinBox_DX1->text();
- aParameters<<GroupDimensions->SpinBox_DY1->text();
- aParameters<<GroupDimensions->SpinBox_DX2->text();
- aParameters<<GroupDimensions->SpinBox_DY2->text();
- }
- res = true;
+ if (GroupArgs->CheckAngleStep->isChecked())
+ anObj = anOper->MultiRotate2DByStep(myBase.get(), myVector.get(), myAng * M_PI / 180., myNbTimes1,
+ myStep, myNbTimes2);
+ else
+ anObj = anOper->MultiRotate2DNbTimes(myBase.get(), myVector.get(), myNbTimes1, myStep, myNbTimes2);
+
+ if (!IsPreview()) {
+ if (GroupArgs->CheckAngleStep->isChecked())
+ aParameters << GroupArgs->SpinBox_DX1->text();
+ aParameters << GroupArgs->SpinBox_DY1->text();
+ aParameters << GroupArgs->SpinBox_DX2->text();
+ aParameters << GroupArgs->SpinBox_DY2->text();
}
+ res = true;
break;
}
if (!anObj->_is_nil()) {
- if(!IsPreview())
+ if (!IsPreview())
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
mainFrame()->CheckBoxAddPrefix->isChecked());
}
}
+
+//=================================================================================
+// function : TransformationGUI_2Sel4Spin1Check
+// purpose :
+//=================================================================================
+TransformationGUI_2Sel4Spin1Check::TransformationGUI_2Sel4Spin1Check (QWidget *parent)
+{
+ gridLayout = new QGridLayout (parent);
+ gridLayout->setSpacing(6);
+ gridLayout->setContentsMargins(11, 11, 11, 11);
+ gridLayout->setHorizontalSpacing(0);
+ gridLayout->setVerticalSpacing(0);
+ gridLayout->setContentsMargins(0, 0, 0, 0);
+
+ GroupBox1 = new QGroupBox (parent);
+
+ gridLayout1 = new QGridLayout (GroupBox1);
+ gridLayout1->setSpacing(6);
+ gridLayout1->setContentsMargins(11, 11, 11, 11);
+ gridLayout1->setHorizontalSpacing(6);
+ gridLayout1->setVerticalSpacing(6);
+ gridLayout1->setContentsMargins(9, 9, 9, 9);
+
+ // 2Sel
+ TextLabel1 = new QLabel(GroupBox1);
+ TextLabel2 = new QLabel(GroupBox1);
+
+ PushButton1 = new QPushButton (GroupBox1);
+ PushButton2 = new QPushButton (GroupBox1);
+
+ LineEdit2 = new QLineEdit(GroupBox1);
+ LineEdit1 = new QLineEdit(GroupBox1);
+
+ gridLayout1->addWidget(TextLabel1, 0, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel2, 1, 0, 1, 1);
+ gridLayout1->addWidget(PushButton1, 0, 1, 1, 1);
+ gridLayout1->addWidget(PushButton2, 1, 1, 1, 1);
+ gridLayout1->addWidget(LineEdit1, 0, 2, 1, 1);
+ gridLayout1->addWidget(LineEdit2, 1, 2, 1, 1);
+
+ // 4Spin (double-int-double-int)
+ //TextLabel3 = new QLabel (GroupBox1);
+ CheckAngleStep = new QCheckBox (GroupBox1);
+ TextLabel4 = new QLabel (GroupBox1);
+ TextLabel5 = new QLabel (GroupBox1);
+ TextLabel6 = new QLabel (GroupBox1);
+
+ SpinBox_DX1 = new SalomeApp_DoubleSpinBox (GroupBox1);
+ SpinBox_DY1 = new SalomeApp_IntSpinBox (GroupBox1);
+ SpinBox_DX2 = new SalomeApp_DoubleSpinBox (GroupBox1);
+ SpinBox_DY2 = new SalomeApp_IntSpinBox (GroupBox1);
+
+ //gridLayout1->addWidget(TextLabel3, 2, 0, 1, 1);
+ gridLayout1->addWidget(CheckAngleStep, 2, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel4, 3, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel5, 5, 0, 1, 1);
+ gridLayout1->addWidget(TextLabel6, 6, 0, 1, 1);
+
+ gridLayout1->addWidget(SpinBox_DX1, 2, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DY1, 3, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DX2, 5, 1, 1, 2);
+ gridLayout1->addWidget(SpinBox_DY2, 6, 1, 1, 2);
+
+ // 1Check
+ CheckButton1 = new QCheckBox (GroupBox1);
+
+ gridLayout1->addWidget(CheckButton1, 4, 0, 1, 3);
+
+ gridLayout->addWidget(GroupBox1, 0, 0, 1, 1);
+}
+
+//=================================================================================
+// function : ~TransformationGUI_2Sel4Spin1Check()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+TransformationGUI_2Sel4Spin1Check::~TransformationGUI_2Sel4Spin1Check()
+{
+ // no need to delete child widgets, Qt does it all for us
+}
// 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 : TransformationGUI_MultiRotationDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#ifndef TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#define TRANSFORMATIONGUI_MULTIROTATIONDLG_H
#include "GEOMBase_Skeleton.h"
#include "GEOM_GenericObjPtr.h"
-class DlgRef_2Sel4Spin1Check;
-class DlgRef_2Sel1SpinInt;
+#include <SalomeApp_IntSpinBox.h>
+
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QCheckBox>
+
+//=================================================================================
+// class : TransformationGUI_2Sel4Spin1Check
+// purpose :
+//=================================================================================
+class TransformationGUI_2Sel4Spin1Check : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ TransformationGUI_2Sel4Spin1Check (QWidget *parent);
+ ~TransformationGUI_2Sel4Spin1Check();
+
+ public:
+ QGridLayout *gridLayout;
+ QGroupBox *GroupBox1;
+ QGridLayout *gridLayout1;
+
+ // 2Sel
+ QLabel *TextLabel1;
+ QLabel *TextLabel2;
+ QPushButton *PushButton1;
+ QPushButton *PushButton2;
+ QLineEdit *LineEdit1;
+ QLineEdit *LineEdit2;
+
+ // 4Spin (double-int-double-int)
+ QCheckBox *CheckAngleStep;
+ QLabel *TextLabel4;
+ QLabel *TextLabel5;
+ QLabel *TextLabel6;
+ SalomeApp_DoubleSpinBox *SpinBox_DX1;
+ SalomeApp_IntSpinBox *SpinBox_DY1;
+ SalomeApp_DoubleSpinBox *SpinBox_DX2;
+ SalomeApp_IntSpinBox *SpinBox_DY2;
+
+ // 1Check
+ QCheckBox *CheckButton1;
+};
//=================================================================================
// class : TransformationGUI_MultiRotationDlg
// purpose :
//=================================================================================
class TransformationGUI_MultiRotationDlg : public GEOMBase_Skeleton
-{
+{
Q_OBJECT
public:
- TransformationGUI_MultiRotationDlg( GeometryGUI*, QWidget* = 0,
- bool = false, Qt::WindowFlags = 0 );
+ TransformationGUI_MultiRotationDlg (GeometryGUI*, QWidget* = 0,
+ bool = false, Qt::WindowFlags = 0);
~TransformationGUI_MultiRotationDlg();
-
+
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
private:
void Init();
void enterEvent( QEvent* );
-
+
private:
GEOM::GeomObjPtr myBase, myVector;
int myNbTimes1;
// to initialize the first selection field with a selected object on the dialog creation
bool myInitial;
-
- DlgRef_2Sel1SpinInt* GroupPoints;
- DlgRef_2Sel4Spin1Check* GroupDimensions;
+
+ TransformationGUI_2Sel4Spin1Check* GroupArgs;
private slots:
void ClickOnOk();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void CheckAngleStep (bool);
void ReverseAngle();
void ValueChangedInSpinBox( double );
void ValueChangedInSpinBox( int );
GroupPoints = new DlgRef_2Sel2Spin1Check(centralWidget());
GroupPoints->GroupBox1->setTitle(tr("GEOM_MULTITRANSLATION_SIMPLE"));
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
- GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR_U"));
- GroupPoints->TextLabel3->setText(tr("GEOM_STEP_U"));
- GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES_U"));
- GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_U"));
+ GroupPoints->TextLabel2->setText(tr("GEOM_VECTOR"));
+ GroupPoints->TextLabel3->setText(tr("GEOM_STEP"));
+ GroupPoints->TextLabel4->setText(tr("GEOM_NB_TIMES"));
+ GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE_DIRECTION"));
GroupPoints->PushButton1->setIcon(image2);
GroupPoints->PushButton2->setIcon(image2);
GroupPoints->LineEdit1->setReadOnly(true);
int SpecificStep = 1;
// init variables
myStepU = myStepV = 50.0;
- myNbTimesU = myNbTimesV = 2;
+ myNbTimesU = myNbTimesV = 3;
// min, max, step and decimals for spin boxes & initial values
initSpinBox(GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
QString aName = GEOMBase::GetName( aSelectedObject.get() );
myEditCurrentArgument->setText( aName );
+
if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
myBase = aSelectedObject;
- if ( !myVectorU )
+
+ // recompute myStepU (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ myStepU = floor(1.5 * (Xmax - Xmin));
+ GroupPoints->SpinBox_DX->setValue(myStepU);
+ }
+
+ if (!myVectorU)
GroupPoints->PushButton2->click();
}
else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
}
else if ( myEditCurrentArgument == GroupDimensions->LineEdit1 ) {
myBase = aSelectedObject;
+
+ // recompute myStepU and myStepV (Mantis issue 0021718)
+ GEOM::GEOM_IMeasureOperations_var anOper = getGeomEngine()->GetIMeasureOperations(getStudyId());
+ double Xmin, Xmax, Ymin, Ymax, Zmin, Zmax;
+ anOper->GetBoundingBox(myBase.get(), Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
+ if (anOper->IsDone()) {
+ myStepU = floor(1.5 * (Xmax - Xmin));
+ myStepV = floor(1.5 * (Ymax - Ymin));
+ GroupDimensions->SpinBox_DX1->setValue(myStepU);
+ GroupDimensions->SpinBox_DX2->setValue(myStepV);
+ }
+
if ( !myVectorU )
GroupDimensions->PushButton2->click();
else if ( !myVectorV )
bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg)
{
bool ok = false;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- myBase && myVectorU;
+ myBase;
+ //myBase && myVectorU; // Mantis issue 0021718
break;
case 1:
ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) &&
GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) &&
- myBase && myVectorU && myVectorV;
+ myBase;
+ //myBase && myVectorU && myVectorV; // Mantis issue 0021718
break;
default:
break;
bool res = false;
GEOM::GEOM_Object_var anObj;
-
QStringList aParameters;
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
switch (getConstructorId()) {
case 0:
- if ( myBase && myVectorU ) {
- createPathPreview ( myVectorU.get() );
- anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU);
- if(!IsPreview()) {
- aParameters<<GroupPoints->SpinBox_DX->text();
- aParameters<<GroupPoints->SpinBox_DY->text();
- }
- res = true;
+ createPathPreview(myVectorU.get());
+ anObj = anOper->MultiTranslate1D(myBase.get(), myVectorU.get(), myStepU, myNbTimesU);
+ if (!IsPreview()) {
+ aParameters << GroupPoints->SpinBox_DX->text();
+ aParameters << GroupPoints->SpinBox_DY->text();
}
+ res = true;
break;
case 1:
- if ( myBase && myVectorU && myVectorV ) {
- createPathPreview ( myVectorU.get() );
- createPathPreview ( myVectorV.get() );
- anObj = anOper->MultiTranslate2D(myBase.get(),
- myVectorU.get(), myStepU, myNbTimesU,
- myVectorV.get(), myStepV, myNbTimesV);
- if(!IsPreview()) {
- aParameters<<GroupDimensions->SpinBox_DX1->text();
- aParameters<<GroupDimensions->SpinBox_DY1->text();
- aParameters<<GroupDimensions->SpinBox_DX2->text();
- aParameters<<GroupDimensions->SpinBox_DY2->text();
- }
- res = true;
+ createPathPreview(myVectorU.get());
+ createPathPreview(myVectorV.get());
+ anObj = anOper->MultiTranslate2D(myBase.get(),
+ myVectorU.get(), myStepU, myNbTimesU,
+ myVectorV.get(), myStepV, myNbTimesV);
+ if (!IsPreview()) {
+ aParameters << GroupDimensions->SpinBox_DX1->text();
+ aParameters << GroupDimensions->SpinBox_DY1->text();
+ aParameters << GroupDimensions->SpinBox_DX2->text();
+ aParameters << GroupDimensions->SpinBox_DY2->text();
}
+ res = true;
break;
}
if (!anObj->_is_nil()) {
- if(!IsPreview())
+ if (!IsPreview())
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
objects.push_back(anObj._retn());
}
void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Object_ptr thePath )
{
if ( IsPreview() ) {
+ if (thePath->_is_nil()) return;
TopoDS_Shape aShape;
GEOMBase::GetShape( thePath, aShape, TopAbs_SHAPE );
TopoDS_Edge anEdge = TopoDS::Edge( aShape );
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-# $Header$
-#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
# header files