CURRENT_DIR=`pwd`
CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
cd ${CONF_DIR}
-python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --geom
+python $KERNEL_ROOT_DIR/salome_adm/cmake_files/deprecated/am2cmake.py --geom
status=$?
cd ${CURRENT_DIR}
exit $status
@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
@REM
-%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --geom\r
+%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\deprecated\am2cmake.py --geom\r
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 ])
+sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,25, 10,20,100, 0,0,0 ])
# add object in the study
id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1")
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)
+sk.addPointRadiusAnglesRelative(45, 0, 100, "OXY")
# add three points with relative coordinates
# three segments will be added by this command
pyexamplesdir = $(docdir)/examples/GEOM
-BAD_TESTS =
+BAD_TESTS = \
+ repairing_operations_ex09.py
GOOD_TESTS = \
3dsketcher.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 \
EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py
-check-local:
+installcheck-local:
@for f in $(GOOD_TESTS) ; do \
- python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
+ env GEOM_ROOT_DIR=$(prefix) python -B $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \
done
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"
+try:
+ Angle = geompy.GetAngle(OX, arc)
+ pass
+except:
+ # It is a correct case, because GetAngle() must not be computed on curvilinear edges.
pass
+
+assert (not geompy.MeasuOp.IsDone() ), 'Angle must not be computed on curvilinear edges.'
import salome
# create a box
-box = geompy.MakeBoxDXDYDZ(200, 200, 200)
+check_box = geompy.MakeBoxDXDYDZ(200, 200, 200)
# build all possible propagation groups
listChains = geompy.Propagate(check_box)
import geompy
import salome
+import math
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])
+# get sub-shapes
+edges = geompy.SubShapeAll(WirePath, geompy.ShapeType["EDGE"])
+vertices = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"])
+
+
#=======================================================
# Create shell sections
#=======================================================
-ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4]
-theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4]
+ps = [vertices[0],vertices[1],vertices[2],vertices[3]]
+theLocations = [vertices[0],vertices[1],vertices[2],vertices[3]]
VC = geompy.MakeCompound(theLocations)
geompy.addToStudy(VC,"VC")
-vs = [Edge_1,Edge_1,Edge_3,Edge_3]
+vs = [edges[0],edges[0],edges[2],edges[2]]
hs = [20,40,30,20]
shells = []
subbases = []
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
f4 = geompy.MakeFace(w,1)
faces.append(f1)
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
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])
+contour = geompy.CloseContour(w, [], isCommonVertex=False)
+[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"])
+w = geompy.MakeWire([e1,e2,e3,e4])
f4 = geompy.MakeFace(w,1)
faces.append(f1)
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])
+for face in fs:
+ if ( 4 == geompy.NbShapes(face, geompy.ShapeType["VERTEX"]) ):
+ faces.append(face)
+ pass
+ pass
shell = geompy.MakeSewing(faces,1.e-6)
shells.append(shell)
faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"])
-
+subbases.append(faces[2])
#===========================================================
# Create Pipe
#===========================================================
-subbases = []
Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath,
theWithContact=0, theWithCorrection=0)
# display disks
gg.createAndDisplayGO(id_vxy)
gg.createAndDisplayGO(id_disk1)
-gg.createAndDisplayGO(id_diks2)
-gg.createAndDisplayGO(id_diks3)
+gg.createAndDisplayGO(id_disk2)
+gg.createAndDisplayGO(id_disk3)
import geompy
import salome
+import GEOM
gg = salome.ImportComponentGUI("GEOM")
# create a vertex and a vector
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])
+# get edges as sub-shapes
+edges = geompy.SubShapeAllSortedCentres(faces[2], geompy.ShapeType["EDGE"])
+edge = geompy.GetInPlace(cut_without_f_2, edges[0], True)
+e_2 = geompy.GetSubShapeID(cut_without_f_2, edge)
-# suppress the selected wire
-result = geompy.SuppressHoles(cut_without_f_2, [w_0])
+# suppress a hole using the selected edge
+result = geompy.SuppressHoles(cut_without_f_2, [e_2])
# add objects in the study
id_cut = geompy.addToStudy(cut, "Cut")
# Limit Tolerance
import geompy
+import salome
gg = salome.ImportComponentGUI("GEOM")
-# import initial topology
+# import initial topology with bad tolerances (more than 1e-07)
shape1 = geompy.ImportBREP("my_shape_1.brep")
shape2 = geompy.ImportBREP("my_shape_2.brep")
#!/usr/bin/env python
-import unittest, sys
+import unittest, sys, os
class SalomeSession(object):
def __init__(self, script):
sys.argv += ["--modules=GEOM"]
sys.argv += ["--execute=%s" % script]
clt, d = runSalome.main()
- self.port = d['port']
return
def __del__(self):
- port = self.port
+ port = os.getenv('NSPORT')
import killSalomeWithPort
killSalomeWithPort.killMyPort(port)
return
import salome
import geompy
+import GEOM
-texture = geompy.LoadTexture("/users/user/mytexture.dat")
+texture = geompy.LoadTexture(os.getenv("DATA_DIR")+"/Textures/texture1.dat")
v1 = geompy.MakeVertex(0, 0, 0)
v2 = geompy.MakeVertex(100, 0, 0)
EXCLUDE_PATTERNS = creating_adv_obj.doc
EXCLUDE =
IMAGE_PATH = @srcdir@/images
-EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG @top_srcdir@/doc/salome/examples
+EXAMPLE_PATH = @top_srcdir@/doc/salome/examples @top_srcdir@/src/GEOM_SWIG
#---------------------------------------------------------------------------
#HTML related options
#because it wrongly defines location of the html files for search.
ALLEXTERNALS = NO
SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+#Custom commands
+#---------------------------------------------------------------------------
+ALIASES += tui_script{1}="\include \1 <a href=\"../../examples/GEOM/\1\">Download this script</a>"
INPUT = @srcdir@/input
FILE_PATTERNS = tui_*.doc
IMAGE_PATH = @srcdir@/images
-EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG
+EXAMPLE_PATH = @top_srcdir@/doc/salome/examples @top_srcdir@/src/GEOM_SWIG
#---------------------------------------------------------------------------
#HTML related options
#---------------------------------------------------------------------------
GENERATE_TAGFILE = tui_examples.tag
SEARCHENGINE = YES
+
+#---------------------------------------------------------------------------
+#Custom commands
+#---------------------------------------------------------------------------
+ALIASES += tui_script{1}="\include \1 <a href=\"../../examples/GEOM/\1\">Download this script</a>"
/*!
\page tui_3dsketcher_page 3D Sketcher
-\include 3dsketcher.py
-<a href="../../examples/GEOM/3dsketcher.py">Download this script</a>
+\tui_script{3dsketcher.py}
*/
\anchor tui_creation_pipetshape
<br><h2>Creation of PipeTShape</h2>
-\include advanced_geom_objs_ex01.py
-<a href="../../examples/GEOM/advanced_geom_objs_ex01.py">Download this script</a>
+\tui_script{advanced_geom_objs_ex01.py}
\anchor tui_creation_divideddisk
<br><h2>Creation of DividedDisk</h2>
-\include advanced_geom_objs_ex02.py
-<a href="../../examples/GEOM/advanced_geom_objs_ex02.py">Download this script</a>
+\tui_script{advanced_geom_objs_ex02.py}
\anchor tui_creation_dividedcylinder
<br><h2>Creation of DividedCylinder</h2>
-\include advanced_geom_objs_ex03.py
-<a href="../../examples/GEOM/advanced_geom_objs_ex03.py">Download this script</a>
+\tui_script{advanced_geom_objs_ex03.py}
<!--@@ insert new functions before this line @@ do not remove this line @@-->
*/
/*!
\page tui_angle_page Angle
-\include angle.py
-<a href="../../examples/GEOM/angle.py">Download this script</a>
+\tui_script{angle.py}
*/
\anchor tui_creation_point
<br><h2>Creation of a Point</h2>
-\include basic_geom_objs_ex01.py
-<a href="../../examples/GEOM/basic_geom_objs_ex01.py">Download this script</a>
+\tui_script{basic_geom_objs_ex01.py}
\anchor tui_creation_line
<br><h2>Creation of a Line</h2>
-\include basic_geom_objs_ex02.py
-<a href="../../examples/GEOM/basic_geom_objs_ex02.py">Download this script</a>
+\tui_script{basic_geom_objs_ex02.py}
\anchor tui_creation_circle
<br><h2>Creation of a Circle</h2>
-\include basic_geom_objs_ex03.py
-<a href="../../examples/GEOM/basic_geom_objs_ex03.py">Download this script</a>
+\tui_script{basic_geom_objs_ex03.py}
\anchor tui_creation_ellipse
<br><h2>Creation of an Ellipse</h2>
-\include basic_geom_objs_ex04.py
-<a href="../../examples/GEOM/basic_geom_objs_ex04.py">Download this script</a>
+\tui_script{basic_geom_objs_ex04.py}
\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>
+\tui_script{basic_geom_objs_ex05.py}
\anchor tui_creation_curve
<br><h2>Creation of a Curve</h2>
-\include basic_geom_objs_ex06.py
-<a href="../../examples/GEOM/basic_geom_objs_ex06.py">Download this script</a>
+\tui_script{basic_geom_objs_ex06.py}
\anchor tui_creation_vector
<br><h2>Creation of a Vector</h2>
-\include basic_geom_objs_ex07.py
-<a href="../../examples/GEOM/basic_geom_objs_ex07.py">Download this script</a>
+\tui_script{basic_geom_objs_ex07.py}
\anchor tui_creation_plane
<br><h2>Creation of a Plane</h2>
-\include basic_geom_objs_ex08.py
-<a href="../../examples/GEOM/basic_geom_objs_ex08.py">Download this script</a>
+\tui_script{basic_geom_objs_ex08.py}
\anchor tui_creation_lcs
<br><h2>Creation of a Local Coordinate System</h2>
-\include basic_geom_objs_ex09.py
-<a href="../../examples/GEOM/basic_geom_objs_ex09.py">Download this script</a>
+\tui_script{basic_geom_objs_ex09.py}
*/
\anchor tui_partition
<br><h2>Partition</h2>
-\include basic_operations_ex01.py
-<a href="../../examples/GEOM/basic_operations_ex01.py">Download this script</a>
+\tui_script{basic_operations_ex01.py}
\anchor tui_archimede
<br><h2>Archimede</h2>
-\include basic_operations_ex02.py
-<a href="../../examples/GEOM/basic_operations_ex02.py">Download this script</a>
+\tui_script{basic_operations_ex02.py}
\anchor tui_restore_prs_params
<br><h2>Restore presentation parameters and sub-shapes</h2>
-\include basic_operations_ex03.py
-<a href="../../examples/GEOM/basic_operations_ex03.py">Download this script</a>
+\tui_script{basic_operations_ex03.py}
*/
/*!
\page tui_basic_properties_page Basic Properties
-\include basic_properties.py
-<a href="../../examples/GEOM/basic_properties.py">Download this script</a>
+\tui_script{basic_properties.py}
*/
\anchor tui_multi_transformation
<br><h2>Multi Transformation</h2>
-\include blocks_operations_ex01.py
-<a href="../../examples/GEOM/blocks_operations_ex01.py">Download this script</a>
+\tui_script{blocks_operations_ex01.py}
\anchor tui_explode_on_blocks
<br><h2>Explode on Blocks</h2>
-\include blocks_operations_ex02.py
-<a href="../../examples/GEOM/blocks_operations_ex02.py">Download this script</a>
+\tui_script{blocks_operations_ex02.py}
\anchor tui_propagate
<br><h2>Propagate</h2>
-\include blocks_operations_ex03.py
-<a href="../../examples/GEOM/blocks_operations_ex03.py">Download this script</a>
+\tui_script{blocks_operations_ex03.py}
*/
\anchor tui_fuse
<br><h2>Fuse</h2>
-\include boolean_operations_ex01.py
-<a href="../../examples/GEOM/boolean_operations_ex01.py">Download this script</a>
+\tui_script{boolean_operations_ex01.py}
\anchor tui_common
<br><h2>Common</h2>
-\include boolean_operations_ex02.py
-<a href="../../examples/GEOM/boolean_operations_ex02.py">Download this script</a>
+\tui_script{boolean_operations_ex02.py}
\anchor tui_cut
<br><h2>Cut</h2>
-\include boolean_operations_ex03.py
-<a href="../../examples/GEOM/boolean_operations_ex03.py">Download this script</a>
+\tui_script{boolean_operations_ex03.py}
\anchor tui_section
<br><h2>Section</h2>
-\include boolean_operations_ex04.py
-<a href="../../examples/GEOM/boolean_operations_ex04.py">Download this script</a>
+\tui_script{boolean_operations_ex04.py}
*/
/*!
\page tui_bounding_box_page Bounding Box
-\include bounding_box.py
-<a href="../../examples/GEOM/bounding_box.py">Download this script</a>
+\tui_script{bounding_box.py}
*/
\page tui_building_by_blocks_page Building by Blocks
<br><h2>Quadrangle Face</h2>
-\include building_by_blocks_ex01.py
-<a href="../../examples/GEOM/building_by_blocks_ex01.py">Download this script</a>
+\tui_script{building_by_blocks_ex01.py}
<br><h2>Hexagonal Solid</h2>
-\include building_by_blocks_ex02.py
-<a href="../../examples/GEOM/building_by_blocks_ex02.py">Download this script</a>
+\tui_script{building_by_blocks_ex02.py}
*/
/*!
\page tui_center_of_mass_page Center of masses
-\include center_of_mass.py
-<a href="../../examples/GEOM/center_of_mass.py">Download this script</a>
+\tui_script{center_of_mass.py}
*/
/*!
\page tui_check_compound_of_blocks_page Check Compound of Blocks
-\include check_compound_of_blocks.py
-<a href="../../examples/GEOM/check_compound_of_blocks.py">Download this script</a>
+\tui_script{check_compound_of_blocks.py}
*/
/*!
\page tui_check_self_intersections_page Detect Self-intersections
-\include check_self_intersections.py
-<a href="../../examples/GEOM/check_self_intersections.py">Download this script</a>
+\tui_script{check_self_intersections.py}
*/
/*!
\page tui_check_shape_page Check Shape
-\include check_shape.py
-<a href="../../examples/GEOM/check_shape.py">Download this script</a>
+\tui_script{check_shape.py}
*/
\anchor tui_creation_prism
<br><h2>Creation of a Prism</h2>
-\include complex_objs_ex01.py
-<a href="../../examples/GEOM/complex_objs_ex01.py">Download this script</a>
+\tui_script{complex_objs_ex01.py}
\anchor tui_creation_revolution
<br><h2>Creation of a Revolution</h2>
-\include complex_objs_ex02.py
-<a href="../../examples/GEOM/complex_objs_ex02.py">Download this script</a>
+\tui_script{complex_objs_ex02.py}
\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>
+\tui_script{complex_objs_ex03.py}
\anchor tui_creation_pipe
<br><h2>Creation of a Pipe</h2>
-\include complex_objs_ex04.py
-<a href="../../examples/GEOM/complex_objs_ex04.py">Download this script</a>
+\tui_script{complex_objs_ex04.py}
\anchor tui_creation_pipe_with_diff_sec
<br><h2>Creation of a PipeWithDifferentSections</h2>
-\include complex_objs_ex05.py
-<a href="../../examples/GEOM/complex_objs_ex05.py">Download this script</a>
+\tui_script{complex_objs_ex05.py}
\anchor tui_creation_pipe_with_shell_sec
<br><h2>Creation of a PipeWithShellSections</h2>
-\include complex_objs_ex06.py
-<a href="../../examples/GEOM/complex_objs_ex06.py">Download this script</a>
+\tui_script{complex_objs_ex06.py}
\anchor tui_creation_pipe_without_path
<br><h2>Creation of a PipeShellsWithoutPath</h2>
-\include complex_objs_ex07.py
-<a href="../../examples/GEOM/complex_objs_ex07.py">Download this script</a>
+\tui_script{complex_objs_ex07.py}
\anchor tui_creation_pipe_binormal_along_vector
<br><h2>Creation of a PipeBiNormalAlongVector</h2>
-\include complex_objs_ex08.py
-<a href="../../examples/GEOM/complex_objs_ex08.py">Download this script</a>
+\tui_script{complex_objs_ex08.py}
\anchor tui_creation_pipe_path
<br><h2>Creation of a Middle Path</h2>
-\include complex_objs_ex09.py
-<a href="../../examples/GEOM/complex_objs_ex09.py">Download this script</a>
+\tui_script{complex_objs_ex09.py}
+\anchor tui_creation_tangent_plane_on_face
<br><h2>Creation of Tangent Plane On Face</h2>
-\include complex_objs_ex10.py
-<a href="../../examples/GEOM/complex_objs_ex10.py">Download this script</a>
+\tui_script{complex_objs_ex10.py}
*/
/*!
\page tui_free_boundaries_page Check Free Boundaries
-\include free_boundaries.py
-<a href="../../examples/GEOM/free_boundaries.py">Download this script</a>
+\tui_script{free_boundaries.py}
*/
/*!
\page tui_free_faces_page Check Free Faces
-\include free_faces.py
-<a href="../../examples/GEOM/free_faces.py">Download this script</a>
+\tui_script{free_faces.py}
*/
/*!
\page tui_get_non_blocks_page Get Non Blocks
-\include get_non_blocks.py
-<a href="../../examples/GEOM/get_non_blocks.py">Download this script</a>
+\tui_script{get_non_blocks.py}
*/
/*!
\page tui_import_export_page Import/Export
-\include import_export.py
-<a href="../../examples/GEOM/import_export.py">Download this script</a>
+\tui_script{import_export.py}
*/
/*!
\page tui_inertia_page Inertia
-\include inertia.py
-<a href="../../examples/GEOM/inertia.py">Download this script</a>
+\tui_script{inertia.py}
*/
/*!
\page tui_min_distance_page Minimal Distance
-\include min_distance.py
-<a href="../../examples/GEOM/min_distance.py">Download this script</a>
+\tui_script{min_distance.py}
*/
/*!
\page tui_normal_face_page Normal to a Face
-\include normal_face.py
-<a href="../../examples/GEOM/normal_face.py">Download this script</a>
+\tui_script{normal_face.py}
*/
\page tui_notebook_geom_page Using SALOME NoteBook
\anchor tui_notebook_geom
-\include notebook_geom.py
-<a href="../../examples/GEOM/notebook_geom.py">Download this script</a>
+\tui_script{notebook_geom.py}
*/
/*!
\page tui_point_coordinates_page Point Coordinates
-\include point_coordinates.py
-<a href="../../examples/GEOM/point_coordinates.py">Download this script</a>
+\tui_script{point_coordinates.py}
*/
\anchor tui_creation_box
<br><h2>Creation of a Box</h2>
-\include primitives_ex01.py
-<a href="../../examples/GEOM/primitives_ex01.py">Download this script</a>
+\tui_script{primitives_ex01.py}
\anchor tui_creation_cylinder
<br><h2>Creation of a Cylinder</h2>
-\include primitives_ex02.py
-<a href="../../examples/GEOM/primitives_ex02.py">Download this script</a>
+\tui_script{primitives_ex02.py}
\anchor tui_creation_sphere
<br><h2>Creation of a Sphere</h2>
-\include primitives_ex03.py
-<a href="../../examples/GEOM/primitives_ex03.py">Download this script</a>
+\tui_script{primitives_ex03.py}
\anchor tui_creation_torus
<br><h2>Creation of a Torus</h2>
-\include primitives_ex04.py
-<a href="../../examples/GEOM/primitives_ex04.py">Download this script</a>
+\tui_script{primitives_ex04.py}
\anchor tui_creation_cone
<br><h2>Creation of a Cone</h2>
-\include primitives_ex05.py
-<a href="../../examples/GEOM/primitives_ex05.py">Download this script</a>
+\tui_script{primitives_ex05.py}
\anchor tui_creation_disk
<br><h2>Creation of a Disk</h2>
-\include primitives_ex06.py
-<a href="../../examples/GEOM/primitives_ex06.py">Download this script</a>
+\tui_script{primitives_ex06.py}
\anchor tui_creation_squareface
<br><h2>Creation of a Rectangle</h2>
-\include primitives_ex07.py
-<a href="../../examples/GEOM/primitives_ex07.py">Download this script</a>
+\tui_script{primitives_ex07.py}
*/
\anchor tui_shape_processing
<br><h2>Shape Processing</h2>
-\include repairing_operations_ex01.py
-<a href="../../examples/GEOM/repairing_operations_ex01.py">Download this script</a>
+\tui_script{repairing_operations_ex01.py}
\anchor tui_suppress_faces
<br><h2>Suppress Faces</h2>
-\include repairing_operations_ex02.py
-<a href="../../examples/GEOM/repairing_operations_ex02.py">Download this script</a>
+\tui_script{repairing_operations_ex02.py}
\anchor tui_close_contour
<br><h2>Close Contour</h2>
-\include repairing_operations_ex03.py
-<a href="../../examples/GEOM/repairing_operations_ex03.py">Download this script</a>
+\tui_script{repairing_operations_ex03.py}
\anchor tui_suppress_internal_wires
<br><h2>Suppress Internal Wires</h2>
-\include repairing_operations_ex04.py
-<a href="../../examples/GEOM/repairing_operations_ex04.py">Download this script</a>
+\tui_script{repairing_operations_ex04.py}
\anchor tui_suppress_holes
<br><h2>Suppress Holes</h2>
-\include repairing_operations_ex05.py
-<a href="../../examples/GEOM/repairing_operations_ex05.py">Download this script</a>
+\tui_script{repairing_operations_ex05.py}
\anchor tui_sewing
<br><h2>Sewing</h2>
-\include repairing_operations_ex06.py
-<a href="../../examples/GEOM/repairing_operations_ex06.py">Download this script</a>
+\tui_script{repairing_operations_ex06.py}
\anchor tui_glue_faces
<br><h2>Glue Faces</h2>
-\include repairing_operations_ex07.py
-<a href="../../examples/GEOM/repairing_operations_ex07.py">Download this script</a>
+\tui_script{repairing_operations_ex07.py}
\anchor tui_glue_edges
<br><h2>Glue Edges</h2>
-\include repairing_operations_ex08.py
-<a href="../../examples/GEOM/repairing_operations_ex08.py">Download this script</a>
+\tui_script{repairing_operations_ex08.py}
\anchor tui_limit_tolerance
<br><h2>Limit Tolerance</h2>
-\include repairing_operations_ex09.py
-<a href="../../examples/GEOM/repairing_operations_ex09.py">Download this script</a>
+\tui_script{repairing_operations_ex09.py}
\anchor tui_add_point_on_edge
<br><h2>Add Point on Edge</h2>
-\include repairing_operations_ex10.py
-<a href="../../examples/GEOM/repairing_operations_ex10.py">Download this script</a>
+\tui_script{repairing_operations_ex10.py}
\anchor tui_fuse_collinear_edges
<br><h2>Fuse Collinear Edges within a Wire</h2>
-\include repairing_operations_ex11.py
-<a href="../../examples/GEOM/repairing_operations_ex11.py">Download this script</a>
+\tui_script{repairing_operations_ex11.py}
*/
/*!
\page tui_sketcher_page 2D Sketcher
-\include sketcher.py
-<a href="../../examples/GEOM/sketcher.py">Download this script</a>
+\tui_script{sketcher.py}
*/
/*!
\page tui_tolerance_page Tolerance
-\include tolerance.py
-<a href="../../examples/GEOM/tolerance.py">Download this script</a>
+\tui_script{tolerance.py}
*/
\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>
+\tui_script{topological_geom_objs_ex01.py}
\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>
+\tui_script{topological_geom_objs_ex02.py}
\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>
+\tui_script{topological_geom_objs_ex03.py}
\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>
+\tui_script{topological_geom_objs_ex04.py}
\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>
+\tui_script{topological_geom_objs_ex05.py}
\anchor tui_creation_compound
<br><h2>Creation of a Compound</h2>
-\include topological_geom_objs_ex06.py
-<a href="../../examples/GEOM/topological_geom_objs_ex06.py">Download this script</a>
+\tui_script{topological_geom_objs_ex06.py}
*/
\anchor tui_translation
<br><h2>Translation</h2>
-\include transformation_operations_ex01.py
-<a href="../../examples/GEOM/transformation_operations_ex01.py">Download this script</a>
+\tui_script{transformation_operations_ex01.py}
\anchor tui_rotation
<br><h2>Rotation</h2>
-\include transformation_operations_ex02.py
-<a href="../../examples/GEOM/transformation_operations_ex02.py">Download this script</a>
+\tui_script{transformation_operations_ex02.py}
\anchor tui_modify_location
<br><h2>Modify Location</h2>
-\include transformation_operations_ex03.py
-<a href="../../examples/GEOM/transformation_operations_ex03.py">Download this script</a>
+\tui_script{transformation_operations_ex03.py}
\anchor tui_mirror
<br><h2>Mirror Image</h2>
-\include transformation_operations_ex04.py
-<a href="../../examples/GEOM/transformation_operations_ex04.py">Download this script</a>
+\tui_script{transformation_operations_ex04.py}
\anchor tui_scale
<br><h2>Scale Transform</h2>
-\include transformation_operations_ex05.py
-<a href="../../examples/GEOM/transformation_operations_ex05.py">Download this script</a>
+\tui_script{transformation_operations_ex05.py}
\anchor tui_offset
<br><h2>Offset Surface</h2>
-\include transformation_operations_ex06.py
-<a href="../../examples/GEOM/transformation_operations_ex06.py">Download this script</a>
+\tui_script{transformation_operations_ex06.py}
\anchor tui_projection
<br><h2>Projection</h2>
-\include transformation_operations_ex07.py
-<a href="../../examples/GEOM/transformation_operations_ex07.py">Download this script</a>
+\tui_script{transformation_operations_ex07.py}
\anchor tui_multi_translation
<br><h2>Multi Translation</h2>
-\include transformation_operations_ex08.py
-<a href="../../examples/GEOM/transformation_operations_ex08.py">Download this script</a>
+\tui_script{transformation_operations_ex08.py}
\anchor tui_multi_rotation
<br><h2>Multi Rotation</h2>
-\include transformation_operations_ex09.py
-<a href="../../examples/GEOM/transformation_operations_ex09.py">Download this script</a>
+\tui_script{transformation_operations_ex09.py}
\anchor tui_fillet2d
<br><h2>Fillet 2D</h2>
-\include transformation_operations_ex10.py
-<a href="../../examples/GEOM/transformation_operations_ex10.py">Download this script</a>
+\tui_script{transformation_operations_ex10.py}
\anchor tui_fillet1d
<br><h2>Fillet 1D</h2>
-\include transformation_operations_ex11.py
-<a href="../../examples/GEOM/transformation_operations_ex11.py">Download this script</a>
+\tui_script{transformation_operations_ex11.py}
\anchor tui_fillet
<br><h2>Fillet</h2>
-\include transformation_operations_ex12.py
-<a href="../../examples/GEOM/transformation_operations_ex12.py">Download this script</a>
+\tui_script{transformation_operations_ex12.py}
\anchor tui_chamfer
<br><h2>Chamfer</h2>
-\include transformation_operations_ex13.py
-<a href="../../examples/GEOM/transformation_operations_ex13.py">Download this script</a>
+\tui_script{transformation_operations_ex13.py}
*/
\anchor tui_change_disp_mode
<br><h2>Changing Display Mode</h2>
-\include viewing_geom_objs_ex01.py
-<a href="../../examples/GEOM/viewing_geom_objs_ex01.py">Download this script</a>
+\tui_script{viewing_geom_objs_ex01.py}
\anchor tui_change_color
<br><h2> Changing Color</h2>
-\include viewing_geom_objs_ex02.py
-<a href="../../examples/GEOM/viewing_geom_objs_ex02.py">Download this script</a>
+\tui_script{viewing_geom_objs_ex02.py}
\anchor tui_change_transparency
<br><h2>Changing Transparency</h2>
-\include viewing_geom_objs_ex03.py
-<a href="../../examples/GEOM/viewing_geom_objs_ex03.py">Download this script</a>
+\tui_script{viewing_geom_objs_ex03.py}
\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>
+\tui_script{viewing_geom_objs_ex04.py}
*/
/*!
\page tui_whatis_page What Is
-\include whatis.py
-<a href="../../examples/GEOM/whatis.py">Download this script</a>
+\tui_script{whatis.py}
*/
<br>
\anchor tui_create_groups_anchor
<h2>Creation of a group</h2>
-\include working_with_groups_ex01.py
-<a href="../../examples/GEOM/working_with_groups_ex01.py">Download this script</a>
+\tui_script{working_with_groups_ex01.py}
\anchor tui_edit_groups_anchor
<br><h2>Adding an object to the group</h2>
-\include working_with_groups_ex02.py
-<a href="../../examples/GEOM/working_with_groups_ex02.py">Download this script</a>
+\tui_script{working_with_groups_ex02.py}
<br><h2>Removing an object from the group</h2>
-\include working_with_groups_ex03.py
-<a href="../../examples/GEOM/working_with_groups_ex03.py">Download this script</a>
+\tui_script{working_with_groups_ex03.py}
<br>
\anchor tui_union_groups_anchor
<h2>Union Groups</h2>
-\include working_with_groups_ex04.py
-<a href="../../examples/GEOM/working_with_groups_ex04.py">Download this script</a>
+\tui_script{working_with_groups_ex04.py}
<br>
\anchor tui_intersect_groups_anchor
<h2>Intersect Groups</h2>
-\include working_with_groups_ex05.py
-<a href="../../examples/GEOM/working_with_groups_ex05.py">Download this script</a>
+\tui_script{working_with_groups_ex05.py}
<br>
\anchor tui_cut_groups_anchor
<h2>Cut Groups</h2>
-\include working_with_groups_ex06.py
-<a href="../../examples/GEOM/working_with_groups_ex06.py">Download this script</a>
+\tui_script{working_with_groups_ex06.py}
*/
in GEOM_Object thePath,
in GEOM_Object theVec);
+
+ /*!
+ * \brief Make a thick solid from a surface shape (face or shell)
+ * \param theObject Surface from which the thick solid is made
+ * \param theThickness Value of the thickness
+ * \return New GEOM_Object, containing the created pipe if isCopy = true
+ * or the modified object if isCopy = false
+ */
+ GEOM_Object MakeThickening (in GEOM_Object theObject,
+ in double theThickness,
+ in boolean isCopy);
+
+
/*!
* \brief Build a middle path of a pipe-like shape.
*
SUIT_ViewManager* vman = vw->getViewManager();
if ( vman->getType() == OCCViewer_Viewer::Type() ||
vman->getType() == SVTK_Viewer::Type() ) {
- GEOM_Displayer( appStudy ).EraseAll();
+ GEOM_Displayer( appStudy ).EraseAll(true);
}
}
}
{
SUIT_OverrideCursor();
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return;
+
if ( !viewWindow )
- viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
- if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
- SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView();
- aView->SetDisplayMode( mode );
- GeometryGUI::Modified();
- }
- else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
- OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-
- AIS_DisplayMode newmode;
- switch (mode) {
- case 0:
- newmode = AIS_WireFrame;
- break;
- case 1:
- newmode = AIS_Shaded;
- break;
- case 2:
- newmode = AIS_DisplayMode( GEOM_AISShape::ShadingWithEdges );
- break;
- case 3:
- newmode = AIS_DisplayMode( GEOM_AISShape::TexturedShape );
- break;
- default:
- break;
- }
+ viewWindow = app->desktop()->activeWindow();
- AIS_ListOfInteractive List;
- ic->DisplayedObjects( List );
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector( List1 );
- List.Append( List1 );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- while( ite.More() ) {
- if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
- if(aSh->isTopLevel()) {
- aSh->setPrevDisplayMode(Standard_Integer( newmode ));
- }
- else {
- ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true );
- }
- }
- ite.Next();
- }
-
- ic->SetDisplayMode( newmode, Standard_False );
+ SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !aStudy ) return;
+
+ GEOM_Displayer displayer( aStudy );
- GeometryGUI::Modified();
+ int mgrId = viewWindow->getViewManager()->getGlobalId();
+
+ SALOME_ListIO anIOlst;
+ displayer.GetActiveView()->GetVisible( anIOlst );
+
+ for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
+ displayer.Redisplay( io, false );
}
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
//=====================================================================================
{
SUIT_OverrideCursor();
+ SalomeApp_Application* app = getGeometryGUI()->getApp();
+ if ( !app ) return;
+
+ SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !aStudy ) return;
+
if ( !viewWindow )
- viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow();
- if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
- viewWindow->setProperty( "VectorsMode", mode );
- SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( viewWindow );
- vtkActorCollection* allActors = vw->getRenderer()->GetActors();
- allActors->InitTraversal();
- while (vtkActor* actor = allActors->GetNextActor()) {
- if (actor->GetVisibility()) { // only for visible actors
- GEOM_Actor* aGeomActor = 0;
- if ( actor->IsA( "GEOM_Actor" ) ) {
- aGeomActor = GEOM_Actor::SafeDownCast( actor );
- if ( aGeomActor )
- aGeomActor->SetVectorMode( mode );
- }
- }
- }
- GeometryGUI::Modified();
- }
- else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
- viewWindow->setProperty( "VectorsMode", mode );
- OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
- AIS_ListOfInteractive List;
- ic->DisplayedObjects( List );
- AIS_ListOfInteractive List1;
- ic->ObjectsInCollector( List1 );
- List.Append( List1 );
-
- AIS_ListIteratorOfListOfInteractive ite( List );
- while( ite.More() ) {
- if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) {
- Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() );
- aSh->SetDisplayVectors(mode);
- ic->RecomputePrsOnly(ite.Value());
- }
- ite.Next();
- }
- GeometryGUI::Modified();
+ viewWindow = app->desktop()->activeWindow();
+
+ GEOM_Displayer displayer( aStudy );
+
+ viewWindow->setProperty( "VectorsMode", mode );
+
+ int aMgrId = viewWindow->getViewManager()->getGlobalId();
+
+ SALOME_ListIO anIOlst;
+ displayer.GetActiveView()->GetVisible( anIOlst );
+
+ for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), mode );
+ displayer.Redisplay( io, false );
}
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
//=====================================================================================
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if ( !aSelMgr ) return;
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-
- if(!aStudy)
- return;
+ SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !aStudy ) return;
SUIT_OverrideCursor();
- SALOME_ListIO aList;
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
- if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
- SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>( viewWindow );
- SVTK_View* aView = vw->getView();
- int mgrId = viewWindow->getViewManager()->getGlobalId();
- bool vectorMode = false;
-
- aSelMgr->selectedObjects( aList );
- SALOME_ListIteratorOfListIO It( aList );
-
- for( ;It.More(); It.Next() ) {
- SVTK_Viewer* stvkViewer = dynamic_cast<SVTK_Viewer*>(vw->getViewManager()->getViewModel());
- SVTK_Prs* vtkPrs =
- stvkViewer ? dynamic_cast<SVTK_Prs*>( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0;
- if ( vtkPrs && !vtkPrs->IsNull() ) {
- if (mode == 0 )
- aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() );
- else if ( mode == 1 )
- aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() );
- else if ( mode == 2 )
- aView->ChangeRepresentationToSurfaceWithEdges( vtkPrs->GetObjects() );
- else if ( mode == 4 ) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- while (vtkActor* anAct = anActors->GetNextActor()) {
- GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct);
- vectorMode = !aGeomActor->GetVectorMode();
- aGeomActor->SetVectorMode(vectorMode);
- }
- }
- if(mode == 0 || mode == 1 || mode == 2) {
- aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
- }
- else if (mode == 4) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
- }
- }
+ GEOM_Displayer displayer( aStudy );
+
+ int mgrId = viewWindow->getViewManager()->getGlobalId();
+
+ QVariant v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), QVariant() );
+ bool vectorMode = v.isValid() ? !v.toBool() : false;
+
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ if ( mode == 0 || mode == 1 || mode == 2 || mode == 3 ) {
+ aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode );
}
- aView->Repaint();
- GeometryGUI::Modified();
- }
- else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
- OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
- Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-
- aSelMgr->selectedObjects( aList );
- SALOME_ListIteratorOfListIO It( aList );
- int mgrId = viewWindow->getViewManager()->getGlobalId();
- bool vectorMode = 0;
-
- for( ;It.More(); It.Next() ) {
- SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel());
- SOCC_Prs* occPrs = dynamic_cast<SOCC_Prs*>( soccViewer->CreatePrs( It.Value()->getEntry() ) );
- 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() ) {
- if(!aSh->isTopLevel()) {
- if ( mode == 0 )
- ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false );
- else if ( mode == 1 )
- ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false );
- else if ( mode == 2 )
- ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false );
- else if ( mode == 3 )
- ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false );
- } else {
- aSh->setPrevDisplayMode(mode);
- }
- if (mode == 4 ) {
- vectorMode = !aSh->isShowVectors();
- aSh->SetDisplayVectors(vectorMode);
- ic->RecomputePrsOnly(interIter.Value());
- }
- }
- }
- if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
- }
- else if (mode == 4) {
- aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
- }
- }
+ else if ( mode == 4 ) {
+ aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), vectorMode );
}
- ic->UpdateCurrentViewer();
- GeometryGUI::Modified();
+ displayer.Redisplay( io, false );
}
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
//=====================================================================================
#include "DlgRef.h"
+//////////////////////////////////////////
+// DlgRef_1Check1Spin1Check
+//////////////////////////////////////////
+
+DlgRef_1Check1Spin1Check::DlgRef_1Check1Spin1Check( QWidget* parent, Qt::WindowFlags f )
+: QWidget( parent, f )
+{
+ setupUi( this );
+}
+
+DlgRef_1Check1Spin1Check::~DlgRef_1Check1Spin1Check()
+{
+}
+
//////////////////////////////////////////
// DlgRef_1List1Spin1Btn
//////////////////////////////////////////
# define DLGREF_EXPORT
#endif
+//////////////////////////////////////////
+// DlgRef_1Check1Spin1Check
+//////////////////////////////////////////
+
+#include "ui_DlgRef_1Check1Spin1Check_QTD.h"
+
+class DLGREF_EXPORT DlgRef_1Check1Spin1Check : public QWidget,
+ public Ui::DlgRef_1Check1Spin1Check_QTD
+{
+ Q_OBJECT
+
+public:
+ DlgRef_1Check1Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 );
+ ~DlgRef_1Check1Spin1Check();
+};
+
+
//////////////////////////////////////////
// DlgRef_1List1Spin1Btn
//////////////////////////////////////////
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DlgRef_1Check1Spin1Check_QTD</class>
+ <widget class="QWidget" name="DlgRef_1Check1Spin1Check_QTD">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>165</width>
+ <height>94</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string/>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="GroupBox1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="spacing">
+ <number>6</number>
+ </property>
+ <item row="0" column="0" colspan="2">
+ <widget class="QCheckBox" name="checkButton1">
+ <property name="text">
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QCheckBox" name="checkButton2">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="TextLabel1">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="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="1">
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
+ </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>SpinBox_DX</tabstop>
+ <tabstop>checkButton2</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
DlgRef_moc.cxx
UIC_FILES = \
+ ui_DlgRef_1Check1Spin1Check_QTD.h \
ui_DlgRef_1List1Spin1Btn_QTD.h \
ui_DlgRef_1Sel1Check1List_QTD.h \
ui_DlgRef_1Sel1Check1Sel_QTD.h \
//=======================================================================
GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR )
{
- GEOM::GEOM_Object_var geomObj;
- if ( !IOR.isEmpty() ) {
- CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object( IOR.toLatin1().constData() );
- if ( !CORBA::is_nil( corbaObj ) )
- geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
- }
- return geomObj._retn();
+ return GeometryGUI::GetObjectFromIOR (IOR);
}
//=======================================================================
//=======================================================================
QString GEOMBase::GetIORFromObject( GEOM::GEOM_Object_ptr object )
{
- QString IOR;
- if ( !CORBA::is_nil( object ) ) {
- CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( object );
- IOR = anIOR.in();
- }
- return IOR;
+ return GeometryGUI::GetIORFromObject (object);
}
//=======================================================================
//================================================================
void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
{
- if ( CORBA::is_nil( theObj ) )
- return;
-
- CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
- TCollection_AsciiString asciiIOR( (char *)IOR.in() );
- GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
-
- if ( !getStudy() || !getStudy()->studyDS() )
- return;
-
- _PTR(Study) aStudy = getStudy()->studyDS();
- _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) );
- if ( !aSObj )
- return;
-
- _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
- for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
- _PTR(GenericAttribute) anAttr;
- if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
- _PTR(AttributeIOR) anIOR ( anAttr );
- TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
- GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
- }
- }
+ GeometryGUI::ClearShapeBuffer(theObj);
}
//================================================================
</message>
<message>
<source>GEOM_MINDIST_NO_SOL</source>
- <translation>No solution found</translation>
+ <translation type="unfinished">No solution found</translation>
</message>
<message>
<source>GEOM_MINDIST_OBJ</source>
<translation>Objects And Results</translation>
</message>
+ <message>
+ <source>GEOM_MINDIST_PUBLISH_TITLE</source>
+ <translation type="unfinished">Multiple solutions found</translation>
+ </message>
+ <message>
+ <source>GEOM_MINDIST_PUBLISH_TEXT</source>
+ <translation type="unfinished">Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published.</translation>
+ </message>
<message>
<source>GEOM_MINDIST_TITLE</source>
<translation>Minimun Distance Between Two Objects</translation>
<source>GEOM_MIN</source>
<translation>Min :</translation>
</message>
+ <message>
+ <source>GEOM_MINDIST_NAME</source>
+ <translation type="unfinished">MinDist</translation>
+ </message>
+ <message>
+ <source>GEOM_MINDIST_NO_SOL</source>
+ <translation type="unfinished">No solution found</translation>
+ </message>
<message>
<source>GEOM_MINDIST_OBJ</source>
<translation>Objets et résultats</translation>
</message>
+ <message>
+ <source>GEOM_MINDIST_PUBLISH_TITLE</source>
+ <translation type="unfinished">Multiple solutions found</translation>
+ </message>
+ <message>
+ <source>GEOM_MINDIST_PUBLISH_TEXT</source>
+ <translation type="unfinished">Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published.</translation>
+ </message>
<message>
<source>GEOM_MINDIST_TITLE</source>
<translation>Distance minimale entre deux objets</translation>
return action(id);
}
+/*!
+ \brief GEOM module message handler
+
+ This method can be re-implemented in the subclasses.
+ This is a GEOM module message handler.
+
+ \param msg the message received.
+*/
+void GeometryGUI::message(const QString& msg)
+{
+ // dispatch message
+ QStringList data = msg.split("/");
+ const int nbStrings = data.count();
+
+ if (nbStrings > 0) {
+ if (data[0] == "modified") {
+ // get mesh entry
+ QString anIOR = nbStrings > 1 ? data[1] : QString();
+
+ if ( anIOR.isEmpty() ) {
+ return;
+ }
+
+ // Get the geom object.
+ GEOM::GEOM_Object_ptr anObj = GeometryGUI::GetObjectFromIOR (anIOR);
+
+ // Clear the shape buffer
+ GeometryGUI::ClearShapeBuffer (anObj);
+ }
+ }
+}
+
+/*!
+ \brief Clears the shape buffer.
+
+ This is a static method. It clears the shape buffer.
+
+ \param theObj the object
+*/
+void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj )
+{
+ if ( CORBA::is_nil( theObj ) )
+ return;
+
+ CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj );
+ TCollection_AsciiString asciiIOR( (char *)IOR.in() );
+ GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
+
+ SALOMEDSClient_StudyManager *aManager = SalomeApp_Application::studyMgr();
+
+ if (!aManager)
+ return;
+
+ _PTR(Study) aStudy = aManager->GetStudyByID(theObj->GetStudyID());
+
+ if ( !aStudy )
+ return;
+
+ _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) );
+ if ( !aSObj )
+ return;
+
+ _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
+ for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
+ _PTR(GenericAttribute) anAttr;
+ if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
+ GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR );
+ }
+ }
+}
+
+/*!
+ \brief Returns the object from IOR.
+
+ This is a static method. It returns the object from its IOR.
+
+ \param IOR object IOR
+ \return GEOM object.
+*/
+GEOM::GEOM_Object_ptr GeometryGUI::GetObjectFromIOR( const QString& IOR )
+{
+ GEOM::GEOM_Object_var geomObj;
+ if ( !IOR.isEmpty() ) {
+ CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object
+ ( IOR.toLatin1().constData() );
+ if ( !CORBA::is_nil( corbaObj ) )
+ geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
+ }
+ return geomObj._retn();
+}
+
+/*!
+ \brief Returns IOR of the object.
+
+ This is a static method. It returns the object's IOR.
+
+ \param object the GEOM object.
+ \return object's IOR.
+*/
+QString GeometryGUI::GetIORFromObject( GEOM::GEOM_Object_ptr object )
+{
+ QString IOR;
+ if ( !CORBA::is_nil( object ) ) {
+ CORBA::String_var anIOR =
+ SalomeApp_Application::orb()->object_to_string( object );
+ IOR = anIOR.in();
+ }
+ return IOR;
+}
+
/*!
\brief Check if this object is can't be renamed in place
QAction* getAction(const int id);
+ virtual void message( const QString& msg);
+ static void ClearShapeBuffer( GEOM::GEOM_Object_ptr );
+ static GEOM::GEOM_Object_ptr
+ GetObjectFromIOR( const QString& IOR );
+
+ static QString GetIORFromObject( GEOM::GEOM_Object_ptr object );
+
+
public slots:
virtual bool deactivateModule( SUIT_Study* );
virtual bool activateModule( SUIT_Study* );
#include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMImpl_FillingDriver.hxx>
#include <GEOMImpl_ThruSectionsDriver.hxx>
+#include <GEOMImpl_OffsetDriver.hxx>
#include <GEOMImpl_IBox.hxx>
#include <GEOMImpl_IFace.hxx>
#include <GEOMImpl_IPipeDiffSect.hxx>
#include <GEOMImpl_IPipeShellSect.hxx>
#include <GEOMImpl_IPipeBiNormal.hxx>
+#include <GEOMImpl_IOffset.hxx>
#include <GEOMImpl_IPipePath.hxx>
#include <Precision.hxx>
//Make a Python command
GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution("
<< theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)";
-
+
SetErrorCode(OK);
return aRevolution;
}
return aPipe;
}
+//=============================================================================
+/*!
+ * MakeThickening
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening(Handle(GEOM_Object) theObject,
+ double theOffset,
+ bool copy = true)
+{
+ SetErrorCode(KO);
+
+ if (theObject.IsNull()) return NULL;
+
+ Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
+ if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
+
+ //Add a new Offset function
+ Handle(GEOM_Function) aFunction;
+ Handle(GEOM_Object) aCopy;
+ if (copy)
+ {
+ //Add a new Copy object
+ aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ aFunction = aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING_COPY);
+ }
+ else
+ aFunction = theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
+
+ GEOMImpl_IOffset aTI (aFunction);
+ aTI.SetShape(anOriginal);
+ aTI.SetValue(theOffset);
+
+ //Compute the offset
+ try {
+#if OCC_VERSION_LARGE > 0x06010000
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Offset driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ if(copy)
+ {
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeThickSolid("
+ << theObject << ", " << theOffset << ")";
+ SetErrorCode(OK);
+ return aCopy;
+ }
+ else
+ {
+ GEOM::TPythonDump(aFunction) << "geompy.Thicken("
+ << theObject << ", " << theOffset << ")";
+ SetErrorCode(OK);
+ return theObject;
+ }
+}
+
//=============================================================================
/*!
* RestorePath
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theVec,
- double theH, double theScaleFactor = -1.0);
+ double theH,
+ double theScaleFactor = -1.0);
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) theVec, double theH);
Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePath,
Handle(GEOM_Object) theVec);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeThickening (Handle(GEOM_Object) theObject,
+ double theOffset,
+ bool isCopy);
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) theBase1,
{
SetErrorCode(KO);
+ if ( theShapeType != TopAbs_VERTEX && theShapeType != TopAbs_EDGE &&
+ theShapeType != TopAbs_FACE && theShapeType != TopAbs_SOLID ) {
+ SetErrorCode( "Error: You could create group only next type: vertex, edge, face or solid" );
+ return NULL;
+ }
+
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, -1);
SetErrorCode(KO);
if(theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetLastFunction();
if(aFunction.IsNull()) return;
TopTools_IndexedMapOfShape aMapOfShapes;
TopExp::MapShapes(aMainShape, aMapOfShapes);
+ TopAbs_ShapeEnum aGroupType = GetType(theGroup);
+ TopAbs_ShapeEnum aShapeType = aMapOfShapes.FindKey(theSubShapeID).ShapeType();
+ if ( aGroupType != aShapeType ) {
+ SetErrorCode( "Error: You could perform this operation only with object the same type as the type of group." );
+ return;
+ }
+
if (theSubShapeID < 1 || aMapOfShapes.Extent() < theSubShapeID) {
SetErrorCode("Invalid sub-shape index: out of range");
return;
SetErrorCode(KO);
if(theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetLastFunction();
if(aFunction.IsNull()) return;
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
//SetErrorCode("The list is empty");
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
//SetErrorCode("The list is empty");
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
//SetErrorCode("The list is empty");
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return;
+ }
+
Standard_Integer aLen = theSubShapes->Length();
if (aLen < 1) {
//SetErrorCode("The list is empty");
SetErrorCode(KO);
if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+ if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
+
// Get group type
TopAbs_ShapeEnum aType1 = GetType(theGroup1);
TopAbs_ShapeEnum aType2 = GetType(theGroup2);
SetErrorCode(KO);
if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+ if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
+
// Get group type
TopAbs_ShapeEnum aType1 = GetType(theGroup1);
TopAbs_ShapeEnum aType2 = GetType(theGroup2);
SetErrorCode(KO);
if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL;
+ if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
+
// Get group type
TopAbs_ShapeEnum aType1 = GetType(theGroup1);
TopAbs_ShapeEnum aType2 = GetType(theGroup2);
// Iterate on the initial groups
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
-
+ if ( aGr_i->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
// Get group type
aType_i = GetType(aGr_i);
if (i == 1)
// Iterate on the initial groups
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i));
-
+ if ( aGr_i->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
// Get group type
aType_i = GetType(aGr_i);
if (i == 1)
// 1. Collect indices to be excluded (from theGList2) into the mapIDs
for (i = 1; i <= aLen2; i++) {
Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList2->Value(i));
-
+ if ( aGr_i->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
// Get group type
aType_i = GetType(aGr_i);
if (i == 1)
// 2. Collect indices from theGList1, avoiding indices from theGList2 (mapIDs)
for (i = 1; i <= aLen1; i++) {
Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList1->Value(i));
-
+ if ( aGr_i->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
// Get group type
aType_i = GetType(aGr_i);
if (i == 1 && aLen2 < 1)
SetErrorCode(KO);
if(theGroup.IsNull()) return NULL;
-
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
Handle(GEOM_Function) aGroupFunction = theGroup->GetFunction(1);
if (aGroupFunction.IsNull()) return NULL;
SetErrorCode(KO);
if(theGroup.IsNull()) return NULL;
-
+ if ( theGroup->GetType() != GEOM_GROUP ) {
+ SetErrorCode( "Error: You could perform this operation only with group. Please select a group." );
+ return NULL;
+ }
Handle(GEOM_Function) aFunction = theGroup->GetLastFunction();
if(aFunction.IsNull()) return NULL;
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
-
- if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) {
- Handle(GEOM_Function) aRefShape = aCI.GetShape();
- TopoDS_Shape aShapeBase = aRefShape->GetValue();
- Standard_Real anOffset = aCI.GetValue();
- Standard_Real aTol = Precision::Confusion();
-
- if (Abs(anOffset) < aTol) {
+
+ Handle(GEOM_Function) aRefShape = aCI.GetShape();
+ TopoDS_Shape aShapeBase = aRefShape->GetValue();
+ Standard_Real anOffset = aCI.GetValue();
+ Standard_Real aTol = Precision::Confusion();
+
+ if (Abs(anOffset) < aTol) {
TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value (");
aMsg += TCollection_AsciiString(aTol);
aMsg += ")";
StdFail_NotDone::Raise(aMsg.ToCString());
- }
+ }
+ if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) {
BRepOffsetAPI_MakeOffsetShape MO (aShapeBase,
aCI.GetValue(),
aTol);
else {
StdFail_NotDone::Raise("Offset construction failed");
}
- } else {
+ }
+ else if (aType == OFFSET_THICKENING || aType == OFFSET_THICKENING_COPY)
+ {
+ BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin,
+ Standard_False, Standard_False, GeomAbs_Intersection, Standard_True);
+
+ if (!myOffsetShape.IsDone())
+ {
+ StdFail_NotDone::Raise("Thickening construction failed");
+ }
+ aShape = myOffsetShape.Shape();
}
if (aShape.IsNull()) return 0;
#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
Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result");
}
- // 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();
- for (; anExpV.More(); anExpV.Next()) {
- TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current());
- Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
- if (aTol > aVertMaxTol)
- aVertMaxTol = aTol;
- }
- aVertMaxTol += Precision::Confusion();
- aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
- //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
+ if (aType != PIPE_BASE_PATH &&
+ aType != PIPE_SHELLS_WITHOUT_PATH) {
+ TopExp_Explorer anExpV (aShape, TopAbs_VERTEX);
+ if (anExpV.More()) {
+ Standard_Real aVertMaxTol = -RealLast();
+ for (; anExpV.More(); anExpV.Next()) {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current());
+ Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+ if (aTol > aVertMaxTol)
+ aVertMaxTol = aTol;
+ }
+ aVertMaxTol += Precision::Confusion();
+ aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True);
+ //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True);
+ }
}
-#endif
TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape);
aFunction->SetValue(aRes);
#define GEOM_PIPE_PATH 48
+#define GEOM_THICKENING 49
+
//GEOM_Function types
#define COPY_WITH_REF 1
#define OFFSET_SHAPE 1
#define OFFSET_SHAPE_COPY 2
+#define OFFSET_THICKENING 3
+#define OFFSET_THICKENING_COPY 4
#define PROJECTION_COPY 1
enum ActionType { SHOWDLG, INCR, DECR };
- static void SetColor( const QString&, const QColor&, bool );
-
private:
// Import and export topology methods
bool Import();
_PTR(Study),
QList<SALOME_View*>,
GEOM_Displayer* );
-
- static void setVtkColor( SalomeApp_Study* study,
- int mgrId,
- SVTK_View* view,
- const Handle_SALOME_InteractiveObject& IO,
- const QColor& color );
-
- static void setOccColor( SalomeApp_Study* study,
- int mgrId,
- const Handle_AIS_InteractiveContext& ic,
- const Handle_SALOME_InteractiveObject& IO,
- const QColor& color );
};
#endif // GEOMTOOLSGUI_H
void GEOMToolsGUI::OnAutoColor()
{
- SALOME_ListIO selected;
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication());
- if (!app)
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if (!aSelMgr || !appStudy)
- return;
+ if ( !aSelMgr ) return;
- aSelMgr->selectedObjects(selected);
- if (selected.IsEmpty())
- return;
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry()));
GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject));
- if (CORBA::is_nil(aMainObject))
- return;
+ if (CORBA::is_nil(aMainObject)) return;
aMainObject->SetAutoColor( true );
QList<SALOMEDS::Color> aReservedColors;
- GEOM_Displayer aDisp (appStudy);
+ GEOM_Displayer displayer ( appStudy );
- SALOME_View* vf = aDisp.GetActiveView();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
for( _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); it->More(); it->Next() )
{
aReservedColors.append( aColor );
#endif // SIMPLE_AUTOCOLOR
aChildObject->SetColor( aColor );
-
+
QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) );
- SALOME_Prs* aPrs = vf->CreatePrs( aChildSObject->GetID().c_str() );
-
- if ( isVTK )
- {
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW )
- return;
- SVTK_View* aView = vtkVW->getView();
- SUIT_OverrideCursor();
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() )
- aView->SetColor( It.Value(), c );
- }
- else if ( isOCC )
- {
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
- Handle(AIS_InteractiveContext) ic = vm->getAISContext();
-
- SOCC_Prs* anOCCPrs = dynamic_cast<SOCC_Prs*>( aPrs );
- if( !anOCCPrs )
- continue;
-
- AIS_ListOfInteractive aList;
- anOCCPrs->GetObjects( aList );
- if( !aList.Extent() )
- continue;
-
- Handle(AIS_InteractiveObject) io = aList.First();
- if( io.IsNull() )
- continue;
-
- Quantity_Color aQuanColor( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
-
- // Set color for a point
- Handle(AIS_Drawer) aCurDrawer = io->Attributes();
- Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
- Quantity_Color aCurColor;
- Standard_Real aCurScale;
- Aspect_TypeOfMarker aCurTypeOfMarker;
- aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
- if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
- aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) );
- }
- else {
- Standard_Integer aWidth, aHeight;
- aCurPointAspect->GetTextureSize( aWidth, aHeight );
-
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture();
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
-#endif
-
- aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aQuanColor, 1, aWidth, aHeight, aTexture ) );
- }
- ic->SetLocalAttributes( io, aCurDrawer );
-
- io->SetColor( aQuanColor );
- if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
- Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
- aGAISShape->SetShadingColor( aQuanColor );
- aGAISShape->storeBoundaryColors();
- }
-
- io->Redisplay( Standard_True );
- }
+ SUIT_OverrideCursor();
+
+ appStudy->setObjectProperty( aMgrId, aChildObject->GetEntry(), GEOM::propertyName( GEOM::Color ), c );
+ Handle( SALOME_InteractiveObject ) io = new SALOME_InteractiveObject( aChildObject->GetEntry(), "GEOM", "" );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
+ displayer.UpdateViewer();
+ // update actions
+ appStudy->Modified();
app->updateActions(); //SRN: To update a Save button in the toolbar
}
aMainObject->SetAutoColor( false );
}
-void GEOMToolsGUI::SetColor( const QString& entry, const QColor& color, bool updateViewer )
+void GEOMToolsGUI::OnColor()
{
- if ( entry.isEmpty() || !color.isValid() ) return;
-
// get active application
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return;
// get current study
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
if ( !appStudy ) return;
+ // get selection manager
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
+
+ // get selection
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
+
+ GEOM_Displayer displayer( appStudy );
+
// get active view
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
+ SALOME_View* window = displayer.GetActiveView();
if ( !window ) return;
-
- bool isOCC = window->getViewManager()->getType() == OCCViewer_Viewer::Type();
- bool isVTK = window->getViewManager()->getType() == SVTK_Viewer::Type();
// get view id
- int mgrId = window->getViewManager()->getGlobalId();
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
- Handle(SALOME_InteractiveObject) IO =
- new SALOME_InteractiveObject( entry.toLatin1().data(), "GEOM", "");
+ QColor color;
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
- if ( isVTK ) {
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW ) return;
- SVTK_View* aView = vtkVW->getView();
+ // show Choose Color dialog box
+ color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
+ if ( !color.isValid() ) return;
- GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, IO, color );
- if ( updateViewer ) aView->Repaint();
- }
- else if ( isOCC ) {
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
- Handle (AIS_InteractiveContext) ic = vm->getAISContext();
- GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, IO, color );
- if ( updateViewer ) ic->UpdateCurrentViewer();
+ // iterate through list of objects and assign new color
+ SUIT_OverrideCursor();
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Color ), color );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
-
- // mark study as modified
+ displayer.UpdateViewer();
GeometryGUI::Modified();
-
+
// update actions
app->updateActions(); //SRN: To update a Save button in the toolbar
}
-void GEOMToolsGUI::OnColor()
+void GEOMToolsGUI::OnTexture()
{
- // get active application
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if ( !app ) return;
- // get current study
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
if ( !appStudy ) return;
- // get selection manager
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
if ( !aSelMgr ) return;
- // get selection
- SALOME_ListIO selected;
+ SALOME_ListIO selected;
aSelMgr->selectedObjects( selected );
if ( selected.IsEmpty() ) return;
-
- // get active view
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
- // get view id
- int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
-
- if ( isVTK ) {
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW ) return;
-
- // 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(), GEOM::propertyName( GEOM::Color ), color );
+ GEOM_Displayer displayer( appStudy );
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- // show Choose Color dialog box
- color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
- if ( !color.isValid() ) return;
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
- // iterate through list of objects and assign new color
- SUIT_OverrideCursor();
+ QString aTexture = QFileDialog::getOpenFileName( dynamic_cast< SUIT_ViewWindow* >( window ),tr("GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES"));
+ if( !aTexture.isEmpty() ) {
+ displayer.SetTexture( aTexture.toStdString() );
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, It.Value(), color );
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), 3 );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
- aView->Repaint();
}
- else if ( isOCC ) {
- // find AIS interactive object (for first item in selection)
- Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() );
- if ( io.IsNull() ) return;
-
- // get initial color (use first object from selection)
- Quantity_Color aColor;
- io->Color( aColor );
- 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(), GEOM::propertyName( GEOM::Color ), color );
-
- // show Choose Color dialog box
- color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
- if ( !color.isValid() ) return;
-
- // iterate through list of objects and assign new color
- SUIT_OverrideCursor();
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
- Handle (AIS_InteractiveContext) ic = vm->getAISContext();
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, It.Value(), color );
- }
- ic->UpdateCurrentViewer();
- }
-
- // mark study as modified
+ displayer.UpdateViewer();
GeometryGUI::Modified();
-
- // update actions
- app->updateActions(); //SRN: To update a Save button in the toolbar
-}
-
-
-void GEOMToolsGUI::setVtkColor( SalomeApp_Study* study, // study
- int mgrId, // view window id
- SVTK_View* view, // VTK view
- const Handle(SALOME_InteractiveObject)& IO, // interactive object
- const QColor& color ) // color
-{
- // get material property
- QString matProp;
- 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(), GEOM::propertyName( GEOM::Color ), color );
- }
-
- // store color to GEOM_Object
- _PTR(Study) aStudy = study->studyDS();
- _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) );
- if ( !aSObject ) return;
-
- GEOM::GEOM_Object_var anObject =
- GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
-
- if ( CORBA::is_nil( anObject ) ) return;
-
- SALOMEDS::Color aSColor;
- aSColor.R = (double)color.red() / 255.0;
- aSColor.G = (double)color.green() / 255.0;
- aSColor.B = (double)color.blue() / 255.0;
- anObject->SetColor( aSColor );
- anObject->SetAutoColor( false );
-}
-
-void GEOMToolsGUI::setOccColor( SalomeApp_Study* study, // study
- int mgrId, // view window id
- const Handle(AIS_InteractiveContext)& ic, // OCC interactive context
- const Handle(SALOME_InteractiveObject)& IO, // interactive object
- const QColor& color ) // color
-{
- // get AIS object
- Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( IO, true );
- if ( io.IsNull() ) return;
-
- // get material property
- QString matProp;
- matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
- Material_Model material;
- material.fromProperties( matProp );
-
- Quantity_Color aColor = Quantity_Color( color.red() / 255., color.green() / 255., color.blue() / 255., Quantity_TOC_RGB );
-
- // change color only for shapes with not physical type of material
- if ( !material.isPhysical() ) {
- if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) {
- TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape();
- bool onlyVertex = (theShape.ShapeType() == TopAbs_VERTEX || GEOM_Displayer::isCompoundOfVertices( theShape ));
- if ( onlyVertex ) {
- // set color for a point
- Handle(AIS_Drawer) aCurDrawer = io->Attributes();
- Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
- Quantity_Color aCurColor;
- Standard_Real aCurScale;
- Aspect_TypeOfMarker aCurTypeOfMarker;
- aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale );
- if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) {
- aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale ) );
- }
- else {
- Standard_Integer aWidth, aHeight;
- aCurPointAspect->GetTextureSize( aWidth, aHeight );
-#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
- Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture();
-#else
- Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
-#endif
- aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) );
- }
- ic->SetLocalAttributes( io, aCurDrawer, Standard_False );
- }
- }
-
- io->SetColor( aColor );
- if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) {
- Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io );
- aGAISShape->SetShadingColor( aColor );
- aGAISShape->storeBoundaryColors();
- }
-
- io->Redisplay( Standard_True );
-
- study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
- }
-
- // store color to GEOM_Object
- _PTR(Study) aStudy = study->studyDS();
- _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) );
- GEOM::GEOM_Object_var anObject =
- GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
- SALOMEDS::Color aSColor;
- aSColor.R = (double)color.red() / 255.0;
- aSColor.G = (double)color.green() / 255.0;
- aSColor.B = (double)color.blue() / 255.0;
- anObject->SetColor( aSColor );
- anObject->SetAutoColor( false );
-}
-
-void GEOMToolsGUI::OnTexture()
-{
- SALOME_ListIO selected;
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
- if ( app && appStudy ) {
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if ( aSelMgr ) {
- aSelMgr->selectedObjects( selected );
- if ( !selected.IsEmpty() ) {
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- if ( isOCC ) {
- QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES"));
- if( !aTexture.isEmpty() )
- {
- SUIT_OverrideCursor();
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
- Handle (AIS_InteractiveContext) ic = vm->getAISContext();
- Handle(AIS_InteractiveObject) io ;
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- io = GEOMBase::GetAIS( It.Value(), true );
- if ( !io.IsNull() ) {
- if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
- Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str()));
- io->Redisplay( Standard_True );
- } // if ( !io.IsNull() )
- } // for
- ic->UpdateCurrentViewer();
- GeometryGUI::Modified();
- GeometryGUI* myGeomGUI = getGeometryGUI();
- myGeomGUI->OnGUIEvent(GEOMOp::OpTexture);
- } // if ( !selFile.isEmpty() )
- } // if ( isOCC )
- } // if ( selection not empty )
- }
- }
+ // update actions
app->updateActions(); //SRN: To update a Save button in the toolbar
}
void GEOMToolsGUI::OnChangeTransparency( bool increase )
{
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- if ( !app )
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if( !appStudy) return;
+
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if ( !aSelMgr )
- return;
+ if ( !aSelMgr ) return;
+
SALOME_ListIO selected;
aSelMgr->selectedObjects( selected );
- if ( selected.IsEmpty() )
- return;
+ if ( selected.IsEmpty() ) return;
- Handle(SALOME_InteractiveObject) FirstIOS = selected.First();
- if ( FirstIOS.IsNull() )
- return;
+ GEOM_Displayer displayer( appStudy );
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
// Delta
float delta = 0.1; // VSR: 23/11/2010 (transparency value <= 0.05 is ignored)
if ( !increase )
delta *= -1;
-
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
-
- if ( isVTK ) {
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW )
- return;
- SVTK_View* aView = vtkVW->getView();
-
- float transp = aView->GetTransparency(FirstIOS);
-
- // Compute new transparency value
- transp = transp + delta;
- if ( transp < 0 )
- transp = 0;
- else if ( transp > 1 )
- transp = 1;
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- aView->SetTransparency( It.Value(), transp );
- }
- aView->Repaint();
- GeometryGUI::Modified();
- } // if ( isVTK )
-
- else if ( isOCC ) {
- GEOMBase* gb = new GEOMBase();
- Handle(GEOM_AISShape) aisShape;
-
- aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, true );
- if( aisShape.IsNull() )
- return;
- float transp = aisShape->Transparency();
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Transparency ), QVariant() );
+ float transp = v.isValid() ? v.toFloat() : 1;
- // Compute new transparency value
- transp = transp + delta;
- if ( transp < 0 )
- transp = 0;
- else if ( transp > 1 )
- transp = 1;
+ // Compute new transparency value
+ transp = transp + delta;
+ if ( transp < 0 )
+ transp = 0;
+ else if ( transp > 1 )
+ transp = 1;
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
- if ( !vm )
- return;
- Handle(AIS_InteractiveContext) ic = vm->getAISContext();
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
- if ( !aisShape.IsNull() ) {
- ic->SetTransparency( aisShape, transp, false );
- ic->Redisplay( aisShape, Standard_False, Standard_True );
- }
- } // for...
- ic->UpdateCurrentViewer();
- GeometryGUI::Modified();
- } // if ( isOCC )
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId ,io->getEntry(), GEOM::propertyName( GEOM::Transparency ), transp );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnNbIsos( ActionType actionType )
{
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
-
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
-
- if(isOCC){ // if is OCCViewer
-
- 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() ) {
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
- CurObject->restoreIsoNumbers();
- Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
- int UIso = CurDrawer->UIsoAspect()->Number();
- int VIso = CurDrawer->VIsoAspect()->Number();
-
- int newNbUIso = -1;
- int newNbVIso = -1;
-
- if ( actionType == SHOWDLG ) {
- GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
- new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
-
- NbIsosDlg->setU( UIso );
- NbIsosDlg->setV( VIso );
-
- if ( NbIsosDlg->exec() ) {
- SUIT_OverrideCursor();
-
- newNbUIso = NbIsosDlg->getU();
- newNbVIso = NbIsosDlg->getV();
- } else //Cancel case
- return;
- }
- else if ( actionType == INCR || actionType == DECR ) {
- int delta = 1;
- if (actionType == DECR)
- delta = -1;
-
- newNbUIso = UIso + delta;
- newNbVIso = VIso + delta;
-
- if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
- return;
- }
-
- for(; ic->MoreCurrent(); ic->NextCurrent()) {
- CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
-
- Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
- QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ) , QVariant() );
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
- int width = v.isValid() ? v.toInt() : 1;
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
- CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) );
- CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbVIso) );
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
- CurObject->storeIsoNumbers();
-
- ic->SetLocalAttributes(CurObject, CurDrawer);
- ic->Redisplay(CurObject);
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
- 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();
+ GEOM_Displayer displayer( appStudy );
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
+
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::NbIsos ) , QVariant() );
+ QString aStr = v.toString();
+ QStringList aStrList = aStr.split( GEOM::subSectionSeparator() );
+ int UIso = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "iso_number_u", 1 );
+ int VIso = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "iso_number_v", 1 );
+ if ( aStrList.count() == 2 ) {
+ if ( !aStrList[0].isEmpty() ) UIso = aStrList[0].toInt();
+ if ( !aStrList[1].isEmpty() ) VIso = aStrList[1].toInt();
}
- else if(isVTK){ // if is VTKViewer
- //
- // Warning. It's works incorrect. must be recheked.
- //
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >
- ( SUIT_Session::session()->activeApplication() );
- if ( !app )
- return;
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if ( !aSelMgr )
- return;
- SALOME_ListIO selected;
- aSelMgr->selectedObjects( selected );
- if ( selected.IsEmpty() )
- return;
-
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW )
- return;
- int aMgrId = window->getViewManager()->getGlobalId();
+ int newNbUIso = -1;
+ int newNbVIso = -1;
- SALOME_View* view = GEOM_Displayer::GetActiveView();
+ if ( actionType == SHOWDLG ) {
+ GEOMToolsGUI_NbIsosDlg * NbIsosDlg =
+ new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
- vtkActorCollection* aCollection = vtkActorCollection::New();
+ NbIsosDlg->setU( UIso );
+ NbIsosDlg->setV( VIso );
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) anIObject = It.Value();
- SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() );
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aPrs );
- if ( vtkPrs ) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- vtkActor* anAct = anActors->GetNextActor();
- aCollection->AddItem(anAct);
- }
- }
-
- if(aCollection)
- aCollection->InitTraversal();
- else
+ if ( NbIsosDlg->exec() ) {
+ SUIT_OverrideCursor();
+ newNbUIso = NbIsosDlg->getU();
+ newNbVIso = NbIsosDlg->getV();
+ } else //Cancel case
return;
+ }
+ else if ( actionType == INCR || actionType == DECR ) {
+ int delta = 1;
+ if (actionType == DECR)
+ delta = -1;
- int UIso = 0;
- int VIso = 0;
+ newNbUIso = UIso + delta;
+ newNbVIso = VIso + delta;
- vtkActor* anAct = aCollection->GetNextActor();
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
- anActor->RestoreIsoNumbers();
- anActor->GetNbIsos(UIso,VIso);
- }
- else
+ if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
return;
-
- int newNbUIso = -1;
- int newNbVIso = -1;
-
- if ( actionType == SHOWDLG ) {
- GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
- new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
-
- NbIsosDlg->setU( UIso );
- NbIsosDlg->setV( VIso );
-
- if ( NbIsosDlg->exec() ) {
- SUIT_OverrideCursor();
+ }
- newNbUIso = NbIsosDlg->getU();
- newNbVIso = NbIsosDlg->getV();
- } else
- return; //Cancel case
- }
- else if ( actionType == INCR || actionType == DECR ) {
- int delta = 1;
- if (actionType == DECR)
- delta = -1;
-
- newNbUIso = UIso + delta;
- newNbVIso = VIso + delta;
-
- if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 )
- return;
- }
-
- while( anAct!=NULL ) {
- if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){
- // There are no casting to needed actor.
- int aIsos[2]={newNbUIso,newNbVIso};
- anActor->SetNbIsos(aIsos);
- anActor->StoreIsoNumbers();
-
- 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();
- }
- view->Repaint();
- GeometryGUI::Modified();
- } // end vtkviewer
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ QString anIsos = QString( "%1%2%3" ).arg( newNbUIso ).arg( GEOM::subSectionSeparator() ).arg( newNbVIso );
+ appStudy->setObjectProperty( aMgrId ,io->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnDeflection()
{
- SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-
-
- bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
- bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
-
- if (isOCC) { // if is OCCViewer
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
- Handle (AIS_InteractiveContext) ic = vm->getAISContext();
-
- ic->InitCurrent();
- if (ic->MoreCurrent()) {
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
-
- Standard_Real aDC, aPrevDC;
- Standard_Boolean isOwnDC = CurObject->OwnDeviationCoefficient(aDC, aPrevDC);
- if (!isOwnDC)
- aDC = ic->DeviationCoefficient();
-
- GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
- (SUIT_Session::session()->activeApplication()->desktop());
- DeflectionDlg->setTheDC(aDC);
- double aNewDC = 0.0;
- bool ok = false;
- while (!ok) {
- if (DeflectionDlg->exec()) {
- SUIT_OverrideCursor();
- aNewDC = DeflectionDlg->getTheDC();
- ok = (1e-07 <= aNewDC && aNewDC <= 1.0); // spinbox can return zero
- if (ok) {
- for (; ic->MoreCurrent(); ic->NextCurrent()) {
- CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
- ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
- ic->Redisplay(CurObject);
- appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aNewDC);
- }
- }
- }
- else {
- ok = true;
- }
- }
- }
- GeometryGUI::Modified();
- }
- else if (isVTK) { // if is VTKViewer
- SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- if (!app)
- return;
-
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if (!aSelMgr)
- return;
-
- SALOME_ListIO selected;
- aSelMgr->selectedObjects(selected);
- if (selected.IsEmpty())
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>(window);
- if (!vtkVW)
- return;
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
- SALOME_View* view = GEOM_Displayer::GetActiveView();
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
- vtkActorCollection* aCollection = vtkActorCollection::New();
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
- for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) {
- Handle(SALOME_InteractiveObject) anIObject = It.Value();
- SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry());
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>(aPrs);
- if (vtkPrs) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- vtkActor* anAct = anActors->GetNextActor();
- aCollection->AddItem(anAct);
- }
- }
+ GEOM_Displayer displayer( appStudy );
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- if (aCollection)
- aCollection->InitTraversal();
- else
- return;
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
- double aDC = 0.;
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Deflection ), QVariant() );
+ double aDC = v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coef", 0.001 );
- vtkActor* anAct = aCollection->GetNextActor();
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
- aDC = anActor->GetDeflection();
- else
- return;
+ GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
+ ( SUIT_Session::session()->activeApplication()->desktop() );
+ DeflectionDlg->setTheDC( aDC );
+ if ( DeflectionDlg->exec() ) {
+ SUIT_OverrideCursor();
+ aDC = DeflectionDlg->getTheDC();
- GEOMToolsGUI_DeflectionDlg* DeflectionDlg = new GEOMToolsGUI_DeflectionDlg
- (SUIT_Session::session()->activeApplication()->desktop());
- DeflectionDlg->setTheDC(aDC);
- if (DeflectionDlg->exec()) {
- SUIT_OverrideCursor();
- aDC = DeflectionDlg->getTheDC();
- while (anAct != NULL) {
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
- // There are no casting to needed actor.
- anActor->SetDeflection(aDC);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC);
- }
- anAct = aCollection->GetNextActor();
- }
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
- GeometryGUI::Modified();
- } // end vtkviewer
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnSelectOnly(int mode)
void GEOMToolsGUI::OnEdgeWidth()
{
- SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-
-
- bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
- bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
- int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
-
- if (isOCC) { // if is OCCViewer
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
- Handle (AIS_InteractiveContext) ic = vm->getAISContext();
- SALOME_View* view = GEOM_Displayer::GetActiveView();
- ic->InitCurrent();
- if (ic->MoreCurrent()) {
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
-
- int aWidth = (int)CurObject->Width();
-
- GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg
- (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT");
- Dlg->setTheLW(aWidth);
- int aNewWidth = 0;
- if (Dlg->exec()) {
- aNewWidth = Dlg->getTheLW();
- bool ok = (aNewWidth != aWidth && aNewWidth != 0 );
- if (ok) {
- for(; ic->MoreCurrent(); ic->NextCurrent()) {
- CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
- SOCC_Prs* aPrs = dynamic_cast<SOCC_Prs*>(view->CreatePrs(CurObject->getIO()->getEntry()));
- AIS_ListOfInteractive anAISObjects;
- aPrs->GetObjects( anAISObjects );
- AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
- for ( ; aIter.More(); aIter.Next() ) {
- Handle(SALOME_AISShape) cur = Handle(SALOME_AISShape)::DownCast(aIter.Value());
- if ( !cur.IsNull() ) {
- cur->SetWidth(aNewWidth);
- ic->Redisplay(cur);
- }
- }
- appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aNewWidth);
- }
- }
- }
- }
- else {
- return;
- }
- GeometryGUI::Modified();
- }
- else if (isVTK) { // if is VTKViewer
- SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
- (SUIT_Session::session()->activeApplication());
- if (!app)
- return;
-
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if (!aSelMgr)
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
- SALOME_ListIO selected;
- aSelMgr->selectedObjects(selected);
- if (selected.IsEmpty())
- return;
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>(window);
- if (!vtkVW)
- return;
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
- SALOME_View* view = GEOM_Displayer::GetActiveView();
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
- vtkActorCollection* aCollection = vtkActorCollection::New();
+ GEOM_Displayer displayer( appStudy );
- for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) {
- Handle(SALOME_InteractiveObject) anIObject = It.Value();
- SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry());
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>(aPrs);
- if (vtkPrs) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- vtkActor* anAct = anActors->GetNextActor();
- aCollection->AddItem(anAct);
- }
- }
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- if (aCollection)
- aCollection->InitTraversal();
- else
- return;
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
- int aWidth = 1;
+ GEOMToolsGUI_LineWidthDlg* Dlg =
+ new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "EDGE_WIDTH_TLT" );
- vtkActor* anAct = aCollection->GetNextActor();
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct))
- aWidth = anActor->GetWidth();
- else
- return;
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), QVariant() );
+ int aWidth = v.isValid() ? v.toInt() : SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "edge_width", 1 );
- GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg
- (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT");
-
- Dlg->setTheLW(aWidth);
- if (Dlg->exec()) {
- SUIT_OverrideCursor();
- aWidth = Dlg->getTheLW();
- while (anAct != NULL) {
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
- // There are no casting to needed actor.
- anActor->SetWidth(aWidth);
- appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth);
- }
- anAct = aCollection->GetNextActor();
- }
+ Dlg->setTheLW( aWidth );
+ if ( Dlg->exec() ) {
+ SUIT_OverrideCursor();
+ aWidth = Dlg->getTheLW();
+ } else
+ return; //Cancel case
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
- GeometryGUI::Modified();
- } // end vtkviewer
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnIsosWidth() {
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
-
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
- bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
-
- if(isOCC){ // if is OCCViewer
-
- 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() ) {
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
- CurObject->restoreIsoNumbers();
- Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
- Handle(Graphic3d_AspectLine3d) asp = CurDrawer->UIsoAspect()->Aspect();
-
- Quantity_Color C;
- Aspect_TypeOfLine T;
- Standard_Real W;
- asp->Values(C,T,W);
-
- int aWidth = (int)W;
-
- GEOMToolsGUI_LineWidthDlg * Dlg =
- new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(),"ISOS_WIDTH_TLT" );
-
- Dlg->setTheLW( aWidth );
-
- if ( Dlg->exec() ) {
- SUIT_OverrideCursor();
- aWidth = Dlg->getTheLW();
- } else //Cancel case
- return;
-
- for(; ic->MoreCurrent(); ic->NextCurrent()) {
- CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
-
- Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
-
- CurObject->Attributes()->UIsoAspect()->SetWidth(aWidth);
- CurObject->Attributes()->VIsoAspect()->SetWidth(aWidth);
-
- ic->Redisplay(CurObject);
-
- aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
- }
- GeometryGUI::Modified();
- }
- }
- else if(isVTK){ // if is VTKViewer
- //
- // Warning. It's works incorrect. must be recheked.
- //
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >
- ( SUIT_Session::session()->activeApplication() );
- if ( !app )
- return;
- LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if ( !aSelMgr )
- return;
- SALOME_ListIO selected;
- aSelMgr->selectedObjects( selected );
- if ( selected.IsEmpty() )
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
- SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
- if ( !vtkVW )
- return;
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
- int aMgrId = window->getViewManager()->getGlobalId();
+ LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+ if ( !aSelMgr ) return;
- SALOME_View* view = GEOM_Displayer::GetActiveView();
+ SALOME_ListIO selected;
+ aSelMgr->selectedObjects( selected );
+ if ( selected.IsEmpty() ) return;
- vtkActorCollection* aCollection = vtkActorCollection::New();
+ GEOM_Displayer displayer( appStudy );
- for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
- Handle(SALOME_InteractiveObject) anIObject = It.Value();
- SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() );
- SVTK_Prs* vtkPrs = dynamic_cast<SVTK_Prs*>( aPrs );
- if ( vtkPrs ) {
- vtkActorCollection* anActors = vtkPrs->GetObjects();
- anActors->InitTraversal();
- vtkActor* anAct = anActors->GetNextActor();
- aCollection->AddItem(anAct);
- }
- }
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- if(aCollection)
- aCollection->InitTraversal();
- else
- return;
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
- int aWidth = 1;
+ GEOMToolsGUI_LineWidthDlg* Dlg =
+ new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" );
- vtkActor* anAct = aCollection->GetNextActor();
- if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
- aWidth = anActor->GetIsosWidth();
- }
- else
- return;
-
- GEOMToolsGUI_LineWidthDlg* Dlg =
- new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" );
-
- Dlg->setTheLW( aWidth );
- if (Dlg->exec() ) {
- SUIT_OverrideCursor();
- aWidth = Dlg->getTheLW();
- } else
- return; //Cancel case
-
- while( anAct!= NULL ) {
- if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
- // There are no casting to needed actor.
- anActor->SetIsosWidth(aWidth);
- aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
- }
- anAct = aCollection->GetNextActor();
- }
-
- view->Repaint();
- GeometryGUI::Modified();
- } // end vtkviewer
+ QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), QVariant() );
+ int aWidth = v.isValid() ? v.toInt() : SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "isolines_width", 1 );
+
+ Dlg->setTheLW( aWidth );
+ if ( Dlg->exec() ) {
+ SUIT_OverrideCursor();
+ aWidth = Dlg->getTheLW();
+ } else
+ return; //Cancel case
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnBringToFront() {
- SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- if ( !app )
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
+
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy());
+ if (!appStudy) return;
- SalomeApp_Module* mod = dynamic_cast<SalomeApp_Module*>(app->activeModule());
- if(!mod)
- return;
-
- GEOM_Displayer* disp = dynamic_cast<GEOM_Displayer*>(mod->displayer());
-
- if(!disp)
- return;
-
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
- if ( !aSelMgr )
- return;
+ if ( !aSelMgr ) return;
SALOME_ListIO selected;
aSelMgr->selectedObjects( selected );
- if ( selected.IsEmpty() )
- return;
+ if ( selected.IsEmpty() ) return;
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if(!appStudy)
- return;
+ GEOM_Displayer displayer( appStudy );
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
- OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
- if ( !vm )
- return;
-
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
QAction* a = getGeometryGUI()->getAction( GEOMOp::OpBringToFront );
bool checked = a->isChecked();
-
- 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);
- anIOlst.Append(aisShape->getIO());
- }
- } // for...
- disp->Redisplay(anIOlst);
- GeometryGUI::Modified();
- } // if ( isOCC )
+
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
+ }
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnClsBringToFront() {
- SalomeApp_Application* app =
- dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- if(!app)
- return;
+ SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app ) return;
- SalomeApp_Module* mod = dynamic_cast<SalomeApp_Module*>(app->activeModule());
- if(!mod)
- return;
-
- GEOM_Displayer* disp = dynamic_cast<GEOM_Displayer*>(mod->displayer());
-
- if(!disp)
- return;
+ SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() );
+ if ( !appStudy ) return;
+ GEOM_Displayer displayer( appStudy );
- SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
- if(!appStudy)
- return;
-
- SUIT_ViewWindow* window = app->desktop()->activeWindow();
-
- bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
-
- if(isOCC){ // if is OCCViewer
-
- 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;
- ic->DisplayedObjects( aList );
- for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) {
-
- Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(it.Value());
-
- if(CurObject.IsNull())
- continue;
-
- appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), GEOM::propertyName( GEOM::TopLevel ), Standard_False );
- CurObject->setTopLevel(Standard_False);
- anIOlst.Append(CurObject->getIO());
- }
- disp->Redisplay(anIOlst);
- GeometryGUI::Modified();
+ SALOME_View* window = displayer.GetActiveView();
+ if ( !window ) return;
+
+ int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId();
+
+ SALOME_ListIO anIOlst;
+ window->GetVisible( anIOlst );
+
+ for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
+ Handle( SALOME_InteractiveObject ) io = It.Value();
+ appStudy->setObjectProperty( aMgrId, QString( io->getEntry() ), GEOM::propertyName( GEOM::TopLevel ), Standard_False );
+ if ( window->isVisible( io ) ) displayer.Redisplay( io, false );
}
+ displayer.Redisplay( anIOlst );
+ displayer.UpdateViewer();
+ GeometryGUI::Modified();
}
void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
// generic method to be put in a super class
void register_name(char * name);
+ // Get ORB object
+ CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); }
+
+ // Get Naming Service object
+ SALOME_NamingService* GetNS() { return name_service; }
//-----------------------------------------------------------------------//
// Inherited methods from SALOMEDS::Driver //
#include "GEOM_Engine.hxx"
#include "GEOM_Object.hxx"
+#define SUBSHAPE_ERROR "Sub shape cannot be transformed"
+
//=============================================================================
/*!
* constructor:
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeThickening
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
+ (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theOffset,
+ CORBA::Boolean doCopy)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
+
+ //check if the object is a sub-shape
+ if (!theObject->IsMainShape() && !doCopy) {
+ GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
+ return aGEOMObject._retn();
+ }
+
+ if (!doCopy)
+ aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
+
+ //Get the basic object
+ Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
+ if (aBasicObject.IsNull()) return aGEOMObject._retn();
+
+ //Create the thickened shape
+ if (doCopy)
+ {
+ Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
+ aBasicObject, theOffset, doCopy);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+ }
+ else
+ {
+ GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy);
+
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
+ return aGEOMObject._retn();
+ }
+}
+
//=============================================================================
/*!
* RestorePath
GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath,
GEOM::GEOM_Object_ptr theVec);
+
+ GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
+ CORBA::Double theOffset,
+ CORBA::Boolean isCopy);
GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr theBase1,
if (aGroupRef.IsNull()) return;
GetOperations()->AddObject(aGroupRef, theSubShapeId);
+
+ // Update GUI.
+ UpdateGUIForObject(theGroup);
}
//=============================================================================
if (aGroupRef.IsNull()) return;
GetOperations()->RemoveObject(aGroupRef, theSubShapeId);
+
+ // Update GUI.
+ UpdateGUIForObject(theGroup);
}
//=============================================================================
#include "GEOM_IOperations_i.hh"
#include "GEOM_Engine.hxx"
+#include "GEOM_Gen_i.hh"
+#include <SALOME_NamingService.hxx>
#include "utilities.h"
#include "OpUtil.hxx"
#include <TCollection_AsciiString.hxx>
#include <TDF_Tool.hxx>
+#include CORBA_SERVER_HEADER(SALOME_Session)
+
//=============================================================================
/*!
* default constructor:
}
return anImpl;
}
+
+//=============================================================================
+/*!
+ * UpdateGUIForObject
+ */
+//=============================================================================
+void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj)
+{
+ if (!CORBA::is_nil (theObj)) {
+ // Cast _engine to GEOM_Gen_i type.
+ PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in());
+ GEOM_Gen_i *anEngine = dynamic_cast<GEOM_Gen_i *>(aServant);
+
+ if (anEngine) {
+ SALOME_NamingService *aNameService = anEngine->GetNS();
+ CORBA::Object_var aSessionObj = aNameService->Resolve("/Kernel/Session");
+ SALOME::Session_var aSession = SALOME::Session::_narrow(aSessionObj);
+
+ if (!aSession->_is_nil())
+ {
+ std::string aMsg("GEOM/modified/");
+ CORBA::String_var anIOR = anEngine->GetORB()->object_to_string(theObj);
+
+ aMsg += anIOR.in();
+ aSession->emitMessageOneWay(aMsg.c_str());
+ }
+ }
+ }
+}
::GEOM_IOperations* GetImpl() { return _impl; }
+ virtual void UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj);
+
private:
::GEOM_IOperations* _impl;
//Perform the translation
GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the translation
GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the translation
GetOperations()->TranslateVector(anObject, aVector);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
}
GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
+
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the rotation
GetOperations()->Rotate(anObject, anAxis, theAngle);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the mirror
GetOperations()->MirrorPlane(anObject, aPlane);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the mirror
GetOperations()->MirrorAxis(anObject, aAxis);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the mirror
GetOperations()->MirrorPoint(anObject, aPoint);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Create the offset shape
GetOperations()->OffsetShape(aBasicObject, theOffset);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the scale
GetOperations()->ScaleShape(anObject, aPoint, theFactor);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
GetOperations()->ScaleShapeAlongAxes
(anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
//Perform the Position
GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
+ if (!theCopy) {
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+ }
+
return GetObject(anObject);
}
//Perform the translation
GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
+ // Update GUI.
+ UpdateGUIForObject(theObject);
+
return aGEOMObject._retn();
}
RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp)
self._autoPublish(anObj, theName, "pipe")
return anObj
+
+ ## Makes a thick solid from a face or a shell
+ # @param theShape Face or Shell to be thicken
+ # @param theThickness Thickness of the resulting 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
+ #
+ def MakeThickSolid(self, theShape, theThickness, theName=None):
+ """
+ Make a thick solid from a face or a shell
+
+ Parameters:
+ theShape Face or Shell to be thicken
+ theThickness Thickness of the resulting 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_TestAll.py
+ anObj = self.PrimOp.MakeThickening(theShape, theThickness, True)
+ RaiseIfFailed("MakeThickening", self.PrimOp)
+ self._autoPublish(anObj, theName, "pipe")
+ return anObj
+
+
+ ## Modifies a face or a shell to make it a thick solid
+ # @param theShape Face or Shell to be thicken
+ # @param theThickness Thickness of the resulting solid
+ #
+ # @return The modified shape
+ #
+ def Thicken(self, theShape, theThickness):
+ """
+ Modifies a face or a shell to make it a thick solid
+
+ 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:
+ The modified shape
+ """
+ # Example: see GEOM_TestAll.py
+ anObj = self.PrimOp.MakeThickening(theShape, theThickness, False)
+ RaiseIfFailed("MakeThickening", self.PrimOp)
+ return anObj
## Build a middle path of a pipe-like shape.
# The path shape can be a wire or an edge.
sk = geompy.Sketcher3D()
sk.addPointsAbsolute(0,0,0, 70,0,0)
sk.addPointsRelative(0, 0, 130)
- sk.addPointAnglesLength("OXY", 50, 0, 100)
- sk.addPointAnglesLength("OXZ", 30, 80, 130)
+ sk.addPointRadiusAnglesRelative(50, 0, 100, 'OXY')
+ sk.addPointRadiusAnglesRelative(30, 80, 130, 'OXZ')
sk.close()
a3D_Sketcher_1 = sk.wire()
"""
GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR"));
GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY"));
GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM"));
+
+ GroupThickening = new DlgRef_1Check1Spin1Check(centralWidget());
+ GroupThickening->GroupBox1->setTitle("Thickening");
+ GroupThickening->checkButton1->setText("Add thickness (edges or wires only)");
+ GroupThickening->checkButton2->setText("Thicken towards outside");
+ GroupThickening->TextLabel1->setText("Thickness");
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupVecH);
layout->addWidget(Group2Points);
layout->addWidget(GroupDXDYDZ);
+ layout->addWidget(GroupThickening);
/***************************************************************/
setHelpFileName("create_extrusion_page.html");
double aScaleFactor = 2.0;
double aScaleStep = 0.5;
double aScaleMin = Precision::Confusion() * 10.0;
+
+ double aThickness = 10;
+ double aThicknessMin = Precision::Confusion() * 10.0;
initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
GroupVecH->SpinBox_DX->setValue(100.0);
GroupVecH->SpinBox_DY->setValue(aScaleFactor);
Group2Points->SpinBox1->setValue(aScaleFactor);
GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor);
+
+ initSpinBox(GroupThickening->SpinBox_DX, aThicknessMin, COORD_MAX, step, "length_precision" );
+ GroupThickening->SpinBox_DX->setValue(aThickness);
// hide not used controls
Group2Points->TextLabel5->hide();
Group2Points->LineEdit3->setText("");
GroupDXDYDZ->LineEdit1->setText("");
+
+ GroupThickening->SpinBox_DX->hide();
+ GroupThickening->checkButton2->hide();
+ GroupThickening->TextLabel1->hide();
+
+ GroupVecH->TextLabel4->hide();
+ GroupVecH->SpinBox_DY->hide();
+
+ Group2Points->TextLabel4->hide();
+ Group2Points->SpinBox1->hide();
+
+ GroupDXDYDZ->TextLabel5->hide();
+ GroupDXDYDZ->SpinBox_SC->hide();
myBaseObjects.clear();
myPoint1.nullify();
connect(GroupVecH->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
connect(GroupVecH->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onReverse()));
- connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
+ connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool)));
connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(Group2Points->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2Points->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2Points->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group2Points->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
- connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
+ connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool)));
connect(Group2Points->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupDXDYDZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupDXDYDZ->SpinBox_SC, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(GroupDXDYDZ->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
- connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism()));
+ connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool)));
+
+ connect(GroupThickening->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+ connect(GroupThickening->checkButton1, SIGNAL(toggled(bool)), this, SLOT(onAddThickening(bool)));
+ connect(GroupThickening->checkButton2, SIGNAL(toggled(bool)), this, SLOT(onChangeDirection(bool)));
initName(tr("GEOM_EXTRUSION"));
myEditCurrentArgument == Group2Points->LineEdit1 ||
myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) {
myBaseObjects.clear();
+ GroupThickening->checkButton1->setEnabled(true);
+
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
for ( int i = 0; i < objects.count(); i++ ) {
GEOM::shape_type stype = objects[i]->GetMaxShapeType();
if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
continue;
+ if ( stype > GEOM::EDGE || stype < GEOM::WIRE )
+ {
+ GroupThickening->checkButton1->setChecked(false);
+ GroupThickening->checkButton1->setEnabled(false);
+ }
+
myBaseObjects << objects[i];
}
if ( !myBaseObjects.isEmpty() ) {
// function : onScalePrism()
// purpose :
//=================================================================================
-void GenerationGUI_PrismDlg::onScalePrism()
+void GenerationGUI_PrismDlg::onScalePrism(bool isChecked)
{
- GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked());
- GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked());
+ GroupVecH->TextLabel4->setVisible(isChecked);
+ GroupVecH->SpinBox_DY->setVisible(isChecked);
+
+ Group2Points->TextLabel4->setVisible(isChecked);
+ Group2Points->SpinBox1->setVisible(isChecked);
- Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked());
- Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked());
+ GroupDXDYDZ->TextLabel5->setVisible(isChecked);
+ GroupDXDYDZ->SpinBox_SC->setVisible(isChecked);
+
+ GroupVecH->TextLabel4->setEnabled(isChecked);
+ GroupVecH->SpinBox_DY->setEnabled(isChecked);
- GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
- GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked());
+ Group2Points->TextLabel4->setEnabled(isChecked);
+ Group2Points->SpinBox1->setEnabled(isChecked);
+
+ GroupDXDYDZ->TextLabel5->setEnabled(isChecked);
+ GroupDXDYDZ->SpinBox_SC->setEnabled(isChecked);
processPreview();
}
+//=================================================================================
+// function : onAddThickening(bool)
+// purpose :
+//=================================================================================
+void GenerationGUI_PrismDlg::onAddThickening(bool isChecked)
+{
+ GroupThickening->SpinBox_DX->setVisible(isChecked);
+ GroupThickening->checkButton2->setVisible(isChecked);
+ GroupThickening->TextLabel1->setVisible(isChecked);
+
+ updateGeometry();
+ resize(minimumSizeHint());
+ processPreview();
+}
+
+//=================================================================================
+// function : onChangeDirection(bool)
+// purpose :
+//=================================================================================
+void GenerationGUI_PrismDlg::onChangeDirection(bool isChecked)
+{
+ processPreview();
+}
+
//=================================================================================
// function : execute
// purpose :
GEOM::GEOM_Object_var anObj;
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
+ GEOM::GEOM_I3DPrimOperations_var anotherOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
for (int i = 0; i < myBaseObjects.count(); i++) {
switch (getConstructorId()) {
}
break;
}
-
+
+ if(GroupThickening->checkButton1->isChecked())
+ {
+ double aThickness = 0.0;
+
+ if(GroupThickening->checkButton2->isChecked() ^ GroupVecH->CheckBox2->isChecked()) // if "towards outside" XOR "reversed" is checked
+ aThickness = -1.0*(GroupThickening->SpinBox_DX->value()); // change the offset sign to negative
+ else
+ aThickness = GroupThickening->SpinBox_DX->value();
+
+ anObj = anotherOper->MakeThickening(anObj, aThickness, /*copy=*/false);
+ }
+
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
class DlgRef_2Sel1Spin3Check1Spin;
class DlgRef_3Sel2Check3Spin;
class DlgRef_1Sel3Spin2Check1Spin;
+class DlgRef_1Check1Spin1Check;
//=================================================================================
// class : GenerationGUI_PrismDlg
DlgRef_2Sel1Spin3Check1Spin* GroupVecH;
DlgRef_3Sel2Check3Spin* Group2Points;
DlgRef_1Sel3Spin2Check1Spin* GroupDXDYDZ;
+ DlgRef_1Check1Spin1Check* GroupThickening;
private slots:
void ClickOnOk();
void SetDoubleSpinBoxStep( double );
void onReverse();
void onBothway();
- void onScalePrism();
+ void onScalePrism(bool);
+ void onAddThickening( bool );
+ void onChangeDirection( bool );
};
#endif // GENERATIONGUI_PRISMDLG_H
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SUIT_OverrideCursor.h>
+#include <SUIT_MessageBox.h>
#include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <SalomeApp_Tools.h>
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]);
+ bool doPublishAll = true;
+ if (nbSols > 1) {
+ QMessageBox::StandardButton anAnswer =
+ SUIT_MessageBox::question(this, tr("GEOM_MINDIST_PUBLISH_TITLE"),
+ tr("GEOM_MINDIST_PUBLISH_TEXT"),
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel,
+ QMessageBox::No);
+ if (anAnswer == QMessageBox::No)
+ doPublishAll = false;
+ else if (anAnswer != QMessageBox::Yes)
+ return true;
+ }
+ if (doPublishAll) {
+ 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());
+ }
+ }
+ }
+ else {
+ int i = myGrp->ComboBox1->currentIndex();
+ 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());