# Modified by : Alexander BORODIN (OCN) - autotools usage
# Created from configure.in.base
#
-AC_INIT([Salome2 Project GEOM module], [6.5.0], [webmaster.salome@opencascade.com], [SalomeGEOM])
+AC_INIT([Salome2 Project GEOM module], [6.6.0], [webmaster.salome@opencascade.com], [SalomeGEOM])
AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
following conditions:
<ul>
<li>Each element of the compound should be a Block (6 faces and 12 edges);</li>
-<li>A connection between two Blocks should be an entire quadrangle face or an entire edge;</li>
+<li>Blocks can be connected only via an entire quadrangle face or an entire edge;</li>
<li>The compound should be connected;</li>
-<li>Two quadrangle faces should be glued.</li>
+<li>Each couple of connecting quadrangle faces should be glued.</li>
</ul>
\n Informs of the following possible errors:
3D Sketcher allows creating a closed or unclosed 3D wire, made of
consequent straight segments.
+<b>Example:</b>
+
+\image html 3dsketch4.png
+
To create a 3D Sketch, select in the main menu <em>New Entity -> Basic -> 3D Sketch</em>.
-\image html 3dsketch2.png
+\image html 3dsketch_dlg.png
-The first sketcher point can be defined by \b Absolute coordinates X, Y and Z.
+The first point of a sketch can be defined by \b Absolute coordinates X, Y and Z.
When the first point is defined, it is possible to add straight segments.
-Each segment will start at the end point of previous segment or at the
-sketcher first point, if there are no validated segments.
-
-Segment can be defined by:
- - \b Absolute coordinates X, Y and Z of its second end,
- - \b Relative coordinates DX, DY and DZ of its second end with
- respect to the previous applied point,
- - \b Direction and \b Length of the segment. Direction is set by two
- \b Angles in selected coordinate system.
+Each segment will start at the end point of the previous segment or at the
+first point of the sketch, if there are no validated segments.
The way of segment construction can be selected by the <b>Coordinates Type</b>
radio buttons.
-To validate the segment and to proceed with the definition of the next
-segment, click <b>Apply</b> button. \b Undo and \b Redo buttons,
+To validate a segment and to proceed with the definition of the next
+one, click <b>Apply</b> button. \b Undo and \b Redo buttons,
respectively, remove or restore the last segment in the wire.
\n <b>"Sketch Validation"</b> button applies the wire, built by the
\n <b>"Sketch Closure"</b> closes the Sketch by a straight line from
the start to the end point and applies it.
-<b>Example:</b>
+A segment can be defined by:
+- <b>Cartesian coordinates</b> of its second end, which can be either:
+ - \b Absolute coordinates X, Y and Z, or
+ - \b Relative coordinates DX, DY and DZ with
+ respect to the previous applied point,
+
+- <b>Angular coordinates</b> of its second end specified by:
+<ul>
+ <li> the \b Length of the segment and an \b Angle in the chosen plane (OXY for example) in \b Relative mode.
+ The angle is then relative to a local coordinate system with the last point of the sketch as origin. </li>
+
+ \image html 3dsketch_angle_rel.png
+
+ <li> the \b Radius (i.e. the distance from the origin) and an \b Angle in the chosen plane in \b Absolute mode </li>
+
+ \image html 3dsketch_angle_abs.png
+
+ In both angular modes you can additionally specify the following:
+
+ <li> the second \b Angle (latitude) </li>
+
+ \image html 3dsketch_2angles_rel.png
+
+ or
+
+ <li> the \b Height </li>
+
+ \image html 3dsketch_angle_height_rel.png
+
-\image html 3dsketch1.png
+</ul>
<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
This algorithm creates a wire from the list of real values, which
+++ /dev/null
-/*!
-
-\page create_adv_obj_page Creating Advanced Geometrical Objects
-
-<b>New Entity -> Advanced </b> submenu allows to create additional complex topological objects.
-
-<ul>
-<li>\subpage create_pipetshape_page</li>
-<li>\subpage create_divideddisk_page</li>
-<li>\subpage create_dividedcylinder_page</li>
-<!--@@ insert new functions before this line @@ do not remove this line @@-->
-</ul>
-<!--WRNING : In order to let this page appear in the documentation please remove this file from the EXCLUDE_PATTERNS field of the doxyfile.in file in ../ -->
-*/
Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_compound "Advanced Geometric Objects".
+<b> More details: </b>
+
+Perhaps you ask yourself : \ref partition_explanation "What's the difference between partition, compounds and fuse operation ?"
+
*/
\page create_dividedcylinder_page DividedCylinder
-The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexaedral meshing.Two division patterns are available :
+The <b>Divided cylinder</b> object is a cylinder divided into \b blocks for easy hexahedral meshing. Two division patterns are available :
<ul>
-<li> A square pattern which is frequently used </li>
-<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
+<li> A square pattern, which is frequently used; </li>
+<li> A hexagonal pattern, which ensures a better mesh quality and especially less acute or obtuse angles. </li>
</ul>
\image html dividedcylinder.png
\page create_divideddisk_page DividedDisk
-The <b>Divided disk</b> object is a disk divided into \b blocks. It means that it's a shape <b>prepared for hexaedral meshing</b>. Two division patterns are available :
+The <b>Divided disk</b> object is a disk divided into \b blocks for easy hexahedral meshing. Two division patterns are available :
<ul>
-<li> A square pattern which is frequently used </li>
-<li> An hexagonal pattern which ensures a better mesh quality and especially less acute or obtuse angles </li>
+<li> A square pattern, which is frequently used; </li>
+<li> A hexagonal pattern, which ensures a better mesh quality and especially less acute or obtuse angles. </li>
</ul>
-\n Moreover this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any <b>tube shape</b> prepared for hexaedral meshing
+\n Moreover, this shape can be used as a basis in an \ref create_extrusion_alongpath_page "Extrusion along a path" operation in order to obtain any <b>tube shape</b> prepared for hexahedral meshing
(see example below). (Another alternative is to create a 2D mesh on the divided disk and create a 3D mesh by extrusion in the SMESH module.)
To create a <b> Divided Disk </b> in the <b>Main Menu</b> select <b>New Entity - >
Advanced - > DividedDisk </b>
-\n Then there are 2 ways to create a <b> Divided Disk</b> in 3D space.
+\n There are 2 ways to create a <b> Divided Disk</b> in 3D space.
\n For both operations :
Specify the parameters of the DividedDisk object creation in the opened dialog
box and press "Apply" or "Apply & Close" button.
The result of each operation will be a GEOM_Object.
-\n First way : by radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates
+\n At first it is possible to define a disk by its radius and orientation (plane "OXY", "OYZ" or "OZX"). The resulting disk is located at the origin of coordinates
<b>TUI Command:</b> <em>geompy.MakeDividedDisk(Radius, Orientation, Pattern)</em>
\image html divided_disk_dlg.png
-\n Second way : by giving its center, normal and radius.
+\n At second the disk can be defined by its center, normal and radius.
<b>TUI Command:</b> <em>geompy.MakeDividedDiskPntVecR(Center, Vector,
Radius, Pattern)</em>
\page create_hexa_solid_page Hexaedral solid
-\n <b>Description:</b> Builds a hexahedral solid. either of the below
-mentioned arguments. This operation allows to build a solid bypassing
-the intermediate stage of building a shell and 4 faces (in the case of
-building by 2 faces) or just a shell (in the case of building by 6
+This operation allows to build a hexahedral solid bypassing
+the intermediate stage of building a shell and 4 faces (in case of
+building by 2 faces) or just a shell (in case of building by 6
faces).
+There are 2 algorithms to create a hexahedral solid in the 3D space.
\n The \b Result of the operation will be a \b GEOM_Object (solid).
-\n <b>TUI Command:</b>
-<ul>
-<li><em>geompy.MakeHexa2Faces(F1, F2),</em> where F1 and F2 are faces
-from which the hexahedron is constructed, other four faces are created
-automatically.</li>
-<li><em>geompy.MakeHexa(F1, F2, F3, F4, F5, F6),</em> where F1 — F6 are six faces from which the hexahedron is constructed.</li>
-</ul>
+Firstly, you can define a Hexahedral Solid by two faces, other four faces are created automatically.
-\n <b>Arguments:</b>
-<ul>
-<li>Name + 2 Faces, or</li>
-<li>Name + 6 Faces.</li>
-</ul>
-
-\n <b>Dialog Box:</b>
+<b>TUI Command:</b> <em>geompy.MakeHexa2Faces(F1, F2),</em>
+<b>Arguments: Name + 2 Faces.
\image html block4.png
+\n <b>Example:</b>
+
+\image html image181.png
+<center>Hexahedral Solid built on the base of two Faces</center>
+Secondly, you can define a Hexahedral Solid by all six faces.
+
+<b>TUI Command:</b> <em>geompy.MakeHexa(F1, F2, F3, F4, F5, F6),</em>
+<b>Arguments:</b> Name + 6 Faces.
\image html block5.png
\image html image180.png
<center>Hexahedral Solid built on the base of six Faces</center>
-\image html image181.png
-<center>Hexahedral Solid built on the base of two Faces</center>
-
The created blocks can be processed with \ref blocks_operations_page "Operations on Blocks".
\image html pipe_path_dlg.png
-\n To obtain a \b Path of a pipe-like shape, you should define the
-<b>Pipe-like shell or solid</b> and two pipe \b Bases, each of them can
-be set as a wire, a face or a list of edges.<br>
+\n To obtain the \b Path of a pipe-like shape, you should define the
+<b>Pipe-like shell or solid</b> and two pipe \b Bases, which can
+be defined by a wire, a face or a list of edges.<br>
\n <b>Select unpublished edges</b> checkbox - if checked, allows
-selection of edges in the viewer, that are not published in the Object
+selecting in the viewer the edges, that are not published in the Object
Browser.<br>
\n The \b Result of the operation will be a GEOM_Object (edge or wire).<br>
<li>\ref preview_anchor "Preview"</li>
</ul><br>
-\note It is not assumed that exact or approximate copy of the Shape
- can be obtained by applying existing Pipe operation on the
- resulting "Path" wire taking the first Base as the base - it is
- not always possible; though in some particular cases it might
- work it is not guaranteed. Thus, RestorePath function should not
+\note It is not always possible to obtain an exact or approximate
+ copy of the Shape by applying the \b Pipe operation to the
+ resulting "Path" wire with the first Base as the base;
+ though in some particular cases it might
+ work. Thus, Restore Path function should not
be considered as an exact reverse operation of the Pipe.<br>
\n <b>Example:</b>
\page create_quadrangle_face_page Quadrangle face
-\n <b>Description:</b> Builds a face using the below mentioned
-arguments. This operation allows to build a face bypassing the
-intermediate stage of building edges and wires (in the case of
-building by 4 points) or wires (in the case of building by 4 or 2
+This operation allows to build a face bypassing the
+intermediate stage of building edges and wires (in case of
+building by 4 points) or wires (in case of building by 4 or 2
edges).
-\n The \b Result of the operation will be a \b GEOM_Object (face).
-
-\n <b>TUI Command:</b>
-<ul>
-<li><em>geompy.MakeQuad4Vertices(V1, V2, V3, V4),</em> where V1, V2,
-V3, V4 are four vertices from which a face is constructed. Edges are
-created automatically.</li>
-<li><em>geompy.MakeQuad2Edges(E1, E2),</em> where E1, E2 are edges from
-which the face is constructed, two other edges are created
-automatically.</li>
-<li><em>geompy.MakeQuad(E1, E2, E3, E4),</em> where E1, E2, E3, E4 are
-four edges from which the face is constructed.</li>
-</ul>
-
-<b>Arguments:</b>
-<ul>
-<li>Name + 4 Points, or</li>
-<li>Name + 2 Edges, or</li>
-<li>Name + 4 Edges.</li>
-</ul>
-
-\n <b>Dialog Box:</b>
+There are 3 algorithms to create a Quadrangle Face in the 3D space.
+\n The \b Result of each op
+
+The created blocks can be processed with \ref blocks_operations_page "Operations on Blocks".
+
+Our <b>TUI Scripts</b> provide you with useful examples of
+\ref tui_building_by_blocks_p
+
+The created blocks can be processed with \ref blocks_operations_page "Operations on Blocks".
+
+Our <b>TUI Scripts</b> provide you with useful examples of
+\ref tui_building_by_blocks_page "Building by Blocks".
+age "Building by Blocks".
+eration will be a \b GEOM_Object (face).
+
+Firstly you can define a Quadrangle Face by four vertices. Edges are
+created automatically.
+
+<b>TUI Command:</b> <em>geompy.MakeQuad4Vertices(V1, V2, V3, V4),</em>
+<b>Arguments:</b> Name + 4 Points.
\image html block1.png
+Secondly, you can define a Quadrangle Face by two edges, while the other two edges are created automatically.
+<b>TUI Command:</b> <em>geompy.MakeQuad2Edges(E1, E2)
+<b>Arguments:</b> Name + 2 Edges.
+
\image html block2.png
+Finally, you can define a Quadrangle Face by four edges.
+
+<b>TUI Command:</b> <em>geompy.MakeQuad(E1, E2, E3, E4),</em>.
+<b>Arguments:</b> Name + 4 Edges.
+
\image html block3.png
\n <b>Example:</b>
<li> Select the \b plane or the <b>planar face</b> on which to create the sketch.
\note By default the sketch is created on the XOY plane of the global coordinate system.
If Local Coordinate Systems have been created in the study they appear
-in the combobox and can be selected as a reference coordinate system.</li>
+in the combo-box and can be selected as a reference coordinate system.</li>
<li> Choose a \b segment or an \b arc element to start a \b profile or choose \b rectangle to draw a rectangle.
<li> You can define the segment by either its <b>end point</b> or \b direction and \b length. The direction is defined relatively to the tangent at the last point of the sketch. It can be:
<ul>
- <li> Tangent (colinear to the tangent at the last point)</li>
+ <li> Tangent (collinear to the tangent at the last point)</li>
<li> Perpendicular</li>
<li> Defined by an angle</li>
<li> Defined by a vector (Vx, Vy)</li>
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_sketcher_page "Sketcher".
-A wrapper also exists to help in the construction of a sketcher using simple commands.
+There is also a wrapper that can help in the construction of a sketcher using simple commands.
The description of this wrapper can be found in the <a class="el" target="_new" href="../../tui/GEOM/docutils/docapi.html#module-salome.geom.sketcher">
dedicated page</a> of the <a class="el" target="_new" href="../../tui/GEOM/docutils/index.html">salome.geom python package</a>.
--- /dev/null
+/*!
+
+\page faq FAQ ("Frequently Asked Questions")
+
+Here you can find the answers to some frequently asked questions:
+
+<ul>
+<li>\subpage partition_explanation "What is the difference between partition, compounds and fuse operation ?" </li>
+</ul>
+
+
+*/
+++ /dev/null
-/*!
-
-\page first_steps_guide First steps in GEOM
-
-You can find here some useful information to start working with GEOM
-
-<ul>
-<li>\subpage partition_explanation "Partition, compounds and boolean operations" </li>
-</ul>
-
-
-*/
\ No newline at end of file
\n To <b>Fuse Collinear Edges within a Wire</b> in the <b>Main Menu</b>
select <b>Repair - > Fuse Collinear Edges within a Wire</b>.
-\n This operation removes selected vertices from a given wire in case
-if adjacent edges are C1 continuous. The function takes a list of
+\n This operation removes the selected vertices from a given wire,
+provided that the junction of two adjacent edges is C1 continuous
+(i.e. the edges have equal tangents at the junction).
+\n The function takes a list of
vertices to suppress as a parameter. If the list is empty, all
vertices in a wire are taken into account.
+\n \b Example:
+
+Wire with 2 colinear edges:
+\image html wire_before_fuse.png
+
+Fused wire (only one edge):
+\image html fused_wire.png
+
\n <b>Arguments:</b> Name + a wire + a list of vertices (can be empty).
\image html fuse_collinear_edges.png
\page fuse_operation_page Fuse
-For detail description of the Boolean operations please refer to
-<a href="SALOME_BOA_PA.pdf">this document</a>.
-It provides a general review of the Partition and Boolean
-operations algorithms, describes the usage methodology and highlighs
-major limitations of these operations.
-
To produce a \b Fuse operation in the <b>Main Menu</b> select
-<b>Operations - > Boolean - > Fuse</b>
-
-This operation creates a shape from two shapes.
+<b>Operations - > Boolean - > Fuse</b>.
+This operation creates one shape from two shapes.
The \b Result will be any \b GEOM_Object.
-<b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2)</em>
-<b>Arguments:</b> Name + 2 shapes.
-<b>Advanced option:</b>
-\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
-
-\image html bool1.png
<b>Example:</b>
\image html fusesn2.png "The resulting fuse"
+<b>TUI Command:</b> <em>geompy.MakeFuse(s1, s2)</em>\n
+<b>Arguments:</b> Name + 2 shapes.\n
+<b>Advanced option:</b>
+\ref restore_presentation_parameters_page "Set presentation parameters and sub-shapes from arguments".
+
+\image html bool1.png
+
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_fuse "Boolean Operations".
+<b> More details </b>
+<ul>
+ <li>For a detailed description of the Boolean operations please refer to
+<a href="SALOME_BOA_PA.pdf">this document</a>.
+It provides a general review of the Partition and Boolean
+operations algorithms, describes the usage methodology and highlights
+major limitations of these operations.</li>
+ <li>Perhaps you also ask yourself : \ref partition_explanation "What is the difference between partition, compounds and fuse operation ?"</li>
+</ul>
+
*/
\image html measures2.png
-Retrieve all non blocks solids and faces from the given shape.
-Collect them in two groups: solids and faces separately.
+This operation retrieves all non block solids and faces from the given
+shape in two groups: solids and faces separately.
-\n <b>Result:</b> Two or less groups are published in the Object
- Browser under the processed object. Reports error if
- no bad sub-shapes (solids and faces) have been found.
+Two or less groups are published in the Object
+Browser under the processed object. An error is raised if
+no bad sub-shapes (solids and faces) have been found.
\n <b>TUI Command:</b>
<em>geompy.GetNonBlocks(Compound).</em> Returns a tuple of two
GEOM_Objects. The first object is a group of all non block solids
- (= not 6 faces, or with 6 faces, but with the presence of
- non-quadrangular faces). The second object is a group of all non
+ (not having 6 faces, or having 6 faces, but some of them
+ are not quadrangular). The second object is a group of all non
quadrangular faces.
See also a \ref tui_get_non_blocks_page "TUI example".
the module and its contents (geometrical object) will be displayed in
the <b>Object Browser</b>.
-\note If the selected file is in IGES format and the length is not
-expressed in meters, it will be suggested to scale the model into the
-metric system (see the picture below). This feature can be helpful if
-some wrong units have been written to the IGES file by a
+\note If the selected file is in IGES or STEP format and the length
+is not expressed in meters, it will be asked whether to take or not these
+units into account (see the picture below). This feature can be
+helpful if some wrong units have been written to the IGES or STEP file by a
3rd-party software.
\image html iges_unit.png
\image html geomscreen.png
-If you are a new user some general information about GEOM usage are given here:
-\subpage first_steps_guide
-
\b Geometry module of SALOME is destined for:
- \subpage import_export_geom_obj_page "import and export of geometrical models"
in IGES, BREP and STEP formats;
Almost all geometry module functionalities are accessible via
\subpage geompy_page "Geometry module Python Interface"
+You can find the answer to some Frequently Asked Questions in this page:
+- \subpage faq "Frequently Asked Questions"
+
Other functions are available in <a class="el" target="_new" href="../../tui/GEOM/docutils/index.html">salome.geom python package</a>.
\image html image3.png "Example of Geometry module usage for engineering tasks"
\page partition_page Partition
-For detail description of the Partition operation please refer to
+<ul>
+<li>For a detailed description of the Partition operation please refer to
<a href="SALOME_BOA_PA.pdf">this document</a>.
It provides a general review of the Partition and Boolean
-operations algorithms, describes the usage methodology and highlighs
-major limitations of these operations.
+operations algorithms, describes the usage methodology and highlights
+major limitations of these operations.</li>
+
+<li>Perhaps you also ask yourself : \ref partition_explanation "What's the difference between partition, compounds and fuse operation ?"</li>
+</ul>
To produce a \b Partition in the <b>Main Menu</b> select <b>Operations - > Partition</b>
\tableofcontents
-It is frequently asked about the difference between the above mentioned operations. It's indeed simple. Lets take the example of a cylinder and a box that you want to join together.
+It is frequently asked about the difference between the above mentioned operations. It is indeed simple. Let us take the example of a cylinder and a box that you want to join together.
\section sec1 Fuse
-The \b fuse operation will make a <b>single solid</b> from the two given solids. It allows you to build complex models by putting simple shapes together.
+The \b fuse operation will make a <b>single solid</b> from two given solids. It allows you to build complex models by putting simple shapes together.
\image html fuse.png
\section sec2 Partition
-The \b partition operation will also connect the two solids but it will <b>keep a face at the frontier</b> (in brown on the picture below). The resulting shape will consist in <b>two connected solids</b> that share
+The \b partition operation will also connect the solids but it will <b>keep a face at the frontier</b> (in brown in the picture below). The resulting shape will consist of <b>two connected solids</b> that share
a face at their frontier. It means that this face is present only one time in the resulting shape and is a sub-shape of both the box and the cylinder.
\n This operation allows you to identify different areas in a shape (e.g. different materials) and to ensure a <b>conformal mesh</b> when meshing it later. Indeed the face at the frontier is meshed only once.
\section sec3 Compound
-When you build a \b compound by using the build -> compound operation you just make <b>an object that contains the two separate solids</b> like in a "bag".
+When you build a \b compound by using the Build -> Compound operation you just make <b>an object that contains two separate solids</b> like in a "bag".
The two solids remain unconnected. The compound is just a set of shapes, no more.
-\n The compound Allows applying operations to a collection of shapes.
+\n The compound allows applying operations to a collection of shapes.
\image html compound2.png
<li> \b Partition
<ul>
<li>\a Result : Two <b>connected solids</b> sharing faces.</li>
-<li>\a Purpose : Useful to ensure a conformal mesh of separated areas of your model (fluid / solid , concrete / steel ...)</li>
+<li>\a Purpose : Useful to ensure a conformal mesh of separate areas of your model (fluid / solid , concrete / steel ...).</li>
</ul>
<li> \b Compound
<ul>
\code
import geompy
import salome
+import GEOM
gg = salome.ImportComponentGUI("GEOM")
# create DividedDisk object
-divideddisk = geompy.MakeDividedDisk(100, 50)
+divideddisk = geompy.MakeDividedDisk(100, 1, GEOM.SQUARE)
# add object in the study
id_divideddisk = geompy.addToStudy(divideddisk,"DividedDisk")
# display divideddisk
-gg.createAndDisplayGO(id_divideddisk)
+gg.createAndDisplayGO(id_divideddisk)
\endcode
\anchor tui_creation_dividedcylinder
\code
import geompy
import salome
+import GEOM
gg = salome.ImportComponentGUI("GEOM")
# create DividedCylinder object
-dividedcylinder = geompy.MakeDividedCylinder(100, 300)
+dividedcylinder = geompy.MakeDividedCylinder(100, 300, GEOM.SQUARE)
# add object in the study
id_dividedcylinder = geompy.addToStudy(dividedcylinder,"DividedCylinder")
# display dividedcylinder
-gg.createAndDisplayGO(id_dividedcylinder)
+gg.createAndDisplayGO(id_dividedcylinder)
\endcode
<!--@@ insert new functions before this line @@ do not remove this line @@-->
geompy.addToStudy(cyl, 'cyl')
# make a compound
-compound = geompy.MakeCompound([box1, box2])
+compound = geompy.MakeCompound([box, cyl])
geompy.addToStudy(compound, 'compound')
# explore the compound
\page work_with_groups_page Working with groups
Creation and editing groups of sub-shapes of a geometrical object makes
-handling sub-shapes much easier. Also some Boolean operations on
-groups are available.
+handling sub-shapes much easier. Boolean operations on
+groups are also available.
<ul>
<li>\ref create_groups_anchor "Create a Group"</li>
\image html groups_union_dlg.png
In this dialog box you should specify the name of the resulting group
-and set of groups which will be united.
+and select the groups, which will be united.
</li>
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
</ol>
<h2>Intersection of groups</h2>
This operation allows to create a new group in such a way that only
-sub-shapes that are present in all initial groups together are added to the
+the sub-shapes that are present in all initial groups are added to the
new one.
<em>To intersect groups:</em>
\image html groups_intersect_dlg.png
In this dialog box you should specify the name of the resulting group
-and set of groups which will be intersected.
+and select the groups, which will be intersected.
</li>
<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
</ol>
\image html groups_cut_dlg.png
In this dialog box you should specify the name of the resulting group
-and groups which will be cut.
+and the groups which will be cut.
</li>
-<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the
-group.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
</ol>
Our <b>TUI Scripts</b> provide you with useful examples of
{
/*!
- * \brief Get an entry of the object in GEOM component.
+ * \brief Get internal (unique) entry of the object in the GEOM component's data tree.
+ * \note This is not an entry of the data object in SALOME study.
+ * This is internal function of GEOM component, though it can be used outside it for
+ appropriate reason (e.g. for unique identification of geometry object).
*/
string GetEntry();
* \param theFileName The file, containing the shape.
* \param theFormatName Specify format for the file reading.
* Available formats can be obtained with <VAR>ImportTranslators()</VAR> method.
- * If format 'IGES_SCALE' is used instead 'IGES' length unit will be
- * set to 'meter' and result model will be scaled.
+ * If format 'IGES_SCALE' is used instead of 'IGES' or
+ * format 'STEP_SCALE' is used instead of 'STEP',
+ * file length unit will be ignored (set to 'meter') and result model will be scaled.
* \return New GEOM_Object, containing the imported shape.
*/
GEOM_Object ImportFile (in string theFileName, in string theFormatName);
#include "EntityGUI_3DSketcherDlg.h"
#include "EntityGUI_Widgets.h"
-#include <SalomeApp_DoubleSpinBox.h>
+
+#include <Basics_OCCTVersion.hxx>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <SOCC_Prs.h>
#include <SOCC_ViewModel.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <Prs3d_AngleAspect.hxx>
#include <Prs3d_LineAspect.hxx>
#include <Prs3d_LengthAspect.hxx>
+#if OCC_VERSION_LARGE > 0x06050300
+#include <Prs3d_TextAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Text.hxx>
+#include <Graphic3d_VerticalTextAlignment.hxx>
+#include <Graphic3d_HorizontalTextAlignment.hxx>
+#include <Graphic3d_AspectText3d.hxx>
+#include <Font_FontAspect.hxx>
+#endif // OCC_VERSION_LARGE > 0x06050300
// This include must be *AFTER* SOCC_ViewModel.h because
// of the constant ROTATE which is a #define in
// TODO
//
-// + Ecrire la partie absolute / relative pour les coordonnées angulaires Done
-// + Ecrire les bons tests pour les coordonnées cylindriques Done
-// + Finir refactoring des outils de display (displayLength) Done
-// + Mettre en place la visualisation (côtes ...) pour les coordonnées cylindriques Done
-// + Changement du mode de représentation (côtes) pour le cas absolu Half done
-// + Dump pour les coordonnées cylindriques et
-// report des modifs sur les autres types de coordonnées Done
-// + Correction BUG coordonées cylindriques relatives --> la hauteur est absolue Done
-// + Améliorer rendu des cotes pour coordonées cylindriques (tailles relatives Done
-// de la cote rayon et de la cote hauteur)
-// + Prendre en compte les remarques de Raphaël Done
-// + Traductions Done
-// + Doc
+// Avoid duplication of angle coordinates in cylindrical mode
+// Check spherical mode in absolute
enum
{
bool& myLock;
};
+#if OCC_VERSION_LARGE > 0x06050300
+DEFINE_STANDARD_HANDLE(AIS_Text, AIS_InteractiveObject)
+
+class AIS_Text:public AIS_InteractiveObject
+{
+public:
+ // CASCADE RTTI
+ DEFINE_STANDARD_RTTI(AIS_Text );
+
+ AIS_Text(){};
+
+ AIS_Text
+ (
+ const TCollection_ExtendedString& , const gp_Pnt& ,
+ Quantity_Color color,
+ Standard_Integer aHJust,
+ Standard_Integer aVJust ,
+ Standard_Real Angle ,
+ Standard_Boolean Zoom ,
+ Standard_Real Height,
+ Font_FontAspect FontAspect,
+ Standard_CString Font
+ );
+
+private:
+
+ void Compute ( const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
+ const Handle(Prs3d_Presentation)& aPresentation,
+ const Standard_Integer aMode);
+
+ void ComputeSelection ( const Handle(SelectMgr_Selection)& aSelection,
+ const Standard_Integer aMode){} ;
+
+protected:
+ TCollection_ExtendedString aText;
+ gp_Pnt aPosition;
+ Standard_Real Red;
+ Standard_Real Green;
+ Standard_Real Blue;
+ Standard_Real aAngle;
+ Standard_Real aHeight;
+ Standard_Boolean aZoomable;
+ Quantity_Color aColor;
+ Standard_CString aFont;
+ Font_FontAspect aFontAspect;
+ Graphic3d_HorizontalTextAlignment aHJustification;
+ Graphic3d_VerticalTextAlignment aVJustification;
+};
+
+IMPLEMENT_STANDARD_HANDLE(AIS_Text, AIS_InteractiveObject)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_Text, AIS_InteractiveObject)
+
+AIS_Text::AIS_Text( const TCollection_ExtendedString& text, const gp_Pnt& position,
+ Quantity_Color color = Quantity_NOC_YELLOW,
+ Standard_Integer aHJust = Graphic3d_HTA_LEFT,
+ Standard_Integer aVJust = Graphic3d_VTA_BOTTOM,
+ Standard_Real angle = 0.0 ,
+ Standard_Boolean zoomable = Standard_False,
+ Standard_Real height = 16.,
+ Font_FontAspect fontAspect = Font_FA_Regular,
+ Standard_CString font = "Courier")
+{
+ aText = text;
+ aPosition = position;
+ aHJustification = Graphic3d_HorizontalTextAlignment(aHJust);
+ aVJustification = Graphic3d_VerticalTextAlignment(aVJust);
+ aAngle = angle;
+ aZoomable = zoomable;
+ aHeight = height;
+ aColor = color;
+ aFontAspect = fontAspect;
+ aFont = font;
+};
+
+void AIS_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
+ const Handle(Prs3d_Presentation)& aPresentation,
+ const Standard_Integer aMode)
+{
+
+ aPresentation->Clear();
+
+ Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
+
+ asp->SetFont(aFont);
+ asp->SetColor(aColor);
+ asp->SetHeight(aHeight); // I am changing the myHeight value
+
+ asp->SetHorizontalJustification(aHJustification);
+ asp->SetVerticalJustification(aVJustification);
+ asp->Aspect()->SetTextZoomable(aZoomable);
+ asp->Aspect()->SetTextAngle(aAngle);
+ asp->Aspect()->SetTextFontAspect(aFontAspect);
+ Prs3d_Text::Draw(aPresentation, asp, aText, aPosition);
+};
+#endif // OCC_VERSION_LARGE > 0x06050300
+
+bool isSame (double d1, double d2)
+{
+ return Abs(d1 - d2) <= Precision::Confusion();
+}
+
//=================================================================================
// class : EntityGUI_3DSketcherDlg()
// purpose : Constructs a EntityGUI_3DSketcherDlg which is a child of 'parent', with the
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
myAnglePrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
myLengthPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+#if OCC_VERSION_LARGE > 0x06050300
+ myTextPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+#endif // OCC_VERSION_LARGE > 0x06050300
localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
myRedoList.clear();
myLengthIORedoList.Clear();
myAngleIORedoList.Clear();
+ myTextIORedoList.Clear();
if (myCoordType == 0 && myMode == 1) // RELATIVE CARTESIAN COORDINATES
{
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true);
removeLastIOFromPrs();
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
if (isAngleVisible)
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from list
myPointsList.removeLast();
SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true);
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true);
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true);
restoreLastIOToPrs();
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs);
if (isAngleVisible)
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs);
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from redo list
myRedoList.removeLast();
myAngleIORedoList.Prepend(anIOList.First()); // Store last prepended Angle IO in redo list
myAnglePrs->RemoveFirst(); // Remove it from myAnglePrs
}
+ for (int t = 0; t<Last.T; t++)
+ {
+ myTextPrs->GetObjects(anIOList);
+ myTextIORedoList.Prepend(anIOList.First()); // Store last prepended Text IO in redo list
+ myTextPrs->RemoveFirst(); // Remove it from myTextPrs
+ }
}
//=================================================================================
myAnglePrs->PrependObject(myAngleIORedoList.First()); // Restore last removed IO
myAngleIORedoList.RemoveFirst(); // Remove it from redo list
}
+ for (int t = 0; t<LastDeleted.T; t++)
+ {
+ myTextPrs->PrependObject(myTextIORedoList.First()); // Restore last removed IO
+ myTextIORedoList.RemoveFirst(); // Remove it from redo list
+ }
}
//=================================================================================
// Update point presentation type
xyz.A = myPrsType.A; // Number of angle diomensions
xyz.L = myPrsType.L; // Number of length dimensions
+ xyz.T = myPrsType.T; // Number of text objects
return xyz;
}
gp_Vec Vec1(P1,P2);
gp_Vec Vec2(P1,P3);
- gp_Vec Vec3 = Vec1;
gp_Dir aNormal; // Normal defining the plane of the presentation
if (withAngle) // If one angle
{
- switch(myOrientation)
+ // Transformation from the current coordinate system
+ // to the reference coordinate system
+ gp_Trsf aTransform = toReferenceSystem (P1);
+ gp_Dir N1 = gp::DZ();
+ gp_Dir N2 = gp::DY();
+ N1.Transform(aTransform);
+ N2.Transform(aTransform);
+
+ if (Vec1.CrossMagnitude(N1) > Precision::Confusion())
{
- case OXY:
- {
- if (Vec1.CrossMagnitude(gp::DZ()) > Precision::Confusion())
- aNormal = gp::DZ().Crossed(gp_Dir(Vec1)); // --> the plane is orthogonal to the angle presentation
- else // plane and contains the current edge
- aNormal = gp::DY();
-
- if (twoAngles) // If two angles
- {
- gp_XYZ Vec1_XY(Vec1.X(),Vec1.Y(),0.0);// --> define Vec3 as the projection of the current
- Vec3 = gp_Vec(Vec1_XY); // edge on the plane chosen for the first angle
- }
- break;
- }
- case OYZ:
- {
- if (Vec1.CrossMagnitude(gp::DX()) > Precision::Confusion())
- aNormal = gp::DX().Crossed(gp_Dir(Vec1));
- else
- aNormal = gp::DZ();
-
- if (twoAngles)
- {
- gp_XYZ Vec1_YZ(0.0,Vec1.Y(),Vec1.Z());
- Vec3 = gp_Vec(Vec1_YZ);
- }
- break;
- }
- case OXZ:
- {
- if (Vec1.CrossMagnitude(gp::DY()) > Precision::Confusion())
- aNormal = gp::DY().Crossed(gp_Dir(Vec1));
- else
- aNormal = gp::DZ();
-
- if (twoAngles)
- {
- gp_XYZ Vec1_XZ(Vec1.X(),0.0,Vec1.Z());
- Vec3 = gp_Vec(Vec1_XZ);
- }
- break;
- }
+ // The plane is orthogonal to the angle presentation plane
+ // and contains the current edge
+ aNormal = N1.Crossed(gp_Dir(Vec1));
}
-
- if(twoAngles // If two angles
- && Abs(Vec1.CrossMagnitude(Vec3)) > Precision::Confusion())
+ else
+ aNormal = N2;
+
+ if (twoAngles)
{
- aNormal = gp_Dir(Vec1.Crossed(Vec3));// --> set the normal as the cross product of
- } // the current edge with its projection
- } // it ensures that the dimension changes
- // side when the angle becomes negative
+ gp_Vec V = Vec1.Transformed(aTransform.Inverted());
+ gp_Vec Vec3(V.X(),V.Y(),0.0);
+
+ // Express the coordinates in the refernce coordinate system (OXY)
+ Vec3.Transform(aTransform);
+ if(Abs(Vec1.CrossMagnitude(Vec3)) > Precision::Confusion())
+ {
+ // set the normal as the cross product of the current edge with its projection
+ // it ensures that the dimension changes side when the angle becomes negative
+ aNormal = gp_Dir(Vec1.Crossed(Vec3));
+ }
+ }
+ }
else
{
// Check colinearity
Vec2 = gp_Vec(gp::DY());
}
}
- aNormal = gp_Dir(Vec1.Crossed(Vec2)); // If no angles --> the plane is the one formed by
- } // the last edge and the current one
+ // If no angles, the plane is the one formed by the last edge and the current one
+ aNormal = gp_Dir(Vec1.Crossed(Vec2));
+ }
return aNormal;
}
//================================================================
// Function : displayDimensions( bool store )
-// Purpose : Method for displaying dimensions if store = true
+// Purpose : Method for displaying dimensions. If store = true
// the presentation is stored in a list
//================================================================
void EntityGUI_3DSketcherDlg::displayDimensions (bool store)
XYZ Last = getLastPoint();
XYZ Current = getCurrentPoint();
- gp_Pnt P0(Last.x,Last.y,Last.z);
+ gp_Pnt Last_Pnt(Last.x,Last.y,Last.z);
+
+ gp_Pnt P0 = Last_Pnt;
+ gp_Pnt Origin = gp::Origin();
if (myMode == 0) // Absolute coordinates
- P0=gp::Origin();
+ P0 = Origin;
+
gp_Pnt Current_Pnt(Current.x,Current.y,Current.z);
gp_Pnt P1, P2;
+
+ // Check if last end current point are coincident
+ if (Last_Pnt.IsEqual(Current_Pnt, 1e-7))
+ return;
+
gp_Dir aNormal = getPresentationPlane();
if (myCoordType == 0)
{
- if((( Abs(Last.x-Current.x) <= Precision::Confusion() &&
- Abs(Last.y-Current.y) <= Precision::Confusion() ) ||
- ( Abs(Last.x-Current.x) <= Precision::Confusion() &&
- Abs(Last.z-Current.z) <= Precision::Confusion() ) ||
- ( Abs(Last.y-Current.y) <= Precision::Confusion() &&
- Abs(Last.z-Current.z) <= Precision::Confusion() ))&&
- myMode == 1)
- {
- // For better colocation of dimensions if only one coordinate changes (aNormal is a better choice)
- displayLength(P0, Current_Pnt, aNormal, store);
- }
- else
+ bool oneDimensionalMove = (isSame(Last_Pnt.X(), Current_Pnt.X()) &&
+ isSame(Last_Pnt.Y(), Current_Pnt.Y()) ) ||
+ (isSame(Last_Pnt.Y(), Current_Pnt.Y()) &&
+ isSame(Last_Pnt.Z(), Current_Pnt.Z()) ) ||
+ (isSame(Last_Pnt.X(), Current_Pnt.X()) &&
+ isSame(Last_Pnt.Z(), Current_Pnt.Z()) );
+
+ if (myMode == 0)
{
- displayLength(gp_Pnt(P0.X(),Current.y,P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ().Reversed(), store);
- displayLength(gp_Pnt(Current.x,P0.Y(),P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ(), store);
- displayLength(gp_Pnt(Current.x,Current.y,P0.Z()), Current_Pnt, gp::DX(), store);
+ std::string aCoordText = "( " + doubleToString(Current_Pnt.X()) +
+ ", " + doubleToString(Current_Pnt.Y()) +
+ ", " + doubleToString(Current_Pnt.Z()) + " )";
+ displayText(aCoordText, Current_Pnt, store);
+ }
+ else
+ {
+ if (oneDimensionalMove)
+ {
+ // For better colocation of dimensions if only one coordinate changes (aNormal is a better choice)
+ displayLength(P0, Current_Pnt, aNormal, store);
+ }
+ else
+ {
+ displayLength(gp_Pnt(P0.X(),Current.y,P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ().Reversed(), store);
+ displayLength(gp_Pnt(Current.x,P0.Y(),P0.Z()), gp_Pnt(Current.x,Current.y,P0.Z()), gp::DZ(), store);
+ displayLength(gp_Pnt(Current.x,Current.y,P0.Z()), Current_Pnt, gp::DX(), store);
+ }
}
}
else if (myCoordType == 1) // ANGLES
double anAngle1 = GroupAngles->SpinBox_DA->value();
double aLength = GroupAngles->SpinBox_DL->value();
- switch(myOrientation)
- {
- case OXY:
- {
- P1 = gp_Pnt(P0.X() + aLength,P0.Y(),P0.Z()); // X direction
- P2 = gp_Pnt(P0.X() + aLength * cos(anAngle1 * M_PI / 180.),
- P0.Y() + aLength * sin(anAngle1 * M_PI / 180.),
- P0.Z());
- break;
- }
- case OYZ:
- {
- P1 = gp_Pnt(P0.X(), P0.Y() + aLength,P0.Z()); // Y direction
- P2 = gp_Pnt(P0.X(),
- P0.Y() + aLength * cos(anAngle1 * M_PI / 180.),
- P0.Z() + aLength * sin(anAngle1 * M_PI / 180.));
- break;
- }
- case OXZ:
- {
- P1 = gp_Pnt(P0.X() + aLength,P0.Y(),P0.Z()); // X direction
- P2 = gp_Pnt(P0.X() + aLength * cos(anAngle1 * M_PI / 180.) ,
- P0.Y(),
- P0.Z() + aLength * sin(anAngle1 * M_PI / 180.));
- break;
- }
- }
+ // Set the coordinates in the current coordinate system
+ P1.SetCoord( aLength, 0.0, 0.0); // X direction
+ P2.SetCoord( aLength * cos(anAngle1 * M_PI / 180. ),
+ aLength * sin(anAngle1 * M_PI / 180. ),
+ 0.0);
+
+ // Express the coordinates in the refernce coordinate system (OXY)
+ gp_Trsf aTranform = toReferenceSystem(P0);
+ P1.Transform(aTranform);
+ P2.Transform(aTranform);
+ P1.Translate(Origin, P0);
+ P2.Translate(Origin, P0);
- if(!cylindrical)
- displayLength(P0, Current_Pnt, aNormal, store);
if(myMode !=0 || !store)
displayAngle(anAngle1, P0, P1, P2, store);
+ else
+ {
+ std::string anAngleText = doubleToString(anAngle1) + " deg.";
+ displayText(anAngleText, Current_Pnt, store);
+ }
if(spherical)
{
double anAngle2 = GroupAngles->SpinBox_DA2->value();
displayAngle(anAngle2, P0, P2, Current_Pnt, store);
+ displayLength(P0, Current_Pnt, aNormal, store);
}
- if(cylindrical)
- {
+ else
+ {
+ bool sameRadius = isSame ( radius(Last_Pnt), radius(Current_Pnt) );
+ bool sameHeight = isSame ( height(Last_Pnt), height(Current_Pnt) );
+
gp_Vec aVec(P2, Current_Pnt);
- if (myMode == 0)
+
+ if (myMode == 0 && !sameRadius)
+ {
displayLength(P0.Translated(aVec), P2.Translated(aVec), aNormal, store); // Radius
- else
+ }
+ else if (myMode == 1)
displayLength(P0, P2, aNormal, store);
- displayLength(P2, Current_Pnt, aNormal.Reversed(), store); // Height
+
+ if ( cylindrical &&
+ (myMode == 1 || !sameHeight) )
+ displayLength(P2, Current_Pnt, aNormal.Reversed(), store); // Height
}
}
}
}
}
+//================================================================
+// Function : displayText()
+// Purpose : Method for displaying length dimensions for a segment
+// creation step
+//================================================================
+void EntityGUI_3DSketcherDlg::displayText ( std::string theText,
+ gp_Pnt P,
+ bool store )
+{
+#if OCC_VERSION_LARGE > 0x06050300
+ SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+
+ Handle(AIS_Text) anIO = new AIS_Text(TCollection_ExtendedString(theText.c_str()), P);
+
+ if (store)
+ {
+ // Erase length dimensions presentation
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true);
+ myTextPrs->PrependObject(anIO);
+
+ // Display modified presentation
+ ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
+
+ // Update dimension presentation text count for later undo / redo
+ myPrsType.T += 1;
+ }
+ else
+ {
+ SOCC_Prs* aSPrs = dynamic_cast<SOCC_Prs*>
+ (((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
+ if (aSPrs)
+ {
+ aSPrs->PrependObject(anIO);
+ GEOMBase_Helper::displayPreview(aSPrs, true, true);
+ }
+ }
+#endif // OCC_VERSION_LARGE > 0x06050300
+}
+
//================================================================
// Function : createAISLengthDimension()
// Purpose : Method for creation of a length dimension object
double aLength = P0.Distance(P1);
// Check input data
- if (Abs(theAngle - 90.0) < Precision::Angular() ||
+ if (Abs(theAngle) < Precision::Angular() ||
aLength < Precision::Confusion())
return NULL;
return QString::number(num, format, digNum).toStdString();
}
+
+//================================================================
+// Function : toReferenceSystem ()
+// Purpose :
+//================================================================
+gp_Trsf EntityGUI_3DSketcherDlg::toReferenceSystem(gp_Pnt origin) const
+{
+ gp_Trsf T; // Identity transformation
+ gp_Ax3 reference_system; // OXY
+ reference_system.SetLocation(origin);
+
+ gp_Ax3 current_system = reference_system;
+ switch (myOrientation)
+ {
+ case OYZ:
+ {
+ current_system = gp_Ax3(origin, gp::DX(), gp::DY());
+ break;
+ }
+ case OXZ:
+ {
+ current_system = gp_Ax3(origin, gp::DY().Reversed(), gp::DX());
+ break;
+ }
+ }
+
+ T.SetTransformation( current_system, reference_system );
+
+ return T;
+}
+
+//================================================================
+// Function : toCurrentSystem ()
+// Purpose :
+//================================================================
+gp_Trsf EntityGUI_3DSketcherDlg::toCurrentSystem(gp_Pnt origin) const
+{
+ return toReferenceSystem(origin).Inverted();
+}
+
+//================================================================
+// Function : radius (gp_Pnt) const
+// Purpose :
+//================================================================
+double EntityGUI_3DSketcherDlg::radius (gp_Pnt thePnt) const
+{
+ // Get the point coordinates in the current coordinates system
+ gp_Trsf aTrsf = toCurrentSystem(gp::Origin());
+ gp_Pnt aPnt = thePnt.Transformed(aTrsf);
+
+ double radius = sqrt(aPnt.X()*aPnt.X() + aPnt.Y()*aPnt.Y());
+ return radius;
+}
+
+//================================================================
+// Function : height (gp_Pnt) const
+// Purpose :
+//================================================================
+double EntityGUI_3DSketcherDlg::height (gp_Pnt thePnt) const
+{
+ // Get the point coordinates in the current coordinates system
+ gp_Trsf aTrsf = toCurrentSystem(gp::Origin());
+ gp_Pnt aPnt = thePnt.Transformed(aTrsf);
+
+ return aPnt.Z();
+}
# define DBL_DIGITS_DISPLAY 16
#endif // COORD_MIN
+// For convenience
+bool isSame (double d1, double d2);
+
//=================================================================================
// class : EntityGUI_Dlg
// purpose :
struct XYZ
{
- XYZ() { x = y = z = 0.0; command = params = ""; L=A=0; }
+ XYZ() { x = y = z = 0.0; command = params = ""; L=A=T=0; }
double x, y, z; // for preview only
- int L, A; // for preview only
+ int L, A, T; // for preview only
QString command;
QString params;
};
struct prsType
{
- prsType(){L=A=0;}
+ prsType(){L=A=T=0;}
int L;
int A;
+ int T;
};
typedef QList<XYZ> XYZList;
gp_Dir theNormal,
bool store = false);
+ void displayText(std::string theText,
+ gp_Pnt P,
+ bool store = false);
+
void displayTrihedron( int );
void displayDimensions(bool store = false);
std::string doubleToString( double );
+ gp_Trsf toReferenceSystem(gp_Pnt origin) const;
+ gp_Trsf toCurrentSystem(gp_Pnt origin) const;
+
void removeLastIOFromPrs();
void restoreLastIOToPrs();
+
+ double radius(gp_Pnt) const;
+ double height(gp_Pnt) const;
+ double longitude(gp_Pnt) const;
+ double latitude(gp_Pnt) const;
private:
XYZList myPointsList;
XYZList myRedoList;
AIS_ListOfInteractive myLengthIORedoList;
AIS_ListOfInteractive myAngleIORedoList;
+ AIS_ListOfInteractive myTextIORedoList;
prsType myPrsType;
EntityGUI_3Spin* Group3Spin;
GeometryGUI* myGeometryGUI;
SOCC_Prs* myAnglePrs;
SOCC_Prs* myLengthPrs;
+ SOCC_Prs* myTextPrs;
private slots:
void ClickOnOk();
#include <ShapeFix_Edge.hxx>
#include <Geom_Curve.hxx>
#include <Geom2d_Curve.hxx>
+#include <GProp_GProps.hxx>
+#include <BRepGProp.hxx>
//=======================================================================
if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
gp_Sphere sp = aSphere->Sphere();
+ //modified by jgv, 12.11.2012 for issue 21777//
+ Standard_Real Radius = sp.Radius();
+ Standard_Real HalfArea = 2.*M_PI*Radius*Radius;
+ GProp_GProps Properties;
+ BRepGProp::SurfaceProperties(aFace, Properties);
+ Standard_Real anArea = Properties.Mass();
+ Standard_Real AreaTol = Radius*Radius*1.e-6;
+ if (anArea > HalfArea - AreaTol) //no chance to avoid singularity
+ return Standard_False;
+ ///////////////////////////////////////////////
gp_Ax3 ax3 = sp.Position();
if(Abs(Vmax-Vmin) < PI2) {
gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
const Standard_Integer ,
NMTTools_IndexedDataMapOfIndexedMapOfInteger& );
-//modified by NIZNHY-PKV Thu Feb 16 12:24:52 2012f
static
Standard_Boolean IsClosed(const TopoDS_Edge& ,
- const TopoDS_Face& );
-//modified by NIZNHY-PKV Thu Feb 16 12:24:56 2012t
+ const TopoDS_Face&,
+ Standard_Boolean& );
//=======================================================================
//function : FillImagesFaces
const Handle(IntTools_Context)& aCtx= pPF->Context();
//
Standard_Boolean bToReverse, bIsClosed, bIsDegenerated;
+ Standard_Boolean bFlagClosed;
Standard_Integer i, aNb, aNbF, nF;
TopTools_MapOfShape aMFence;
TColStd_IndexedMapOfInteger aMFP;
}
//
bIsDegenerated=BRep_Tool::Degenerated(aE);
- //modified by NIZNHY-PKV Wed Mar 07 07:46:09 2012f
- bIsClosed=IsClosed(aE, aF);
- //bIsClosed=BRep_Tool::IsClosed(aE, aF);
- //modified by NIZNHY-PKV Wed Mar 07 07:46:13 2012t
+ bIsClosed=IsClosed(aE, aF, bFlagClosed);
//
const TopTools_ListOfShape& aLIE=myImages.Image(aE);
aIt.Initialize(aLIE);
aWES.AddStartElement(aSp);
}
continue;
- }// if (aMFence.Add(aSp))
+ }// if (bIsClosed){
+ //
+ //modified by NIZNHY-PKV Wed Nov 28 13:50:34 2012f
+ if (!bIsClosed && bFlagClosed) {
+ if (!BRep_Tool::IsClosed(aSp, aF)){
+ BOPTools_Tools3D::DoSplitSEAMOnFace(aSp, aF);
+ }
+ }
+ //modified by NIZNHY-PKV Wed Nov 28 13:50:36 2012t
+ //
//
aSp.Orientation(anOriE);
bToReverse=BOPTools_Tools3D::IsSplitToReverse1(aSp, aE, aCtx);
//purpose :
//=======================================================================
Standard_Boolean IsClosed(const TopoDS_Edge& aE,
- const TopoDS_Face& aF)
+ const TopoDS_Face& aF,
+ Standard_Boolean& bFlag)
{
Standard_Boolean bRet;
//
bRet=BRep_Tool::IsClosed(aE, aF);
+ bFlag=bRet;
if (bRet) {
Standard_Integer iCnt;
TopoDS_Shape aE1;
#include <GEOMAlgo_PassKey.hxx>
#include <GEOMAlgo_DataMapOfPassKeyInteger.hxx>
#include <GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger.hxx>
+//
+#include <gp_Dir2d.hxx>
+#include <gp_Pnt2d.hxx>
+#include <Geom2d_Line.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <HatchGen_Domain.hxx>
+#include <Geom2dHatch_Hatcher.hxx>
+#include <IntTools_Context.hxx>
+#include <BRepTools.hxx>
+#include <IntTools_Tools.hxx>
//=======================================================================
//function : GEOMAlgo_FinderShapeOn1
//purpose :
//=======================================================================
- GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2()
+GEOMAlgo_FinderShapeOn2::GEOMAlgo_FinderShapeOn2()
:
GEOMAlgo_ShapeAlgo()
{
//function : ~
//purpose :
//=======================================================================
- GEOMAlgo_FinderShapeOn2::~GEOMAlgo_FinderShapeOn2()
+GEOMAlgo_FinderShapeOn2::~GEOMAlgo_FinderShapeOn2()
{
}
//=======================================================================
//function : SetClsf
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf)
+void GEOMAlgo_FinderShapeOn2::SetClsf(const Handle(GEOMAlgo_Clsf)& aClsf)
{
myClsf=aClsf;
}
//function : Clsf
//purpose :
//=======================================================================
- const Handle(GEOMAlgo_Clsf)& GEOMAlgo_FinderShapeOn2::Clsf() const
+const Handle(GEOMAlgo_Clsf)& GEOMAlgo_FinderShapeOn2::Clsf() const
{
return myClsf;
}
//function : SetShapeType
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::SetShapeType(const TopAbs_ShapeEnum aType)
+void GEOMAlgo_FinderShapeOn2::SetShapeType(const TopAbs_ShapeEnum aType)
{
myShapeType=aType;
}
//function : ShapeType
//purpose :
//=======================================================================
- TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn2::ShapeType()const
+TopAbs_ShapeEnum GEOMAlgo_FinderShapeOn2::ShapeType()const
{
return myShapeType;
}
//function : SetState
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::SetState(const GEOMAlgo_State aState)
+void GEOMAlgo_FinderShapeOn2::SetState(const GEOMAlgo_State aState)
{
myState=aState;
}
//function : State
//purpose :
//=======================================================================
- GEOMAlgo_State GEOMAlgo_FinderShapeOn2::State() const
+GEOMAlgo_State GEOMAlgo_FinderShapeOn2::State() const
{
return myState;
}
//function : SetNbPntsMin
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::SetNbPntsMin(const Standard_Integer aNb)
+void GEOMAlgo_FinderShapeOn2::SetNbPntsMin(const Standard_Integer aNb)
{
myNbPntsMin=aNb;
}
//function : NbPntsMin
//purpose :
//=======================================================================
- Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMin()const
+Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMin()const
{
return myNbPntsMin;
}
//function : SetNbPntsMax
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::SetNbPntsMax(const Standard_Integer aNb)
+void GEOMAlgo_FinderShapeOn2::SetNbPntsMax(const Standard_Integer aNb)
{
myNbPntsMax=aNb;
}
//function : NbPntsMax
//purpose :
//=======================================================================
- Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMax()const
+Standard_Integer GEOMAlgo_FinderShapeOn2::NbPntsMax()const
{
return myNbPntsMax;
}
// function: Shapes
// purpose:
//=======================================================================
- const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn2::Shapes() const
+const TopTools_ListOfShape& GEOMAlgo_FinderShapeOn2::Shapes() const
{
Standard_Integer i, aNb;
TopTools_ListOfShape* pL;
//function : Perform
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::Perform()
+void GEOMAlgo_FinderShapeOn2::Perform()
{
myErrorStatus=0;
myWarningStatus=0;
//function : CheckData
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::CheckData()
+void GEOMAlgo_FinderShapeOn2::CheckData()
{
Standard_Integer iErr;
//
//function : ProcessVertices
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::ProcessVertices()
+void GEOMAlgo_FinderShapeOn2::ProcessVertices()
{
myErrorStatus=0;
//
//function : ProcessEdges
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::ProcessEdges()
+void GEOMAlgo_FinderShapeOn2::ProcessEdges()
{
myErrorStatus=0;
//
//function : ProcessFaces
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::ProcessFaces()
+void GEOMAlgo_FinderShapeOn2::ProcessFaces()
{
myErrorStatus=0;
//
//function : ProcessSolids
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::ProcessSolids()
+void GEOMAlgo_FinderShapeOn2::ProcessSolids()
{
myErrorStatus=0;
//
//function : InnerPoints
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF,
+void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Face& aF,
GEOMAlgo_ListOfPnt& aLP)
{
- myErrorStatus=0;
- //
Standard_Integer j, j1, j2, k, n[4], aNbLinks, aNx, aNb, iCnt;//, aNbMax, *pIds;
TopLoc_Location aLoc;
Handle(Poly_Triangulation) aTRF;
GEOMAlgo_DataMapOfPassKeyInteger aMPKI;
GEOMAlgo_DataMapIteratorOfDataMapOfPassKeyInteger aIt;
gp_Pnt aP, aP1, aP2;
+ //
+ myErrorStatus=0;
//
aLP.Clear();
//
iCnt=aIt.Value();
if (iCnt==1) {
const GEOMAlgo_PassKey& aPK=aIt.Key();
- //qf
- /*
- aNbMax=aPK.NbMax();
- pIds=(Standard_Integer*)aPK.Key();
- for (k=1; k<3; ++k) {
- aNx=*(pIds+aNbMax-k);
- aMBN.Add(aNx);
- }
- */
aNx=(Standard_Integer)aPK.Id(1);
aMBN.Add(aNx);
aNx=(Standard_Integer)aPK.Id(2);
aMBN.Add(aNx);
- //qt
+
}
}
//
//
aNb=aLP.Extent();
//
- if (!aNb && myNbPntsMin) {
- // try to fill it yourself
- Standard_Boolean bIsDone;
- Standard_Integer aN1, aN2;
+ //modified by NIZNHY-PKV Mon Sep 24 08:42:32 2012f
+ if (!aNb && myNbPntsMin) { // A
+ Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
+ Standard_Integer i, aNb, aIx, iErr, aNbDomains;
+ Standard_Real aUMin, aUMax, aVMin, aVMax, dU, aUx, aVx, aV1, aV2;
+ gp_Pnt aPx;
+ gp_Dir2d aD2D (0., 1.);
+ gp_Pnt2d aP2D;
+ Handle(Geom2d_Line) aL2D;
Handle(Geom_Surface) aS;
- GeomAdaptor_Surface aGAS;
- GeomAbs_SurfaceType aType;
+ TopoDS_Face aFF;
//
- aS=BRep_Tool::Surface(aF);
- aGAS.Load(aS);
- aType=aGAS.GetType();
- if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) {
- // inner links
- aNbLinks=aMPKI.Extent();
- aIt.Initialize(aMPKI);
- for (; aIt.More(); aIt.Next()) {
- iCnt=aIt.Value();
- if (iCnt>1) {
- // take the first having occured inner link
- // and discretize it
- const GEOMAlgo_PassKey& aPK=aIt.Key();
- //qf
- /*
- aNbMax=aPK.NbMax();
- pIds=(Standard_Integer*)aPK.Key();
- aN1=*(pIds+aNbMax-1);
- aN2=*(pIds+aNbMax-2);
- */
- //
- aN1=(Standard_Integer)aPK.Id(1);
- aN2=(Standard_Integer)aPK.Id(2);
- //qt
- aP1=aNodes(aN1).Transformed(aTrsf);
- aP2=aNodes(aN2).Transformed(aTrsf);
- //
- if (aType==GeomAbs_Cylinder) {
- Standard_Real aTolSM;
- gp_Cylinder aCyl;
- //
- aTolSM=1.523e-6;//~1.-cos(0.1 deg)
- aCyl=aGAS.Cylinder();
- if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) {
- continue;
- }
- }
- //
- BRepLib_MakeEdge aBME(aP1, aP2);
- bIsDone=aBME.IsDone();
- if (!bIsDone) {
- myErrorStatus=30; //can not obtain the line fron the link
- return;
- }
- //
- const TopoDS_Shape& aSx=aBME.Shape();
- const TopoDS_Edge& aE=TopoDS::Edge(aSx);
- //
- InnerPoints(aE, myNbPntsMin, aLP);
- break;
- }// if (iCnt>1)
- }// for (; aIt.More(); aIt.Next())
- }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
+ aFF=aF;
+ aFF.Orientation (TopAbs_FORWARD);
+ //
+ Geom2dHatch_Hatcher& aHatcher=myContext->Hatcher(aFF);
+ //
+ aS=BRep_Tool::Surface(aFF);
+ BRepTools::UVBounds(aFF, aUMin, aUMax, aVMin, aVMax);
+ //
+ aNb=myNbPntsMin+1;
+ dU=(aUMax-aUMin)/aNb;
+ for (i=1; i<aNb; ++i) {
+ aUx=aUMin+i*dU;
+ aP2D.SetCoord(aUx, 0.);
+ aL2D=new Geom2d_Line (aP2D, aD2D);
+ Geom2dAdaptor_Curve aHCur(aL2D);
+ //
+ aHatcher.ClrHatchings();
+ aIx=aHatcher.AddHatching(aHCur);
+ //
+ aHatcher.Trim(aIx);
+ bIsDone=aHatcher.TrimDone(aIx);
+ if (!bIsDone) {
+ myErrorStatus=42;
+ return;
+ }
+ //
+ aHatcher.ComputeDomains(aIx);
+ bIsDone=aHatcher.IsDone(aIx);
+ if (!bIsDone) {
+ continue;
+ }
+ //
+ aNbDomains=aHatcher.NbDomains(aIx);
+ for (j=1; j<=aNbDomains; ++j) {
+ const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, j) ;
+ // 1
+ bHasFirstPoint=aDomain.HasFirstPoint();
+ bHasSecondPoint=aDomain.HasSecondPoint();
+ if (!bHasFirstPoint || !bHasSecondPoint) {
+ continue;
+ }
+ // 2
+ aV1=aDomain.FirstPoint().Parameter();
+ aV2=aDomain.SecondPoint().Parameter();
+ aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+ // 3
+ aS->D0(aUx, aVx, aPx);
+ aLP.Append(aPx);
+ break;
+ }
+ }// for (i=1; i<aNb; ++i) {
}// if (!aNb && myNbPntsMin) {
}
//=======================================================================
//function : InnerPoints
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
+void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
GEOMAlgo_ListOfPnt& aLP)
{
myErrorStatus=0;
//function : InnerPoints
//purpose :
//=======================================================================
- void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
+void GEOMAlgo_FinderShapeOn2::InnerPoints(const TopoDS_Edge& aE,
const Standard_Integer aNbPntsMin,
GEOMAlgo_ListOfPnt& aLP)
{
// 30- can not obtain the line from the link
// 40- point can not be classified
// 41- invalid data for classifier
+// 42- can not compute hatching
+
+/*
+// A
+if (!aNb && myNbPntsMin) {
+ // try to fill it yourself
+ Standard_Boolean bIsDone;
+ Standard_Integer aN1, aN2;
+ Handle(Geom_Surface) aS;
+ GeomAdaptor_Surface aGAS;
+ GeomAbs_SurfaceType aType;
+ //
+ aS=BRep_Tool::Surface(aF);
+ aGAS.Load(aS);
+ aType=aGAS.GetType();
+ if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) {
+ // inner links
+ aNbLinks=aMPKI.Extent();
+ aIt.Initialize(aMPKI);
+ for (; aIt.More(); aIt.Next()) {
+ iCnt=aIt.Value();
+ if (iCnt>1) {
+ // take the first having occured inner link
+ // and discretize it
+ const GEOMAlgo_PassKey& aPK=aIt.Key();
+ //
+ aN1=(Standard_Integer)aPK.Id(1);
+ aN2=(Standard_Integer)aPK.Id(2);
+ //
+ aP1=aNodes(aN1).Transformed(aTrsf);
+ aP2=aNodes(aN2).Transformed(aTrsf);
+ //
+ if (aType==GeomAbs_Cylinder) {
+ Standard_Real aTolSM;
+ gp_Cylinder aCyl;
+ //
+ aTolSM=1.523e-6;//~1.-cos(0.1 deg)
+ aCyl=aGAS.Cylinder();
+ if (!GEOMAlgo_SurfaceTools::IsCoaxial(aP1, aP2, aCyl, aTolSM)) {
+ continue;
+ }
+ }
+ //
+ BRepLib_MakeEdge aBME(aP1, aP2);
+ bIsDone=aBME.IsDone();
+ if (!bIsDone) {
+ myErrorStatus=30; //can not obtain the line fron the link
+ return;
+ }
+ //
+ const TopoDS_Shape& aSx=aBME.Shape();
+ const TopoDS_Edge& aE=TopoDS::Edge(aSx);
+ //
+ InnerPoints(aE, myNbPntsMin, aLP);
+ break;
+ }// if (iCnt>1)
+ }// for (; aIt.More(); aIt.Next())
+ }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
+ }// if (!aNb && myNbPntsMin) {
+*/
// In the case of concave quadrangle, return IN if
// aP is OUT of only one concave side
double nbIn = 0.;
- for ( int i = 0; i < myPlanes.size(); ++i )
+ for ( size_t i = 0; i < myPlanes.size(); ++i )
{
TopAbs_State aSt;
GEOMAlgo_SurfaceTools::GetState(aP, myPlanes[i], myTolerance, aSt);
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType1,
const TopAbs_ShapeEnum aType2)
{
- Standard_Integer iRet, iT1, iT2, iX;
+ Standard_Integer iRet;
//
iRet=-1;
//
const TopTools_IndexedDataMapOfShapeListOfShape& aMVE,
const TopTools_IndexedDataMapOfShapeListOfShape& aMEV)
{
- Standard_Integer i, aNbVSD, aNbA, iRet;
- TopAbs_ShapeEnum aTypeS, aTypeA[2];
+ Standard_Integer aNbVSD, iRet;
TopExp_Explorer aExp, aExpA;
TopTools_MapOfShape aMFence, aMVSD;
TopTools_ListOfShape aLV;
Standard_Boolean bIsToReverse, bIsUPeriodic;
Standard_Integer iRet;
Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
- TopAbs_Orientation aOrE;
Handle(Geom_Surface) aS;
TopLoc_Location aLoc;
TopoDS_Shape aW, aWr;
</message>
<message>
<source>GEOM_SCALE_DIMENSIONS</source>
- <translation>Would you like to take into account the units?
-Otherwise the dimensions will be kept without modifications.</translation>
+ <translation>Take into account the units (%1) embedded to the file?
+Ignoring units will cause model scaling (as dimensions are supposed to
+be specified in meters).</translation>
</message>
<message>
<source>GEOM_ADVANCED</source>
<message>
<source>GEOM_SCALE_DIMENSIONS</source>
<translation>Voulez-vous prendre les unités en considération?
-Sinon les dimensions seront préservées sans modifications.</translation>
+Sinon le modèle sera mis à l'échèlle GEOM (unités interprétées comme des mètres).</translation>
</message>
<message>
<source>GEOM_ADVANCED</source>
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode("RestorePath: inappropriate arguments given");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ SetErrorCode("RestorePath: inappropriate arguments given");
return NULL;
}
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TFunction_Driver.hxx>
#include <TFunction_Logbook.hxx>
#include <TDF_Tool.hxx>
+#include <TNaming_CopyShape.hxx>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
return false;
}
+ // Copy source shape
+ TopoDS_Shape aShapeCopy;
+ TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
+ TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
+
Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
if (Te8.IsNull()) {
SetErrorCode("Impossible to glue faces of TShape");
}
TopoDS_Shape aShape = Te8->GetValue();
+ BRepCheck_Analyzer anAna (aShape, Standard_True);
+
+ if (!anAna.IsValid()) {
+ // Try to do gluing with the tolerance equal to maximal
+ // tolerance of vertices of the source shape.
+ Standard_Real aTolMax = -RealLast();
+
+ for (TopExp_Explorer ExV (aShapeCopy, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
+ TopoDS_Vertex aVertex = TopoDS::Vertex(ExV.Current());
+ Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+
+ if (aTol > aTolMax) {
+ aTolMax = aTol;
+ }
+ }
+
+ // Perform gluing
+ Te7->GetLastFunction()->SetValue(aShapeCopy);
+ Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
+
+ if (Te8.IsNull()) {
+ SetErrorCode("Impossible to glue faces of TShape");
+ return false;
+ }
+
+ aShape = Te8->GetValue();
+ }
+
theShape->GetLastFunction()->SetValue(aShape);
int theOrientation, int thePattern)
{
SetErrorCode(KO);
-
+
+ if (theOrientation != 1 &&
+ theOrientation != 2 &&
+ theOrientation != 3)
+ {
+ SetErrorCode("theOrientation must be 1(=OXY), 2(=OYZ) or 3(=OZX)");
+ return NULL;
+ }
//Add a new object
Handle(GEOM_Object) aShape = GetEngine()->AddObject(GetDocID(), GEOM_DIVIDEDDISK);
return NULL;
}
- Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, PyList_Size( coords ) * 3);
+ int lsize = PyList_Size( coords );
- if(PyList_Size( coords ) <= 0) {
+ if(lsize <= 0) {
SetErrorCode("Empty list of the points, please check input parameters !!!");
return NULL;
}
+ Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, lsize * 3);
+
int k=1;
- for ( Py_ssize_t i = 0; i< PyList_Size( coords ); ++i ) {
+ for ( Py_ssize_t i = 0; i < lsize; ++i ) {
PyObject* coord = PyList_GetItem( coords, i );
if (coord != NULL) {
for ( Py_ssize_t j = 0; j < PyList_Size(coord); ++j) {
GEOMImpl_IPolyline aCI (aFunction);
- aCI.SetLength(PyList_Size( coords ));
+ aCI.SetLength(lsize);
aCI.SetConstructorType(COORD_CONSTRUCTOR);
aCI.SetIsClosed(false);
aCI.SetCoordinates(aCoordsArray);
GEOMImpl_ISpline aCI (aFunction);
- aCI.SetLength(PyList_Size( coords ));
+ aCI.SetLength(lsize);
aCI.SetConstructorType(COORD_CONSTRUCTOR);
aCI.SetIsClosed(false);
aCI.SetCoordinates(aCoordsArray);
GEOMImpl_ISpline aCI (aFunction);
aCI.SetConstructorType(COORD_CONSTRUCTOR);
- aCI.SetLength(PyList_Size( coords ));
+ aCI.SetLength(lsize);
aCI.SetIsClosed(false);
aCI.SetDoReordering(false);
aCI.SetCoordinates(aCoordsArray);
}
//Make a Python command
- if( theFormatName != "IGES_UNIT" ) {
- GEOM::TPythonDump(aFunction) << result << " = geompy.ImportFile(\""
- << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
+ if (theFormatName != "IGES_UNIT") {
+ GEOM::TPythonDump pd (aFunction);
+ if (theFormatName == "BREP")
+ pd << result << " = geompy.ImportBREP(\"" << theFileName.ToCString() << "\")";
+ else if (theFormatName == "IGES")
+ pd << result << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\")";
+ else if (theFormatName == "IGES_SCALE")
+ pd << result << " = geompy.ImportIGES(\"" << theFileName.ToCString() << "\", True)";
+ else if (theFormatName == "STEP")
+ pd << result << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\")";
+ else if (theFormatName == "STEP_SCALE")
+ pd << result << " = geompy.ImportSTEP(\"" << theFileName.ToCString() << "\", True)";
+ else {
+ pd << result << " = geompy.ImportFile(\""
+ << theFileName.ToCString() << "\", \"" << theFormatName.ToCString() << "\")";
+ }
}
SetErrorCode(OK);
gp_Pnt P = BRep_Tool::Pnt(V);
double scale = P.X();
TCollection_AsciiString aUnitName = "UNIT_M";
- if( fabs(scale-0.01) < 1.e-6 )
+ if (fabs(scale-0.01) < 1.e-6)
aUnitName = "UNIT_CM";
- else if( fabs(scale-0.001) < 1.e-6 )
+ else if (fabs(scale-0.001) < 1.e-6)
aUnitName = "UNIT_MM";
//cout<<"IIO: aUnitName = "<<aUnitName.ToCString()<<endl;
SetErrorCode(aUnitName);
// jfa 21.08.2012 for mantis issue 21511 (STEP file units)
CORBA::String_var aUnits = aInsOp->ReadValue(fileN, fileT, "LEN_UNITS");
- TCollection_AsciiString aUnitsStr (aUnits.in());
+ QString aUnitsStr (aUnits.in());
bool needConvert = true;
- if (aUnitsStr.IsEmpty() || aUnitsStr == "UNIT_M")
+ if (aUnitsStr.isEmpty() || aUnitsStr == "M" || aUnitsStr.toLower() == "metre")
needConvert = false;
if (needConvert) {
if (i < fileNames.count() - 1) btns = btns | SUIT_MessageBox::YesToAll | SUIT_MessageBox::NoToAll;
igesAnswer = SUIT_MessageBox::question(app->desktop(),
"Question",//tr("WRN_WARNING"),
- tr("GEOM_SCALE_DIMENSIONS"),
+ tr("GEOM_SCALE_DIMENSIONS").arg(aUnitsStr),
btns | SUIT_MessageBox::Cancel,
SUIT_MessageBox::No);
switch (igesAnswer) {
(meshGroupList, newparams) = self._extractMeshGroups(command)
for meshGroup in meshGroupList:
# Get the geometrical primitive object
- groupSObj = self._studyEditor.study.FindObject(meshGroup)
+ if meshGroup.startswith('/'):
+ groupSObj = self._studyEditor.study.FindObjectByPath(meshGroup)
+ meshGroup = meshGroup.split('/')[-1]
+ pass
+ else:
+ groupSObj = self._studyEditor.study.FindObject(meshGroup)
+ pass
groupGeomObj = None
if groupSObj is not None:
groupGeomObj = \
from salome.kernel.logger import Logger
from salome.kernel import termcolor
-logger = Logger("__PAL_GEOM__.structelem.orientation", color = termcolor.RED)
+logger = Logger("salome.geom.structelem.orientation", color = termcolor.RED)
class Orientation1D:
coordinate system.
The parameters can be specified several times. In this case, only the
- first "VECT_Y" is taken into account, and the values of "ANGL_VRIL"
- are added to obtain the total rotation angle.
+ last "VECT_Y" or "ANGL_VRIL" is taken into account.
"""
+ if self._vectorYCoords is not None or self._angle != 0.0:
+ logger.warning('Orientation parameters are specified several '
+ 'times for the same mesh group, only the last '
+ 'parameter will be used')
mydict = params.copy()
if mydict.has_key("VECT_Y"):
newVecCoords = mydict.pop("VECT_Y")
- if self._vectorYCoords is None:
- logger.debug("Setting orientation vector Y to %s" %
+ logger.debug("Setting orientation vector Y to %s" %
str(newVecCoords))
- self._vectorYCoords = newVecCoords
- else:
- logger.warning('Orientation parameter "VECT_Y" is specified '
- 'several times for the same mesh group, vector'
- ' %s will be used' % str(self._vectorYCoords))
+ self._vectorYCoords = newVecCoords
+ self._angle = 0.0
if mydict.has_key("ANGL_VRIL"):
newAngle = mydict.pop("ANGL_VRIL")
- self._angle += newAngle
- logger.debug("Adding angle %f to orientation, new angle is %f." %
- (newAngle, self._angle))
+ logger.debug("Setting orientation angle to %f" % newAngle)
+ self._angle = newAngle
+ self._vectorYCoords = None
if len(mydict) > 0:
logger.warning("Invalid orientation parameter(s) (ignored): %s" %
str(mydict))
# Import
Import = geompy.ImportFile(fileExportImport, "BREP")
- id_Import = geompy.addToStudy(Import, "Import")
+ geompy.addToStudy(Import, "Import")
# ImportBREP, ImportIGES, ImportSTEP
ImportBREP = geompy.ImportBREP(fileExportImportBREP)
ImportIGES = geompy.ImportIGES(fileExportImportIGES)
ImportSTEP = geompy.ImportSTEP(fileExportImportSTEP)
- id_ImportBREP = geompy.addToStudy(ImportBREP, "ImportBREP")
- id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES")
- id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP")
+ geompy.addToStudy(ImportBREP, "ImportBREP")
+ geompy.addToStudy(ImportIGES, "ImportIGES")
+ geompy.addToStudy(ImportSTEP, "ImportSTEP")
+
+ # GetIGESUnit and GetSTEPUnit
+ if geompy.GetIGESUnit(fileExportImportIGES) != "M":
+ ImportIGES_scaled = geompy.ImportIGES(fileExportImportIGES, True)
+ geompy.addToStudy(ImportIGES_scaled, "ImportIGES_scaled")
+
+ if geompy.GetSTEPUnit(fileExportImportSTEP) != "M":
+ ImportSTEP_scaled = geompy.ImportSTEP(fileExportImportSTEP, True)
+ geompy.addToStudy(ImportSTEP_scaled, "ImportSTEP_scaled")
# Remove files for Export/Import testing
os.remove(fileExportImport)
# @param theFileName The file, containing the shape.
# @param theFormatName Specify format for the file reading.
# Available formats can be obtained with InsertOp.ImportTranslators() method.
- # If format 'IGES_SCALE' is used instead 'IGES' length unit will be
- # set to 'meter' and result model will be scaled.
+ # If format 'IGES_SCALE' is used instead of 'IGES' or
+ # format 'STEP_SCALE' is used instead of 'STEP',
+ # length unit will be set to 'meter' and result model will be scaled.
# @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportFile(self,theFileName, theFormatName):
+ def ImportFile(self, theFileName, theFormatName):
"""
Import a shape from the BREP or IGES or STEP file
(depends on given format) with given name.
Parameters:
theFileName The file, containing the shape.
theFormatName Specify format for the file reading.
- Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
- If format 'IGES_SCALE' is used instead 'IGES' length unit will be
- set to 'meter' and result model will be scaled.
+ Available formats can be obtained with geompy.InsertOp.ImportTranslators() method.
+ If format 'IGES_SCALE' is used instead of 'IGES' or
+ format 'STEP_SCALE' is used instead of 'STEP',
+ length unit will be set to 'meter' and result model will be scaled.
Returns:
New GEOM.GEOM_Object, containing the imported shape.
return anObj
## Deprecated analog of ImportFile()
- def Import(self,theFileName, theFormatName):
+ def Import(self, theFileName, theFormatName):
"""
Deprecated analog of geompy.ImportFile
"""
RaiseIfFailed("Import", self.InsertOp)
return anObj
- ## Shortcut to ImportFile() for BREP format
+ ## Shortcut to ImportFile() for BREP format.
+ # Import a shape from the BREP file with given name.
+ # @param theFileName The file, containing the shape.
+ # @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportBREP(self,theFileName):
+ def ImportBREP(self, theFileName):
"""
geompy.ImportFile(...) function for BREP format
+ Import a shape from the BREP file with given name.
+
+ Parameters:
+ theFileName The file, containing the shape.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
return self.ImportFile(theFileName, "BREP")
## Shortcut to ImportFile() for IGES format
+ # Import a shape from the IGES file with given name.
+ # @param theFileName The file, containing the shape.
+ # @param ignoreUnits If True, file length units will be ignored (set to 'meter')
+ # and result model will be scaled, if its units are not meters.
+ # If False (default), file length units will be taken into account.
+ # @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportIGES(self,theFileName):
+ def ImportIGES(self, theFileName, ignoreUnits = False):
"""
geompy.ImportFile(...) function for IGES format
+
+ Parameters:
+ theFileName The file, containing the shape.
+ ignoreUnits If True, file length units will be ignored (set to 'meter')
+ and result model will be scaled, if its units are not meters.
+ If False (default), file length units will be taken into account.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
+ if ignoreUnits:
+ return self.ImportFile(theFileName, "IGES_SCALE")
return self.ImportFile(theFileName, "IGES")
## Return length unit from given IGES file
+ # @param theFileName The file, containing the shape.
+ # @return String, containing the units name.
#
# @ref swig_Import_Export "Example"
- def GetIGESUnit(self,theFileName):
+ def GetIGESUnit(self, theFileName):
"""
- Return length unit from given IGES file
+ Return length units from given IGES file
+
+ Parameters:
+ theFileName The file, containing the shape.
+
+ Returns:
+ String, containing the units name.
"""
# Example: see GEOM_TestOthers.py
- anObj = self.InsertOp.ImportFile(theFileName, "IGES_UNIT")
- #RaiseIfFailed("Import", self.InsertOp)
- # recieve name using returned vertex
- UnitName = "M"
- if anObj.GetShapeType() == GEOM.VERTEX:
- vertices = [anObj]
- else:
- vertices = self.SubShapeAll(anObj,ShapeType["VERTEX"])
- if len(vertices)>0:
- p = self.PointCoordinates(vertices[0])
- if abs(p[0]-0.01) < 1.e-6:
- UnitName = "CM"
- elif abs(p[0]-0.001) < 1.e-6:
- UnitName = "MM"
- return UnitName
+ aUnitName = self.InsertOp.ReadValue(theFileName, "IGES", "LEN_UNITS")
+ return aUnitName
## Shortcut to ImportFile() for STEP format
+ # Import a shape from the STEP file with given name.
+ # @param theFileName The file, containing the shape.
+ # @param ignoreUnits If True, file length units will be ignored (set to 'meter')
+ # and result model will be scaled, if its units are not meters.
+ # If False (default), file length units will be taken into account.
+ # @return New GEOM.GEOM_Object, containing the imported shape.
#
# @ref swig_Import_Export "Example"
- def ImportSTEP(self,theFileName):
+ def ImportSTEP(self, theFileName, ignoreUnits = False):
"""
geompy.ImportFile(...) function for STEP format
+
+ Parameters:
+ theFileName The file, containing the shape.
+ ignoreUnits If True, file length units will be ignored (set to 'meter')
+ and result model will be scaled, if its units are not meters.
+ If False (default), file length units will be taken into account.
+
+ Returns:
+ New GEOM.GEOM_Object, containing the imported shape.
"""
# Example: see GEOM_TestOthers.py
+ if ignoreUnits:
+ return self.ImportFile(theFileName, "STEP_SCALE")
return self.ImportFile(theFileName, "STEP")
+ ## Return length unit from given IGES or STEP file
+ # @param theFileName The file, containing the shape.
+ # @return String, containing the units name.
+ #
+ # @ref swig_Import_Export "Example"
+ def GetSTEPUnit(self, theFileName):
+ """
+ Return length units from given STEP file
+
+ Parameters:
+ theFileName The file, containing the shape.
+
+ Returns:
+ String, containing the units name.
+ """
+ # Example: see GEOM_TestOthers.py
+ aUnitName = self.InsertOp.ReadValue(theFileName, "STEP", "LEN_UNITS")
+ return aUnitName
+
## Read a shape from the binary stream, containing its bounding representation (BRep).
# @note This method will not be dumped to the python script by DumpStudy functionality.
# @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
# Available formats can be obtained with InsertOp.ImportTranslators() method.
#
# @ref swig_Import_Export "Example"
- def Export(self,theObject, theFileName, theFormatName):
+ def Export(self, theObject, theFileName, theFormatName):
"""
Export the given shape into a file with given name.
RaiseIfFailed("LoadTexture", self.InsertOp)
return ID
- ## Get entry of the object
+ ## Get internal name of the object based on its study entry
+ # @note This method does not provide an unique identifier of the geometry object.
+ # @note This is internal function of GEOM component, though it can be used outside it for
+ # appropriate reason (e.g. for identification of geometry object).
# @param obj geometry object
# @return unique object identifier
# @ingroup l1_geompy_auxiliary
def getObjectID(self, obj):
"""
- Get entry of the object
+ Get internal name of the object based on its study entry.
+ Note: this method does not provide an unique identifier of the geometry object.
+ It is an internal function of GEOM component, though it can be used outside GEOM for
+ appropriate reason (e.g. for identification of geometry object).
Parameters:
obj geometry object
if (!aModel.IsNull()) {
aValue = aModel->GlobalSection().UnitName();
- if (!aValue.IsNull()) {
- Handle(TCollection_HAsciiString) aPrefix = new TCollection_HAsciiString ("UNIT_");
- aValue->Prepend(aPrefix);
- }
+ //if (!aValue.IsNull()) {
+ // Handle(TCollection_HAsciiString) aPrefix = new TCollection_HAsciiString ("UNIT_");
+ // aValue->Prepend(aPrefix);
+ //}
}
}
else {
#include <Geom_Curve.hxx>
#include <gp_Pnt.hxx>
-
-
-static
- Standard_Boolean IsValid(const TopoDS_Edge& aE,
- const TopoDS_Vertex& aV,
- const Standard_Real aTV1,
- const Standard_Real aTV2);
-
//=======================================================================
// function: PreparePaveBlocks
// purpose:
//=======================================================================
void NMTTools_CheckerSI::PreparePaveBlocks(const Standard_Integer nE)
{
- myIsDone=Standard_False;
- //
- // char buf[32]={"SR"};
- Standard_Boolean bIsValid;
+ //Standard_Boolean bIsValid;
Standard_Integer nV1, nV2, iErr;
Standard_Real aT1, aT2;
TopoDS_Edge aE;
TopoDS_Vertex aV1, aV2;
+ //
+ myIsDone=Standard_False;
//
BOPTools_ListOfPaveBlock& aLPB=mySplitShapesPool(myDS->RefEdge(nE));
// Edge
aV2=TopoDS::Vertex(myDS->Shape(nV2));
aT2=aPave2.Param();
//
+ //modified by NIZNHY-PKV Thu Nov 01 13:46:00 2012f
+ //w/a: http://salome.mantis.opencascade.com/view.php?id=21835
+ /*
bIsValid=Standard_True;
if (nV1==nV2) {
bIsValid=IsValid(aE, aV1, aT1, aT2);
if (!bIsValid) {
- //printf(" pb SR: nV nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2);
myStopStatus=1;
}
}
+ */
+ //modified by NIZNHY-PKV Thu Nov 01 13:46:09 2012t
//
IntTools_ShrunkRange aSR (aE, aV1, aV2, aRange, myContext);
iErr=aSR.ErrorStatus();
if (!aSR.IsDone()) {
- //printf(" pb SR: Done nE: %d nV1:( %d %15.10lf ) nV2:( %d %15.10lf )\n", nE, nV1, aT1, nV2, aT2);
aSR.SetShrunkRange(aRange);
- //throw BOPTColStd_Failure(buf) ;
}
else if (iErr!=6) {
CorrectShrunkRanges (0, aPave1, aSR);
} //for (; aPBIt.More(); aPBIt.Next())
myIsDone=Standard_True;
}
-
+//modified by NIZNHY-PKV Thu Nov 01 13:46:55 2012f
+//w/a: http://salome.mantis.opencascade.com/view.php?id=21835
+/*
//=======================================================================
//function : IsValid
//purpose :
}
return bRet;
}
+*/
+//modified by NIZNHY-PKV Thu Nov 01 13:47:07 2012t
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// File: STEPExport.cxx
// Created: Wed May 19 14:53:52 2004
// Author: Pavel TELKOV
-// <ptv@mutex.nnov.opencascade.com>
-//
+
#include "utilities.h"
#include <Basics_Utils.hxx>
extern "C"
{
-STEPEXPORT_EXPORT
+ STEPEXPORT_EXPORT
int Export(const TopoDS_Shape& theShape, const TCollection_AsciiString& theFileName)
{
MESSAGE("Export STEP into file " << theFileName.ToCString());
- try
- {
- // Set "C" numeric locale to save numbers correctly
- Kernel_Utils::Localizer loc;
+ try
+ {
+ // Set "C" numeric locale to save numbers correctly
+ Kernel_Utils::Localizer loc;
- IFSelect_ReturnStatus status ;
- //VRV: OCC 4.0 migration
- STEPControl_Writer aWriter;
- //VSR: 16/09/09: Convert to METERS
- Interface_Static::SetCVal("xstep.cascade.unit","M");
- Interface_Static::SetIVal("write.step.nonmanifold", 1);
-//JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep );
- status = aWriter.Transfer( theShape, STEPControl_AsIs );
- //VRV: OCC 4.0 migration
- if ( status == IFSelect_RetDone )
+ IFSelect_ReturnStatus status ;
+ //VRV: OCC 4.0 migration
+ STEPControl_Writer aWriter;
+ //VSR: 16/09/09: Convert to METERS
+ Interface_Static::SetCVal("xstep.cascade.unit","M");
+ Interface_Static::SetCVal("write.step.unit", "M");
+ Interface_Static::SetIVal("write.step.nonmanifold", 1);
+ //JFA: PAL6162 status = aWriter.Transfer( theShape, STEPControl_ManifoldSolidBrep );
+ status = aWriter.Transfer( theShape, STEPControl_AsIs );
+ //VRV: OCC 4.0 migration
+ if ( status == IFSelect_RetDone )
status = aWriter.Write( theFileName.ToCString() );
- // Return previous locale
- if ( status == IFSelect_RetDone )
- return 1;
- }
- catch(Standard_Failure)
- {
- //THROW_SALOME_CORBA_EXCEPTION("Exception catched in STEPExport", SALOME::BAD_PARAM);
- }
- return 0;
+ // Return previous locale
+ if ( status == IFSelect_RetDone )
+ return 1;
+ }
+ catch (Standard_Failure)
+ {
+ //THROW_SALOME_CORBA_EXCEPTION("Exception catched in STEPExport", SALOME::BAD_PARAM);
+ }
+ return 0;
}
}
TColStd_SequenceOfAsciiString anUnitSolidAngleNames;
aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames);
if (anUnitLengthNames.Length() > 0) {
+ aValue = new TCollection_HAsciiString( anUnitLengthNames.First() );
+ /*
TCollection_AsciiString aLenUnits = anUnitLengthNames.First();
if (aLenUnits == "millimetre")
- aValue = new TCollection_HAsciiString ("UNIT_MM");
+ aValue = new TCollection_HAsciiString ("MM");
else if (aLenUnits == "centimetre")
- aValue = new TCollection_HAsciiString ("UNIT_CM");
+ aValue = new TCollection_HAsciiString ("CM");
else if (aLenUnits == "metre")
- aValue = new TCollection_HAsciiString ("UNIT_M");
+ aValue = new TCollection_HAsciiString ("M");
else if (aLenUnits == "INCH")
- aValue = new TCollection_HAsciiString ("UNIT_INCH");
- // TODO
+ aValue = new TCollection_HAsciiString ("INCH");
+ // TODO (for other units than mm, cm, m or inch)
//else if (aLenUnits == "")
// aValue = new TCollection_HAsciiString ("");
// std::cout << ", " << anUnitLengthNames.Value(ii);
//std::cout << std::endl;
// tmp end
+ */
}
}
else {
Interface_Static::SetCVal("xstep.cascade.unit", "MM");
else if (aLenUnits == "centimetre")
Interface_Static::SetCVal("xstep.cascade.unit", "CM");
- else if (aLenUnits == "metre")
+ else if (aLenUnits == "metre" || aLenUnits.IsEmpty())
Interface_Static::SetCVal("xstep.cascade.unit", "M");
else if (aLenUnits == "INCH")
Interface_Static::SetCVal("xstep.cascade.unit", "INCH");
theError = "The file contains not supported units.";
return aResShape;
}
- // TODO
+ // TODO (for other units than mm, cm, m or inch)
//else if (aLenUnits == "")
- // Interface_Static::SetCVal("xstep.cascade.unit", "");
+ // Interface_Static::SetCVal("xstep.cascade.unit", "???");
}
}
else {
#include <ShHealOper_ChangeOrientation.hxx>
-#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_Copy.hxx>
-
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRep_Builder.hxx>
+#include <Geom_Curve.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopoDS_Iterator.hxx>
+#include <Geom_TrimmedCurve.hxx>
//=======================================================================
//function : ShHealOper_ChangeOrientation()
Standard_Boolean ShHealOper_ChangeOrientation::Perform()
{
BRep_Builder B;
- if (myInitShape.ShapeType() == TopAbs_SHELL) {
+ if (myInitShape.ShapeType() == TopAbs_SHELL)
+ {
myResultShape = myInitShape.EmptyCopied();
TopoDS_Iterator itr (myInitShape);
while (itr.More()) {
itr.Next();
}
}
- else if (myInitShape.ShapeType() == TopAbs_FACE) {
+ else if (myInitShape.ShapeType() == TopAbs_FACE)
+ {
myResultShape = myInitShape.EmptyCopied();
TopoDS_Iterator itr (myInitShape);
while (itr.More()) {
}
myResultShape.Reverse();
}
- else if ( myInitShape.ShapeType() == TopAbs_WIRE || myInitShape.ShapeType() == TopAbs_EDGE) {
- myResultShape = myInitShape.EmptyCopied();
- TopoDS_Iterator itr (myInitShape);
- while (itr.More()) {
- B.Add(myResultShape,itr.Value());
- itr.Next();
+ else if ( myInitShape.ShapeType() == TopAbs_WIRE || myInitShape.ShapeType() == TopAbs_EDGE)
+ {
+ TopTools_ListOfShape reversedEdges;
+ for ( TopExp_Explorer edgeIt( myInitShape, TopAbs_EDGE ); edgeIt.More(); edgeIt.Next() )
+ {
+ const TopoDS_Edge& edge = TopoDS::Edge( edgeIt.Current() );
+
+ double f,l;
+ Handle(Geom_Curve) curve = BRep_Tool::Curve( edge, f,l );
+ Handle(Geom_TrimmedCurve) tc = Handle(Geom_TrimmedCurve)::DownCast(curve);
+ if ( !tc.IsNull() ) curve = tc->BasisCurve();
+
+ f = curve->ReversedParameter( f );
+ l = curve->ReversedParameter( l );
+ curve = curve->Reversed();
+ reversedEdges.Prepend( BRepBuilderAPI_MakeEdge( curve, Min( f, l ), Max( f, l )));
}
- myResultShape.Reverse();
+ if ( myInitShape.ShapeType() == TopAbs_EDGE )
+ {
+ myResultShape = reversedEdges.First();
+ }
+ else
+ {
+ BRepBuilderAPI_MakeWire wire;
+ wire.Add( reversedEdges );
+ myResultShape = wire;
+ }
+ // myResultShape = myInitShape.EmptyCopied();
+ // TopoDS_Iterator itr (myInitShape);
+ // while (itr.More()) {
+ // B.Add(myResultShape,itr.Value());
+ // itr.Next();
+ // }
+ // myResultShape.Reverse();
}
- else {
+ else
+ {
BRepBuilderAPI_Copy Copy (myInitShape);
if (!Copy.IsDone()) return false;