mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 09:20:35 +05:00
CCAR: update with V5_1_main (28/09)
This commit is contained in:
parent
7f7c194649
commit
36168d4a96
@ -28,6 +28,7 @@ nodist_salomescript_DATA = VERSION
|
||||
|
||||
# python files
|
||||
dist_salomescript_PYTHON = \
|
||||
addvars2notebook_GEOM.py \
|
||||
geom_setenv.py
|
||||
|
||||
# distributed files
|
||||
|
50
bin/addvars2notebook_GEOM.py
Normal file
50
bin/addvars2notebook_GEOM.py
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
def addvars2notebook(filename, vars_and_values):
|
||||
stream = open(filename)
|
||||
lines = stream.readlines()
|
||||
stream.close()
|
||||
newlines = []
|
||||
for line in lines:
|
||||
if line.find("= geompy.") >= 0:
|
||||
name = line.split('=')[0]
|
||||
name = name.strip()
|
||||
vals = line
|
||||
fields = vals.split("(")
|
||||
if len(fields) == 2:
|
||||
begin = fields[0] + "("
|
||||
vals = fields[1]
|
||||
fields = vals.split(")")
|
||||
if len(fields) == 2:
|
||||
vals = fields[0]
|
||||
end = ")" + fields[1]
|
||||
vals = vals.split(',')
|
||||
newline = begin
|
||||
newvals = []
|
||||
for i in range(len(vals)):
|
||||
valname = name + "_val_%s"%(i+1)
|
||||
val = vals[i]
|
||||
vvv = val.strip()
|
||||
try:
|
||||
iii = int(vvv)
|
||||
vars_and_values.append([valname, val])
|
||||
val = val.replace(vvv, valname.__repr__())
|
||||
except ValueError:
|
||||
try:
|
||||
fff = float(vvv)
|
||||
vars_and_values.append([valname, val])
|
||||
val = val.replace(vvv, valname.__repr__())
|
||||
except ValueError:
|
||||
pass
|
||||
pass
|
||||
newvals.append(val)
|
||||
pass
|
||||
newline += ','.join(newvals)
|
||||
newline += end
|
||||
line = newline
|
||||
pass
|
||||
pass
|
||||
pass
|
||||
newlines.append(line)
|
||||
pass
|
||||
content = "".join(newlines)
|
||||
return content
|
14
configure.ac
14
configure.ac
@ -316,6 +316,13 @@ echo
|
||||
|
||||
CHECK_HTML_GENERATORS
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo testing sphinx
|
||||
echo ---------------------------------------------
|
||||
echo
|
||||
CHECK_SPHINX
|
||||
|
||||
echo
|
||||
echo ---------------------------------------------
|
||||
echo Testing Kernel
|
||||
@ -333,7 +340,7 @@ echo
|
||||
echo Configure
|
||||
|
||||
if test "${gui_ok}" = "yes"; then
|
||||
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok"
|
||||
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok sphinx_ok Kernel_ok gui_ok"
|
||||
elif test "${SalomeGUI_need}" != "no"; then
|
||||
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok"
|
||||
else
|
||||
@ -381,6 +388,7 @@ AC_OUTPUT([ \
|
||||
bin/Makefile \
|
||||
GEOM_version.h \
|
||||
doc/Makefile \
|
||||
doc/docutils/Makefile \
|
||||
doc/salome/Makefile \
|
||||
doc/salome/gui/Makefile \
|
||||
doc/salome/gui/GEOM/Makefile \
|
||||
@ -415,6 +423,8 @@ AC_OUTPUT([ \
|
||||
src/GEOM_I_Superv/Makefile \
|
||||
src/GEOM_SWIG/Makefile \
|
||||
src/GEOM_SWIG_WITHIHM/Makefile \
|
||||
src/GEOM_PY/Makefile \
|
||||
src/GEOM_PY/structelem/Makefile \
|
||||
src/GenerationGUI/Makefile \
|
||||
src/GroupGUI/Makefile \
|
||||
src/IGESExport/Makefile \
|
||||
@ -439,3 +449,5 @@ AC_OUTPUT([ \
|
||||
idl/Makefile \
|
||||
Makefile \
|
||||
])
|
||||
|
||||
AC_HACK_LIBTOOL
|
||||
|
@ -24,7 +24,7 @@
|
||||
# $Header$
|
||||
# source path
|
||||
#
|
||||
SUBDIRS = salome
|
||||
SUBDIRS = salome docutils
|
||||
|
||||
usr_docs:
|
||||
(cd salome && $(MAKE) $(AM_MAKEFLAGS) usr_docs)
|
||||
|
92
doc/docutils/Makefile.am
Normal file
92
doc/docutils/Makefile.am
Normal file
@ -0,0 +1,92 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
#
|
||||
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
pydocdir = $(docdir)/tui/GEOM/docutils
|
||||
|
||||
.PHONY : latex
|
||||
|
||||
if SPHINX_IS_OK
|
||||
|
||||
pydoc_DATA=html/index.html
|
||||
html/index.html:$(RSTFILES)
|
||||
make htm
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST+= html
|
||||
|
||||
SPHINXOPTS =
|
||||
SOURCEDIR = $(srcdir)
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
ALLSPHINXOPTS = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR)
|
||||
|
||||
SPHINX_PYTHONPATH = $(prefix)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(KERNEL_ROOT_DIR)/bin/salome:$(KERNEL_ROOT_DIR)/lib/python$(PYTHON_VERSION)/site-packages/salome:$(OMNIORB_ROOT)/lib/python$(PYTHON_VERSION)/site-packages
|
||||
|
||||
SPHINX_LD_LIBRARY_PATH = $(OMNIORB_ROOT)/lib
|
||||
|
||||
htm:
|
||||
mkdir -p html doctrees
|
||||
PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH}; \
|
||||
LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH}; \
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in html."
|
||||
|
||||
latex:
|
||||
mkdir -p latex doctrees
|
||||
PYTHONPATH=$(SPHINX_PYTHONPATH):${PYTHONPATH}; \
|
||||
LD_LIBRARY_PATH=$(SPHINX_LD_LIBRARY_PATH):${LD_LIBRARY_PATH}; \
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in latex."
|
||||
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
|
||||
"run these through (pdf)latex."
|
||||
|
||||
html:
|
||||
mkdir -p $@
|
||||
|
||||
RSTFILES= \
|
||||
index.rst \
|
||||
overview.rst \
|
||||
docapi.rst
|
||||
|
||||
EXTRA_DIST+= $(RSTFILES)
|
||||
|
||||
EXTRA_DIST+= \
|
||||
conf.py
|
||||
|
||||
install-data-local:
|
||||
$(INSTALL) -d $(pydocdir)
|
||||
if test -d "html"; then b=; else b="$(srcdir)/"; fi; \
|
||||
cp -rf $$b"html"/* $(pydocdir) ; \
|
||||
if test -f $$b"latex"/geompy.pdf; then cp -f $$b"latex"/geompy.pdf $(pydocdir) ; fi;
|
||||
|
||||
uninstall-local:
|
||||
chmod -R +w $(pydocdir)
|
||||
rm -rf $(pydocdir)/*
|
||||
|
||||
clean-local:
|
||||
-rm -rf html latex doctrees
|
||||
if test -d "html"; then rm -rf html ; fi
|
200
doc/docutils/conf.py
Normal file
200
doc/docutils/conf.py
Normal file
@ -0,0 +1,200 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
||||
#
|
||||
# yacs documentation build configuration file, created by
|
||||
# sphinx-quickstart on Fri Aug 29 09:57:25 2008.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
#
|
||||
# The contents of this file are pickled, so don't put values in the namespace
|
||||
# that aren't pickleable (module imports are okay, they're removed automatically).
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys, os
|
||||
|
||||
# If your extensions are in another directory, add it here. If the directory
|
||||
# is relative to the documentation root, use os.path.abspath to make it
|
||||
# absolute, like shown here.
|
||||
#sys.path.append(os.path.abspath('.'))
|
||||
|
||||
# General configuration
|
||||
# ---------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc']
|
||||
|
||||
# Uncomment the following line to build the links with Python documentation
|
||||
# (you might need to set http_proxy environment variable for this to work)
|
||||
#extensions += ['sphinx.ext.intersphinx']
|
||||
|
||||
# Intersphinx mapping to add links to modules and objects in the Python
|
||||
# standard library documentation
|
||||
intersphinx_mapping = {'http://docs.python.org': None}
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
source_encoding = 'utf-8'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'GEOM python packages'
|
||||
copyright = '2010 EDF R&D'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '5.1.4'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '5.1.4'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
language = 'en'
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of documents that shouldn't be included in the build.
|
||||
#unused_docs = []
|
||||
|
||||
# List of directories, relative to source directory, that shouldn't be searched
|
||||
# for source files.
|
||||
exclude_trees = ['.build','ref','images','CVS','.svn']
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
|
||||
# Options for HTML output
|
||||
# -----------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
html_theme = 'default'
|
||||
#html_theme = 'nature'
|
||||
#html_theme = 'agogo'
|
||||
#html_theme = 'sphinxdoc'
|
||||
#html_theme = 'omadoc'
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = ['themes']
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
#html_static_path = ['_static']
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
html_use_modindex = False
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, the reST sources are included in the HTML build as _sources/<name>.
|
||||
html_copy_source = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = ''
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'geompydoc'
|
||||
|
||||
|
||||
# Options for LaTeX output
|
||||
# ------------------------
|
||||
|
||||
# The paper size ('letter' or 'a4').
|
||||
latex_paper_size = 'a4'
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
latex_font_size = '10pt'
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, document class [howto/manual]).
|
||||
latex_documents = [
|
||||
('index', 'geompy.tex', 'Documentation of the GEOM python packages', 'EDF R\&D', 'manual')
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
latex_logo = '../salome/tui/images/head.png'
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = True
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#latex_preamble = ''
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
latex_use_modindex = False
|
43
doc/docutils/docapi.rst
Normal file
43
doc/docutils/docapi.rst
Normal file
@ -0,0 +1,43 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
Documentation of the programming interface (API)
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
This section describes the python packages and modules of the
|
||||
``salome.geom`` python package. The main part is generated from the
|
||||
code documentation included in source python files.
|
||||
|
||||
:mod:`salome.geom` -- Package containing the GEOM python utilities
|
||||
==================================================================
|
||||
|
||||
:mod:`geomtools` -- Tools to access GEOM engine and objects
|
||||
-----------------------------------------------------------
|
||||
|
||||
.. automodule:: salome.geom.geomtools
|
||||
:members:
|
||||
|
||||
:mod:`structelem` -- Structural elements package
|
||||
------------------------------------------------
|
||||
|
||||
.. automodule:: salome.geom.structelem
|
||||
|
||||
.. autoclass:: StructuralElementManager
|
||||
:members:
|
||||
|
||||
.. autoclass:: StructuralElement
|
||||
:members:
|
||||
|
||||
:mod:`structelem.parts` -- Structural element parts
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: salome.geom.structelem.parts
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
:mod:`structelem.orientation` -- Structural element orientation
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. automodule:: salome.geom.structelem.orientation
|
||||
:members:
|
||||
:undoc-members:
|
BIN
doc/docutils/images/salome-geom-structuralelements.png
Normal file
BIN
doc/docutils/images/salome-geom-structuralelements.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
14
doc/docutils/index.rst
Normal file
14
doc/docutils/index.rst
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
Documentation of the GEOM python packages
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
Main documentation
|
||||
==================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
overview.rst
|
||||
docapi.rst
|
||||
|
38
doc/docutils/overview.rst
Normal file
38
doc/docutils/overview.rst
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
General presentation of the GEOM python package
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
The GEOM python package essentially contains:
|
||||
|
||||
* The visualization of structural elements: a function to create
|
||||
geometrical 3D representations of mechanical models called
|
||||
"structural elements".
|
||||
|
||||
Note that these functions either encapsulate the python programming
|
||||
interface of GEOM core (the CORBA or SWIG interfaces for example) or
|
||||
extend existing utilities as the ``geompy.py`` module.
|
||||
|
||||
The functions are distributed in the python package
|
||||
``salome.geom``. For example, the usage of the visualization of
|
||||
structural elements can be appreciated with this set of instructions:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from salome.geom.structelem import TEST_StructuralElement
|
||||
TEST_StructuralElement()
|
||||
|
||||
This creates the geometrical objects displayed in the study below:
|
||||
|
||||
.. image:: /images/salome-geom-structuralelements.png
|
||||
:align: center
|
||||
|
||||
The specification of the programming interface of this package is
|
||||
detailled in the part :doc:`Documentation of the programming interface
|
||||
(API)</docapi>` of this documentation.
|
||||
|
||||
.. note::
|
||||
The main package ``salome`` contains other sub-packages that are
|
||||
distributed with the other SALOME modules. For example, the KERNEL
|
||||
module provides the python package ``salome.kernel`` and SMESH the
|
||||
package ``salome.smesh``.
|
BIN
doc/salome/gui/GEOM/images/limit_tolerance_dlg.png
Normal file
BIN
doc/salome/gui/GEOM/images/limit_tolerance_dlg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
doc/salome/gui/GEOM/images/salome-geom-structuralelements.png
Normal file
BIN
doc/salome/gui/GEOM/images/salome-geom-structuralelements.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 KiB |
44
doc/salome/gui/GEOM/input/geompypkg.doc
Normal file
44
doc/salome/gui/GEOM/input/geompypkg.doc
Normal file
@ -0,0 +1,44 @@
|
||||
/*!
|
||||
|
||||
\page geompypkg_page Programming Interface of GEOM python package
|
||||
|
||||
Sorry, but the documentation is not available yet in doxygen format.
|
||||
|
||||
Fortunately, a documentation exists in restructured format and then
|
||||
can be generated here using sphinx, in the expectative of the doxygen
|
||||
version. This documentation is available <a href="../../tui/GEOM/docutils/index.html">
|
||||
here</a>.
|
||||
|
||||
Here is a sample generated from the doxygen format:
|
||||
|
||||
The GEOM python package essentially contains:
|
||||
|
||||
<ul>
|
||||
<li>The visualization of structural elements: a function to create
|
||||
geometrical 3D representations of mechanical models called
|
||||
"structural elements".
|
||||
</ul>
|
||||
|
||||
For details, you should refer to the complete
|
||||
<a href="../../tui/GEOM/docutils/index.html"> documentation of the GEOM
|
||||
python packages</a> generated with sphinx from rst text files.
|
||||
|
||||
Note that these functions either encapsulate the python programming
|
||||
interface of GEOM core (the CORBA or SWIG interfaces for example) or
|
||||
extend existing utilities as the ``geompy.py`` module.
|
||||
|
||||
The functions are distributed in the python package
|
||||
``salome.geom``. For example, the usage of the visualization of
|
||||
structural elements can be appreciated with this set of instructions:
|
||||
|
||||
\code
|
||||
|
||||
from salome.geom.structelem import TEST_StructuralElement
|
||||
TEST_StructuralElement()
|
||||
\endcode
|
||||
|
||||
This creates the geometrical objects displayed in the study below:
|
||||
|
||||
\image html salome-geom-structuralelements.png "Example of Geometry created from structural elements"
|
||||
|
||||
*/
|
@ -23,6 +23,9 @@ various algorithms;</li>
|
||||
Almost all geometry module functionalities are accessible via
|
||||
\subpage geompy_page "Geometry module Python Interface"
|
||||
|
||||
\n Have a look also at the
|
||||
<a href="../../gui/GEOM/geompypkg_page.html"> documentation of the GEOM python packages</a>
|
||||
|
||||
\image html image3.png "Example of Geometry module usage for engineering tasks"
|
||||
|
||||
|
||||
|
37
doc/salome/gui/GEOM/input/limit_tolerance_operation.doc
Normal file
37
doc/salome/gui/GEOM/input/limit_tolerance_operation.doc
Normal file
@ -0,0 +1,37 @@
|
||||
/*!
|
||||
|
||||
\page limit_tolerance_operation_page Limit Tolerance
|
||||
|
||||
\n To produce a <b>Limit Tolerance</b> operation in the <b>Main
|
||||
Menu</b> select <b>Repair - > Limit Tolerance</b>.
|
||||
|
||||
\image html limit_tolerance_dlg.png
|
||||
|
||||
\n <b>Arguments:</b> Name + 1 shape + 1 value (new tolerance).
|
||||
|
||||
\n It is possible on all kind of shapes.
|
||||
|
||||
\n The \b Result will be a \b GEOM_Object.
|
||||
|
||||
\n This functionality tries to set new value of tolerance for the
|
||||
given shape. But the final tolerance value depends also on the
|
||||
initial shape topology (regards existing gaps) in order to obtain
|
||||
valid resulting shape.
|
||||
|
||||
\n Example of usage:
|
||||
<ol>
|
||||
<li>Try a partition on objects obj1 and obj2.</li>
|
||||
<li>Partition fails.</li>
|
||||
<li>Perform Limit Tolerance on objects obj1 and obj2.</li>
|
||||
<li>Try again the partition.</li>
|
||||
</ol>
|
||||
See also \ref tui_limit_tolerance "TUI example".
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.LimitTolerance(Shape, Tolerance),</em>
|
||||
where \em Shape is a shape with presumably incorrect tolerance, \em
|
||||
Tolerance is a desired value of tolerance.
|
||||
|
||||
Our <b>TUI Scripts</b> provide you with useful examples of the use of
|
||||
\ref tui_limit_tolerance "Repairing Operations".
|
||||
|
||||
*/
|
@ -37,6 +37,12 @@ the box, see corresponding \ref partition_picture_3 "picture" below).
|
||||
\n <b>Advanced option:</b>
|
||||
\ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
|
||||
|
||||
\note Partition is a kind of complex operation, result of it depends
|
||||
on the initial shapes quality. Sometimes, if partition fails,
|
||||
some healing operations could help. Try <b>Shape Processing</b>
|
||||
and <b>Limit Tolerance</b> in such cases. See also \ref
|
||||
tui_limit_tolerance "TUI example" of shape healing.
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakePartition(ListOfShapes,
|
||||
ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs,
|
||||
ListOfMaterials, KeepNonlimitShapes),</em> where where \em
|
||||
|
@ -17,6 +17,8 @@ holes with free boundaries on a selected face.</li>
|
||||
<li>\subpage sewing_operation_page "Sewing" - sews faces or shells.</li>
|
||||
<li>\subpage glue_faces_operation_page "Glue faces" - unites
|
||||
coincident faces within the given tolerance.</li>
|
||||
<li>\subpage limit_tolerance_operation_page "Limit Tolerance" - tries
|
||||
to set new tolerance value for the given shape.</li>
|
||||
<li>\subpage add_point_on_edge_operation_page "Add point on edge" -
|
||||
splits an edge in two.</li>
|
||||
<li>\subpage change_orientation_operation_page "Change orientation" -
|
||||
|
@ -3,7 +3,7 @@
|
||||
\page shape_processing_operation_page Shape Processing
|
||||
|
||||
\n To produce a <b>Shape Processing</b> operation in the <b>Main Menu</b>
|
||||
select <b>Repair - > Shape Processing</b>.
|
||||
select <b>Repair - > Shape Processing</b>.
|
||||
\n This operation processes one or more shapes using various operators.
|
||||
|
||||
\n The \b Result will be a \b GEOM_Object.
|
||||
@ -15,6 +15,19 @@ is a list of operators ("FixShape", "SplitClosedFaces", etc.),
|
||||
etc), \em Values is a list of values of parameters placed in the same
|
||||
order as in the list of Parameters.
|
||||
|
||||
\note <b>Shape Processing</b> is usefull not only on invalid shapes,
|
||||
but sometimes also on shapes, that are classified as valid by
|
||||
the <b>Check</b> functionality. Use it, if some operation (for
|
||||
example, <b>Partition</b>) fails.
|
||||
Example of usage:
|
||||
<ol>
|
||||
<li>Try a partition on objects obj1 and obj2.</li>
|
||||
<li>Partition fails.</li>
|
||||
<li>Perform Shape Processing on objects obj1 and obj2.</li>
|
||||
<li>Try again the partition.</li>
|
||||
</ol>
|
||||
See also \ref tui_limit_tolerance "TUI example".
|
||||
|
||||
\n In this dialog box you can select the object that you need to
|
||||
process, define its name and operators applied to it during
|
||||
processing.
|
||||
|
@ -289,6 +289,43 @@ gg.createAndDisplayGO(id_glue)
|
||||
gg.setDisplayMode(id_glue,1)
|
||||
\endcode
|
||||
|
||||
\anchor tui_limit_tolerance
|
||||
<br><h2>Limit Tolerance</h2>
|
||||
|
||||
\code
|
||||
import geompy
|
||||
gg = salome.ImportComponentGUI("GEOM")
|
||||
|
||||
# import initial topology
|
||||
shape1 = geompy.ImportBREP("my_shape_1.brep")
|
||||
shape2 = geompy.ImportBREP("my_shape_2.brep")
|
||||
|
||||
geompy.addToStudy(shape1, "Shape 1")
|
||||
geompy.addToStudy(shape2, "Shape 2")
|
||||
|
||||
# perform partition
|
||||
try:
|
||||
part = geompy.MakePartition([shape1, shape2])
|
||||
except:
|
||||
# limit tolerance
|
||||
tolerance = 1e-07
|
||||
shape1_lt = geompy.LimitTolerance(shape1, tolerance)
|
||||
shape2_lt = geompy.LimitTolerance(shape2, tolerance)
|
||||
|
||||
# process shape
|
||||
good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
|
||||
good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
|
||||
|
||||
geompy.addToStudy(good_shape1, "Shape 1 corrected")
|
||||
geompy.addToStudy(good_shape2, "Shape 2 corrected")
|
||||
|
||||
# perform partition on corrected shapes
|
||||
part = geompy.MakePartition([good_shape1, good_shape2])
|
||||
pass
|
||||
|
||||
geompy.addToStudy(part, "Partition")
|
||||
\endcode
|
||||
|
||||
\anchor tui_add_point_on_edge
|
||||
<br><h2>Add Point on Edge</h2>
|
||||
|
||||
|
@ -99,12 +99,21 @@
|
||||
\anchor swig_GetPoint
|
||||
\until blocksComp (-50, -50, -50)
|
||||
|
||||
\anchor swig_GetVertexNearPoint
|
||||
\until near (40, 40, 40)
|
||||
|
||||
\anchor swig_GetEdge
|
||||
\until by two points
|
||||
|
||||
\anchor swig_GetEdgeNearPoint
|
||||
\until edge near point
|
||||
|
||||
\anchor swig_GetBlockByParts
|
||||
\until "b0 image"
|
||||
|
||||
\anchor swig_GetShapesNearPoint
|
||||
\until "faces near point"
|
||||
|
||||
\anchor swig_GetShapesOnPlane
|
||||
\until Face on Plane
|
||||
|
||||
|
@ -19,10 +19,9 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File : GEOM_Gen.idl
|
||||
// Author : Sergey RUIN
|
||||
//
|
||||
|
||||
#ifndef __GEOM_GEN__
|
||||
#define __GEOM_GEN__
|
||||
|
||||
@ -1399,6 +1398,17 @@ module GEOM
|
||||
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
|
||||
in ListOfGO theFaces, in boolean doKeepNonSolids);
|
||||
|
||||
/*!
|
||||
* Get all sub-shapes and groups of \a theShape,
|
||||
* that were created already by any other methods.
|
||||
* \param theShape Any shape.
|
||||
* \param theGroupsOnly If this parameter is TRUE, only groups will be
|
||||
* returned, else all found sub-shapes and groups.
|
||||
* \return List of existing sub-objects of \a theShape.
|
||||
*/
|
||||
ListOfGO GetExistingSubObjects (in GEOM_Object theShape,
|
||||
in boolean theGroupsOnly);
|
||||
|
||||
/*!
|
||||
* Explode a shape on subshapes of a given type.
|
||||
* \param theShape Shape to be exploded.
|
||||
@ -1905,6 +1915,15 @@ module GEOM
|
||||
in double theZ,
|
||||
in double theEpsilon);
|
||||
|
||||
/*!
|
||||
* Find a vertex of the given shape, which has minimal distance to the given point.
|
||||
* \param theShape Any shape.
|
||||
* \param thePoint Point, close to the desired vertex.
|
||||
* \return New GEOM_Object, containing the found vertex.
|
||||
*/
|
||||
GEOM_Object GetVertexNearPoint (in GEOM_Object theShape,
|
||||
in GEOM_Object thePoint);
|
||||
|
||||
/*!
|
||||
* Get an edge, found in the given shape by two given vertices.
|
||||
* \param theShape Block or a compound of blocks.
|
||||
@ -1973,6 +1992,22 @@ module GEOM
|
||||
GEOM_Object GetFaceByNormale (in GEOM_Object theBlock,
|
||||
in GEOM_Object theVector);
|
||||
|
||||
/*!
|
||||
* Find all subshapes of type \a theShapeType of the given shape,
|
||||
* which have minimal distance to the given point.
|
||||
* \param theShape Any shape.
|
||||
* \param thePoint Point, close to the desired shape.
|
||||
* \param theShapeType Defines what kind of subshapes is searched.
|
||||
* \param theTolerance The tolerance for distances comparison. All shapes
|
||||
* with distances to the given point in interval
|
||||
* [minimal_distance, minimal_distance + theTolerance] will be gathered.
|
||||
* \return New GEOM_Object, containing a group of all found shapes.
|
||||
*/
|
||||
GEOM_Object GetShapesNearPoint (in GEOM_Object theShape,
|
||||
in GEOM_Object thePoint,
|
||||
in long theShapeType,
|
||||
in double theTolerance);
|
||||
|
||||
/*!
|
||||
* Extract blocks from blocks compounds
|
||||
*/
|
||||
@ -2726,6 +2761,14 @@ module GEOM
|
||||
GEOM_Object ChangeOrientation (in GEOM_Object theObject);
|
||||
GEOM_Object ChangeOrientationCopy (in GEOM_Object theObject);
|
||||
|
||||
/*!
|
||||
* Try to limit tolerance of the given object by value \a theTolerance.
|
||||
* \param theObject Shape to be processed.
|
||||
* \param theTolerance Required tolerance value.
|
||||
* \return New GEOM_Object, containing processed shape.
|
||||
*/
|
||||
GEOM_Object LimitTolerance (in GEOM_Object theObject, in double theTolerance);
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
@ -2917,7 +2960,6 @@ module GEOM
|
||||
*/
|
||||
GEOM_Object GetCentreOfMass (in GEOM_Object theShape);
|
||||
|
||||
|
||||
/*
|
||||
* Get the vertex by index for 1D objects depends the edge/wire orientation
|
||||
* \param theShape Shape (wire or edge) to find the vertex on it
|
||||
|
@ -93,6 +93,7 @@ filletface.png \
|
||||
filling.png \
|
||||
fuse.png \
|
||||
geometry.png \
|
||||
limit_tolerance.png \
|
||||
line.png \
|
||||
line2points.png \
|
||||
line2faces.png \
|
||||
|
BIN
resources/limit_tolerance.png
Normal file
BIN
resources/limit_tolerance.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 565 B |
@ -899,9 +899,11 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
|
||||
if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
|
||||
aShape.ShapeType() == TopAbs_VERTEX ) {
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
|
||||
myX->setText( QString( "%1" ).arg( aPnt.X() ) );
|
||||
myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
|
||||
myZ->setText( QString( "%1" ).arg( aPnt.Z() ) );
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
myX->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) );
|
||||
myY->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) );
|
||||
myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) );
|
||||
}
|
||||
else {
|
||||
myX->setText( "" );
|
||||
|
@ -342,6 +342,7 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
|
||||
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();
|
||||
@ -363,6 +364,7 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow )
|
||||
}
|
||||
|
||||
ic->SetDisplayMode( newmode, Standard_False );
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
}
|
||||
|
||||
@ -413,6 +415,7 @@ void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
|
||||
}
|
||||
}
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
viewWindow->setCustomData( "VectorsMode", QVariant( mode ) );
|
||||
@ -433,6 +436,7 @@ void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow )
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,6 +508,7 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
}
|
||||
}
|
||||
aView->Repaint();
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer();
|
||||
@ -534,6 +539,7 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
||||
}
|
||||
}
|
||||
ic->UpdateCurrentViewer();
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -781,13 +781,12 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
|
||||
if ( qAbs(theValue) < prec )
|
||||
return "0";
|
||||
|
||||
QString aRes;
|
||||
aRes.setNum( theValue, 'g', thePrecision );
|
||||
QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( thePrecision ) );
|
||||
|
||||
if ( prec > 0 ) {
|
||||
int p = 0;
|
||||
while ( p < thePrecision ) {
|
||||
aRes.setNum( theValue, 'g', p++ );
|
||||
QString aRes = QLocale().toString( theValue, thePrecision >= 0 ? 'f' : 'g', qAbs( p++ ) );
|
||||
double v = aRes.toDouble();
|
||||
double err = qAbs( theValue - v );
|
||||
if ( err > 0 && err <= prec )
|
||||
@ -796,21 +795,19 @@ QString DlgRef::PrintDoubleValue( double theValue, int thePrecision )
|
||||
}
|
||||
|
||||
// remove trailing zeroes
|
||||
QString delim( "." );
|
||||
|
||||
int idx = aRes.lastIndexOf( delim );
|
||||
if ( idx == -1 )
|
||||
return aRes;
|
||||
QRegExp expre( QString( "(%1|%2)[+-]?[0-9]+$" ).arg( QLocale().exponential().toLower(),
|
||||
QLocale().exponential().toUpper() ) );
|
||||
|
||||
QString iPart = aRes.left( idx );
|
||||
QString fPart = aRes.mid( idx + 1 );
|
||||
int idx = aRes.indexOf( expre );
|
||||
QString aResExp = "";
|
||||
if ( idx >= 0 ) {
|
||||
aResExp = aRes.mid( idx );
|
||||
aRes = aRes.left( idx );
|
||||
}
|
||||
|
||||
while ( !fPart.isEmpty() && fPart.at( fPart.length() - 1 ) == '0' )
|
||||
fPart.remove( fPart.length() - 1, 1 );
|
||||
if ( aRes.contains( QLocale().decimalPoint() ) )
|
||||
aRes.remove( QRegExp( QString( "(\\%1|0)0*$" ).arg( QLocale().decimalPoint() ) ) );
|
||||
|
||||
aRes = iPart;
|
||||
if ( !fPart.isEmpty() )
|
||||
aRes += delim + fPart;
|
||||
|
||||
return aRes;
|
||||
return aRes == "-0" ? QString( "0" ) : aRes + aResExp;
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
||||
Handle(TColStd_HArray1OfInteger) theIndices,
|
||||
bool isStandaloneOperation)
|
||||
{
|
||||
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
|
||||
if (theMainShape.IsNull() || theIndices.IsNull()) return NULL;
|
||||
|
||||
Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID());
|
||||
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
|
||||
@ -319,21 +319,6 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
||||
// if this label has been freed (object deleted)
|
||||
bool useExisting = false;
|
||||
TDF_Label aChild;
|
||||
/*
|
||||
if (!_lastCleared.IsNull()) {
|
||||
if (_lastCleared.Root() == aDoc->Main().Root()) {
|
||||
useExisting = true;
|
||||
aChild = _lastCleared;
|
||||
// 0020229: if next label exists and is empty, try to reuse it
|
||||
Standard_Integer aNextTag = aChild.Tag() + 1;
|
||||
TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False);
|
||||
if (!aNextL.IsNull() && !aNextL.HasAttribute())
|
||||
_lastCleared = aNextL;
|
||||
else
|
||||
_lastCleared.Nullify();
|
||||
}
|
||||
}
|
||||
*/
|
||||
int aDocID = theMainShape->GetDocID();
|
||||
if (_freeLabels.find(aDocID) != _freeLabels.end()) {
|
||||
std::list<TDF_Label>& aFreeLabels = _freeLabels[aDocID];
|
||||
@ -349,10 +334,10 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
||||
}
|
||||
|
||||
Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction();
|
||||
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type
|
||||
Handle(GEOM_Object) anObject = new GEOM_Object (aChild, 28); //28 is SUBSHAPE type
|
||||
Handle(GEOM_Function) aFunction = anObject->AddFunction(GEOM_Object::GetSubShapeID(), 1);
|
||||
|
||||
GEOM_ISubShape aSSI(aFunction);
|
||||
GEOM_ISubShape aSSI (aFunction);
|
||||
aSSI.SetMainShape(aMainShape);
|
||||
aSSI.SetIndices(theIndices);
|
||||
|
||||
@ -372,11 +357,14 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Put an object in the map of created objects
|
||||
// Put an object in the map of created objects
|
||||
TCollection_AsciiString anID = BuildIDFromObject(anObject);
|
||||
if(_objects.IsBound(anID)) _objects.UnBind(anID);
|
||||
if (_objects.IsBound(anID)) _objects.UnBind(anID);
|
||||
_objects.Bind(anID, anObject);
|
||||
|
||||
// Put this subshape in the list of subshapes of theMainShape
|
||||
aMainShape->AddSubShapeReference(aFunction);
|
||||
|
||||
GEOM::TPythonDump pd (aFunction);
|
||||
|
||||
if (isStandaloneOperation) {
|
||||
@ -410,9 +398,17 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject)
|
||||
TCollection_AsciiString anID = BuildIDFromObject(theObject);
|
||||
if (_objects.IsBound(anID)) _objects.UnBind(anID);
|
||||
|
||||
// If subshape, remove it from the list of subshapes of its main shape
|
||||
if (!theObject->IsMainShape()) {
|
||||
Handle(GEOM_Function) aFunction = theObject->GetFunction(1);
|
||||
GEOM_ISubShape aSSI (aFunction);
|
||||
Handle(GEOM_Function) aMainShape = aSSI.GetMainShape();
|
||||
aMainShape->RemoveSubShapeReference(aFunction);
|
||||
}
|
||||
|
||||
int nb = theObject->GetNbFunctions();
|
||||
Handle(TDataStd_TreeNode) aNode;
|
||||
for (int i = 1; i<=nb; i++) {
|
||||
for (int i = 1; i <= nb; i++) {
|
||||
Handle(GEOM_Function) aFunction = theObject->GetFunction(i);
|
||||
if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
|
||||
aNode->Remove();
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -43,6 +42,7 @@
|
||||
#include <TDataStd_UAttribute.hxx>
|
||||
#include <TDataStd_ChildNodeIterator.hxx>
|
||||
#include <TDataStd_ExtStringArray.hxx>
|
||||
#include <TDataStd_ExtStringList.hxx>
|
||||
#include <TDocStd_Owner.hxx>
|
||||
#include <TDocStd_Document.hxx>
|
||||
#include <TFunction_Function.hxx>
|
||||
@ -64,6 +64,8 @@
|
||||
#define RESULT_LABEL 2
|
||||
#define DESCRIPTION_LABEL 3
|
||||
#define HISTORY_LABEL 4
|
||||
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
|
||||
#define NAMING_LABEL 6 // 002020750: Naming during STEP import
|
||||
|
||||
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
|
||||
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
|
||||
@ -471,8 +473,8 @@ TCollection_AsciiString GEOM_Function::GetString(int thePosition)
|
||||
void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference)
|
||||
{
|
||||
_isDone = false;
|
||||
if(thePosition <= 0) return;
|
||||
if(theReference.IsNull()) return;
|
||||
if (thePosition <= 0) return;
|
||||
if (theReference.IsNull()) return;
|
||||
TDF_Label anArgLabel = ARGUMENT(thePosition);
|
||||
TDF_Reference::Set(anArgLabel, theReference->GetEntry());
|
||||
TDataStd_UAttribute::Set(anArgLabel, GetDependencyID());
|
||||
@ -670,6 +672,85 @@ void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* AddSubShapeReference
|
||||
*/
|
||||
//=============================================================================
|
||||
void GEOM_Function::AddSubShapeReference(Handle(GEOM_Function) theSubShape)
|
||||
{
|
||||
_isDone = false;
|
||||
|
||||
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
|
||||
|
||||
Handle(TDataStd_ExtStringList) aList;
|
||||
if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
|
||||
aList = new TDataStd_ExtStringList;
|
||||
aSubShapesLabel.AddAttribute(aList);
|
||||
}
|
||||
|
||||
TCollection_AsciiString anEntry;
|
||||
TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
|
||||
aList->Append(anEntry);
|
||||
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* RemoveSubShapeReference
|
||||
*/
|
||||
//=============================================================================
|
||||
void GEOM_Function::RemoveSubShapeReference(Handle(GEOM_Function) theSubShape)
|
||||
{
|
||||
_isDone = false;
|
||||
|
||||
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
|
||||
|
||||
Handle(TDataStd_ExtStringList) aList;
|
||||
if (aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
|
||||
TCollection_AsciiString anEntry;
|
||||
TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
|
||||
aList->Remove(anEntry);
|
||||
}
|
||||
|
||||
_isDone = true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* HasSubShapeReferences
|
||||
*/
|
||||
//=============================================================================
|
||||
bool GEOM_Function::HasSubShapeReferences()
|
||||
{
|
||||
_isDone = true;
|
||||
|
||||
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
|
||||
return aSubShapesLabel.IsAttribute(TDataStd_ExtStringList::GetID());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetSubShapeReferences
|
||||
*/
|
||||
//=============================================================================
|
||||
const TDataStd_ListOfExtendedString& GEOM_Function::GetSubShapeReferences()
|
||||
{
|
||||
_isDone = false;
|
||||
|
||||
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
|
||||
|
||||
Handle(TDataStd_ExtStringList) aList;
|
||||
if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
|
||||
aList = new TDataStd_ExtStringList;
|
||||
aSubShapesLabel.AddAttribute(aList);
|
||||
}
|
||||
|
||||
_isDone = true;
|
||||
return aList->List();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetHistoryEntry
|
||||
@ -713,6 +794,16 @@ TDF_Label GEOM_Function::GetArgumentHistoryEntry (const TDF_Label& theArgu
|
||||
return aHistoryCurLabel;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetNamingEntry
|
||||
*/
|
||||
//=============================================================================
|
||||
TDF_Label GEOM_Function::GetNamingEntry (const Standard_Boolean create)
|
||||
{
|
||||
return _label.FindChild(NAMING_LABEL, create);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOM_Function_Type_
|
||||
//purpose :
|
||||
@ -721,10 +812,9 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
|
||||
{
|
||||
|
||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
|
||||
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
|
||||
if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
|
||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
|
||||
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
|
||||
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
|
||||
@ -751,5 +841,5 @@ const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standar
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject ;
|
||||
return _anOtherObject;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOM_Function_HeaderFile
|
||||
#define _GEOM_Function_HeaderFile
|
||||
@ -65,7 +64,7 @@ class Handle(MMgt_TShared);
|
||||
class GEOM_Function;
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#include <TDataStd_ListOfExtendedString.hxx>
|
||||
|
||||
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function);
|
||||
|
||||
@ -141,8 +140,10 @@ public:
|
||||
// Type management
|
||||
//
|
||||
Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_();
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; }
|
||||
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); }
|
||||
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
|
||||
{ return STANDARD_TYPE(GEOM_Function) ; }
|
||||
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
|
||||
{ return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); }
|
||||
|
||||
|
||||
private:
|
||||
@ -254,6 +255,12 @@ public:
|
||||
//Returns a sequence of the external dependencies of this function
|
||||
Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq);
|
||||
|
||||
// Add/Remove/Check/Get subshape references
|
||||
Standard_EXPORT void AddSubShapeReference (Handle(GEOM_Function) theSubShape);
|
||||
Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape);
|
||||
Standard_EXPORT bool HasSubShapeReferences();
|
||||
Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences();
|
||||
|
||||
//Returns top label of this function's history tree
|
||||
Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
|
||||
|
||||
@ -262,8 +269,10 @@ public:
|
||||
Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
|
||||
const Standard_Boolean create = Standard_True);
|
||||
|
||||
private:
|
||||
//Returns top label of this function's naming tree
|
||||
Standard_EXPORT TDF_Label GetNamingEntry (const Standard_Boolean create = Standard_True);
|
||||
|
||||
private:
|
||||
|
||||
TDF_Label _label;
|
||||
bool _isDone;
|
||||
|
@ -19,10 +19,9 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// NOTE: This is an intreface to a function for the Shapes
|
||||
// (Wire, Face, Shell, Solid and Compound) creation.
|
||||
//
|
||||
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#include "TColStd_HSequenceOfTransient.hxx"
|
||||
@ -30,7 +29,6 @@
|
||||
|
||||
#define SHAPE_ARG_MAIN_SHAPE 1
|
||||
#define SHAPE_ARG_INDICES 2
|
||||
#define SHAPE_ARG_SORTED 3
|
||||
|
||||
class GEOM_ISubShape
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ GEOM_Object::GEOM_Object(TDF_Label& theEntry, int theType)
|
||||
//=============================================================================
|
||||
GEOM_Object::~GEOM_Object()
|
||||
{
|
||||
//MESSAGE("GEOM_Object::~GEOM_Object()");
|
||||
MESSAGE("GEOM_Object::~GEOM_Object()");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
@ -291,9 +291,15 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||
TopoDS_Shape aResult = myContext->Apply(Shape);
|
||||
|
||||
// processing each solid
|
||||
TopExp_Explorer exps;
|
||||
for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
|
||||
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
|
||||
TopAbs_ShapeEnum aType = TopAbs_SOLID;
|
||||
TopExp_Explorer exps (Shape, aType);
|
||||
if (!exps.More()) {
|
||||
aType = TopAbs_SHELL;
|
||||
exps.Init(Shape, aType);
|
||||
}
|
||||
for (; exps.More(); exps.Next()) {
|
||||
//TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
|
||||
TopoDS_Shape aSolid = exps.Current();
|
||||
|
||||
TopTools_IndexedMapOfShape ChangedFaces;
|
||||
|
||||
@ -307,21 +313,21 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||
|
||||
// processing each face
|
||||
TopExp_Explorer exp;
|
||||
for(exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
for (exp.Init(aRes, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||
TopoDS_Face aFace =
|
||||
TopoDS::Face(aContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
|
||||
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
|
||||
|
||||
for(TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
|
||||
for (TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
|
||||
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
|
||||
if(!aMapEdgeFaces.Contains(edge)) continue;
|
||||
if (!aMapEdgeFaces.Contains(edge)) continue;
|
||||
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
|
||||
TopTools_ListIteratorOfListOfShape anIter(aList);
|
||||
for( ; anIter.More(); anIter.Next()) {
|
||||
for ( ; anIter.More(); anIter.Next()) {
|
||||
TopoDS_Face face = TopoDS::Face(anIter.Value());
|
||||
TopoDS_Face face1 = TopoDS::Face(aContext->Apply(anIter.Value()));
|
||||
if(face1.IsSame(aFace)) continue;
|
||||
if(aMapFacesEdges.Contains(face)) {
|
||||
if (face1.IsSame(aFace)) continue;
|
||||
if (aMapFacesEdges.Contains(face)) {
|
||||
aMapFacesEdges.ChangeFromKey(face).Append(edge);
|
||||
}
|
||||
else {
|
||||
@ -332,27 +338,27 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||
}
|
||||
}
|
||||
|
||||
for(Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
|
||||
for (Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
|
||||
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
|
||||
TopTools_SequenceOfShape SeqEdges;
|
||||
TopTools_ListIteratorOfListOfShape anIter(ListEdges);
|
||||
for( ; anIter.More(); anIter.Next()) {
|
||||
for ( ; anIter.More(); anIter.Next()) {
|
||||
SeqEdges.Append(anIter.Value());
|
||||
}
|
||||
if(SeqEdges.Length()==1) continue;
|
||||
if (SeqEdges.Length()==1) continue;
|
||||
TopoDS_Edge E;
|
||||
if( MergeEdges(SeqEdges,aFace,Tol,E) ) {
|
||||
if ( MergeEdges(SeqEdges,aFace,Tol,E) ) {
|
||||
// now we have only one edge - aChain.Value(1)
|
||||
// we have to replace old ListEdges with this new edge
|
||||
aContext->Replace(SeqEdges(1),E);
|
||||
for(Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
|
||||
for (Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
|
||||
aContext->Remove(SeqEdges(j));
|
||||
}
|
||||
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
|
||||
if( !ChangedFaces.Contains(tmpF) )
|
||||
if ( !ChangedFaces.Contains(tmpF) )
|
||||
ChangedFaces.Add(tmpF);
|
||||
tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
|
||||
if( !ChangedFaces.Contains(tmpF) )
|
||||
if ( !ChangedFaces.Contains(tmpF) )
|
||||
ChangedFaces.Add(tmpF);
|
||||
}
|
||||
}
|
||||
@ -360,7 +366,7 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||
} // end processing each face
|
||||
|
||||
// fix changed faces and replace them in the local context
|
||||
for(Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
|
||||
for (Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
|
||||
TopoDS_Face aFace = TopoDS::Face(aContext->Apply(ChangedFaces.FindKey(i)));
|
||||
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
|
||||
sff->SetContext(myContext);
|
||||
@ -371,11 +377,11 @@ TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||
aContext->Replace(aFace,sff->Face());
|
||||
}
|
||||
|
||||
if(ChangedFaces.Extent()>0) {
|
||||
if (ChangedFaces.Extent() > 0) {
|
||||
// fix changed shell and replace it in the local context
|
||||
TopoDS_Shape aRes1 = aContext->Apply(aRes);
|
||||
TopExp_Explorer expsh;
|
||||
for(expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) {
|
||||
for (expsh.Init(aRes1, TopAbs_SHELL); expsh.More(); expsh.Next()) {
|
||||
TopoDS_Shell aShell = TopoDS::Shell(expsh.Current());
|
||||
Handle(ShapeFix_Shell) sfsh = new ShapeFix_Shell;
|
||||
sfsh->FixFaceOrientation(aShell);
|
||||
|
@ -269,6 +269,10 @@
|
||||
<source>ICON_DLG_GLUE_FACES2</source>
|
||||
<translation>glue2.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_LIMIT_TOLERANCE</source>
|
||||
<translation>limit_tolerance.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_DLG_INERTIA</source>
|
||||
<translation>axisinertia.png</translation>
|
||||
@ -849,6 +853,10 @@
|
||||
<source>ICO_GLUE_FACES</source>
|
||||
<translation>glue.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_LIMIT_TOLERANCE</source>
|
||||
<translation>limit_tolerance.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_GROUP_CREATE</source>
|
||||
<translation>group_new.png</translation>
|
||||
|
@ -1,33 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<!--
|
||||
Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
|
||||
Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
|
||||
-->
|
||||
<TS version="1.1" >
|
||||
<context>
|
||||
<TS version="2.0" language="en_US">
|
||||
<context>
|
||||
<name>@default</name>
|
||||
<message>
|
||||
<source>BRep_API: command not done</source>
|
||||
<translation>Error: can't build object</translation>
|
||||
<translation>Error: can't build object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHANGE_ORIENTATION_NEW_OBJ_NAME</source>
|
||||
@ -40,7 +18,7 @@
|
||||
<message>
|
||||
<source>DEP_OBJECT</source>
|
||||
<translation>Selected object has been used to create another one.
|
||||
It can't be deleted </translation>
|
||||
It can't be deleted </translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DEVIDE_EDGE_NEW_OBJECT_NAME</source>
|
||||
@ -313,7 +291,7 @@ Please, select face, shell or solid and try again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CHAMFER_ABORT</source>
|
||||
<translation>Chamfer can't be computed with %1 and %2</translation>
|
||||
<translation>Chamfer can't be computed with %1 and %2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_CHAMFER_ALL</source>
|
||||
@ -653,7 +631,7 @@ Please, select face, shell or solid and try again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLET_ABORT</source>
|
||||
<translation>Fillet can't be computed with radius %1</translation>
|
||||
<translation>Fillet can't be computed with radius %1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_FILLET_ALL</source>
|
||||
@ -771,6 +749,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GEOM_GLUE_TITLE</source>
|
||||
<translation>Glue faces</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_LIMIT_TOLERANCE_TITLE</source>
|
||||
<translation>Limit tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_HEIGHT</source>
|
||||
<translation>Height :</translation>
|
||||
@ -2055,6 +2037,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>GLUE_NEW_OBJ_NAME</source>
|
||||
<translation>Glue</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LIMIT_TOLERANCE_NEW_OBJ_NAME</source>
|
||||
<translation>Limit_tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_ALL_SEL_ONLY</source>
|
||||
<translation>Select All</translation>
|
||||
@ -2307,6 +2293,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_ISOS</source>
|
||||
<translation>Isos</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_LIMIT_TOLERANCE</source>
|
||||
<translation>Limit tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_LINE</source>
|
||||
<translation>Line</translation>
|
||||
@ -2955,6 +2945,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_LINE</source>
|
||||
<translation>Create a line</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_LIMIT_TOLERANCE</source>
|
||||
<translation>Limit tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_LOCAL_CS</source>
|
||||
<translation>Create a local coordinate system</translation>
|
||||
@ -2973,7 +2967,7 @@ Please, select face, shell or solid and try again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MODIFY_LOCATION</source>
|
||||
<translation>Modify shape's location</translation>
|
||||
<translation>Modify shape's location</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_MUL_ROTATION</source>
|
||||
@ -3479,6 +3473,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_LINE</source>
|
||||
<translation>Create a line</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_LIMIT_TOLERANCE</source>
|
||||
<translation>Limit tolerance</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_LOCAL_CS</source>
|
||||
<translation>Create a local coordinate system</translation>
|
||||
@ -4072,17 +4070,77 @@ Otherwise the dimensions will be kept without modifications.</translation>
|
||||
<source>GEOM_PRECISION_HINT</source>
|
||||
<translation>
|
||||
Input value precision can be adjusted using
|
||||
'%1' parameter in Geometry module preferences.</translation>
|
||||
'%1' parameter in Geometry module preferences.</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<message>
|
||||
<source>TOP_PIPETSHAPE</source>
|
||||
<translation>Create Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_PIPETSHAPE</source>
|
||||
<translation>Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_PIPETSHAPE</source>
|
||||
<translation>Create new Pipe TShape object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_ADVANCED_201</source>
|
||||
<translation>Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HALF_LENGTH_MAIN_PIPE</source>
|
||||
<translation>Main pipe half length</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HALF_LENGTH_INCIDENT_PIPE</source>
|
||||
<translation>Incident pipe half length</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CIRCULAR_QUARTER_PIPE</source>
|
||||
<translation>Circular quarter of pipe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>THICKNESS</source>
|
||||
<translation>Thickness</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FLANGE</source>
|
||||
<translation>Flange</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHAMFER_OR_FILLET</source>
|
||||
<translation>Chamfer or fillet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHAMFER</source>
|
||||
<translation>Chamfer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FILLET</source>
|
||||
<translation>Fillet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_1</source>
|
||||
<translation>Junction 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_2</source>
|
||||
<translation>Junction 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_3</source>
|
||||
<translation>Junction 3</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>BasicGUI_CurveDlg</name>
|
||||
<message>
|
||||
<source>GEOM_IS_CLOSED</source>
|
||||
<translation>Build a closed edge</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BasicGUI_EllipseDlg</name>
|
||||
<message>
|
||||
<source>GEOM_VECTOR_MAJOR</source>
|
||||
@ -4100,8 +4158,8 @@ Input value precision can be adjusted using
|
||||
<source>Z_AXIS_DEFAULT</source>
|
||||
<translation>Z axis by default</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BasicGUI_MarkerDlg</name>
|
||||
<message>
|
||||
<source>CAPTION</source>
|
||||
@ -4143,8 +4201,8 @@ Input value precision can be adjusted using
|
||||
<source>YDIR</source>
|
||||
<translation>Y axis direction</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BlocksGUI_BlockDlg</name>
|
||||
<message>
|
||||
<source>FACE_1</source>
|
||||
@ -4170,8 +4228,8 @@ Input value precision can be adjusted using
|
||||
<source>FACE_6</source>
|
||||
<translation>Face 6</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BlocksGUI_ExplodeDlg</name>
|
||||
<message>
|
||||
<source>NB_FACES_MAX</source>
|
||||
@ -4181,8 +4239,8 @@ Input value precision can be adjusted using
|
||||
<source>NB_FACES_MIN</source>
|
||||
<translation>Min. nb. faces</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BlocksGUI_QuadFaceDlg</name>
|
||||
<message>
|
||||
<source>EDGE_1</source>
|
||||
@ -4216,8 +4274,8 @@ Input value precision can be adjusted using
|
||||
<source>VERTEX_4</source>
|
||||
<translation>Vertex 4</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>BlocksGUI_TrsfDlg</name>
|
||||
<message>
|
||||
<source>FACE_1</source>
|
||||
@ -4243,30 +4301,30 @@ Input value precision can be adjusted using
|
||||
<source>FACE_2V</source>
|
||||
<translation>Face 2 V</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>EntityGUI_SketcherDlg</name>
|
||||
<message>
|
||||
<source>CANNOT_CLOSE</source>
|
||||
<translation>It is impossible to close sketch
|
||||
Number of sketch points too small</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>EntityGUI_SubShapeDlg</name>
|
||||
<message>
|
||||
<source>NO_SUBSHAPES_SELECTED</source>
|
||||
<translation>Please, select one or more sub-shapes</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>GroupGUI</name>
|
||||
<message>
|
||||
<source>NO_GROUP</source>
|
||||
<translation>Please, select a group to edit</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>GroupGUI_GroupDlg</name>
|
||||
<message>
|
||||
<source>ADD</source>
|
||||
@ -4344,15 +4402,15 @@ Number of sketch points too small</translation>
|
||||
<source>SECOND_SHAPE</source>
|
||||
<translation>Second Shape</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>MeasureGUI_1Sel1TextView1Check_QTD</name>
|
||||
<message>
|
||||
<source>CHECK_SHAPE_GEOMETRY</source>
|
||||
<translation>Check also geometry</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>MeasureGUI_PointDlg</name>
|
||||
<message>
|
||||
<source>CAPTION</source>
|
||||
@ -4378,8 +4436,8 @@ Number of sketch points too small</translation>
|
||||
<source>Z</source>
|
||||
<translation>Z</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>OperationGUI_ChamferDlg</name>
|
||||
<message>
|
||||
<source>D</source>
|
||||
@ -4397,8 +4455,8 @@ Number of sketch points too small</translation>
|
||||
<source>SELECTED_FACES</source>
|
||||
<translation>Selected faces</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>OperationGUI_FilletDlg</name>
|
||||
<message>
|
||||
<source>SELECTED_EDGES</source>
|
||||
@ -4408,8 +4466,8 @@ Number of sketch points too small</translation>
|
||||
<source>SELECTED_FACES</source>
|
||||
<translation>Selected faces</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>RepairGUI_FreeBoundDlg</name>
|
||||
<message>
|
||||
<source>CAPTION</source>
|
||||
@ -4427,8 +4485,8 @@ Number of sketch points too small</translation>
|
||||
<source>NUMBER_OPEN</source>
|
||||
<translation>Number of open free boundaries: </translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>RepairGUI_GlueDlg</name>
|
||||
<message>
|
||||
<source>FACES_FOR_GLUING_ARE_DETECTED</source>
|
||||
@ -4447,8 +4505,8 @@ Please close this message box and select faces for glueing</translation>
|
||||
<source>THERE_ARE_NO_FACES_FOR_GLUING</source>
|
||||
<translation>There are no faces for gluing</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>RepairGUI_ShapeProcessDlg</name>
|
||||
<message>
|
||||
<source>ERROR_NO_OBJECTS</source>
|
||||
@ -4463,8 +4521,8 @@ Please close this message box and select faces for glueing</translation>
|
||||
<translation>Enabling this option may result in a very time-consuming operation for some input shapes.
|
||||
Would you like to continue?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_DeleteDlg</name>
|
||||
<message>
|
||||
<source>GEOM_REALLY_DELETE</source>
|
||||
@ -4478,8 +4536,8 @@ Would you like to continue?</translation>
|
||||
<source>GEOM_DELETE_OBJECTS</source>
|
||||
<translation>Delete objects</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_DeflectionDlg</name>
|
||||
<message>
|
||||
<source>GEOM_DEFLECTION_TLT</source>
|
||||
@ -4489,8 +4547,8 @@ Would you like to continue?</translation>
|
||||
<source>GEOM_DEFLECTION</source>
|
||||
<translation>Deflection :</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_MarkerDlg</name>
|
||||
<message>
|
||||
<source>SET_MARKER_TLT</source>
|
||||
@ -4536,8 +4594,8 @@ Would you like to continue?</translation>
|
||||
<source>LOAD_TEXTURE_TLT</source>
|
||||
<translation>Load Texture</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
</context>
|
||||
<context>
|
||||
<name>AdvancedGUI_PipeTShapeDlg</name>
|
||||
<message>
|
||||
<source>GEOM_PIPE_TSHAPE_TITLE</source>
|
||||
@ -4611,69 +4669,5 @@ Would you like to continue?</translation>
|
||||
<source>GEOM_PIPE_TSHAPE_POSITION_LBL_L2</source>
|
||||
<translation>New L2</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>@default</name>
|
||||
<message>
|
||||
<source>TOP_PIPETSHAPE</source>
|
||||
<translation>Create Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_PIPETSHAPE</source>
|
||||
<translation>Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_PIPETSHAPE</source>
|
||||
<translation>Create new Pipe TShape object</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_ADVANCED_201</source>
|
||||
<translation>Pipe TShape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HALF_LENGTH_MAIN_PIPE</source>
|
||||
<translation>Main pipe half length</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HALF_LENGTH_INCIDENT_PIPE</source>
|
||||
<translation>Incident pipe half length</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CIRCULAR_QUARTER_PIPE</source>
|
||||
<translation>Circular quarter of pipe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>THICKNESS</source>
|
||||
<translation>Thickness</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FLANGE</source>
|
||||
<translation>Flange</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHAMFER_OR_FILLET</source>
|
||||
<translation>Chamfer or fillet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CHAMFER</source>
|
||||
<translation>Chamfer</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>FILLET</source>
|
||||
<translation>Fillet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_1</source>
|
||||
<translation>Junction 1</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_2</source>
|
||||
<translation>Junction 2</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>JUNCTION_FACE_3</source>
|
||||
<translation>Junction 3</translation>
|
||||
</message>
|
||||
</context>
|
||||
<!-- @@ insert new functions before this line @@ do not remove this line @@ -->
|
||||
</context>
|
||||
</TS>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,11 +19,10 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : GeometryGUI.cxx
|
||||
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||
//
|
||||
|
||||
#include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
|
||||
#include "Python.h"
|
||||
#include "GeometryGUI.h"
|
||||
@ -152,6 +151,17 @@ SALOMEDS::Study_var GeometryGUI::ClientStudyToStudy (_PTR(Study) theStudy)
|
||||
return aDSStudy._retn();
|
||||
}
|
||||
|
||||
void GeometryGUI::Modified( bool theIsUpdateActions )
|
||||
{
|
||||
if( SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() ) ) {
|
||||
if( SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) ) {
|
||||
appStudy->Modified();
|
||||
if( theIsUpdateActions )
|
||||
app->updateActions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : GeometryGUI::GeometryGUI()
|
||||
// purpose : Constructor
|
||||
@ -378,7 +388,11 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
case GEOMOp::OpColor: // POPUP MENU - COLOR
|
||||
case GEOMOp::OpTransparency: // POPUP MENU - TRANSPARENCY
|
||||
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||
case GEOMOp::OpIsos: // POPUP MENU - ISOS
|
||||
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOS
|
||||
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOS
|
||||
case GEOMOp::OpAutoColor: // POPUP MENU - AUTO COLOR
|
||||
case GEOMOp::OpNoAutoColor: // POPUP MENU - DISABLE AUTO COLOR
|
||||
case GEOMOp::OpShowChildren: // POPUP MENU - SHOW CHILDREN
|
||||
@ -476,6 +490,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
case GEOMOp::OpFreeFaces: // MENU MEASURE - FREE FACES
|
||||
case GEOMOp::OpOrientation: // MENU REPAIR - CHANGE ORIENTATION
|
||||
case GEOMOp::OpGlueFaces: // MENU REPAIR - GLUE FACES
|
||||
case GEOMOp::OpLimitTolerance: // MENU REPAIR - LIMIT TOLERANCE
|
||||
case GEOMOp::OpRemoveExtraEdges: // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
libName = "RepairGUI";
|
||||
break;
|
||||
@ -572,7 +587,8 @@ void GeometryGUI::OnMousePress( SUIT_ViewWindow* w, QMouseEvent* e )
|
||||
// function : createGeomAction
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel, const int accel, const bool toggle )
|
||||
void GeometryGUI::createGeomAction( const int id, const QString& label, const QString& icolabel,
|
||||
const int accel, const bool toggle, const QString& shortcutAction )
|
||||
{
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
QPixmap icon = icolabel.isEmpty() ? resMgr->loadPixmap( "GEOM", tr( (QString( "ICO_" )+label).toLatin1().constData() ), false )
|
||||
@ -585,11 +601,12 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS
|
||||
accel,
|
||||
application()->desktop(),
|
||||
toggle,
|
||||
this, SLOT( OnGUIEvent() ) );
|
||||
this, SLOT( OnGUIEvent() ),
|
||||
shortcutAction );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : createGeomAction
|
||||
// function : createOriginAndBaseVectors
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GeometryGUI::createOriginAndBaseVectors()
|
||||
@ -706,6 +723,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
|
||||
createGeomAction( GEOMOp::OpSewing, "SEWING" );
|
||||
createGeomAction( GEOMOp::OpGlueFaces, "GLUE_FACES" );
|
||||
createGeomAction( GEOMOp::OpLimitTolerance, "LIMIT_TOLERANCE" );
|
||||
createGeomAction( GEOMOp::OpSuppressFaces, "SUPPRESS_FACES" );
|
||||
createGeomAction( GEOMOp::OpSuppressHoles, "SUPPERSS_HOLES" );
|
||||
createGeomAction( GEOMOp::OpShapeProcess, "SHAPE_PROCESS" );
|
||||
@ -767,6 +785,19 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( GEOMOp::OpPointMarker, "POP_POINT_MARKER" );
|
||||
|
||||
createGeomAction( GEOMOp::OpPipeTShape, "PIPETSHAPE" );
|
||||
|
||||
// Create actions for increase/decrease transparency shortcuts
|
||||
createGeomAction( GEOMOp::OpIncrTransparency, "", "", 0, false,
|
||||
"Geometry:Increase transparency");
|
||||
createGeomAction( GEOMOp::OpDecrTransparency, "", "", 0, false,
|
||||
"Geometry:Decrease transparency");
|
||||
|
||||
// Create actions for increase/decrease number of isolines
|
||||
createGeomAction( GEOMOp::OpIncrNbIsos, "", "", 0, false,
|
||||
"Geometry:Increase number of isolines");
|
||||
createGeomAction( GEOMOp::OpDecrNbIsos, "", "", 0, false,
|
||||
"Geometry:Decrease number of isolines");
|
||||
|
||||
// createGeomAction( GEOMOp::OpPipeTShapeGroups, "PIPETSHAPEGROUPS" );
|
||||
//@@ insert new functions before this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@ do not remove this line @@//
|
||||
|
||||
@ -891,6 +922,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createMenu( GEOMOp::OpSuppressHoles, repairId, -1 );
|
||||
createMenu( GEOMOp::OpSewing, repairId, -1 );
|
||||
createMenu( GEOMOp::OpGlueFaces, repairId, -1 );
|
||||
createMenu( GEOMOp::OpLimitTolerance, repairId, -1 );
|
||||
createMenu( GEOMOp::OpAddPointOnEdge, repairId, -1 );
|
||||
//createMenu( GEOMOp::OpFreeBoundaries, repairId, -1 );
|
||||
//createMenu( GEOMOp::OpFreeFaces, repairId, -1 );
|
||||
@ -1089,7 +1121,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->setRule( action( GEOMOp::OpDeflection ), "selcount>0 and isVisible and client='OCCViewer'", QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( GEOMOp::OpPointMarker ), -1, -1 ); // point marker
|
||||
//mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1}" ).arg(GEOM::VERTEX), QtxPopupMgr::VisibleRule );
|
||||
mgr->setRule( action( GEOMOp::OpPointMarker ), QString( "selcount>0 and $typeid in {%1 %2}" ).arg(GEOM::VERTEX).arg(GEOM::COMPOUND), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
mgr->insert( action( GEOMOp::OpAutoColor ), -1, -1 ); // auto color
|
||||
mgr->setRule( action( GEOMOp::OpAutoColor ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
|
||||
|
@ -87,6 +87,8 @@ public:
|
||||
static CORBA::Object_var ClientSObjectToObject (_PTR(SObject) theSObject);
|
||||
static SALOMEDS::Study_var ClientStudyToStudy (_PTR(Study) theStudy);
|
||||
|
||||
static void Modified( bool = true );
|
||||
|
||||
GEOM_Client& GetShapeReader() { return GEOM_Client::ShapeReader; }
|
||||
//GEOM_Client& GetShapeReader() { return myShapeReader; }
|
||||
|
||||
@ -148,7 +150,8 @@ private:
|
||||
GEOMGUI* getLibrary( const QString& libraryName );
|
||||
void createGeomAction( const int id, const QString& po_id,
|
||||
const QString& icon_id = QString(""),
|
||||
const int key = 0, const bool toggle = false );
|
||||
const int key = 0, const bool toggle = false,
|
||||
const QString& shortcutAction = QString() );
|
||||
void createPopupItem( const int, const QString& clients, const QString& types,
|
||||
const bool isSingle = false, const int isVisible = -1,
|
||||
const bool isExpandAll = false, const bool isOCC = false,
|
||||
|
@ -16,10 +16,9 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File : GeometryGUI_Operations.h
|
||||
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||
//
|
||||
|
||||
#ifndef GEOMETRYGUI_OPERATIONS_H
|
||||
#define GEOMETRYGUI_OPERATIONS_H
|
||||
|
||||
@ -41,10 +40,14 @@ namespace GEOMOp {
|
||||
OpDeflection = 1200, // POPUP MENU - DEFLECTION COEFFICIENT
|
||||
OpColor = 1201, // POPUP MENU - COLOR
|
||||
OpTransparency = 1202, // POPUP MENU - TRANSPARENCY
|
||||
OpIsos = 1203, // POPUP MENU - ISOS
|
||||
OpAutoColor = 1204, // POPUP MENU - AUTO COLOR
|
||||
OpNoAutoColor = 1205, // POPUP MENU - DISABLE AUTO COLOR
|
||||
OpPointMarker = 1206, // POPUP MENU - POINT MARKER
|
||||
OpIncrTransparency = 1203, // SHORTCUT - INCREASE TRANSPARENCY
|
||||
OpDecrTransparency = 1204, // SHORTCUT - DECREASE TRANSPARENCY
|
||||
OpIsos = 1205, // POPUP MENU - ISOS
|
||||
OpIncrNbIsos = 1206, // SHORTCUT - INCREASE NB ISOS
|
||||
OpDecrNbIsos = 1207, // SHORTCUT - DECREASE NB ISOS
|
||||
OpAutoColor = 1208, // POPUP MENU - AUTO COLOR
|
||||
OpNoAutoColor = 1209, // POPUP MENU - DISABLE AUTO COLOR
|
||||
OpPointMarker = 1210, // POPUP MENU - POINT MARKER
|
||||
OpShowChildren = 1250, // POPUP MENU - SHOW CHILDREN
|
||||
OpHideChildren = 1251, // POPUP MENU - HIDE CHILDREN
|
||||
OpRename = 1252, // POPUP MENU - RENAME
|
||||
@ -131,6 +134,7 @@ namespace GEOMOp {
|
||||
OpOrientation = 4009, // MENU REPAIR - CHANGE ORIENTATION
|
||||
OpGlueFaces = 4010, // MENU REPAIR - GLUE FACES
|
||||
OpRemoveExtraEdges = 4011, // MENU REPAIR - REMOVE EXTRA EDGES
|
||||
OpLimitTolerance = 4012, // MENU REPAIR - LIMIT TOLERANCE
|
||||
// MeasureGUI ----------------//--------------------------------
|
||||
OpProperties = 5000, // MENU MEASURES - PROPERTIES
|
||||
OpCenterMass = 5001, // MENU MEASURES - CENTRE OF MASS
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -45,6 +44,12 @@
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
||||
#include <TNaming_CopyShape.hxx>
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
#include <BRepCheck_Analyzer.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
|
||||
#include <StdFail_NotDone.hxx>
|
||||
@ -126,6 +131,9 @@ Standard_Integer GEOMImpl_HealingDriver::Execute(TFunction_Logbook& log) const
|
||||
case CHANGE_ORIENTATION:
|
||||
ChangeOrientation(&HI, anOriginalShape, aShape);
|
||||
break;
|
||||
case LIMIT_TOLERANCE:
|
||||
LimitTolerance(&HI, anOriginalShape, aShape);
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -465,6 +473,36 @@ Standard_Boolean GEOMImpl_HealingDriver::ChangeOrientation (GEOMImpl_IHealing* t
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : LimitTolerance
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMImpl_HealingDriver::LimitTolerance (GEOMImpl_IHealing* theHI,
|
||||
const TopoDS_Shape& theOriginalShape,
|
||||
TopoDS_Shape& theOutShape) const
|
||||
{
|
||||
Standard_Real aTol = theHI->GetTolerance();
|
||||
if (aTol < Precision::Confusion())
|
||||
aTol = Precision::Confusion();
|
||||
|
||||
// 1. Make a copy to prevent the original shape changes.
|
||||
TopoDS_Shape aShapeCopy;
|
||||
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
|
||||
TNaming_CopyShape::CopyTool(theOriginalShape, aMapTShapes, aShapeCopy);
|
||||
|
||||
// 2. Limit tolerance.
|
||||
ShapeFix_ShapeTolerance aSFT;
|
||||
aSFT.LimitTolerance(aShapeCopy, aTol, aTol, TopAbs_SHAPE);
|
||||
|
||||
// 3. Fix obtained shape.
|
||||
Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape (aShapeCopy);
|
||||
aSfs->Perform();
|
||||
theOutShape = aSfs->Shape();
|
||||
|
||||
BRepCheck_Analyzer ana (theOutShape, Standard_True);
|
||||
if (!ana.IsValid())
|
||||
StdFail_NotDone::Raise("Non valid shape result");
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GEOMImpl_HealingDriver_Type_
|
||||
|
@ -19,10 +19,9 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File : GEOMImpl_HealingDriver.hxx
|
||||
// Module : GEOMImpl
|
||||
//
|
||||
|
||||
#ifndef _GEOMImpl_HealingDriver_HeaderFile
|
||||
#define _GEOMImpl_HealingDriver_HeaderFile
|
||||
|
||||
@ -167,7 +166,7 @@ Standard_Boolean RemoveHoles ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS
|
||||
Standard_Boolean Sew ( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
|
||||
Standard_Boolean AddPointOnEdge( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
|
||||
Standard_Boolean ChangeOrientation( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
|
||||
|
||||
void LimitTolerance( GEOMImpl_IHealing*, const TopoDS_Shape&, TopoDS_Shape& ) const;
|
||||
|
||||
};
|
||||
|
||||
|
@ -281,6 +281,10 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int
|
||||
aShell->GetLastFunction()->SetDescription("");
|
||||
// Get the common shapes between shell and shape
|
||||
Handle(GEOM_Object) aCommonCompound = myBooleanOperations->MakeBoolean (theShape, aShell, 1); // MakeCommon
|
||||
if (aCommonCompound.IsNull()) {
|
||||
SetErrorCode(myBooleanOperations->GetErrorCode());
|
||||
return false;
|
||||
}
|
||||
aCommonCompound->GetLastFunction()->SetDescription("");
|
||||
// Explode the faces of common shapes => 3 faces
|
||||
Handle(TColStd_HSequenceOfTransient) aCommonFaces = myShapesOperations->MakeExplode(aCommonCompound, TopAbs_FACE, true);
|
||||
@ -316,34 +320,34 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int
|
||||
|
||||
// Uncomment the following lines when GetInPlace bug is solved
|
||||
// == BEGIN
|
||||
// Handle(GEOM_Object) aP1 = myBasicOperations->MakePointXYZ(-theL1, 0, 0);
|
||||
// Handle(GEOM_Object) aP2 = myBasicOperations->MakePointXYZ(-0, 0, theL2);
|
||||
// Handle(GEOM_Object) aP3 = myBasicOperations->MakePointXYZ(theL1, 0, 0);
|
||||
// aP1->GetLastFunction()->SetDescription("");
|
||||
// aP2->GetLastFunction()->SetDescription("");
|
||||
// aP3->GetLastFunction()->SetDescription("");
|
||||
// Handle(GEOM_Object) aV1 = myBasicOperations->MakeVectorDXDYDZ(-1, 0, 0);
|
||||
// Handle(GEOM_Object) aV2 = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
|
||||
// Handle(GEOM_Object) aV3 = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
|
||||
// aV1->GetLastFunction()->SetDescription("");
|
||||
// aV2->GetLastFunction()->SetDescription("");
|
||||
// aV3->GetLastFunction()->SetDescription("");
|
||||
// Handle(GEOM_Object) aPln1 = myBasicOperations->MakePlanePntVec(aP1, aV1, 2*(theR1+theW1+theL2));
|
||||
// Handle(GEOM_Object) aPln2 = myBasicOperations->MakePlanePntVec(aP2, aV2, 2*(theR2+theW2));
|
||||
// Handle(GEOM_Object) aPln3 = myBasicOperations->MakePlanePntVec(aP3, aV3, 2*(theR1+theW1+theL2));
|
||||
// aPln1->GetLastFunction()->SetDescription("");
|
||||
// aPln2->GetLastFunction()->SetDescription("");
|
||||
// aPln3->GetLastFunction()->SetDescription("");
|
||||
|
||||
// BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape();
|
||||
// aPln1->GetLastFunction()->SetValue(aTrsf_Shape1);
|
||||
// BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape();
|
||||
// aPln2->GetLastFunction()->SetValue(aTrsf_Shape2);
|
||||
// BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape();
|
||||
// aPln3->GetLastFunction()->SetValue(aTrsf_Shape3);
|
||||
// Handle(GEOM_Object) aP1 = myBasicOperations->MakePointXYZ(-theL1, 0, 0);
|
||||
// Handle(GEOM_Object) aP2 = myBasicOperations->MakePointXYZ(-0, 0, theL2);
|
||||
// Handle(GEOM_Object) aP3 = myBasicOperations->MakePointXYZ(theL1, 0, 0);
|
||||
// aP1->GetLastFunction()->SetDescription("");
|
||||
// aP2->GetLastFunction()->SetDescription("");
|
||||
// aP3->GetLastFunction()->SetDescription("");
|
||||
// Handle(GEOM_Object) aV1 = myBasicOperations->MakeVectorDXDYDZ(-1, 0, 0);
|
||||
// Handle(GEOM_Object) aV2 = myBasicOperations->MakeVectorDXDYDZ(0, 0, 1);
|
||||
// Handle(GEOM_Object) aV3 = myBasicOperations->MakeVectorDXDYDZ(1, 0, 0);
|
||||
// aV1->GetLastFunction()->SetDescription("");
|
||||
// aV2->GetLastFunction()->SetDescription("");
|
||||
// aV3->GetLastFunction()->SetDescription("");
|
||||
// Handle(GEOM_Object) aPln1 = myBasicOperations->MakePlanePntVec(aP1, aV1, 2*(aR1Ext+theL2));
|
||||
// Handle(GEOM_Object) aPln2 = myBasicOperations->MakePlanePntVec(aP2, aV2, 2*(aR2Ext));
|
||||
// Handle(GEOM_Object) aPln3 = myBasicOperations->MakePlanePntVec(aP3, aV3, 2*(aR1Ext+theL2));
|
||||
// aPln1->GetLastFunction()->SetDescription("");
|
||||
// aPln2->GetLastFunction()->SetDescription("");
|
||||
// aPln3->GetLastFunction()->SetDescription("");
|
||||
//
|
||||
// BRepBuilderAPI_Transform aTransformation1(aPln1->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape1 = aTransformation1.Shape();
|
||||
// aPln1->GetLastFunction()->SetValue(aTrsf_Shape1);
|
||||
// BRepBuilderAPI_Transform aTransformation2(aPln2->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape2 = aTransformation2.Shape();
|
||||
// aPln2->GetLastFunction()->SetValue(aTrsf_Shape2);
|
||||
// BRepBuilderAPI_Transform aTransformation3(aPln3->GetValue(), aTrsf, Standard_False);
|
||||
// TopoDS_Shape aTrsf_Shape3 = aTransformation3.Shape();
|
||||
// aPln3->GetLastFunction()->SetValue(aTrsf_Shape3);
|
||||
// == END
|
||||
//
|
||||
|
||||
@ -386,7 +390,10 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int
|
||||
// theSeq->Append(aPln3);
|
||||
// return false;
|
||||
}
|
||||
// Comment the following lines when GetInPlace bug is solved
|
||||
// == BEGIN
|
||||
}
|
||||
// == END
|
||||
/////////////////////////
|
||||
//// Groups of Edges ////
|
||||
/////////////////////////
|
||||
@ -510,7 +517,7 @@ bool GEOMImpl_IAdvancedOperations::MakeGroups(Handle(GEOM_Object) theShape, int
|
||||
}
|
||||
else if (nbEdges == 8) {
|
||||
incidentPipeFound = true;
|
||||
mainPipeFound = false;
|
||||
mainPipeFound = true;
|
||||
flangeFound = false;
|
||||
|
||||
TopExp_Explorer Ex(aGroupShapeTrsfInv,TopAbs_VERTEX);
|
||||
@ -989,7 +996,12 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapePartition(Handle(GEOM_Object) t
|
||||
}
|
||||
Te3->GetLastFunction()->SetDescription("");
|
||||
|
||||
|
||||
// Last verification: result should be a block
|
||||
std::list<GEOMImpl_IBlocksOperations::BCError> errList;
|
||||
if (!myBlocksOperations->CheckCompoundOfBlocks(Te3,errList)) {
|
||||
SetErrorCode("TShape is not a block");
|
||||
return false;
|
||||
}
|
||||
TopoDS_Shape aShape = Te3->GetValue();
|
||||
theShape->GetLastFunction()->SetValue(aShape);
|
||||
|
||||
@ -1141,8 +1153,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShape(double theR1, double theW1, double
|
||||
/*
|
||||
* Get the groups: BEGIN
|
||||
*/
|
||||
try {
|
||||
if (!MakeGroups(aShape, TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf()))
|
||||
return NULL;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
@ -1271,9 +1290,16 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeWithPosition(double theR1, double th
|
||||
//
|
||||
// Get the groups: BEGIN
|
||||
//
|
||||
try {
|
||||
if (!MakeGroups(aShape,TSHAPE_BASIC, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
@ -1465,8 +1491,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamfer(double theR1, double theW1,
|
||||
// << ", " << theHexMesh << ")";
|
||||
// }
|
||||
// else {
|
||||
try {
|
||||
if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf()))
|
||||
return NULL;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
@ -1658,8 +1691,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeChamferWithPosition(double theR1, do
|
||||
/*
|
||||
* Get the groups: BEGIN
|
||||
*/
|
||||
try {
|
||||
if (!MakeGroups(aShape, TSHAPE_CHAMFER, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf))
|
||||
return NULL;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
@ -1808,7 +1848,8 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d
|
||||
return NULL;
|
||||
}
|
||||
if (aFillet.IsNull()) {
|
||||
SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
|
||||
// SetErrorCode("Fillet can not be computed on the given shape with the given parameters");
|
||||
SetErrorCode(myLocalOperations->GetErrorCode());
|
||||
return NULL;
|
||||
}
|
||||
aFillet->GetLastFunction()->SetDescription("");
|
||||
@ -1830,8 +1871,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFillet(double theR1, double theW1, d
|
||||
/*
|
||||
* Get the groups: BEGIN
|
||||
*/
|
||||
try {
|
||||
if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, gp_Trsf()))
|
||||
return NULL;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
@ -2022,8 +2070,15 @@ GEOMImpl_IAdvancedOperations::MakePipeTShapeFilletWithPosition(double theR1, dou
|
||||
/*
|
||||
* Get the groups: BEGIN
|
||||
*/
|
||||
try {
|
||||
if (!MakeGroups(aShape, TSHAPE_FILLET, theR1, theW1, theL1, theR2, theW2, theL2, aSeq, aTrsf))
|
||||
return NULL;
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TCollection_AsciiString aListRes, anEntry;
|
||||
// Iterate over the sequence aSeq
|
||||
|
@ -569,6 +569,81 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetVertexNearPoint
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetVertexNearPoint
|
||||
(Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object) thePoint)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
// New Point object
|
||||
Handle(GEOM_Object) aResult;
|
||||
|
||||
// Arguments
|
||||
if (theShape.IsNull() || thePoint.IsNull()) return NULL;
|
||||
|
||||
TopoDS_Shape aBlockOrComp = theShape->GetValue();
|
||||
TopoDS_Shape aPoint = thePoint->GetValue();
|
||||
if (aBlockOrComp.IsNull() || aPoint.IsNull()) {
|
||||
SetErrorCode("Given shape is null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (aPoint.ShapeType() != TopAbs_VERTEX) {
|
||||
SetErrorCode("Element for vertex identification is not a vertex");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TopoDS_Vertex aVert = TopoDS::Vertex(aPoint);
|
||||
gp_Pnt aP = BRep_Tool::Pnt(aVert);
|
||||
|
||||
// Compute the Vertex value
|
||||
TopoDS_Shape V;
|
||||
bool isFound = false;
|
||||
Standard_Real aDist = RealLast();
|
||||
TopTools_MapOfShape mapShape;
|
||||
|
||||
TopExp_Explorer exp (aBlockOrComp, TopAbs_VERTEX);
|
||||
for (; exp.More(); exp.Next()) {
|
||||
if (mapShape.Add(exp.Current())) {
|
||||
TopoDS_Vertex aVi = TopoDS::Vertex(exp.Current());
|
||||
gp_Pnt aPi = BRep_Tool::Pnt(aVi);
|
||||
Standard_Real aDisti = aPi.Distance(aP);
|
||||
if (aDisti < aDist) {
|
||||
V = aVi;
|
||||
aDist = aDisti;
|
||||
isFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFound) {
|
||||
SetErrorCode("Vertex has not been found");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
TopExp::MapShapes(aBlockOrComp, anIndices);
|
||||
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
|
||||
anArray->SetValue(1, anIndices.FindIndex(V));
|
||||
aResult = GetEngine()->AddSubShape(theShape, anArray);
|
||||
|
||||
// The GetPoint() doesn't change object so no new function is required.
|
||||
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
|
||||
|
||||
// Make a Python command
|
||||
GEOM::TPythonDump(aFunction, /*append=*/true)
|
||||
<< aResult << " = geompy.GetVertexNearPoint("
|
||||
<< theShape << ", " << thePoint << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetEdge
|
||||
@ -1458,6 +1533,136 @@ Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetFaceByNormale
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetShapesNearPoint
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetShapesNearPoint
|
||||
(Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object) thePoint,
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Real theTolerance)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
// New object
|
||||
Handle(GEOM_Object) aResult;
|
||||
|
||||
// Arguments
|
||||
if (theShape.IsNull() || thePoint.IsNull()) return NULL;
|
||||
|
||||
TopoDS_Shape aBlockOrComp = theShape->GetValue();
|
||||
if (aBlockOrComp.IsNull()) {
|
||||
SetErrorCode("Block or compound is null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TopoDS_Shape anArg = thePoint->GetValue();
|
||||
if (anArg.IsNull()) {
|
||||
SetErrorCode("Null shape is given as argument");
|
||||
return NULL;
|
||||
}
|
||||
if (anArg.ShapeType() != TopAbs_VERTEX) {
|
||||
SetErrorCode("Element for face identification is not a vertex");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (theShapeType < TopAbs_SOLID || TopAbs_VERTEX < theShapeType) {
|
||||
SetErrorCode("Invalid type of result is requested");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (theTolerance < Precision::Confusion()) {
|
||||
theTolerance == Precision::Confusion();
|
||||
}
|
||||
|
||||
// Compute the result
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
TopoDS_Vertex aVert = TopoDS::Vertex(anArg);
|
||||
|
||||
TopTools_MapOfShape mapShape;
|
||||
Standard_Integer nbEdges = 0;
|
||||
TopExp_Explorer exp (aBlockOrComp, TopAbs_ShapeEnum(theShapeType));
|
||||
for (; exp.More(); exp.Next()) {
|
||||
if (mapShape.Add(exp.Current())) {
|
||||
nbEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nbEdges == 0) {
|
||||
SetErrorCode("Given shape contains no subshapes of requested type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Calculate distances and find min
|
||||
mapShape.Clear();
|
||||
Standard_Integer ind = 1;
|
||||
Standard_Real aMinDist = RealLast();
|
||||
TopTools_Array1OfShape anEdges (1, nbEdges);
|
||||
TColStd_Array1OfReal aDistances (1, nbEdges);
|
||||
for (exp.Init(aBlockOrComp, TopAbs_ShapeEnum(theShapeType)); exp.More(); exp.Next()) {
|
||||
if (mapShape.Add(exp.Current())) {
|
||||
TopoDS_Shape anEdge = exp.Current();
|
||||
anEdges(ind) = anEdge;
|
||||
|
||||
BRepExtrema_DistShapeShape aDistTool (aVert, anEdges(ind));
|
||||
if (!aDistTool.IsDone()) {
|
||||
SetErrorCode("Can not find a distance from the given point to one of subshapes");
|
||||
return NULL;
|
||||
}
|
||||
aDistances(ind) = aDistTool.Value();
|
||||
if (aDistances(ind) < aMinDist) {
|
||||
aMinDist = aDistances(ind);
|
||||
}
|
||||
ind++;
|
||||
}
|
||||
}
|
||||
|
||||
if (aMinDist < RealLast()) {
|
||||
// Collect subshapes with distance < (aMinDist + theTolerance)
|
||||
int nbSubShapes = 0;
|
||||
TopTools_Array1OfShape aNearShapes (1, nbEdges);
|
||||
for (ind = 1; ind <= nbEdges; ind++) {
|
||||
if (aDistances(ind) < aMinDist + theTolerance) {
|
||||
nbSubShapes++;
|
||||
aNearShapes(nbSubShapes) = anEdges(ind);
|
||||
}
|
||||
}
|
||||
|
||||
// Add subshape
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
TopExp::MapShapes(aBlockOrComp, anIndices);
|
||||
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger (1, nbSubShapes);
|
||||
for (ind = 1; ind <= nbSubShapes; ind++) {
|
||||
anArray->SetValue(ind, anIndices.FindIndex(aNearShapes(ind)));
|
||||
}
|
||||
aResult = GetEngine()->AddSubShape(theShape, anArray);
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (aResult.IsNull())
|
||||
return NULL;
|
||||
|
||||
Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction)
|
||||
<< aResult << " = geompy.GetShapesNearPoint(" << theShape << ", " << thePoint
|
||||
<< ", " << TopAbs_ShapeEnum(theShapeType) << ", " << theTolerance << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* IsCompoundOfBlocks
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMImpl_IBlocksOperations_HXX_
|
||||
#define _GEOMImpl_IBlocksOperations_HXX_
|
||||
@ -72,6 +71,9 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
|
||||
const Standard_Real theZ,
|
||||
const Standard_Real theEpsilon);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) GetVertexNearPoint (Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object) thePoint);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) GetEdge (Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object) thePoint1,
|
||||
Handle(GEOM_Object) thePoint2);
|
||||
@ -98,6 +100,11 @@ class GEOMImpl_IBlocksOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) GetFaceByNormale (Handle(GEOM_Object) theBlock,
|
||||
Handle(GEOM_Object) theVector);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) GetShapesNearPoint (Handle(GEOM_Object) theShape,
|
||||
Handle(GEOM_Object) thePoint,
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Real theTolerance);
|
||||
|
||||
// Check blocks compounds
|
||||
Standard_EXPORT Standard_Boolean IsCompoundOfBlocks (Handle(GEOM_Object) theCompound,
|
||||
const Standard_Integer theMinNbFaces,
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
|
@ -19,9 +19,8 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// NOTE: This is an intreface to a function for the Healing creation.
|
||||
|
||||
//NOTE: This is an intreface to a function for the Healing creation.
|
||||
//
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifdef WNT
|
||||
#pragma warning( disable:4786 )
|
||||
@ -864,7 +863,6 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_
|
||||
return theObject;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ChangeOrientationCopy
|
||||
@ -921,3 +919,62 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G
|
||||
SetErrorCode(OK);
|
||||
return aNewObject;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* LimitTolerance
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_IHealingOperations::LimitTolerance (Handle(GEOM_Object) theObject,
|
||||
double theTolerance)
|
||||
{
|
||||
// Set error code, check parameters
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theObject.IsNull())
|
||||
return NULL;
|
||||
|
||||
Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
|
||||
if (aLastFunction.IsNull())
|
||||
return NULL; // There is no function which creates an object to be processed
|
||||
|
||||
// Add a new object
|
||||
Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
|
||||
|
||||
// Add the function
|
||||
aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), LIMIT_TOLERANCE);
|
||||
|
||||
if (aFunction.IsNull())
|
||||
return NULL;
|
||||
|
||||
// Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
|
||||
|
||||
// Prepare "data container" class IHealing
|
||||
GEOMImpl_IHealing HI (aFunction);
|
||||
HI.SetOriginal(aLastFunction);
|
||||
HI.SetTolerance(theTolerance);
|
||||
|
||||
// Compute
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Healing driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.LimitTolerance("
|
||||
<< theObject << ", " << theTolerance << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aNewObject;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMImpl_IHealingOperations_HXX_
|
||||
#define _GEOMImpl_IHealingOperations_HXX_
|
||||
@ -54,7 +53,8 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
|
||||
std::list<std::string>& theValues );
|
||||
|
||||
// returns all parameters that are valid for the given operation (Shape Process operator)
|
||||
Standard_EXPORT static bool GetParameters( const std::string theOperation, std::list<std::string>& theParams );
|
||||
Standard_EXPORT static bool GetParameters( const std::string theOperation,
|
||||
std::list<std::string>& theParams );
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) SuppressFaces( Handle(GEOM_Object) theObject,
|
||||
const Handle(TColStd_HArray1OfInteger)& theFaces);
|
||||
@ -87,6 +87,9 @@ class GEOMImpl_IHealingOperations : public GEOM_IOperations {
|
||||
Standard_EXPORT Handle(GEOM_Object) ChangeOrientation( Handle(GEOM_Object) theObject);
|
||||
Standard_EXPORT Handle(GEOM_Object) ChangeOrientationCopy( Handle(GEOM_Object) theObject);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) LimitTolerance( Handle(GEOM_Object) theObject,
|
||||
double theTolerance );
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -19,13 +19,12 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File : GEOMImpl_IShapesOperations.cxx
|
||||
// Created :
|
||||
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
|
||||
// Project : SALOME
|
||||
// $Header$
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
#include "GEOMImpl_IShapesOperations.hxx"
|
||||
@ -66,6 +65,7 @@
|
||||
#include <TFunction_Logbook.hxx>
|
||||
#include <TDataStd_Integer.hxx>
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
|
||||
#include <BRepExtrema_ExtCF.hxx>
|
||||
@ -803,6 +803,70 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
|
||||
return aGlued;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetExistingSubObjects
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetExistingSubObjects
|
||||
(Handle(GEOM_Object) theShape,
|
||||
const Standard_Boolean theGroupsOnly)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (theShape.IsNull()) return NULL;
|
||||
|
||||
Handle(GEOM_Function) aMainShape = theShape->GetLastFunction();
|
||||
if (aMainShape.IsNull()) return NULL;
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
|
||||
SetErrorCode(NOT_FOUND_ANY);
|
||||
|
||||
if (!aMainShape->HasSubShapeReferences()) return aSeq;
|
||||
const TDataStd_ListOfExtendedString& aListEntries = aMainShape->GetSubShapeReferences();
|
||||
if (aListEntries.IsEmpty()) return aSeq;
|
||||
|
||||
SetErrorCode(KO);
|
||||
|
||||
TCollection_AsciiString anAsciiList;
|
||||
|
||||
TDataStd_ListIteratorOfListOfExtendedString anIt (aListEntries);
|
||||
for (; anIt.More(); anIt.Next()) {
|
||||
TCollection_ExtendedString anEntry = anIt.Value();
|
||||
Standard_Integer aStrLen = anEntry.LengthOfCString();
|
||||
char* anEntryStr = new char[aStrLen];
|
||||
anEntry.ToUTF8CString(anEntryStr);
|
||||
Handle(GEOM_Object) anObj = GetEngine()->GetObject(GetDocID(), anEntryStr, false);
|
||||
if (!anObj.IsNull()) {
|
||||
if (!theGroupsOnly || anObj->GetType() == GEOM_GROUP) {
|
||||
aSeq->Append(anObj);
|
||||
|
||||
// for python command
|
||||
anAsciiList += anEntryStr;
|
||||
anAsciiList += ",";
|
||||
}
|
||||
}
|
||||
delete [] anEntryStr;
|
||||
}
|
||||
|
||||
if (aSeq->Length() == 0) {
|
||||
SetErrorCode(NOT_FOUND_ANY);
|
||||
return aSeq;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
anAsciiList.Trunc(anAsciiList.Length() - 1);
|
||||
|
||||
GEOM::TPythonDump pd (aMainShape, /*append=*/true);
|
||||
pd << "[" << anAsciiList.ToCString();
|
||||
pd << "] = geompy.GetExistingSubObjects(";
|
||||
pd << theShape << ", " << (int)theGroupsOnly << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeExplode
|
||||
@ -1941,9 +2005,31 @@ Handle(TColStd_HSequenceOfInteger)
|
||||
return aSeqOfIDs;
|
||||
}
|
||||
|
||||
// BEGIN: Mantis issue 0020961: Error on a pipe T-Shape
|
||||
// Compute tolerance
|
||||
Standard_Real T, VertMax = -RealLast();
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
for (TopExp_Explorer ExV (theShape, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
|
||||
TopoDS_Vertex Vertex = TopoDS::Vertex(ExV.Current());
|
||||
T = BRep_Tool::Tolerance(Vertex);
|
||||
if (T > VertMax)
|
||||
VertMax = T;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return aSeqOfIDs;
|
||||
}
|
||||
// END: Mantis issue 0020961
|
||||
|
||||
// Call algo
|
||||
GEOMAlgo_FinderShapeOn1 aFinder;
|
||||
Standard_Real aTol = 0.0001; // default value
|
||||
//Standard_Real aTol = 0.0001; // default value
|
||||
Standard_Real aTol = VertMax; // Mantis issue 0020961
|
||||
|
||||
aFinder.SetShape(theShape);
|
||||
aFinder.SetTolerance(aTol);
|
||||
|
@ -85,6 +85,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
||||
std::list<Handle(GEOM_Object)> theFaces,
|
||||
const Standard_Boolean doKeepNonSolids);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
|
||||
(Handle(GEOM_Object) theShape,
|
||||
const Standard_Boolean theGroupsOnly);
|
||||
|
||||
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const Standard_Boolean isSorted);
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -109,7 +108,7 @@ Standard_Integer GEOMImpl_ImportDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
// perform the import
|
||||
TCollection_AsciiString anError;
|
||||
TopoDS_Shape aShape = fp( aFileName, aFormatName, anError, aFunction->GetEntry() );
|
||||
TopoDS_Shape aShape = fp(aFileName, aFormatName, anError, aFunction->GetNamingEntry());
|
||||
|
||||
// unload plugin library
|
||||
// commented by enk:
|
||||
@ -159,7 +158,8 @@ Standard_EXPORT Handle_Standard_Type& GEOMImpl_ImportDriver_Type_()
|
||||
//function : DownCast
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||
const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast
|
||||
(const Handle(Standard_Transient)& AnObject)
|
||||
{
|
||||
Handle(GEOMImpl_ImportDriver) _anOtherObject;
|
||||
|
||||
@ -169,5 +169,5 @@ const Handle(GEOMImpl_ImportDriver) Handle(GEOMImpl_ImportDriver)::DownCast(cons
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject ;
|
||||
return _anOtherObject;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -29,12 +28,12 @@
|
||||
#include <GEOM_Object.hxx>
|
||||
#include <GEOM_Function.hxx>
|
||||
|
||||
//#include <NMTAlgo_Splitter1.hxx>
|
||||
#include <GEOMAlgo_Splitter.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <TDataStd_IntegerArray.hxx>
|
||||
#include <TNaming_CopyShape.hxx>
|
||||
|
||||
//#include <BRepBuilderAPI_Copy.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepAlgo.hxx>
|
||||
|
||||
@ -46,11 +45,14 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
|
||||
#include <ShapeFix_ShapeTolerance.hxx>
|
||||
#include <ShapeFix_Shape.hxx>
|
||||
|
||||
#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TColStd_ListOfInteger.hxx>
|
||||
#include <Standard_NullObject.hxx>
|
||||
@ -117,6 +119,9 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
//sklNMTAlgo_Splitter1 PS;
|
||||
GEOMAlgo_Splitter PS;
|
||||
|
||||
TopTools_DataMapOfShapeShape aCopyMap;
|
||||
TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
|
||||
|
||||
if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS)
|
||||
{
|
||||
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
|
||||
@ -141,8 +146,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_NullObject::Raise("In Partition a shape is null");
|
||||
}
|
||||
//
|
||||
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||
TopoDS_Shape aShape_i_copy;
|
||||
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aShape_i_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape aSimpleShapes;
|
||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||
@ -164,8 +188,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_NullObject::Raise("In Partition a tool shape is null");
|
||||
}
|
||||
//
|
||||
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||
TopoDS_Shape aShape_i_copy;
|
||||
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aShape_i_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape aSimpleShapes;
|
||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||
@ -183,8 +226,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_NullObject::Raise("In Partition a Keep Inside shape is null");
|
||||
}
|
||||
//
|
||||
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||
TopoDS_Shape aShape_i_copy;
|
||||
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aShape_i_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape aSimpleShapes;
|
||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||
@ -201,8 +263,27 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_NullObject::Raise("In Partition a Remove Inside shape is null");
|
||||
}
|
||||
//
|
||||
//BRepBuilderAPI_Copy aCopyTool (aShape_i);
|
||||
TopoDS_Shape aShape_i_copy;
|
||||
TNaming_CopyShape::CopyTool(aShape_i, aMapTShapes, aShape_i_copy);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aShape_i_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aShape_i_inds;
|
||||
TopTools_IndexedMapOfShape aShape_i_copy_inds;
|
||||
TopExp::MapShapes(aShape_i, aShape_i_inds);
|
||||
TopExp::MapShapes(aShape_i_copy, aShape_i_copy_inds);
|
||||
Standard_Integer nbInds = aShape_i_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aShape_i_inds.FindKey(ie), aShape_i_copy_inds.FindKey(ie));
|
||||
}
|
||||
//
|
||||
TopTools_ListOfShape aSimpleShapes;
|
||||
PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
//PrepareShapes(aShape_i, aType, aSimpleShapes);
|
||||
PrepareShapes(aShape_i_copy, aType, aSimpleShapes);
|
||||
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
|
||||
for (; aSimpleIter.More(); aSimpleIter.Next()) {
|
||||
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
|
||||
@ -212,7 +293,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
}
|
||||
|
||||
PS.SetLimitMode(aCI.GetKeepNonlimitShapes());
|
||||
PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() );
|
||||
PS.SetLimit((TopAbs_ShapeEnum)aCI.GetLimit());
|
||||
PS.Perform();
|
||||
|
||||
//skl PS.Compute();
|
||||
@ -245,11 +326,52 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
Standard_NullObject::Raise("In Half Partition a shape or a plane is null");
|
||||
}
|
||||
|
||||
TopoDS_Shape aShapeArg_copy;
|
||||
TopoDS_Shape aPlaneArg_copy;
|
||||
{
|
||||
TNaming_CopyShape::CopyTool(aShapeArg, aMapTShapes, aShapeArg_copy);
|
||||
//BRepBuilderAPI_Copy aCopyTool (aShapeArg);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aShapeArg_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aShapeArg_inds;
|
||||
TopTools_IndexedMapOfShape aShapeArg_copy_inds;
|
||||
TopExp::MapShapes(aShapeArg, aShapeArg_inds);
|
||||
TopExp::MapShapes(aShapeArg_copy, aShapeArg_copy_inds);
|
||||
Standard_Integer nbInds = aShapeArg_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aShapeArg_inds.FindKey(ie), aShapeArg_copy_inds.FindKey(ie));
|
||||
}
|
||||
}
|
||||
{
|
||||
TNaming_CopyShape::CopyTool(aPlaneArg, aMapTShapes, aPlaneArg_copy);
|
||||
//BRepBuilderAPI_Copy aCopyTool (aPlaneArg);
|
||||
//if (aCopyTool.IsDone())
|
||||
// aPlaneArg_copy = aCopyTool.Shape();
|
||||
//else
|
||||
// Standard_NullObject::Raise("Bad shape detected");
|
||||
//
|
||||
// fill aCopyMap for history
|
||||
TopTools_IndexedMapOfShape aPlaneArg_inds;
|
||||
TopTools_IndexedMapOfShape aPlaneArg_copy_inds;
|
||||
TopExp::MapShapes(aPlaneArg, aPlaneArg_inds);
|
||||
TopExp::MapShapes(aPlaneArg_copy, aPlaneArg_copy_inds);
|
||||
Standard_Integer nbInds = aPlaneArg_inds.Extent();
|
||||
for (Standard_Integer ie = 1; ie <= nbInds; ie++) {
|
||||
aCopyMap.Bind(aPlaneArg_inds.FindKey(ie), aPlaneArg_copy_inds.FindKey(ie));
|
||||
}
|
||||
}
|
||||
|
||||
// add object shapes that are in ListShapes;
|
||||
PS.AddShape(aShapeArg);
|
||||
PS.AddShape(aShapeArg_copy);
|
||||
//PS.AddShape(aShapeArg);
|
||||
|
||||
// add tool shapes that are in ListTools and not in ListShapes;
|
||||
PS.AddTool(aPlaneArg);
|
||||
PS.AddTool(aPlaneArg_copy);
|
||||
//PS.AddTool(aPlaneArg);
|
||||
|
||||
//skl PS.Compute();
|
||||
PS.Perform();
|
||||
@ -293,6 +415,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& aMR = PS.ImagesResult();
|
||||
|
||||
// history for all argument shapes
|
||||
// be sure to use aCopyMap
|
||||
TDF_LabelSequence aLabelSeq;
|
||||
aFunction->GetDependency(aLabelSeq);
|
||||
Standard_Integer nbArg = aLabelSeq.Length();
|
||||
@ -314,6 +437,10 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
for (Standard_Integer ie = 1; ie <= nbArgumentEntities; ie++) {
|
||||
TopoDS_Shape anEntity = anArgumentIndices.FindKey(ie);
|
||||
// be sure to use aCopyMap here
|
||||
if (aCopyMap.IsBound(anEntity))
|
||||
anEntity = aCopyMap.Find(anEntity);
|
||||
//
|
||||
if (!aMR.Contains(anEntity)) continue;
|
||||
|
||||
const TopTools_ListOfShape& aModified = aMR.FindFromKey(anEntity);
|
||||
@ -346,21 +473,17 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
|
||||
//=======================================================================
|
||||
Standard_EXPORT Handle_Standard_Type& GEOMImpl_PartitionDriver_Type_()
|
||||
{
|
||||
|
||||
static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||
if (aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
|
||||
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||
if (aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
||||
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||
if (aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||
|
||||
|
||||
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
|
||||
static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_PartitionDriver",
|
||||
sizeof(GEOMImpl_PartitionDriver),
|
||||
1,
|
||||
(Standard_Address)_Ancestors,
|
||||
(Standard_Address)NULL);
|
||||
static Handle_Standard_Transient _Ancestors[] = {aType1,aType2,aType3,NULL};
|
||||
static Handle_Standard_Type _aType =
|
||||
new Standard_Type ("GEOMImpl_PartitionDriver", sizeof(GEOMImpl_PartitionDriver),
|
||||
1, (Standard_Address)_Ancestors, (Standard_Address)NULL);
|
||||
|
||||
return _aType;
|
||||
}
|
||||
@ -379,5 +502,5 @@ const Handle(GEOMImpl_PartitionDriver) Handle(GEOMImpl_PartitionDriver)::DownCas
|
||||
}
|
||||
}
|
||||
|
||||
return _anOtherObject ;
|
||||
return _anOtherObject;
|
||||
}
|
||||
|
@ -269,6 +269,7 @@
|
||||
#define SEWING 6
|
||||
#define DIVIDE_EDGE 7
|
||||
#define CHANGE_ORIENTATION 8
|
||||
#define LIMIT_TOLERANCE 9
|
||||
|
||||
#define BASIC_FILLING 1
|
||||
|
||||
|
@ -334,9 +334,21 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
|
||||
case GEOMOp::OpTransparency: // POPUP - TRANSPARENCY
|
||||
OnTransparency();
|
||||
break;
|
||||
case GEOMOp::OpIncrTransparency: // SHORTCUT - INCREASE TRANSPARENCY
|
||||
OnChangeTransparency( true );
|
||||
break;
|
||||
case GEOMOp::OpDecrTransparency: // SHORTCUT - DECREASE TRANSPARENCY
|
||||
OnChangeTransparency( false );
|
||||
break;
|
||||
case GEOMOp::OpIsos: // POPUP - ISOS
|
||||
OnNbIsos();
|
||||
break;
|
||||
case GEOMOp::OpIncrNbIsos: // SHORTCUT - INCREASE NB ISOLINES
|
||||
OnNbIsos( INCR );
|
||||
break;
|
||||
case GEOMOp::OpDecrNbIsos: // SHORTCUT - DECREASE NB ISOLINES
|
||||
OnNbIsos( DECR );
|
||||
break;
|
||||
case GEOMOp::OpAutoColor: // POPUP - AUTO COLOR
|
||||
OnAutoColor();
|
||||
break;
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
bool OnGUIEvent( int, SUIT_Desktop* );
|
||||
virtual void deactivate();
|
||||
|
||||
enum ActionType { SHOWDLG, INCR, DECR };
|
||||
|
||||
private:
|
||||
// Import and export topology methods
|
||||
bool Import();
|
||||
@ -67,12 +69,15 @@ private:
|
||||
void OnDisableAutoColor();
|
||||
void OnColor();
|
||||
void OnTransparency();
|
||||
void OnNbIsos();
|
||||
void OnNbIsos( ActionType actionType = SHOWDLG );
|
||||
void OnDeflection();
|
||||
void OnSelectOnly(int mode);
|
||||
void OnShowHideChildren( bool );
|
||||
void OnPointMarker();
|
||||
|
||||
// Shortcut commands
|
||||
void OnChangeTransparency( bool );
|
||||
|
||||
// Recursive deletion of object with children
|
||||
void removeObjectWithChildren( _PTR(SObject),
|
||||
_PTR(Study),
|
||||
|
@ -325,6 +325,7 @@ void GEOMToolsGUI::OnColor()
|
||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||
aView->SetColor( It.Value(), c );
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
} // if ( isVTK )
|
||||
else if ( isOCC ) {
|
||||
@ -382,6 +383,7 @@ void GEOMToolsGUI::OnColor()
|
||||
anObject->SetColor( aSColor );
|
||||
anObject->SetAutoColor( false );
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
} // if c.isValid()
|
||||
} // first IO is not null
|
||||
@ -399,7 +401,88 @@ void GEOMToolsGUI::OnTransparency()
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnNbIsos()
|
||||
void GEOMToolsGUI::OnChangeTransparency( bool increase )
|
||||
{
|
||||
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;
|
||||
|
||||
Handle(SALOME_InteractiveObject) FirstIOS = selected.First();
|
||||
if ( FirstIOS.IsNull() )
|
||||
return;
|
||||
|
||||
// Delta
|
||||
float delta = 0.01;
|
||||
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();
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) aisShape;
|
||||
|
||||
aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, found );
|
||||
if( !found )
|
||||
return;
|
||||
float transp = aisShape->Transparency();
|
||||
|
||||
// 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(), found );
|
||||
if ( found ) {
|
||||
ic->SetTransparency( aisShape, transp, false );
|
||||
ic->Redisplay( aisShape, Standard_False, Standard_True );
|
||||
}
|
||||
} // for...
|
||||
ic->UpdateCurrentViewer();
|
||||
GeometryGUI::Modified();
|
||||
} // if ( isOCC )
|
||||
}
|
||||
|
||||
void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
||||
{
|
||||
SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
|
||||
@ -419,6 +502,10 @@ void GEOMToolsGUI::OnNbIsos()
|
||||
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() );
|
||||
|
||||
@ -427,21 +514,35 @@ void GEOMToolsGUI::OnNbIsos()
|
||||
|
||||
if ( NbIsosDlg->exec() ) {
|
||||
SUIT_OverrideCursor();
|
||||
|
||||
newNbUIso = NbIsosDlg->getU();
|
||||
newNbVIso = NbIsosDlg->getV();
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
int nbUIso = NbIsosDlg->getU();
|
||||
int nbVIso = NbIsosDlg->getV();
|
||||
|
||||
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbUIso) );
|
||||
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , nbVIso) );
|
||||
CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbUIso) );
|
||||
CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, 0.5 , newNbVIso) );
|
||||
|
||||
ic->SetLocalAttributes(CurObject, CurDrawer);
|
||||
ic->Redisplay(CurObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
else if(isVTK){ // if is VTKViewer
|
||||
//
|
||||
@ -493,6 +594,10 @@ void GEOMToolsGUI::OnNbIsos()
|
||||
else
|
||||
return;
|
||||
|
||||
int newNbUIso = -1;
|
||||
int newNbVIso = -1;
|
||||
|
||||
if ( actionType == SHOWDLG ) {
|
||||
GEOMToolsGUI_NbIsosDlg* NbIsosDlg =
|
||||
new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() );
|
||||
|
||||
@ -502,17 +607,32 @@ void GEOMToolsGUI::OnNbIsos()
|
||||
if ( NbIsosDlg->exec() ) {
|
||||
SUIT_OverrideCursor();
|
||||
|
||||
newNbUIso = NbIsosDlg->getU();
|
||||
newNbVIso = NbIsosDlg->getV();
|
||||
}
|
||||
}
|
||||
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.
|
||||
UIso = NbIsosDlg->getU();
|
||||
VIso = NbIsosDlg->getV();
|
||||
int aIsos[2]={UIso,VIso};
|
||||
int aIsos[2]={newNbUIso,newNbVIso};
|
||||
anActor->SetNbIsos(aIsos);
|
||||
}
|
||||
anAct = aCollection->GetNextActor();
|
||||
}
|
||||
}
|
||||
view->Repaint();
|
||||
GeometryGUI::Modified();
|
||||
} // end vtkviewer
|
||||
}
|
||||
|
||||
@ -559,6 +679,7 @@ void GEOMToolsGUI::OnDeflection()
|
||||
}
|
||||
}
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
else if (isVTK) { // if is VTKViewer
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||
@ -623,6 +744,7 @@ void GEOMToolsGUI::OnDeflection()
|
||||
anAct = aCollection->GetNextActor();
|
||||
}
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
} // end vtkviewer
|
||||
}
|
||||
|
||||
|
@ -269,6 +269,7 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency()
|
||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||
aView->SetTransparency( It.Value(), newValue );
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
aView->Repaint();
|
||||
} // if ( isVTK )
|
||||
|
||||
@ -300,6 +301,7 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency()
|
||||
}
|
||||
} // for...
|
||||
ic->UpdateCurrentViewer();
|
||||
GeometryGUI::Modified();
|
||||
} // if ( isOCC )
|
||||
|
||||
ValueHasChanged();
|
||||
|
@ -276,7 +276,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
||||
//if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag());
|
||||
//else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName));
|
||||
|
||||
// try to find existed name for current shape
|
||||
// BEGIN: try to find existed name for current shape
|
||||
bool HasName = false;
|
||||
// recieve current TopoDS shape
|
||||
CORBA::String_var entry = aShape->GetEntry();
|
||||
@ -289,24 +289,28 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
||||
}
|
||||
entry = aMainSh->GetEntry();
|
||||
Handle(GEOM_Object) anObj = _impl->GetObject(aMainSh->GetStudyID(), entry);
|
||||
TDF_Label aMainLbl = anObj->GetEntry();
|
||||
TDF_Label aMainLbl = anObj->GetFunction(1)->GetNamingEntry();
|
||||
|
||||
// check all named shapes using iterator
|
||||
TDF_ChildIDIterator anIt(aMainLbl, TNaming_NamedShape::GetID(), Standard_True);
|
||||
for(; anIt.More(); anIt.Next()) {
|
||||
TDF_ChildIDIterator anIt (aMainLbl, TNaming_NamedShape::GetID(), Standard_True);
|
||||
|
||||
for (; anIt.More() && !HasName; anIt.Next()) {
|
||||
Handle(TNaming_NamedShape) anAttr =
|
||||
Handle(TNaming_NamedShape)::DownCast(anIt.Value());
|
||||
if(anAttr.IsNull()) continue;
|
||||
if (anAttr.IsNull()) continue;
|
||||
TopoDS_Shape S = anAttr->Get();
|
||||
if( !S.IsEqual(TopoSh) ) continue;
|
||||
if (S.IsEqual(TopoSh)) {
|
||||
TDF_Label L = anAttr->Label();
|
||||
Handle(TDataStd_Name) aName;
|
||||
if(L.FindAttribute(TDataStd_Name::GetID(),aName)) {
|
||||
if (L.FindAttribute(TDataStd_Name::GetID(), aName)) {
|
||||
aShapeName = aName->Get();
|
||||
HasName = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// END: try to find existed name for current shape
|
||||
|
||||
if(!HasName) {
|
||||
if (!HasName) {
|
||||
// asv : 11.11.04 Introducing a more sofisticated method of name creation, just as
|
||||
// it is done in GUI in GEOMBase::GetDefaultName() - not just add a Tag() == number
|
||||
// of objects in the study, but compute a number of objects with the same prefix
|
||||
|
@ -269,6 +269,34 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetPoint (GEOM::GEOM_Object_ptr
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetVertexNearPoint
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetVertexNearPoint
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr thePoint)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
// Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
// Get the reference Objects
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
|
||||
if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
// Create the Point
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->GetVertexNearPoint(aShape, aPoint);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetEdge
|
||||
@ -481,6 +509,37 @@ GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetFaceByNormale (GEOM::GEOM_Obj
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetShapesNearPoint
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IBlocksOperations_i::GetShapesNearPoint
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr thePoint,
|
||||
CORBA::Long theShapeType,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
// Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
// Get the reference Objects
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
|
||||
|
||||
if (aShape.IsNull() || aPoint.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
// Create the Shape
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->GetShapesNearPoint(aShape, aPoint, theShapeType, theTolerance);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ExplodeCompoundOfBlocks
|
||||
|
@ -75,6 +75,9 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i :
|
||||
CORBA::Double theZ,
|
||||
CORBA::Double theEpsilon);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetVertexNearPoint (GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr thePoint);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetEdge (GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr thePoint1,
|
||||
GEOM::GEOM_Object_ptr thePoint2);
|
||||
@ -101,6 +104,11 @@ class GEOM_I_EXPORT GEOM_IBlocksOperations_i :
|
||||
GEOM::GEOM_Object_ptr GetFaceByNormale (GEOM::GEOM_Object_ptr theBlock,
|
||||
GEOM::GEOM_Object_ptr theVector);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetShapesNearPoint (GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr thePoint,
|
||||
CORBA::Long theShapeType,
|
||||
CORBA::Double theTolerance);
|
||||
|
||||
// Check blocks compound
|
||||
CORBA::Boolean IsCompoundOfBlocks (GEOM::GEOM_Object_ptr theCompound,
|
||||
CORBA::Long theMinNbFaces,
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -493,3 +492,30 @@ GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GE
|
||||
|
||||
return GetObject(aNewObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* LimitTolerance
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::LimitTolerance (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
// Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
// Get the object itself
|
||||
Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
|
||||
if (anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Perform
|
||||
Handle(GEOM_Object) aNewObject =
|
||||
GetOperations()->LimitTolerance(anObject, theTolerance);
|
||||
if (!GetOperations()->IsDone() || aNewObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(aNewObject);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
|
||||
#ifndef _GEOM_IHealingOperations_i_HeaderFile
|
||||
#define _GEOM_IHealingOperations_i_HeaderFile
|
||||
@ -41,32 +41,55 @@ class GEOM_I_EXPORT GEOM_IHealingOperations_i :
|
||||
public virtual GEOM_IOperations_i
|
||||
{
|
||||
public:
|
||||
GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_IHealingOperations* theImpl);
|
||||
GEOM_IHealingOperations_i(PortableServer::POA_ptr thePOA,
|
||||
GEOM::GEOM_Gen_ptr theEngine,
|
||||
::GEOMImpl_IHealingOperations* theImpl);
|
||||
~GEOM_IHealingOperations_i();
|
||||
|
||||
GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject, const GEOM::string_array& theOperations, const GEOM::string_array& theParams, const GEOM::string_array& theValues);
|
||||
GEOM::GEOM_Object_ptr ProcessShape(GEOM::GEOM_Object_ptr theObject,
|
||||
const GEOM::string_array& theOperations,
|
||||
const GEOM::string_array& theParams,
|
||||
const GEOM::string_array& theValues);
|
||||
|
||||
void GetShapeProcessParameters(GEOM::string_array_out theOperations, GEOM::string_array_out theParams, GEOM::string_array_out theValues);
|
||||
void GetShapeProcessParameters(GEOM::string_array_out theOperations,
|
||||
GEOM::string_array_out theParams,
|
||||
GEOM::string_array_out theValues);
|
||||
|
||||
void GetOperatorParameters (const char* theOperator, GEOM::string_array_out theParams, GEOM::string_array_out theValues);
|
||||
void GetOperatorParameters (const char* theOperator,
|
||||
GEOM::string_array_out theParams,
|
||||
GEOM::string_array_out theValues);
|
||||
|
||||
GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theFaces);
|
||||
GEOM::GEOM_Object_ptr SuppressFaces(GEOM::GEOM_Object_ptr theObject,
|
||||
const GEOM::short_array& theFaces);
|
||||
|
||||
GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires, CORBA::Boolean isCommonVertex);
|
||||
GEOM::GEOM_Object_ptr CloseContour (GEOM::GEOM_Object_ptr theObject,
|
||||
const GEOM::short_array& theWires,
|
||||
CORBA::Boolean isCommonVertex);
|
||||
|
||||
GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires);
|
||||
GEOM::GEOM_Object_ptr RemoveIntWires (GEOM::GEOM_Object_ptr theObject,
|
||||
const GEOM::short_array& theWires);
|
||||
|
||||
GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject, const GEOM::short_array& theWires);
|
||||
GEOM::GEOM_Object_ptr FillHoles (GEOM::GEOM_Object_ptr theObject,
|
||||
const GEOM::short_array& theWires);
|
||||
|
||||
GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject, CORBA::Double theTolerance);
|
||||
GEOM::GEOM_Object_ptr Sew (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theTolerance);
|
||||
|
||||
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject, CORBA::Short theIndex, CORBA::Double theValue, CORBA::Boolean isByParameter);
|
||||
GEOM::GEOM_Object_ptr DivideEdge (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Short theIndex,
|
||||
CORBA::Double theValue,
|
||||
CORBA::Boolean isByParameter);
|
||||
|
||||
CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires );
|
||||
CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject,
|
||||
GEOM::ListOfGO_out theClosedWires,
|
||||
GEOM::ListOfGO_out theOpenWires );
|
||||
|
||||
GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject);
|
||||
GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject);
|
||||
|
||||
GEOM::GEOM_Object_ptr LimitTolerance (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theTolerance);
|
||||
|
||||
::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); }
|
||||
|
||||
private:
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <Standard_Stream.hxx>
|
||||
|
||||
@ -411,6 +410,31 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetExistingSubObjects
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Boolean theGroupsOnly)
|
||||
{
|
||||
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
|
||||
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
if (aShape.IsNull()) return aSeq._retn();
|
||||
|
||||
Handle(TColStd_HSequenceOfTransient) aHSeq =
|
||||
GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
|
||||
if (!GetOperations()->IsDone() || aHSeq.IsNull())
|
||||
return aSeq._retn();
|
||||
|
||||
Standard_Integer aLength = aHSeq->Length();
|
||||
aSeq->length(aLength);
|
||||
for (Standard_Integer i = 1; i <= aLength; i++)
|
||||
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
|
||||
|
||||
return aSeq._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -18,7 +18,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOM_IShapesOperations_i_HeaderFile
|
||||
#define _GEOM_IShapesOperations_i_HeaderFile
|
||||
@ -75,6 +74,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
||||
const GEOM::ListOfGO& theFaces,
|
||||
CORBA::Boolean doKeepNonSolids);
|
||||
|
||||
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Boolean theGroupsOnly);
|
||||
|
||||
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Long theShapeType,
|
||||
|
@ -65,7 +65,7 @@ GEOM_Object_i::GEOM_Object_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr
|
||||
|
||||
GEOM_Object_i::~GEOM_Object_i()
|
||||
{
|
||||
//MESSAGE("GEOM_Object_i::~GEOM_Object_i");
|
||||
MESSAGE("GEOM_Object_i::~GEOM_Object_i");
|
||||
GEOM_Engine::GetEngine()->RemoveObject(_impl);
|
||||
}
|
||||
|
||||
@ -372,16 +372,13 @@ SALOMEDS::TMPFile* GEOM_Object_i::GetShapeStream()
|
||||
BRepTools::Write(aShape, streamShape);
|
||||
//Returns the number of bytes that have been stored in the stream's buffer.
|
||||
int size = streamShape.str().size();
|
||||
char* buf = new char [size];
|
||||
//Get pointer on internal character array in ostrstream
|
||||
const char* valueOfStream = streamShape.str().c_str();
|
||||
//Create copy of ostrstream content
|
||||
memcpy(buf, valueOfStream, size);
|
||||
|
||||
CORBA::Octet* OctetBuf = (CORBA::Octet*)buf;
|
||||
//Allocate octect buffer of required size
|
||||
CORBA::Octet* OctetBuf = SALOMEDS::TMPFile::allocbuf(size);
|
||||
//Copy ostrstream content to the octect buffer
|
||||
memcpy(OctetBuf, streamShape.str().c_str(), size);
|
||||
//Create and return TMPFile
|
||||
SALOMEDS::TMPFile_var SeqFile = new SALOMEDS::TMPFile(size,size,OctetBuf,1);
|
||||
return SeqFile._retn();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
27
src/GEOM_PY/Makefile.am
Normal file
27
src/GEOM_PY/Makefile.am
Normal file
@ -0,0 +1,27 @@
|
||||
# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
SUBDIRS= structelem
|
||||
|
||||
salomepypkgdir = $(salomepythondir)/salome/geom
|
||||
salomepypkg_PYTHON = \
|
||||
__init__.py \
|
||||
geomtools.py
|
1
src/GEOM_PY/__init__.py
Normal file
1
src/GEOM_PY/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
# -*- coding: iso-8859-1 -*-
|
115
src/GEOM_PY/geomtools.py
Normal file
115
src/GEOM_PY/geomtools.py
Normal file
@ -0,0 +1,115 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 EDF R&D
|
||||
#
|
||||
# This file is part of PAL_SRC.
|
||||
#
|
||||
# PAL_SRC is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# PAL_SRC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with PAL_SRC; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
"""
|
||||
This module provides tools to facilitate the use of geom engine and geom
|
||||
objects in Salome.
|
||||
"""
|
||||
|
||||
import salome
|
||||
GEOM = None # GEOM module is loaded only when needed
|
||||
|
||||
from salome.kernel.logger import Logger
|
||||
from salome.kernel import termcolor
|
||||
logger = Logger("salome.geom.geomtools", color = termcolor.RED)
|
||||
|
||||
from salome.kernel.studyedit import getActiveStudyId, getStudyEditor
|
||||
|
||||
_geompys = {}
|
||||
|
||||
def getGeompy(studyId = None):
|
||||
"""
|
||||
Return an object behaving exactly like geompy module, except that it is
|
||||
associated with the study `studyId`. If `studyId` is :const:`None`, return
|
||||
a pseudo geompy object for the current study.
|
||||
"""
|
||||
# We can't use geompy module because it initializes GEOM with
|
||||
# salome.myStudy, which may not exist. So we use this trick to create
|
||||
# a pseudo geompy module.
|
||||
salome.salome_init()
|
||||
if studyId is None:
|
||||
studyId = getActiveStudyId()
|
||||
if not _geompys.has_key(studyId):
|
||||
import geompyDC
|
||||
_geompys[studyId] = salome.lcc.FindOrLoadComponent("FactoryServer",
|
||||
"GEOM")
|
||||
_geompys[studyId].ShapeType = geompyDC.ShapeType
|
||||
_geompys[studyId].GEOM = geompyDC.GEOM
|
||||
_geompys[studyId].kind = geompyDC.kind
|
||||
_geompys[studyId].info = geompyDC.info
|
||||
_geompys[studyId].PackData = geompyDC.PackData
|
||||
_geompys[studyId].ReadTexture = geompyDC.ReadTexture
|
||||
study = salome.myStudyManager.GetStudyByID(studyId)
|
||||
_geompys[studyId].init_geom(study)
|
||||
return _geompys[studyId]
|
||||
|
||||
|
||||
class GeomStudyTools:
|
||||
"""
|
||||
This class provides several methods to manipulate geom objects in Salome
|
||||
study. The parameter `studyEditor` defines a
|
||||
:class:`~salome.kernel.studyedit.StudyEditor` object used to access the study. If
|
||||
:const:`None`, the method returns a :class:`~salome.kernel.studyedit.StudyEditor`
|
||||
object on the current study.
|
||||
|
||||
.. attribute:: editor
|
||||
|
||||
This instance attribute contains the underlying
|
||||
:class:`~salome.kernel.studyedit.StudyEditor` object. It can be used to access
|
||||
the study but the attribute itself should not be modified.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, studyEditor = None):
|
||||
global GEOM
|
||||
if GEOM is None:
|
||||
GEOM = __import__("GEOM")
|
||||
if studyEditor is None:
|
||||
studyEditor = getStudyEditor()
|
||||
self.editor = studyEditor
|
||||
|
||||
def displayShapeByName(self, shapeName, color = None):
|
||||
"""
|
||||
Display the geometrical shape whose name in the study is `shapeName`.
|
||||
|
||||
:type shapeName: string
|
||||
:param shapeName: name of the geometrical shape
|
||||
|
||||
:type color: tuple (triplet)
|
||||
:param color: RGB components of the color of the shape
|
||||
|
||||
:return: True if the shape was found, False otherwise
|
||||
"""
|
||||
logger.debug("displayShapeByName in PAL: %s with color %s" %
|
||||
(shapeName, color))
|
||||
listSO = self.editor.study.FindObjectByName(shapeName, "GEOM")
|
||||
for sObj in listSO:
|
||||
entry = sObj.GetID()
|
||||
geomObj = self.editor.getOrLoadObject(sObj)
|
||||
if geomObj:
|
||||
shape = geomObj._narrow(GEOM.GEOM_Object)
|
||||
if shape:
|
||||
geomgui = salome.ImportComponentGUI("GEOM")
|
||||
geomgui.createAndDisplayGO(entry)
|
||||
geomgui.setDisplayMode(entry, 1)
|
||||
if color is not None:
|
||||
geomgui.setColor(entry, color[0], color[1], color[2])
|
||||
return True
|
||||
return False
|
26
src/GEOM_PY/structelem/Makefile.am
Normal file
26
src/GEOM_PY/structelem/Makefile.am
Normal file
@ -0,0 +1,26 @@
|
||||
# Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
salomepypkgdir = $(salomepythondir)/salome/geom/structelem
|
||||
salomepypkg_PYTHON = \
|
||||
__init__.py \
|
||||
parts.py \
|
||||
orientation.py
|
486
src/GEOM_PY/structelem/__init__.py
Normal file
486
src/GEOM_PY/structelem/__init__.py
Normal file
@ -0,0 +1,486 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 EDF R&D
|
||||
#
|
||||
# This file is part of PAL_SRC.
|
||||
#
|
||||
# PAL_SRC is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# PAL_SRC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with PAL_SRC; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
"""
|
||||
This package is used to create and visualize structural elements. It contains
|
||||
three modules:
|
||||
|
||||
* This module :mod:`salome.geom.structelem` defines the main classes
|
||||
:class:`StructuralElement` and :class:`StructuralElementManager` that can be
|
||||
directly used to build structural elements.
|
||||
* The module :mod:`salome.geom.structelem.parts` defines the classes corresponding to
|
||||
the different parts (beams, grids, etc.) that make up a structural element.
|
||||
It is used to build the geometric shapes in the structural element.
|
||||
* The module :mod:`salome.geom.structelem.orientation` defines the classes that are
|
||||
used to compute the orientation of the structural element parts and to build
|
||||
the corresponding markers.
|
||||
|
||||
A structural element is a set of geometric shapes (beams, grids, etc.) that
|
||||
are built semi-automatically along a set of geometric primitives (edges for
|
||||
instance). They are visualized with the same color as their base primitives in
|
||||
the geom viewer.
|
||||
|
||||
Structural elements are generally created by the
|
||||
:class:`StructuralElementManager` class, from a list of commands describing
|
||||
the element to create.
|
||||
|
||||
Example::
|
||||
|
||||
commandList = [('VisuPoutreGenerale', {'Group_Maille': 'Edge_1'}),
|
||||
('VisuBarreCercle',
|
||||
{'R': 30, 'Group_Maille': 'Edge_1', 'EP': 15}),
|
||||
]
|
||||
|
||||
structElemManager = StructuralElementManager()
|
||||
elem = structElemManager.createElement(commandList)
|
||||
elem.display()
|
||||
salome.sg.updateObjBrowser(True)
|
||||
|
||||
"""
|
||||
|
||||
import types
|
||||
|
||||
import salome
|
||||
|
||||
from salome.kernel.logger import Logger
|
||||
from salome.kernel import termcolor
|
||||
logger = Logger("salome.geom.structelem", color = termcolor.RED)
|
||||
from salome.kernel.studyedit import getStudyEditor
|
||||
|
||||
__all__ = ["parts", "orientation"]
|
||||
|
||||
from salome.geom.structelem import parts
|
||||
from salome.geom.structelem.parts import InvalidParameterError
|
||||
|
||||
class StructuralElementManager:
|
||||
"""
|
||||
This class manages the structural elements in the study. It is used to
|
||||
create a new structural element from a list of commands. The parameter
|
||||
`studyId` defines the ID of the study in which the manager will create
|
||||
structural elements. If it is :const:`None` or not specified, it will use
|
||||
the ID of the current study as defined by
|
||||
:func:`salome.kernel.studyedit.getActiveStudyId` function.
|
||||
"""
|
||||
def __init__(self, studyId = None):
|
||||
self._studyEditor = getStudyEditor(studyId)
|
||||
|
||||
def createElement(self, commandList):
|
||||
"""
|
||||
Create a structural element from the list of commands `commandList`.
|
||||
Each command in this list represent a part of the structural element,
|
||||
that is a specific kind of shape (circular beam, grid, etc.)
|
||||
associated with one or several geometrical primitives. A command must
|
||||
be a tuple. The first element is the structural element part class
|
||||
name or alias name. The second element is a dictionary containing the
|
||||
parameters describing the part. Valid class names are all the classes
|
||||
defined in the module :mod:`~salome.geom.structelem.parts` and inheriting
|
||||
class :class:`~parts.StructuralElementPart`. There are also several
|
||||
aliases for backward compatibility. Here is the complete list:
|
||||
|
||||
* :class:`~parts.GeneralBeam`
|
||||
* :class:`~parts.CircularBeam`
|
||||
* :class:`~parts.RectangularBeam`
|
||||
* :class:`~parts.ThickShell`
|
||||
* :class:`~parts.Grid`
|
||||
|
||||
* :func:`~parts.VisuPoutreGenerale` (alias for
|
||||
:class:`~parts.GeneralBeam`)
|
||||
* :func:`~parts.VisuPoutreCercle` (alias for
|
||||
:class:`~parts.CircularBeam`)
|
||||
* :func:`~parts.VisuPoutreRectangle` (alias for
|
||||
:class:`~parts.RectangularBeam`)
|
||||
* :func:`~parts.VisuBarreGenerale` (alias for
|
||||
:class:`~parts.GeneralBeam`)
|
||||
* :func:`~parts.VisuBarreRectangle` (alias for
|
||||
:class:`~parts.RectangularBeam`)
|
||||
* :func:`~parts.VisuBarreCercle` (alias for
|
||||
:class:`~parts.CircularBeam`)
|
||||
* :func:`~parts.VisuCable` (alias for :class:`~parts.CircularBeam`)
|
||||
* :func:`~parts.VisuCoque` (alias for :class:`~parts.ThickShell`)
|
||||
* :func:`~parts.VisuGrille` (alias for :class:`~parts.Grid`)
|
||||
|
||||
* ``Orientation``: This identifier is used to specify the orientation
|
||||
of one or several 1D structural element parts (i.e. beams). The
|
||||
parameters are described in class
|
||||
:class:`~orientation.Orientation1D`.
|
||||
|
||||
The valid parameters in the dictionary depend on the type of the
|
||||
structural element part, and are detailed in the documentation of
|
||||
the corresponding class. The only parameter that is common to all the
|
||||
classes is "MeshGroups" (that can also be named "Group_Maille"). It
|
||||
defines the name of the geometrical object(s) in the study that will
|
||||
be used as primitives to build the structural element part. This
|
||||
parameter can be either a list of strings or a single string with
|
||||
comma separated names.
|
||||
"""
|
||||
logger.debug("StructuralElementManager.createElement: START")
|
||||
logger.debug("Command list: %s" % commandList)
|
||||
|
||||
element = StructuralElement(self._studyEditor.studyId)
|
||||
orientationCmdList = []
|
||||
for command in commandList:
|
||||
(parttype, parameters) = command
|
||||
if parttype == "Orientation":
|
||||
orientationCmdList += [command]
|
||||
elif parttype not in dir(parts):
|
||||
logger.warning('Invalid structural element part name "%s"'
|
||||
' in command %s, this command will be '
|
||||
'ignored.' % (parttype, command))
|
||||
else:
|
||||
(meshGroupList, newparams) = self._extractMeshGroups(command)
|
||||
for meshGroup in meshGroupList:
|
||||
# Get the geometrical primitive object
|
||||
groupSObj = self._studyEditor.study.FindObject(meshGroup)
|
||||
groupGeomObj = None
|
||||
if groupSObj is not None:
|
||||
groupGeomObj = \
|
||||
self._studyEditor.getOrLoadObject(groupSObj)
|
||||
if groupGeomObj is None:
|
||||
logger.error("Can't get geom object corresponding to "
|
||||
'mesh group "%s", structural element '
|
||||
"part %s will not be built." %
|
||||
(groupName, part))
|
||||
continue
|
||||
|
||||
# Create the part
|
||||
try:
|
||||
part = parts.__dict__[parttype](
|
||||
self._studyEditor.studyId, meshGroup,
|
||||
groupGeomObj, newparams)
|
||||
element.addPart(part)
|
||||
except InvalidParameterError, e:
|
||||
logger.error("Invalid parameter error: %s" % e)
|
||||
raise
|
||||
except:
|
||||
logger.exception("Can't create structural element"
|
||||
" part with command %s." %
|
||||
str(command))
|
||||
|
||||
# Orientations are parsed after the parts because they must be
|
||||
# associated with existing parts.
|
||||
for command in orientationCmdList:
|
||||
(parttype, parameters) = command
|
||||
(meshGroupList, orientParams) = self._extractMeshGroups(command)
|
||||
for meshGroup in meshGroupList:
|
||||
element.addOrientation(meshGroup, orientParams)
|
||||
|
||||
element.build()
|
||||
logger.debug("StructuralElementManager.createElement: END")
|
||||
return element
|
||||
|
||||
def _extractMeshGroups(self, command):
|
||||
"""
|
||||
This method extracts the names of the mesh groups (i.e. the
|
||||
geometrical objects used to build the structural element part) in the
|
||||
command in parameter. It returns a tuple containing the mesh groups as
|
||||
a list of strings and the other parameters of the command as a new
|
||||
dictionary.
|
||||
"""
|
||||
(parttype, parameters) = command
|
||||
newparams = parameters.copy()
|
||||
groupMailleParam = newparams.pop("Group_Maille", None)
|
||||
meshGroupParam = newparams.pop("MeshGroups", None)
|
||||
if groupMailleParam is None and meshGroupParam is None:
|
||||
logger.warning("No mesh group specified in command %s, this "
|
||||
"command will be ignored." % command)
|
||||
return ([], newparams)
|
||||
elif groupMailleParam is not None and meshGroupParam is not None:
|
||||
logger.warning('Both "MeshGroups" and "Group_Maille" specified in'
|
||||
' command %s, only "MeshGroups" will be used.' %
|
||||
command)
|
||||
elif groupMailleParam is not None and meshGroupParam is None:
|
||||
meshGroupParam = groupMailleParam
|
||||
|
||||
meshGroupList = []
|
||||
if type(meshGroupParam) == types.StringType:
|
||||
meshGroupList = self._getMeshGroupListFromString(meshGroupParam)
|
||||
else:
|
||||
for item in meshGroupParam:
|
||||
meshGroupList += self._getMeshGroupListFromString(item)
|
||||
|
||||
if len(meshGroupList) == 0:
|
||||
logger.warning("Mesh group list is empty in command %s, this "
|
||||
"command will be ignored." % command)
|
||||
|
||||
return (meshGroupList, newparams)
|
||||
|
||||
def _getMeshGroupListFromString(self, meshString):
|
||||
"""
|
||||
This method splits the string in parameter to extract comma separated
|
||||
names. Those names are returned as a list of strings.
|
||||
"""
|
||||
meshGroupList = []
|
||||
list = meshString.split(",")
|
||||
for item in list:
|
||||
strippedItem = item.strip()
|
||||
if len(strippedItem) > 0:
|
||||
meshGroupList.append(strippedItem)
|
||||
return meshGroupList
|
||||
|
||||
|
||||
class StructuralElement:
|
||||
"""
|
||||
This class represents a structural element, i.e. a set of geometrical
|
||||
objects built along geometrical primitives. The parameter `studyId`
|
||||
defines the ID of the study that will contain the structural element. If
|
||||
it is :const:`None` or not specified, the constructor will use the ID of
|
||||
the active study as defined by :func:`salome.kernel.studyedit.getActiveStudyId`
|
||||
function. Structural elements are normally created by the class
|
||||
:class:`StructuralElementManager`, so this class should not be
|
||||
instantiated directly in the general case.
|
||||
"""
|
||||
_counter = 1
|
||||
_mainFolderTag = 14725
|
||||
|
||||
def __init__(self, studyId = None):
|
||||
# _parts is the dictionary mapping group name to structural element
|
||||
# part. _shapeDict is the dictionary mapping SubShapeID objects to
|
||||
# structural element parts. Both are used to avoid duplicate shapes
|
||||
# in structural elements.
|
||||
self._parts = {}
|
||||
self._shapeDict = {}
|
||||
self._id = StructuralElement._counter
|
||||
StructuralElement._counter += 1
|
||||
self._studyEditor = getStudyEditor(studyId)
|
||||
logger.debug("Creating structural element in study %s" %
|
||||
self._studyEditor.studyId)
|
||||
self._SObject = None
|
||||
|
||||
def _getSObject(self):
|
||||
"""
|
||||
Find or create the study object corresponding to the structural
|
||||
element. This object is named "SE_N" where N is a numerical ID.
|
||||
"""
|
||||
if self._SObject is None:
|
||||
geomComponent = self._studyEditor.study.FindComponent("GEOM")
|
||||
mainFolder = self._studyEditor.setItemAtTag(geomComponent,
|
||||
StructuralElement._mainFolderTag,
|
||||
name = "Structural Elements")
|
||||
self._SObject = self._studyEditor.findOrCreateItem(mainFolder,
|
||||
name = "SE_" + str(self._id))
|
||||
return self._SObject
|
||||
|
||||
def addPart(self, newpart):
|
||||
"""
|
||||
Add a part to the structural element.
|
||||
|
||||
:type newpart: :class:`~parts.StructuralElementPart`
|
||||
:param newpart: the part to add to the structural element.
|
||||
|
||||
"""
|
||||
newshapes = newpart.baseShapesSet
|
||||
|
||||
# Check duplicate groups
|
||||
if self._parts.has_key(newpart.groupName):
|
||||
logger.warning('Mesh group "%s" is used several times in the '
|
||||
'structural element. Only the last definition '
|
||||
'will be used.' % newpart.groupName)
|
||||
else:
|
||||
# Check duplicate shapes
|
||||
intersect = newshapes.intersection(self._shapeDict.keys())
|
||||
while len(intersect) > 0:
|
||||
shape, = intersect
|
||||
oldpartwithshape = self._shapeDict[shape]
|
||||
oldpartshapes = oldpartwithshape.baseShapesSet
|
||||
intersectwitholdpart = intersect.intersection(oldpartshapes)
|
||||
logger.warning('Some shapes are common to groups "%s" and '
|
||||
'"%s". For those, the parameters defined for '
|
||||
'"%s" will be used.' %
|
||||
(oldpartwithshape.groupName, newpart.groupName,
|
||||
newpart.groupName))
|
||||
oldpartwithshape.baseShapesSet = \
|
||||
oldpartshapes.difference(intersectwitholdpart)
|
||||
intersect = intersect.difference(intersectwitholdpart)
|
||||
|
||||
# Finally add the new part in the structural element
|
||||
self._parts[newpart.groupName] = newpart
|
||||
for shape in newshapes:
|
||||
self._shapeDict[shape] = newpart
|
||||
|
||||
def addOrientation(self, meshGroup, orientParams):
|
||||
"""
|
||||
Add orientation information to a part in the structural element. This
|
||||
information will be used to build the corresponding markers.
|
||||
|
||||
:type meshGroup: string
|
||||
:param meshGroup: the name of a geometrical primitive. The orientation
|
||||
information will apply to the structural element
|
||||
part built along this primitive.
|
||||
|
||||
:type orientParams: dictionary
|
||||
:param orientParams: parameters defining the orientation of the
|
||||
structural element part. Those parameters are
|
||||
detailed in class
|
||||
:class:`~orientation.Orientation1D`.
|
||||
|
||||
"""
|
||||
if self._parts.has_key(meshGroup):
|
||||
self._parts[meshGroup].addOrientation(orientParams)
|
||||
else:
|
||||
logger.warning('Mesh group "%s" not found in structural element, '
|
||||
'cannot set orientation.' % meshGroup)
|
||||
|
||||
def build(self):
|
||||
"""
|
||||
Build the geometric shapes and the markers corresponding to the
|
||||
different parts of the structural element, and add them to the study.
|
||||
"""
|
||||
gg = salome.ImportComponentGUI("GEOM")
|
||||
for part in self._parts.itervalues():
|
||||
# Build the structural element part
|
||||
logger.debug("Building %s" % part)
|
||||
try:
|
||||
(shape, markers) = part.build()
|
||||
if shape is None:
|
||||
logger.error("Part %s has not been built" % part)
|
||||
continue
|
||||
except:
|
||||
logger.exception("Couldn't build part %s" % part)
|
||||
continue
|
||||
|
||||
# Add the new objects to the study
|
||||
IOR = self._studyEditor.study.ConvertObjectToIOR(shape)
|
||||
shapeSObjName = part.name + "_" + part.groupName
|
||||
icon = None
|
||||
if salome.hasDesktop():
|
||||
icon = gg.getShapeTypeIcon(IOR)
|
||||
shapeSObj = self._studyEditor.createItem(self._getSObject(),
|
||||
name = shapeSObjName, IOR = IOR,
|
||||
icon = icon)
|
||||
if markers is not None and len(markers) > 0:
|
||||
i = 1
|
||||
for marker in markers:
|
||||
markerIOR = \
|
||||
self._studyEditor.study.ConvertObjectToIOR(marker)
|
||||
markerSObjName = "Orient_" + shapeSObjName
|
||||
if len(markers) > 1:
|
||||
markerSObjName += "_%d" % i
|
||||
markerSObj = self._studyEditor.createItem(
|
||||
self._getSObject(),
|
||||
name = markerSObjName,
|
||||
IOR = markerIOR,
|
||||
icon = "ICON_OBJBROWSER_LCS")
|
||||
i += 1
|
||||
|
||||
def display(self):
|
||||
"""
|
||||
Display the structural element in the geom view.
|
||||
"""
|
||||
StructuralElement.showElement(self._SObject)
|
||||
|
||||
@staticmethod
|
||||
def showElement(theSObject):
|
||||
"""
|
||||
Display the structural element corresponding to the study object
|
||||
`theSObject`
|
||||
"""
|
||||
if theSObject is not None:
|
||||
gg = salome.ImportComponentGUI("GEOM")
|
||||
aStudy = theSObject.GetStudy()
|
||||
editor = getStudyEditor(aStudy._get_StudyId())
|
||||
aIterator = aStudy.NewChildIterator(theSObject)
|
||||
aIterator.Init()
|
||||
while aIterator.More():
|
||||
sobj = aIterator.Value()
|
||||
icon = editor.getIcon(sobj)
|
||||
if icon != "ICON_OBJBROWSER_LCS":
|
||||
entry = aIterator.Value().GetID()
|
||||
gg.createAndDisplayGO(entry)
|
||||
gg.setDisplayMode(entry, 1)
|
||||
aIterator.Next()
|
||||
|
||||
|
||||
def TEST_CreateGeometry():
|
||||
import geompy
|
||||
import SALOMEDS
|
||||
geompy.init_geom(salome.myStudy)
|
||||
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
|
||||
edges = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["EDGE"])
|
||||
edges[0].SetColor(SALOMEDS.Color(1.0,0.0,0.0))
|
||||
edges[1].SetColor(SALOMEDS.Color(0.0,1.0,0.0))
|
||||
edges[2].SetColor(SALOMEDS.Color(0.0,0.0,1.0))
|
||||
edges[3].SetColor(SALOMEDS.Color(1.0,0.0,1.0))
|
||||
edges[4].SetColor(SALOMEDS.Color(0.0,1.0,1.0))
|
||||
edges[5].SetColor(SALOMEDS.Color(0.5,0.0,0.0))
|
||||
edges[6].SetColor(SALOMEDS.Color(0.0,0.5,0.0))
|
||||
edges[7].SetColor(SALOMEDS.Color(0.0,0.0,0.5))
|
||||
geompy.addToStudy(Box_1, "Box_1")
|
||||
for i in range(len(edges)):
|
||||
geompy.addToStudyInFather(Box_1, edges[i], "Edge_%d" % i)
|
||||
faces = geompy.SubShapeAllSorted(Box_1, geompy.ShapeType["FACE"])
|
||||
faces[3].SetColor(SALOMEDS.Color(1.0,0.5,0.0))
|
||||
faces[4].SetColor(SALOMEDS.Color(0.0,1.0,0.5))
|
||||
for i in range(len(faces)):
|
||||
geompy.addToStudyInFather(Box_1, faces[i], "Face_%d" % i)
|
||||
Cylinder_1 = geompy.MakeCylinderRH(50, 200)
|
||||
geompy.TranslateDXDYDZ(Cylinder_1, 300, 300, 0)
|
||||
cyl_faces = geompy.SubShapeAllSorted(Cylinder_1, geompy.ShapeType["FACE"])
|
||||
geompy.addToStudy(Cylinder_1, "Cylinder_1")
|
||||
for i in range(len(cyl_faces)):
|
||||
geompy.addToStudyInFather(Cylinder_1, cyl_faces[i], "CylFace_%d" % i)
|
||||
Cylinder_2 = geompy.MakeTranslation(Cylinder_1, 100, 100, 0)
|
||||
cyl_faces2 = geompy.SubShapeAllSorted(Cylinder_2,
|
||||
geompy.ShapeType["FACE"])
|
||||
geompy.addToStudy(Cylinder_2, "Cylinder_2")
|
||||
for i in range(len(cyl_faces2)):
|
||||
geompy.addToStudyInFather(Cylinder_2, cyl_faces2[i],
|
||||
"CylFace2_%d" % i)
|
||||
|
||||
|
||||
def TEST_StructuralElement():
|
||||
salome.salome_init()
|
||||
TEST_CreateGeometry()
|
||||
liste_commandes = [('Orientation', {'MeshGroups': 'Edge_4',
|
||||
'VECT_Y': (1.0, 0.0, 1.0)}),
|
||||
('Orientation', {'MeshGroups': 'Edge_5',
|
||||
'ANGL_VRIL': 45.0}),
|
||||
('GeneralBeam', {'MeshGroups': 'Edge_1, Edge_7'}),
|
||||
('VisuPoutreCercle', {'MeshGroups': ['Edge_6'],
|
||||
'R1': 30, 'R2': 20}),
|
||||
('CircularBeam', {'MeshGroups': ['Edge_2', 'Edge_3'],
|
||||
'R': 40, 'EP': 20}),
|
||||
('RectangularBeam', {'MeshGroups': 'Edge_4, Edge_5',
|
||||
'HZ1': 60, 'HY1': 40,
|
||||
'EPZ1': 15, 'EPY1': 10,
|
||||
'HZ2': 40, 'HY2': 60,
|
||||
'EPZ2': 10, 'EPY2': 15}),
|
||||
('VisuCable', {'MeshGroups': 'Edge_7', 'R': 5}),
|
||||
('VisuCoque', {'MeshGroups': 'Face_4',
|
||||
'Epais': 10, 'Excentre': 5,
|
||||
'angleAlpha': 45, 'angleBeta': 60}),
|
||||
('VisuCoque', {'MeshGroups': 'CylFace_2', 'Epais': 5}),
|
||||
('VisuGrille', {'MeshGroups': 'Face_5', 'Excentre': 5,
|
||||
'angleAlpha': 45, 'angleBeta': 60}),
|
||||
('VisuGrille', {'MeshGroups': 'CylFace2_2',
|
||||
'Excentre': 5, 'origAxeX': 400,
|
||||
'origAxeY': 400, 'origAxeZ': 0,
|
||||
'axeX': 0, 'axeY': 0, 'axeZ': 100}),
|
||||
]
|
||||
|
||||
structElemManager = StructuralElementManager()
|
||||
elem = structElemManager.createElement(liste_commandes)
|
||||
if salome.hasDesktop():
|
||||
elem.display()
|
||||
salome.sg.updateObjBrowser(True)
|
||||
|
||||
|
||||
# Main function only used to test the module
|
||||
if __name__ == "__main__":
|
||||
TEST_StructuralElement()
|
249
src/GEOM_PY/structelem/orientation.py
Normal file
249
src/GEOM_PY/structelem/orientation.py
Normal file
@ -0,0 +1,249 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 EDF R&D
|
||||
#
|
||||
# This file is part of PAL_SRC.
|
||||
#
|
||||
# PAL_SRC is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# PAL_SRC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with PAL_SRC; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
"""
|
||||
This module is used to compute the orientation of the different parts in a
|
||||
structural element and to build the corresponding markers (trihedrons).
|
||||
"""
|
||||
|
||||
import math
|
||||
|
||||
from salome.kernel.logger import Logger
|
||||
from salome.kernel import termcolor
|
||||
logger = Logger("__PAL_GEOM__.structelem.orientation", color = termcolor.RED)
|
||||
|
||||
|
||||
class Orientation1D:
|
||||
"""
|
||||
This class is used to compute the orientation of 1D elements and to build
|
||||
the corresponding markers.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.geom = None
|
||||
self._vectorYCoords = None
|
||||
self._angle = 0.0
|
||||
|
||||
def __repr__(self):
|
||||
reprdict = self.__dict__.copy()
|
||||
del reprdict["geom"]
|
||||
return '%s(%s)' % (self.__class__.__name__, reprdict)
|
||||
|
||||
def addParams(self, params):
|
||||
"""
|
||||
Add orientation parameters. `params` is a dictionary containing one or
|
||||
several orientation parameters. The valid parameters are:
|
||||
|
||||
* "VECT_Y": Triplet defining the local Y axis (the X axis is the
|
||||
main direction of the 1D element).
|
||||
* "ANGL_VRIL": Angle of rotation along the X axis to define the local
|
||||
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.
|
||||
"""
|
||||
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" %
|
||||
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))
|
||||
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))
|
||||
if len(mydict) > 0:
|
||||
logger.warning("Invalid orientation parameter(s) (ignored): %s" %
|
||||
str(mydict))
|
||||
|
||||
def _buildDefaultMarker(self, center, vecX):
|
||||
"""
|
||||
Create the default marker, that use the main direction of the 1D
|
||||
object as the local X axis and the global Z axis to determine the
|
||||
local Z axis.
|
||||
"""
|
||||
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
||||
givenVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0)
|
||||
angle = self.geom.GetAngleRadians(vecX, givenVecZ)
|
||||
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
||||
logger.warning("Beam X axis is colinear to absolute Z axis. "
|
||||
"Absolute X axis will be used to determine "
|
||||
"local Z axis.")
|
||||
givenVecZ = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0)
|
||||
zPoint = self.geom.MakeTranslationVector(center, givenVecZ)
|
||||
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0)
|
||||
locY = self.geom.GetNormal(locPlaneZX)
|
||||
marker = self.geom.MakeMarkerPntTwoVec(center,vecX,locY)
|
||||
return marker
|
||||
|
||||
def buildMarker(self, geom, center, vecX):
|
||||
"""
|
||||
Create a marker with origin `center` and X axis `vecX`. `geom` is the
|
||||
pseudo-geompy object used to build the geometric shapes.
|
||||
"""
|
||||
self.geom = geom
|
||||
marker = None
|
||||
if self._vectorYCoords is None:
|
||||
marker = self._buildDefaultMarker(center, vecX)
|
||||
else:
|
||||
xPoint = self.geom.MakeTranslationVector(center, vecX)
|
||||
givenLocY = self.geom.MakeVectorDXDYDZ(self._vectorYCoords[0],
|
||||
self._vectorYCoords[1],
|
||||
self._vectorYCoords[2])
|
||||
angle = self.geom.GetAngleRadians(vecX, givenLocY)
|
||||
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
||||
logger.warning("Vector Y is colinear to the beam X axis, "
|
||||
"using default LCS.")
|
||||
marker = self._buildDefaultMarker(center, vecX)
|
||||
else:
|
||||
yPoint = self.geom.MakeTranslationVector(center, givenLocY)
|
||||
locPlaneXY = self.geom.MakePlaneThreePnt(center, xPoint,
|
||||
yPoint, 1.0)
|
||||
locZ = self.geom.GetNormal(locPlaneXY)
|
||||
zPoint = self.geom.MakeTranslationVector(center, locZ)
|
||||
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint,
|
||||
xPoint, 1.0)
|
||||
locY = self.geom.GetNormal(locPlaneZX)
|
||||
marker = self.geom.MakeMarkerPntTwoVec(center,vecX,locY)
|
||||
|
||||
if self._angle != 0.0:
|
||||
angleRad = math.radians(self._angle)
|
||||
marker = self.geom.Rotate(marker, vecX, angleRad)
|
||||
|
||||
return marker
|
||||
|
||||
|
||||
class Orientation2D:
|
||||
"""
|
||||
This class is used to compute the orientation of 2D elements and to build
|
||||
the corresponding markers. Angles `alpha` and `beta` are used to determine
|
||||
the local coordinate system for the 2D element. If `vect` is not
|
||||
:const:`None`, it is used instead of `alpha` and `beta`.
|
||||
"""
|
||||
|
||||
def __init__(self, alpha, beta, vect):
|
||||
self.geom = None
|
||||
self._alpha = alpha
|
||||
self._beta = beta
|
||||
self._vect = vect
|
||||
|
||||
def __repr__(self):
|
||||
reprdict = self.__dict__.copy()
|
||||
del reprdict["geom"]
|
||||
return '%s(%s)' % (self.__class__.__name__, reprdict)
|
||||
|
||||
def _buildDefaultMarker(self, center, normal, warnings = True):
|
||||
"""
|
||||
Create the default marker, that use the normal vector of the 2D object
|
||||
as the local Z axis and the global X axis to determine the local X
|
||||
axis. `warnings` can be used to enable or disable the logging of
|
||||
warning messages.
|
||||
"""
|
||||
marker = None
|
||||
globalVecX = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0)
|
||||
angle = self.geom.GetAngleRadians(normal, globalVecX)
|
||||
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
||||
if warnings:
|
||||
logger.warning("Face normal is colinear to absolute X axis. "
|
||||
"Absolute Y axis will be used to determine "
|
||||
"local X axis.")
|
||||
globalVecY = self.geom.MakeVectorDXDYDZ(0.0, 1.0, 0.0)
|
||||
marker = self._buildMarkerRefVecX(center, normal, globalVecY)
|
||||
else:
|
||||
marker = self._buildMarkerRefVecX(center, normal, globalVecX)
|
||||
return marker
|
||||
|
||||
def _buildMarkerRefVecX(self, center, normal, refVecX):
|
||||
"""
|
||||
Create a marker using `normal` as Z axis and `refVecX` to determine
|
||||
the X axis.
|
||||
"""
|
||||
xPoint = self.geom.MakeTranslationVector(center, refVecX)
|
||||
zPoint = self.geom.MakeTranslationVector(center, normal)
|
||||
locPlaneZX = self.geom.MakePlaneThreePnt(center, zPoint, xPoint, 1.0)
|
||||
locY = self.geom.GetNormal(locPlaneZX)
|
||||
yPoint = self.geom.MakeTranslationVector(center, locY)
|
||||
locPlaneYZ = self.geom.MakePlaneThreePnt(center, yPoint, zPoint, 1.0)
|
||||
locX = self.geom.GetNormal(locPlaneYZ)
|
||||
marker = self.geom.MakeMarkerPntTwoVec(center, locX, locY)
|
||||
return marker
|
||||
|
||||
def buildMarker(self, geom, center, normal, warnings = True):
|
||||
"""
|
||||
Create a marker with origin `center` and `normal` as Z axis. The other
|
||||
axes are computed using the parameters alpha and beta of the
|
||||
Orientation2D instance. `geom` is the pseudo-geompy object used to
|
||||
build the geometric shapes. `warnings` can be used to enable or
|
||||
disable the logging of warning messages.
|
||||
"""
|
||||
self.geom = geom
|
||||
marker = None
|
||||
refVecX = None
|
||||
if self._vect is not None:
|
||||
# Using vector parameter
|
||||
if abs(self._vect[0]) <= 1e-7 and abs(self._vect[1]) <= 1e-7 and \
|
||||
abs(self._vect[2]) <= 1e-7:
|
||||
if warnings:
|
||||
logger.warning("Vector too small: %s, using default LCS" %
|
||||
self._vect)
|
||||
else:
|
||||
refVecX = self.geom.MakeVectorDXDYDZ(self._vect[0],
|
||||
self._vect[1],
|
||||
self._vect[2])
|
||||
elif self._alpha is not None and self._beta is not None:
|
||||
# Using alpha and beta angles
|
||||
alphaRad = math.radians(self._alpha)
|
||||
betaRad = math.radians(self._beta)
|
||||
if abs(alphaRad) <= 1e-7 and abs(betaRad) <= 1e-7:
|
||||
if warnings:
|
||||
logger.warning("Angles too small: (%g, %g), using "
|
||||
"default LCS" % (self._alpha, self._beta))
|
||||
else:
|
||||
# rotate global CS with angles alpha and beta
|
||||
refVecX = self.geom.MakeVectorDXDYDZ(1.0, 0.0, 0.0)
|
||||
refVecY = self.geom.MakeVectorDXDYDZ(0.0, 1.0, 0.0)
|
||||
globalVecZ = self.geom.MakeVectorDXDYDZ(0.0, 0.0, 1.0)
|
||||
if abs(alphaRad) > 1e-7:
|
||||
refVecX = self.geom.Rotate(refVecX, globalVecZ, alphaRad)
|
||||
refVecY = self.geom.Rotate(refVecY, globalVecZ, alphaRad)
|
||||
if abs(betaRad) > 1e-7:
|
||||
refVecX = self.geom.Rotate(refVecX, refVecY, betaRad)
|
||||
|
||||
if refVecX is not None:
|
||||
# build local coordinate system
|
||||
angle = self.geom.GetAngleRadians(normal, refVecX)
|
||||
if abs(angle) < 1e-7 or abs(angle - math.pi) < 1e-7:
|
||||
if warnings:
|
||||
logger.warning("Face normal is colinear to the reference "
|
||||
"X axis, using default LCS.")
|
||||
else:
|
||||
marker = self._buildMarkerRefVecX(center, normal, refVecX)
|
||||
|
||||
if marker is None:
|
||||
marker = self._buildDefaultMarker(center, normal, warnings)
|
||||
|
||||
return marker
|
969
src/GEOM_PY/structelem/parts.py
Normal file
969
src/GEOM_PY/structelem/parts.py
Normal file
@ -0,0 +1,969 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2007-2009 EDF R&D
|
||||
#
|
||||
# This file is part of PAL_SRC.
|
||||
#
|
||||
# PAL_SRC is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# PAL_SRC is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with PAL_SRC; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
"""
|
||||
This module defines the different structural element parts. It is used to
|
||||
build the geometric shapes of the structural elements. It should not be used
|
||||
directly in the general case. Structural elements should be created by the
|
||||
class :class:`~salome.geom.structelem.StructuralElementManager`.
|
||||
"""
|
||||
|
||||
import salome
|
||||
|
||||
from salome.kernel.logger import Logger
|
||||
from salome.kernel import termcolor
|
||||
logger = Logger("salome.geom.structelem.parts", color = termcolor.RED)
|
||||
from salome.geom.geomtools import getGeompy
|
||||
|
||||
import orientation
|
||||
|
||||
# Filling for the beams
|
||||
FULL = "FULL"
|
||||
HOLLOW = "HOLLOW"
|
||||
|
||||
# Minimum dimension for the shapes to extrude
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE = 2e-4
|
||||
MIN_LENGTH_FOR_EXTRUSION = 1e-4
|
||||
MIN_THICKNESS = 1e-5
|
||||
|
||||
|
||||
class InvalidParameterError(Exception):
|
||||
"""
|
||||
This exception is raised when an invalid parameter is used to build a
|
||||
structural element part.
|
||||
"""
|
||||
|
||||
def __init__(self, groupName, expression, minValue, value):
|
||||
self.groupName = groupName
|
||||
self.expression = expression
|
||||
self.minValue = minValue
|
||||
self.value = value
|
||||
|
||||
def __str__(self):
|
||||
return "%s < %g (%s = %g in %s)" % (self.expression, self.minValue,
|
||||
self.expression, self.value,
|
||||
self.groupName)
|
||||
|
||||
|
||||
class SubShapeID:
|
||||
"""
|
||||
This class enables the use of subshapes in sets or as dictionary keys.
|
||||
It implements __eq__ and __hash__ methods so that subshapes with the same
|
||||
CORBA object `mainShape` and the same `id` are considered equal.
|
||||
"""
|
||||
|
||||
def __init__(self, mainShape, id):
|
||||
self._mainShape = mainShape
|
||||
self._id = id
|
||||
|
||||
def getObj(self, geom):
|
||||
"""
|
||||
Return the subshape (GEOM object). `geom` is a pseudo-geompy object
|
||||
used to find the geometrical object.
|
||||
"""
|
||||
return geom.GetSubShape(self._mainShape, [self._id])
|
||||
|
||||
def __eq__(self, other):
|
||||
return self._mainShape._is_equivalent(other._mainShape) and \
|
||||
self._id == other._id
|
||||
|
||||
def __hash__(self):
|
||||
return self._mainShape._hash(2147483647) ^ self._id
|
||||
|
||||
|
||||
class StructuralElementPart:
|
||||
"""
|
||||
This class is the base class for all structural element parts. It should
|
||||
not be instantiated directly (consider it as an "abstract" class).
|
||||
|
||||
:type studyId: integer
|
||||
:param studyId: the ID of the study in which the part is created.
|
||||
|
||||
:type groupName: string
|
||||
:param groupName: the name of the underlying geometrical primitive in the
|
||||
study.
|
||||
|
||||
:type groupGeomObj: GEOM object
|
||||
:param groupGeomObj: the underlying geometrical primitive.
|
||||
|
||||
:type parameters: dictionary
|
||||
:param parameters: parameters defining the structural element (see
|
||||
subclasses for details).
|
||||
|
||||
:type name: string
|
||||
:param name: name to use for the created object in the study.
|
||||
|
||||
"""
|
||||
|
||||
DEFAULT_NAME = "StructElemPart"
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = DEFAULT_NAME):
|
||||
self._parameters = parameters
|
||||
self.groupName = groupName
|
||||
self._groupGeomObj = groupGeomObj
|
||||
self._orientation = None
|
||||
self._paramUserName = {}
|
||||
self.name = name
|
||||
self.geom = getGeompy(studyId)
|
||||
self.baseShapesSet = set()
|
||||
mainShape = self.geom.GetMainShape(groupGeomObj)
|
||||
listIDs = self.geom.GetObjectIDs(groupGeomObj)
|
||||
if mainShape is not None and listIDs is not None:
|
||||
for id in listIDs:
|
||||
self.baseShapesSet.add(SubShapeID(mainShape, id))
|
||||
|
||||
def _getParameter(self, nameList, default = None):
|
||||
"""
|
||||
This method finds the value of a parameter in the parameters
|
||||
dictionary. The argument is a list because some parameters can have
|
||||
several different names.
|
||||
"""
|
||||
if len(nameList) > 0:
|
||||
paramName = nameList[0]
|
||||
for name in nameList:
|
||||
if self._parameters.has_key(name):
|
||||
self._paramUserName[paramName] = name
|
||||
return self._parameters[name]
|
||||
return default
|
||||
|
||||
def _getParamUserName(self, paramName):
|
||||
"""
|
||||
This method finds the user name for a parameter.
|
||||
"""
|
||||
if self._paramUserName.has_key(paramName):
|
||||
return self._paramUserName[paramName]
|
||||
else:
|
||||
return paramName
|
||||
|
||||
def __repr__(self):
|
||||
reprdict = self.__dict__.copy()
|
||||
del reprdict["_parameters"]
|
||||
del reprdict["groupName"]
|
||||
del reprdict["_groupGeomObj"]
|
||||
del reprdict["_paramUserName"]
|
||||
del reprdict["name"]
|
||||
del reprdict["geom"]
|
||||
del reprdict["baseShapesSet"]
|
||||
return '%s("%s", %s)' % (self.__class__.__name__, self.groupName,
|
||||
reprdict)
|
||||
|
||||
def addOrientation(self, orientParams):
|
||||
"""
|
||||
Add orientation information to the structural element part. See class
|
||||
:class:`~salome.geom.structelem.orientation.Orientation1D` for the description
|
||||
of the parameters.
|
||||
"""
|
||||
self._orientation.addParams(orientParams)
|
||||
|
||||
def _checkSize(self, value, mindim, expression):
|
||||
"""
|
||||
This method checks that some parameters or some expressions involving
|
||||
those parameters are greater than a minimum value.
|
||||
"""
|
||||
if value < mindim:
|
||||
raise InvalidParameterError(self.groupName, expression,
|
||||
mindim, value)
|
||||
|
||||
def build(self):
|
||||
"""
|
||||
Build the geometric shapes and the markers corresponding to the
|
||||
structural element part in the study `studyId`.
|
||||
"""
|
||||
shape = self._buildPart()
|
||||
markers = self._buildMarkers()
|
||||
shape.SetColor(self._groupGeomObj.GetColor())
|
||||
for marker in markers:
|
||||
marker.SetColor(self._groupGeomObj.GetColor())
|
||||
return (shape, markers)
|
||||
|
||||
def _buildPart(self):
|
||||
"""
|
||||
This abstract method must be implemented in subclasses and should
|
||||
create the geometrical shape(s) of the structural element part.
|
||||
"""
|
||||
raise NotImplementedError("Method _buildPart not implemented in class"
|
||||
" %s (it must be implemented in "
|
||||
"StructuralElementPart subclasses)." %
|
||||
self.__class__.__name__)
|
||||
|
||||
def _buildMarkers(self):
|
||||
"""
|
||||
This abstract method must be implemented in subclasses and should
|
||||
create the markers defining the orientation of the structural element
|
||||
part.
|
||||
"""
|
||||
raise NotImplementedError("Method _buildMarker not implemented in "
|
||||
"class %s (it must be implemented in "
|
||||
"StructuralElementPart subclasses)." %
|
||||
self.__class__.__name__)
|
||||
|
||||
def _getSubShapes(self, minDim = MIN_LENGTH_FOR_EXTRUSION):
|
||||
"""
|
||||
Find and return the base subshapes in the structural element part.
|
||||
"""
|
||||
subShapes = []
|
||||
for subShapeID in self.baseShapesSet:
|
||||
subShape = subShapeID.getObj(self.geom)
|
||||
length = self.geom.BasicProperties(subShape)[0]
|
||||
if length < minDim:
|
||||
logger.warning("Length too short (%s - ID %s, length = %g), "
|
||||
"subshape will not be used in structural "
|
||||
"element" % (self.groupName, subShapeID._id,
|
||||
length))
|
||||
else:
|
||||
subShapes.append(subShape)
|
||||
return subShapes
|
||||
|
||||
|
||||
class Beam(StructuralElementPart):
|
||||
"""
|
||||
This class is an "abstract" class for all 1D structural element parts. It
|
||||
should not be instantiated directly. See class
|
||||
:class:`StructuralElementPart` for the description of the parameters.
|
||||
"""
|
||||
|
||||
DEFAULT_NAME = "Beam"
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = DEFAULT_NAME):
|
||||
StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
|
||||
parameters, name)
|
||||
self._orientation = orientation.Orientation1D()
|
||||
|
||||
def _isReversed(self, path):
|
||||
"""
|
||||
This method checks if a 1D object is "reversed", i.e. if its
|
||||
orientation is different than the orientation of the underlying OCC
|
||||
object.
|
||||
"""
|
||||
fParam = 0.
|
||||
lParam = 1.
|
||||
fPoint = self.geom.MakeVertexOnCurve(path, fParam)
|
||||
lPoint = self.geom.MakeVertexOnCurve(path, lParam)
|
||||
|
||||
fNormal = self.geom.MakeTangentOnCurve(path, fParam)
|
||||
lNormal = self.geom.MakeTangentOnCurve(path, lParam)
|
||||
|
||||
fCircle = self.geom.MakeCircle(fPoint, fNormal, 10)
|
||||
lCircle = self.geom.MakeCircle(lPoint, lNormal, 10)
|
||||
|
||||
try:
|
||||
pipe = self.geom.MakePipeWithDifferentSections([fCircle, lCircle],
|
||||
[fPoint, lPoint],
|
||||
path, False, False)
|
||||
except RuntimeError, e:
|
||||
# This dirty trick is needed if the wire is not oriented in the
|
||||
# direction corresponding to parameters 0.0 -> 1.0. In this case,
|
||||
# we catch the error and invert the ends of the wire. This trick
|
||||
# will be removed when the function giving the orientation of an
|
||||
# edge will be added in geompy (see issue 1144 in PAL bugtracker).
|
||||
if (str(e) == "MakePipeWithDifferentSections : First location "
|
||||
"shapes is not coincided with first vertex of "
|
||||
"aWirePath"):
|
||||
return True
|
||||
else:
|
||||
raise
|
||||
return False
|
||||
|
||||
def _getVertexAndTangentOnOrientedWire(self, path, param):
|
||||
"""
|
||||
Get a vertex and the corresponding tangent on a wire by parameter.
|
||||
This method takes into account the "real" orientation of the wire
|
||||
(i.e. the orientation of the underlying OCC object).
|
||||
"""
|
||||
if self._isReversed(path):
|
||||
vertex = self.geom.MakeVertexOnCurve(path, 1.0 - param)
|
||||
invtangent = self.geom.MakeTangentOnCurve(path, 1.0 - param)
|
||||
tanpoint = self.geom.MakeTranslationVectorDistance(vertex,
|
||||
invtangent,
|
||||
-1.0)
|
||||
tangent = self.geom.MakeVector(vertex, tanpoint)
|
||||
else:
|
||||
vertex = self.geom.MakeVertexOnCurve(path, param)
|
||||
tangent = self.geom.MakeTangentOnCurve(path, param)
|
||||
return (vertex, tangent)
|
||||
|
||||
def _makeSolidPipeFromWires(self, wire1, wire2, point1, point2, path):
|
||||
"""
|
||||
Create a solid by the extrusion of section `wire1` to section `wire2`
|
||||
along `path`.
|
||||
"""
|
||||
face1 = self.geom.MakeFace(wire1, True)
|
||||
face2 = self.geom.MakeFace(wire2, True)
|
||||
shell = self.geom.MakePipeWithDifferentSections([wire1, wire2],
|
||||
[point1, point2],
|
||||
path, False, False)
|
||||
closedShell = self.geom.MakeShell([face1, face2, shell])
|
||||
solid = self.geom.MakeSolid([closedShell])
|
||||
return solid
|
||||
|
||||
def _buildPart(self):
|
||||
"""
|
||||
Build the structural element part.
|
||||
"""
|
||||
# Get all the subshapes in the group (normally only edges and wires)
|
||||
paths = self._getSubShapes()
|
||||
listPipes = []
|
||||
withContact = False
|
||||
withCorrection = False
|
||||
|
||||
for path in paths:
|
||||
# Build the sections (rectangular or circular) at each end of the
|
||||
# beam
|
||||
(fPoint, fNormal) = self._getVertexAndTangentOnOrientedWire(path,
|
||||
0.0)
|
||||
(lPoint, lNormal) = self._getVertexAndTangentOnOrientedWire(path,
|
||||
1.0)
|
||||
(outerWire1, innerWire1, outerWire2, innerWire2) = \
|
||||
self._makeSectionWires(fPoint, fNormal, lPoint, lNormal)
|
||||
|
||||
# Create the resulting solid
|
||||
outerSolid = self._makeSolidPipeFromWires(outerWire1, outerWire2,
|
||||
fPoint, lPoint, path)
|
||||
if self.filling == HOLLOW:
|
||||
innerSolid = self._makeSolidPipeFromWires(innerWire1,
|
||||
innerWire2, fPoint,
|
||||
lPoint, path)
|
||||
resultSolid = self.geom.MakeCut(outerSolid, innerSolid)
|
||||
listPipes.append(resultSolid)
|
||||
else:
|
||||
listPipes.append(outerSolid)
|
||||
|
||||
if len(listPipes) == 0:
|
||||
return None
|
||||
elif len(listPipes) == 1:
|
||||
return listPipes[0]
|
||||
else:
|
||||
return self.geom.MakeCompound(listPipes)
|
||||
|
||||
def _buildMarkers(self):
|
||||
"""
|
||||
Build the markers defining the orientation of the structural element
|
||||
part.
|
||||
"""
|
||||
param = 0.5
|
||||
paths = self._getSubShapes()
|
||||
listMarkers = []
|
||||
for path in paths:
|
||||
(center, vecX) = self._getVertexAndTangentOnOrientedWire(path,
|
||||
param)
|
||||
marker = self._orientation.buildMarker(self.geom, center, vecX)
|
||||
listMarkers.append(marker)
|
||||
return listMarkers
|
||||
|
||||
|
||||
class GeneralBeam(Beam):
|
||||
"""
|
||||
This class defines a beam with a generic section. It is represented only
|
||||
as the underlying wire. See class :class:`StructuralElementPart` for the
|
||||
description of the parameters.
|
||||
"""
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = Beam.DEFAULT_NAME):
|
||||
Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name)
|
||||
logger.debug(repr(self))
|
||||
|
||||
def _buildPart(self):
|
||||
"""
|
||||
Create a copy of the underlying wire.
|
||||
"""
|
||||
edges = self._getSubShapes(1e-7)
|
||||
wire = None
|
||||
if len(edges) > 0:
|
||||
wire = self.geom.MakeWire(edges)
|
||||
return wire
|
||||
|
||||
|
||||
class CircularBeam(Beam):
|
||||
"""
|
||||
This class defines a beam with a circular section. It can be full or
|
||||
hollow, and its radius and thickness can vary from one end of the beam to
|
||||
the other. The valid parameters for circular beams are:
|
||||
|
||||
* "R1" or "R": radius at the first end of the beam.
|
||||
* "R2" or "R": radius at the other end of the beam.
|
||||
* "EP1" or "EP" (optional): thickness at the first end of the beam.
|
||||
If not specified or equal to 0, the beam is considered full.
|
||||
* "EP2" or "EP" (optional): thickness at the other end of the beam.
|
||||
If not specified or equal to 0, the beam is considered full.
|
||||
|
||||
See class :class:`StructuralElementPart` for the description of the
|
||||
other parameters.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = Beam.DEFAULT_NAME):
|
||||
Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name)
|
||||
|
||||
self.R1 = self._getParameter(["R1", "R"])
|
||||
self.R2 = self._getParameter(["R2", "R"])
|
||||
self.EP1 = self._getParameter(["EP1", "EP"])
|
||||
self.EP2 = self._getParameter(["EP2", "EP"])
|
||||
|
||||
if self.EP1 is None or self.EP2 is None or \
|
||||
self.EP1 == 0 or self.EP2 == 0:
|
||||
self.filling = FULL
|
||||
else:
|
||||
self.filling = HOLLOW
|
||||
|
||||
logger.debug(repr(self))
|
||||
|
||||
# Check parameters
|
||||
self._checkSize(self.R1, MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0,
|
||||
self._getParamUserName("R1"))
|
||||
self._checkSize(self.R2, MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0,
|
||||
self._getParamUserName("R2"))
|
||||
if self.filling == HOLLOW:
|
||||
self._checkSize(self.EP1, MIN_THICKNESS,
|
||||
self._getParamUserName("EP1"))
|
||||
self._checkSize(self.EP2, MIN_THICKNESS,
|
||||
self._getParamUserName("EP2"))
|
||||
self._checkSize(self.R1 - self.EP1,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0,
|
||||
"%s - %s" % (self._getParamUserName("R1"),
|
||||
self._getParamUserName("EP1")))
|
||||
self._checkSize(self.R2 - self.EP2,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE / 2.0,
|
||||
"%s - %s" % (self._getParamUserName("R2"),
|
||||
self._getParamUserName("EP2")))
|
||||
|
||||
def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
|
||||
"""
|
||||
Create the circular sections used to build the pipe.
|
||||
"""
|
||||
outerCircle1 = self.geom.MakeCircle(fPoint, fNormal, self.R1)
|
||||
outerCircle2 = self.geom.MakeCircle(lPoint, lNormal, self.R2)
|
||||
if self.filling == HOLLOW:
|
||||
innerCircle1 = self.geom.MakeCircle(fPoint, fNormal,
|
||||
self.R1 - self.EP1)
|
||||
innerCircle2 = self.geom.MakeCircle(lPoint, lNormal,
|
||||
self.R2 - self.EP2)
|
||||
else:
|
||||
innerCircle1 = None
|
||||
innerCircle2 = None
|
||||
|
||||
return (outerCircle1, innerCircle1, outerCircle2, innerCircle2)
|
||||
|
||||
|
||||
class RectangularBeam(Beam):
|
||||
"""
|
||||
This class defines a beam with a rectangular section. It can be full or
|
||||
hollow, and its dimensions can vary from one end of the beam to the other.
|
||||
The valid parameters for rectangular beams are:
|
||||
|
||||
* "HY1", "HY", "H1" or "H": width at the first end of the beam.
|
||||
* "HZ1", "HZ", "H1" or "H": height at the first end of the beam.
|
||||
* "HY2", "HY", "H2" or "H": width at the other end of the beam.
|
||||
* "HZ2", "HZ", "H2" or "H": height at the other end of the beam.
|
||||
* "EPY1", "EPY", "EP1" or "EP" (optional): thickness in the width
|
||||
direction at the first end of the beam. If not specified or equal to 0,
|
||||
the beam is considered full.
|
||||
* "EPZ1", "EPZ", "EP1" or "EP" (optional): thickness in the height
|
||||
direction at the first end of the beam. If not specified or equal to 0,
|
||||
the beam is considered full.
|
||||
* "EPY2", "EPY", "EP2" or "EP" (optional): thickness in the width
|
||||
direction at the other end of the beam. If not specified or equal to 0,
|
||||
the beam is considered full.
|
||||
* "EPZ2", "EPZ", "EP2" or "EP" (optional): thickness in the height
|
||||
direction at the other end of the beam. If not specified or equal to 0,
|
||||
the beam is considered full.
|
||||
|
||||
See class :class:`StructuralElementPart` for the description of the
|
||||
other parameters.
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = Beam.DEFAULT_NAME):
|
||||
Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name)
|
||||
|
||||
self.HY1 = self._getParameter(["HY1", "HY", "H1", "H"])
|
||||
self.HZ1 = self._getParameter(["HZ1", "HZ", "H1", "H"])
|
||||
self.HY2 = self._getParameter(["HY2", "HY", "H2", "H"])
|
||||
self.HZ2 = self._getParameter(["HZ2", "HZ", "H2", "H"])
|
||||
self.EPY1 = self._getParameter(["EPY1", "EPY", "EP1", "EP"])
|
||||
self.EPZ1 = self._getParameter(["EPZ1", "EPZ", "EP1", "EP"])
|
||||
self.EPY2 = self._getParameter(["EPY2", "EPY", "EP2", "EP"])
|
||||
self.EPZ2 = self._getParameter(["EPZ2", "EPZ", "EP2", "EP"])
|
||||
|
||||
if self.EPY1 is None or self.EPZ1 is None or \
|
||||
self.EPY2 is None or self.EPZ2 is None or \
|
||||
self.EPY1 == 0 or self.EPZ1 == 0 or \
|
||||
self.EPY2 == 0 or self.EPZ2 == 0:
|
||||
self.filling = FULL
|
||||
else:
|
||||
self.filling = HOLLOW
|
||||
|
||||
logger.debug(repr(self))
|
||||
|
||||
# Check parameters
|
||||
self._checkSize(self.HY1, MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
self._getParamUserName("HY1"))
|
||||
self._checkSize(self.HZ1, MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
self._getParamUserName("HZ1"))
|
||||
self._checkSize(self.HY2, MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
self._getParamUserName("HY2"))
|
||||
self._checkSize(self.HZ2, MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
self._getParamUserName("HZ2"))
|
||||
if self.filling == HOLLOW:
|
||||
self._checkSize(self.EPY1, MIN_THICKNESS,
|
||||
self._getParamUserName("EPY1"))
|
||||
self._checkSize(self.EPZ1, MIN_THICKNESS,
|
||||
self._getParamUserName("EPZ1"))
|
||||
self._checkSize(self.EPY2, MIN_THICKNESS,
|
||||
self._getParamUserName("EPY2"))
|
||||
self._checkSize(self.EPZ2, MIN_THICKNESS,
|
||||
self._getParamUserName("EPZ2"))
|
||||
self._checkSize(self.HY1 - 2 * self.EPY1,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
"%s - 2 * %s" % (self._getParamUserName("HY1"),
|
||||
self._getParamUserName("EPY1")))
|
||||
self._checkSize(self.HZ1 - 2 * self.EPZ1,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
"%s - 2 * %s" % (self._getParamUserName("HZ1"),
|
||||
self._getParamUserName("EPZ1")))
|
||||
self._checkSize(self.HY2 - 2 * self.EPY2,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
"%s - 2 * %s" % (self._getParamUserName("HY2"),
|
||||
self._getParamUserName("EPY2")))
|
||||
self._checkSize(self.HZ2 - 2 * self.EPZ2,
|
||||
MIN_DIM_FOR_EXTRUDED_SHAPE,
|
||||
"%s - 2 * %s" % (self._getParamUserName("HZ2"),
|
||||
self._getParamUserName("EPZ2")))
|
||||
|
||||
def _makeRectangle(self, HY, HZ, planeSect):
|
||||
"""
|
||||
Create a rectangle in the specified plane.
|
||||
"""
|
||||
halfHY = HY / 2.0
|
||||
halfHZ = HZ / 2.0
|
||||
sketchStr = "Sketcher:F %g" % (-halfHZ) + " %g" % (-halfHY) + ":"
|
||||
sketchStr += "TT %g" % (halfHZ) + " %g" % (-halfHY) + ":"
|
||||
sketchStr += "TT %g" % (halfHZ) + " %g" % (halfHY) + ":"
|
||||
sketchStr += "TT %g" % (-halfHZ) + " %g" % (halfHY) + ":WW"
|
||||
logger.debug('Drawing rectangle: "%s"' % sketchStr)
|
||||
sketch = self.geom.MakeSketcherOnPlane(sketchStr, planeSect)
|
||||
return sketch
|
||||
|
||||
def _makeSectionWires(self, fPoint, fNormal, lPoint, lNormal):
|
||||
"""
|
||||
Create the rectangular sections used to build the pipe.
|
||||
"""
|
||||
planeSect1 = self.geom.MakePlane(fPoint, fNormal, 1.0)
|
||||
outerRect1 = self._makeRectangle(self.HY1, self.HZ1, planeSect1)
|
||||
planeSect2 = self.geom.MakePlane(lPoint, lNormal, 1.0)
|
||||
outerRect2 = self._makeRectangle(self.HY2, self.HZ2, planeSect2)
|
||||
if self.filling == HOLLOW:
|
||||
innerRect1 = self._makeRectangle(self.HY1 - 2 * self.EPY1,
|
||||
self.HZ1 - 2 * self.EPZ1,
|
||||
planeSect1)
|
||||
innerRect2 = self._makeRectangle(self.HY2 - 2 * self.EPY2,
|
||||
self.HZ2 - 2 * self.EPZ2,
|
||||
planeSect2)
|
||||
else:
|
||||
innerRect1 = None
|
||||
innerRect2 = None
|
||||
|
||||
return (outerRect1, innerRect1, outerRect2, innerRect2)
|
||||
|
||||
|
||||
class StructuralElementPart2D(StructuralElementPart):
|
||||
"""
|
||||
This class is an "abstract" class for all 2D structural element parts. It
|
||||
should not be instantiated directly. See class
|
||||
:class:`StructuralElementPart` for the description of the parameters.
|
||||
"""
|
||||
|
||||
DEFAULT_NAME = "StructuralElementPart2D"
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = DEFAULT_NAME):
|
||||
StructuralElementPart.__init__(self, studyId, groupName, groupGeomObj,
|
||||
parameters, name)
|
||||
self._orientation = orientation.Orientation2D(
|
||||
self._getParameter(["angleAlpha"]),
|
||||
self._getParameter(["angleBeta"]),
|
||||
self._getParameter(["Vecteur"]))
|
||||
self.offset = self._getParameter(["Excentre"], 0.0)
|
||||
|
||||
def _makeFaceOffset(self, face, offset, epsilon = 1e-6):
|
||||
"""
|
||||
Create a copy of a face at a given offset.
|
||||
"""
|
||||
if abs(offset) < epsilon:
|
||||
return self.geom.MakeCopy(face)
|
||||
else:
|
||||
offsetObj = self.geom.MakeOffset(face, offset)
|
||||
# We have to explode the resulting object into faces because it is
|
||||
# created as a polyhedron and not as a single face
|
||||
faces = self.geom.SubShapeAll(offsetObj,
|
||||
self.geom.ShapeType["FACE"])
|
||||
return faces[0]
|
||||
|
||||
def _buildMarkersWithOffset(self, offset):
|
||||
"""
|
||||
Build the markers for the structural element part with a given offset
|
||||
from the base face.
|
||||
"""
|
||||
uParam = 0.5
|
||||
vParam = 0.5
|
||||
listMarkers = []
|
||||
subShapes = self._getSubShapes()
|
||||
|
||||
for subShape in subShapes:
|
||||
faces = self.geom.SubShapeAll(subShape,
|
||||
self.geom.ShapeType["FACE"])
|
||||
for face in faces:
|
||||
offsetFace = self._makeFaceOffset(face, offset)
|
||||
# get tangent plane on surface by parameters
|
||||
center = self.geom.MakeVertexOnSurface(offsetFace,
|
||||
uParam, vParam)
|
||||
tangPlane = self.geom.MakeTangentPlaneOnFace(offsetFace,
|
||||
uParam, vParam,
|
||||
1.0)
|
||||
normal = self.geom.GetNormal(tangPlane)
|
||||
marker = self._orientation.buildMarker(self.geom,
|
||||
center, normal)
|
||||
listMarkers.append(marker)
|
||||
|
||||
return listMarkers
|
||||
|
||||
|
||||
class ThickShell(StructuralElementPart2D):
|
||||
"""
|
||||
This class defines a shell with a given thickness. It can be shifted from
|
||||
the base face. The valid parameters for thick shells are:
|
||||
|
||||
* "Epais": thickness of the shell.
|
||||
* "Excentre": offset of the shell from the base face.
|
||||
* "angleAlpha": angle used to build the markers (see class
|
||||
:class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
* "angleBeta": angle used to build the markers (see class
|
||||
:class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
* "Vecteur": vector used instead of the angles to build the markers (see
|
||||
class :class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
|
||||
See class :class:`StructuralElementPart` for the description of the
|
||||
other parameters.
|
||||
"""
|
||||
|
||||
DEFAULT_NAME = "ThickShell"
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = DEFAULT_NAME):
|
||||
StructuralElementPart2D.__init__(self, studyId, groupName,
|
||||
groupGeomObj, parameters, name)
|
||||
self.thickness = self._getParameter(["Epais"])
|
||||
logger.debug(repr(self))
|
||||
|
||||
def _buildPart(self):
|
||||
"""
|
||||
Create the geometrical shapes corresponding to the thick shell.
|
||||
"""
|
||||
subShapes = self._getSubShapes()
|
||||
listSolids = []
|
||||
|
||||
for subShape in subShapes:
|
||||
faces = self.geom.SubShapeAll(subShape,
|
||||
self.geom.ShapeType["FACE"])
|
||||
for face in faces:
|
||||
shape = self._buildThickShellForFace(face)
|
||||
listSolids.append(shape)
|
||||
|
||||
if len(listSolids) == 0:
|
||||
return None
|
||||
elif len(listSolids) == 1:
|
||||
return listSolids[0]
|
||||
else:
|
||||
return self.geom.MakeCompound(listSolids)
|
||||
|
||||
def _buildThickShellForFace(self, face):
|
||||
"""
|
||||
Create the geometrical shapes corresponding to the thick shell for a
|
||||
given face.
|
||||
"""
|
||||
epsilon = 1e-6
|
||||
if self.thickness < 2 * epsilon:
|
||||
return self._makeFaceOffset(face, self.offset, epsilon)
|
||||
|
||||
upperOffset = self.offset + self.thickness / 2.0
|
||||
lowerOffset = self.offset - self.thickness / 2.0
|
||||
ruledMode = True
|
||||
modeSolid = False
|
||||
|
||||
upperFace = self._makeFaceOffset(face, upperOffset, epsilon)
|
||||
lowerFace = self._makeFaceOffset(face, lowerOffset, epsilon)
|
||||
listShapes = [upperFace, lowerFace]
|
||||
upperWires = self.geom.SubShapeAll(upperFace,
|
||||
self.geom.ShapeType["WIRE"])
|
||||
lowerWires = self.geom.SubShapeAll(lowerFace,
|
||||
self.geom.ShapeType["WIRE"])
|
||||
if self.geom.KindOfShape(face)[0] == self.geom.kind.CYLINDER2D:
|
||||
# if the face is a cylinder, we remove the extra side edge
|
||||
upperWires = self._removeCylinderExtraEdge(upperWires)
|
||||
lowerWires = self._removeCylinderExtraEdge(lowerWires)
|
||||
for i in range(len(upperWires)):
|
||||
resShape = self.geom.MakeThruSections([upperWires[i],
|
||||
lowerWires[i]],
|
||||
modeSolid, epsilon,
|
||||
ruledMode)
|
||||
listShapes.append(resShape)
|
||||
resultShell = self.geom.MakeShell(listShapes)
|
||||
resultSolid = self.geom.MakeSolid([resultShell])
|
||||
return resultSolid
|
||||
|
||||
def _removeCylinderExtraEdge(self, wires):
|
||||
"""
|
||||
Remove the side edge in a cylinder.
|
||||
"""
|
||||
result = []
|
||||
for wire in wires:
|
||||
edges = self.geom.SubShapeAll(wire, self.geom.ShapeType["EDGE"])
|
||||
for edge in edges:
|
||||
if self.geom.KindOfShape(edge)[0] == self.geom.kind.CIRCLE:
|
||||
result.append(edge)
|
||||
return result
|
||||
|
||||
def _buildMarkers(self):
|
||||
"""
|
||||
Build the markers defining the orientation of the thick shell.
|
||||
"""
|
||||
return self._buildMarkersWithOffset(self.offset +
|
||||
self.thickness / 2.0)
|
||||
|
||||
|
||||
class Grid(StructuralElementPart2D):
|
||||
"""
|
||||
This class defines a grid. A grid is represented by a 2D face patterned
|
||||
with small lines in the main direction of the grid frame. The valid
|
||||
parameters for grids are:
|
||||
|
||||
* "Excentre": offset of the grid from the base face.
|
||||
* "angleAlpha": angle used to build the markers (see class
|
||||
:class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
* "angleBeta": angle used to build the markers (see class
|
||||
:class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
* "Vecteur": vector used instead of the angles to build the markers (see
|
||||
class :class:`~salome.geom.structelem.orientation.Orientation2D`)
|
||||
* "origAxeX": X coordinate of the origin of the axis used to determine the
|
||||
orientation of the frame in the case of a cylindrical grid.
|
||||
* "origAxeY": Y coordinate of the origin of the axis used to determine the
|
||||
orientation of the frame in the case of a cylindrical grid.
|
||||
* "origAxeZ": Z coordinate of the origin of the axis used to determine the
|
||||
orientation of the frame in the case of a cylindrical grid.
|
||||
* "axeX": X coordinate of the axis used to determine the orientation of
|
||||
the frame in the case of a cylindrical grid.
|
||||
* "axeY": Y coordinate of the axis used to determine the orientation of
|
||||
the frame in the case of a cylindrical grid.
|
||||
* "axeZ": Z coordinate of the axis used to determine the orientation of
|
||||
the frame in the case of a cylindrical grid.
|
||||
|
||||
See class :class:`StructuralElementPart` for the description of the
|
||||
other parameters.
|
||||
"""
|
||||
|
||||
DEFAULT_NAME = "Grid"
|
||||
|
||||
def __init__(self, studyId, groupName, groupGeomObj, parameters,
|
||||
name = DEFAULT_NAME):
|
||||
StructuralElementPart2D.__init__(self, studyId, groupName,
|
||||
groupGeomObj, parameters, name)
|
||||
self.xr = self._getParameter(["origAxeX"])
|
||||
self.yr = self._getParameter(["origAxeY"])
|
||||
self.zr = self._getParameter(["origAxeZ"])
|
||||
self.vx = self._getParameter(["axeX"])
|
||||
self.vy = self._getParameter(["axeY"])
|
||||
self.vz = self._getParameter(["axeZ"])
|
||||
logger.debug(repr(self))
|
||||
|
||||
def _buildPart(self):
|
||||
"""
|
||||
Create the geometrical shapes representing the grid.
|
||||
"""
|
||||
subShapes = self._getSubShapes()
|
||||
listGridShapes = []
|
||||
|
||||
for subShape in subShapes:
|
||||
faces = self.geom.SubShapeAll(subShape,
|
||||
self.geom.ShapeType["FACE"])
|
||||
for face in faces:
|
||||
if self.geom.KindOfShape(face)[0] == \
|
||||
self.geom.kind.CYLINDER2D and \
|
||||
self.xr is not None and self.yr is not None and \
|
||||
self.zr is not None and self.vx is not None and \
|
||||
self.vy is not None and self.vz is not None:
|
||||
shape = self._buildGridForCylinderFace(face)
|
||||
else:
|
||||
shape = self._buildGridForNormalFace(face)
|
||||
listGridShapes.append(shape)
|
||||
|
||||
if len(listGridShapes) == 0:
|
||||
return None
|
||||
elif len(listGridShapes) == 1:
|
||||
return listGridShapes[0]
|
||||
else:
|
||||
return self.geom.MakeCompound(listGridShapes)
|
||||
|
||||
def _buildGridForNormalFace(self, face):
|
||||
"""
|
||||
Create the geometrical shapes representing the grid for a given
|
||||
non-cylindrical face.
|
||||
"""
|
||||
baseFace = self._makeFaceOffset(face, self.offset)
|
||||
gridList = [baseFace]
|
||||
|
||||
# Compute display length for grid elements
|
||||
p1 = self.geom.MakeVertexOnSurface(baseFace, 0.0, 0.0)
|
||||
p2 = self.geom.MakeVertexOnSurface(baseFace, 0.1, 0.1)
|
||||
length = self.geom.MinDistance(p1, p2) / 2.0
|
||||
|
||||
for u in range(1, 10):
|
||||
uParam = u * 0.1
|
||||
for v in range(1, 10):
|
||||
vParam = v * 0.1
|
||||
# get tangent plane on surface by parameters
|
||||
center = self.geom.MakeVertexOnSurface(baseFace,
|
||||
uParam, vParam)
|
||||
tangPlane = self.geom.MakeTangentPlaneOnFace(baseFace, uParam,
|
||||
vParam, 1.0)
|
||||
|
||||
# use the marker to get the orientation of the frame
|
||||
normal = self.geom.GetNormal(tangPlane)
|
||||
marker = self._orientation.buildMarker(self.geom, center,
|
||||
normal, False)
|
||||
[Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz] = self.geom.GetPosition(marker)
|
||||
xPoint = self.geom.MakeTranslation(center, Xx * length,
|
||||
Xy * length, Xz * length)
|
||||
gridLine = self.geom.MakeLineTwoPnt(center, xPoint)
|
||||
gridList.append(gridLine)
|
||||
grid = self.geom.MakeCompound(gridList)
|
||||
return grid
|
||||
|
||||
def _buildGridForCylinderFace(self, face):
|
||||
"""
|
||||
Create the geometrical shapes representing the grid for a given
|
||||
cylindrical face.
|
||||
"""
|
||||
baseFace = self._makeFaceOffset(face, self.offset)
|
||||
gridList = [baseFace]
|
||||
|
||||
# Compute display length for grid elements
|
||||
p1 = self.geom.MakeVertexOnSurface(baseFace, 0.0, 0.0)
|
||||
p2 = self.geom.MakeVertexOnSurface(baseFace, 0.1, 0.1)
|
||||
length = self.geom.MinDistance(p1, p2) / 2.0
|
||||
|
||||
# Create reference vector V
|
||||
origPoint = self.geom.MakeVertex(self.xr, self.yr, self.zr)
|
||||
vPoint = self.geom.MakeTranslation(origPoint,
|
||||
self.vx, self.vy, self.vz)
|
||||
refVec = self.geom.MakeVector(origPoint, vPoint)
|
||||
|
||||
for u in range(10):
|
||||
uParam = u * 0.1
|
||||
for v in range(1, 10):
|
||||
vParam = v * 0.1
|
||||
|
||||
# Compute the local orientation of the frame
|
||||
center = self.geom.MakeVertexOnSurface(baseFace,
|
||||
uParam, vParam)
|
||||
locPlaneYZ = self.geom.MakePlaneThreePnt(origPoint, center,
|
||||
vPoint, 1.0)
|
||||
locOrient = self.geom.GetNormal(locPlaneYZ)
|
||||
xPoint = self.geom.MakeTranslationVectorDistance(center,
|
||||
locOrient,
|
||||
length)
|
||||
gridLine = self.geom.MakeLineTwoPnt(center, xPoint)
|
||||
gridList.append(gridLine)
|
||||
|
||||
grid = self.geom.MakeCompound(gridList)
|
||||
return grid
|
||||
|
||||
def _buildMarkers(self):
|
||||
"""
|
||||
Create the markers defining the orientation of the grid.
|
||||
"""
|
||||
return self._buildMarkersWithOffset(self.offset)
|
||||
|
||||
|
||||
def VisuPoutreGenerale(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "POUTRE"):
|
||||
"""
|
||||
Alias for class :class:`GeneralBeam`.
|
||||
"""
|
||||
return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuPoutreCercle(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "POUTRE"):
|
||||
"""
|
||||
Alias for class :class:`CircularBeam`.
|
||||
"""
|
||||
return CircularBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuPoutreRectangle(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "POUTRE"):
|
||||
"""
|
||||
Alias for class :class:`RectangularBeam`.
|
||||
"""
|
||||
return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuBarreGenerale(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "BARRE"):
|
||||
"""
|
||||
Alias for class :class:`GeneralBeam`.
|
||||
"""
|
||||
return GeneralBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuBarreRectangle(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "BARRE"):
|
||||
"""
|
||||
Alias for class :class:`RectangularBeam`.
|
||||
"""
|
||||
return RectangularBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuBarreCercle(studyId, groupName, groupGeomObj, parameters,
|
||||
name = "BARRE"):
|
||||
"""
|
||||
Alias for class :class:`CircularBeam`.
|
||||
"""
|
||||
return CircularBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuCable(studyId, groupName, groupGeomObj, parameters, name = "CABLE"):
|
||||
"""
|
||||
Alias for class :class:`CircularBeam`.
|
||||
"""
|
||||
return CircularBeam(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuCoque(studyId, groupName, groupGeomObj, parameters, name = "COQUE"):
|
||||
"""
|
||||
Alias for class :class:`ThickShell`.
|
||||
"""
|
||||
return ThickShell(studyId, groupName, groupGeomObj, parameters, name)
|
||||
|
||||
def VisuGrille(studyId, groupName, groupGeomObj, parameters, name = "GRILLE"):
|
||||
"""
|
||||
Alias for class :class:`Grid`.
|
||||
"""
|
||||
return Grid(studyId, groupName, groupGeomObj, parameters, name)
|
@ -437,6 +437,14 @@ def TestAll (geompy, math):
|
||||
nameS = geompy.SubShapeName(SubFaceS, Box)
|
||||
id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS)
|
||||
|
||||
# GetExistingSubObjects
|
||||
SubObjsAll = geompy.GetExistingSubObjects(Box, True)
|
||||
print "For now, Box has the following created sub-objects:", SubObjsAll
|
||||
|
||||
# GetGroups
|
||||
SubGrpsAll = geompy.GetGroups(Box)
|
||||
print "For now, Box has the following created groups:", SubGrpsAll
|
||||
|
||||
# SubShapeAll
|
||||
SubEdgeList = geompy.SubShapeAll(SubFace, geompy.ShapeType["EDGE"])
|
||||
i=0
|
||||
|
@ -500,6 +500,17 @@ def TestOtherOperations (geompy, math):
|
||||
geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)")
|
||||
geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)")
|
||||
|
||||
# GetVertexNearPoint(theShape, thePoint)
|
||||
pb0_top_2_near = geompy.MakeVertex(40, 40, 40)
|
||||
pb0_top_2 = geompy.GetVertexNearPoint(blocksComp, pb0_top_2_near)
|
||||
|
||||
geompy.addToStudyInFather(blocksComp, pb0_top_2, "point from blocksComp near (40, 40, 40)")
|
||||
|
||||
# GetEdge(theShape, thePoint1, thePoint2)
|
||||
edge_top_y50 = geompy.GetEdge(blocksComp, pb0_top_1, pb0_top_2)
|
||||
|
||||
geompy.addToStudyInFather(blocksComp, edge_top_y50, "edge from blocksComp by two points")
|
||||
|
||||
# GetEdgeNearPoint(theShape, thePoint)
|
||||
pmidle = geompy.MakeVertex(50, 0, 50)
|
||||
edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
|
||||
@ -511,6 +522,11 @@ def TestOtherOperations (geompy, math):
|
||||
|
||||
geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
|
||||
|
||||
# GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
|
||||
b0_faces_plus = geompy.GetShapesNearPoint(blocksComp, pb0_top_2_near, geompy.ShapeType["FACE"], 0.01)
|
||||
|
||||
geompy.addToStudyInFather(blocksComp, b0_faces_plus, "faces near point (40, 40, 40)")
|
||||
|
||||
# GetShapesOnPlane
|
||||
faces_on_pln = geompy.GetShapesOnPlane(blocksComp, geompy.ShapeType["FACE"],
|
||||
v_0pp, geompy.GEOM.ST_ONIN)
|
||||
|
@ -448,7 +448,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @return New GEOM_Object, containing the created point.
|
||||
#
|
||||
# @ref tui_creation_point "Example"
|
||||
def MakeVertex(self,theX, theY, theZ):
|
||||
def MakeVertex(self, theX, theY, theZ):
|
||||
# Example: see GEOM_TestAll.py
|
||||
theX,theY,theZ,Parameters = ParseParameters(theX, theY, theZ)
|
||||
anObj = self.BasicOp.MakePointXYZ(theX, theY, theZ)
|
||||
@ -1358,13 +1358,13 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @param theTol3D a 3d tolerance to be reached
|
||||
# @param theNbIter a number of iteration of approximation algorithm
|
||||
# @param theMethod Kind of method to perform filling operation:
|
||||
# 0 - Default - standard behaviour
|
||||
# 1 - Use edges orientation - orientation of edges are
|
||||
# used: if edge is reversed curve from this edge
|
||||
# is reversed before using in filling algorithm.
|
||||
# 2 - Auto-correct orientation - change orientation
|
||||
# of curves using minimization of sum of distances
|
||||
# between ends points of edges.
|
||||
# GEOM.FOM_Default - Default - standard behaviour
|
||||
# /GEOM.FOM_UseOri - Use edges orientation - orientation of edges is
|
||||
# used: if the edge is reversed, the curve from this edge
|
||||
# is reversed before using it in the filling algorithm.
|
||||
# /GEOM.FOM_AutoCorrect - Auto-correct orientation - changes the orientation
|
||||
# of the curves using minimization of sum of distances
|
||||
# between the end points of the edges.
|
||||
# @param isApprox if True, BSpline curves are generated in the process
|
||||
# of surface construction. By default it is False, that means
|
||||
# the surface is created using Besier curves. The usage of
|
||||
@ -2052,6 +2052,32 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
## @addtogroup l4_decompose
|
||||
## @{
|
||||
|
||||
## Get all sub-shapes and groups of \a theShape,
|
||||
# that were created already by any other methods.
|
||||
# @param theShape Any shape.
|
||||
# @param theGroupsOnly If this parameter is TRUE, only groups will be
|
||||
# returned, else all found sub-shapes and groups.
|
||||
# @return List of existing sub-objects of \a theShape.
|
||||
#
|
||||
# @ref swig_all_decompose "Example"
|
||||
def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
|
||||
# Example: see GEOM_TestAll.py
|
||||
ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
|
||||
RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
|
||||
return ListObj
|
||||
|
||||
## Get all groups of \a theShape,
|
||||
# that were created already by any other methods.
|
||||
# @param theShape Any shape.
|
||||
# @return List of existing groups of \a theShape.
|
||||
#
|
||||
# @ref swig_all_decompose "Example"
|
||||
def GetGroups(self, theShape):
|
||||
# Example: see GEOM_TestAll.py
|
||||
ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
|
||||
RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
|
||||
return ListObj
|
||||
|
||||
## Explode a shape on subshapes of a given type.
|
||||
# @param aShape Shape to be exploded.
|
||||
# @param aType Type of sub-shapes to be retrieved.
|
||||
@ -2266,11 +2292,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @return New GEOM_Object, containing processed shape.
|
||||
#
|
||||
# @ref swig_todo "Example"
|
||||
def ChangeOrientationShellCopy(self,theObject):
|
||||
def ChangeOrientationShellCopy(self, theObject):
|
||||
anObj = self.HealOp.ChangeOrientationCopy(theObject)
|
||||
RaiseIfFailed("ChangeOrientationCopy", self.HealOp)
|
||||
return anObj
|
||||
|
||||
## Try to limit tolerance of the given object by value \a theTolerance.
|
||||
# @param theObject Shape to be processed.
|
||||
# @param theTolerance Required tolerance value.
|
||||
# @return New GEOM_Object, containing processed shape.
|
||||
#
|
||||
# @ref tui_limit_tolerance "Example"
|
||||
def LimitTolerance(self, theObject, theTolerance = 1e-07):
|
||||
anObj = self.HealOp.LimitTolerance(theObject, theTolerance)
|
||||
RaiseIfFailed("LimitTolerance", self.HealOp)
|
||||
return anObj
|
||||
|
||||
## Get a list of wires (wrapped in GEOM_Object-s),
|
||||
# that constitute a free boundary of the given shape.
|
||||
# @param theObject Shape to get free boundary of.
|
||||
@ -2280,7 +2317,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# theOpenWires: Open wires on the free boundary of the given shape.
|
||||
#
|
||||
# @ref tui_measurement_tools_page "Example"
|
||||
def GetFreeBoundary(self,theObject):
|
||||
def GetFreeBoundary(self, theObject):
|
||||
# Example: see GEOM_TestHealing.py
|
||||
anObj = self.HealOp.GetFreeBoundary(theObject)
|
||||
RaiseIfFailed("GetFreeBoundary", self.HealOp)
|
||||
@ -3620,19 +3657,31 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @return New GEOM_Object, containing the found vertex.
|
||||
#
|
||||
# @ref swig_GetPoint "Example"
|
||||
def GetPoint(self,theShape, theX, theY, theZ, theEpsilon):
|
||||
def GetPoint(self, theShape, theX, theY, theZ, theEpsilon):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
anObj = self.BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
|
||||
RaiseIfFailed("GetPoint", self.BlocksOp)
|
||||
return anObj
|
||||
|
||||
## Find a vertex of the given shape, which has minimal distance to the given point.
|
||||
# @param theShape Any shape.
|
||||
# @param thePoint Point, close to the desired vertex.
|
||||
# @return New GEOM_Object, containing the found vertex.
|
||||
#
|
||||
# @ref swig_GetVertexNearPoint "Example"
|
||||
def GetVertexNearPoint(self, theShape, thePoint):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
anObj = self.BlocksOp.GetVertexNearPoint(theShape, thePoint)
|
||||
RaiseIfFailed("GetVertexNearPoint", self.BlocksOp)
|
||||
return anObj
|
||||
|
||||
## Get an edge, found in the given shape by two given vertices.
|
||||
# @param theShape Block or a compound of blocks.
|
||||
# @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
|
||||
# @return New GEOM_Object, containing the found edge.
|
||||
#
|
||||
# @ref swig_todo "Example"
|
||||
def GetEdge(self,theShape, thePoint1, thePoint2):
|
||||
# @ref swig_GetEdge "Example"
|
||||
def GetEdge(self, theShape, thePoint1, thePoint2):
|
||||
# Example: see GEOM_Spanner.py
|
||||
anObj = self.BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
|
||||
RaiseIfFailed("GetEdge", self.BlocksOp)
|
||||
@ -3644,7 +3693,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @return New GEOM_Object, containing the found edge.
|
||||
#
|
||||
# @ref swig_GetEdgeNearPoint "Example"
|
||||
def GetEdgeNearPoint(self,theShape, thePoint):
|
||||
def GetEdgeNearPoint(self, theShape, thePoint):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
anObj = self.BlocksOp.GetEdgeNearPoint(theShape, thePoint)
|
||||
RaiseIfFailed("GetEdgeNearPoint", self.BlocksOp)
|
||||
@ -3692,7 +3741,7 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
# @return New GEOM_Object, containing the found face.
|
||||
#
|
||||
# @ref swig_GetFaceNearPoint "Example"
|
||||
def GetFaceNearPoint(self,theShape, thePoint):
|
||||
def GetFaceNearPoint(self, theShape, thePoint):
|
||||
# Example: see GEOM_Spanner.py
|
||||
anObj = self.BlocksOp.GetFaceNearPoint(theShape, thePoint)
|
||||
RaiseIfFailed("GetFaceNearPoint", self.BlocksOp)
|
||||
@ -3710,6 +3759,23 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
||||
RaiseIfFailed("GetFaceByNormale", self.BlocksOp)
|
||||
return anObj
|
||||
|
||||
## Find all subshapes of type \a theShapeType of the given shape,
|
||||
# which have minimal distance to the given point.
|
||||
# @param theShape Any shape.
|
||||
# @param thePoint Point, close to the desired shape.
|
||||
# @param theShapeType Defines what kind of subshapes is searched.
|
||||
# @param theTolerance The tolerance for distances comparison. All shapes
|
||||
# with distances to the given point in interval
|
||||
# [minimal_distance, minimal_distance + theTolerance] will be gathered.
|
||||
# @return New GEOM_Object, containing a group of all found shapes.
|
||||
#
|
||||
# @ref swig_GetShapesNearPoint "Example"
|
||||
def GetShapesNearPoint(self, theShape, thePoint, theShapeType, theTolerance = 1e-07):
|
||||
# Example: see GEOM_TestOthers.py
|
||||
anObj = self.BlocksOp.GetShapesNearPoint(theShape, thePoint, theShapeType, theTolerance)
|
||||
RaiseIfFailed("GetShapesNearPoint", self.BlocksOp)
|
||||
return anObj
|
||||
|
||||
# end of l3_blocks_op
|
||||
## @}
|
||||
|
||||
|
@ -473,7 +473,7 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
|
||||
}
|
||||
}
|
||||
else { // an attempt to synchronize list box selection with 3d viewer
|
||||
if (myBusy) {
|
||||
if ( myBusy || myMainObj->_is_nil() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -617,7 +617,8 @@ int GroupGUI_GroupDlg::getSelectedSubshapes (TColStd_IndexedMapOfInteger& theMap
|
||||
theMapIndex.Clear();
|
||||
|
||||
SalomeApp_Application* app = myGeomGUI->getApp();
|
||||
if (!app) return 0;
|
||||
if ( !app || myMainObj->_is_nil() )
|
||||
return 0;
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
@ -787,6 +788,7 @@ void GroupGUI_GroupDlg::activateSelection()
|
||||
myIsShapeType) // check if shape type is already choosen by user
|
||||
{
|
||||
GEOM_Displayer* aDisplayer = getDisplayer();
|
||||
int prevDisplayMode = aDisplayer->SetDisplayMode(0);
|
||||
|
||||
SUIT_ViewWindow* aViewWindow = 0;
|
||||
SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy();
|
||||
@ -831,6 +833,7 @@ void GroupGUI_GroupDlg::activateSelection()
|
||||
}
|
||||
}
|
||||
aDisplayer->UpdateViewer();
|
||||
aDisplayer->SetDisplayMode(prevDisplayMode);
|
||||
}
|
||||
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
|
@ -19,12 +19,10 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: IGESImport.cxx
|
||||
// Created: Wed May 19 14:36:35 2004
|
||||
// Author: Pavel TELKOV
|
||||
// <ptv@mutex.nnov.opencascade.com>
|
||||
//
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
@ -32,15 +30,26 @@
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
#include <IGESControl_Reader.hxx>
|
||||
#include <IGESData_IGESModel.hxx>
|
||||
#include <IGESData_IGESEntity.hxx>
|
||||
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <TransferBRep.hxx>
|
||||
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TDF_TagSource.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
#include <TCollection_HAsciiString.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
|
||||
#ifdef WNT
|
||||
#if defined IGESIMPORT_EXPORTS || defined IGESImport_EXPORTS
|
||||
@ -72,7 +81,7 @@ IGESIMPORT_EXPORT
|
||||
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& theFormatName,
|
||||
TCollection_AsciiString& theError,
|
||||
const TDF_Label&)
|
||||
const TDF_Label& theShapeLabel)
|
||||
{
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
Kernel_Utils::Localizer loc;
|
||||
@ -85,19 +94,19 @@ IGESIMPORT_EXPORT
|
||||
|
||||
if (status == IFSelect_RetDone) {
|
||||
|
||||
if( theFormatName == "IGES_UNIT" ) {
|
||||
if (theFormatName == "IGES_UNIT") {
|
||||
Handle(IGESData_IGESModel) aModel =
|
||||
Handle(IGESData_IGESModel)::DownCast(aReader.Model());
|
||||
gp_Pnt P(1.0,0.0,0.0);
|
||||
if(!aModel.IsNull()) {
|
||||
if (!aModel.IsNull()) {
|
||||
Handle(TCollection_HAsciiString) aUnitName =
|
||||
aModel->GlobalSection().UnitName();
|
||||
//cout<<"aUnitName = "<<aUnitName->ToCString()<<endl;
|
||||
//cout<<"aUnitFlag = "<<aModel->GlobalSection().UnitFlag()<<endl;
|
||||
if( aUnitName->String()=="MM" ) {
|
||||
if (aUnitName->String()=="MM") {
|
||||
P = gp_Pnt(0.001,0.0,0.0);
|
||||
}
|
||||
else if( aUnitName->String()=="CM" ) {
|
||||
else if (aUnitName->String()=="CM") {
|
||||
P = gp_Pnt(0.01,0.0,0.0);
|
||||
}
|
||||
}
|
||||
@ -107,12 +116,12 @@ IGESIMPORT_EXPORT
|
||||
aResShape = V;
|
||||
return aResShape;
|
||||
}
|
||||
if( theFormatName == "IGES_SCALE" ) {
|
||||
if (theFormatName == "IGES_SCALE") {
|
||||
//cout<<"need re-scale a model"<<endl;
|
||||
// set UnitFlag to 'meter'
|
||||
Handle(IGESData_IGESModel) aModel =
|
||||
Handle(IGESData_IGESModel)::DownCast(aReader.Model());
|
||||
if(!aModel.IsNull()) {
|
||||
if (!aModel.IsNull()) {
|
||||
IGESData_GlobalSection aGS = aModel->GlobalSection();
|
||||
aGS.SetUnitFlag(6);
|
||||
aModel->SetGlobalSection(aGS);
|
||||
@ -129,6 +138,38 @@ IGESIMPORT_EXPORT
|
||||
MESSAGE("ImportIGES : count of shapes produced = " << aReader.NbShapes());
|
||||
aResShape = aReader.OneShape();
|
||||
|
||||
// BEGIN: Store names of sub-shapes from file
|
||||
Handle(Interface_InterfaceModel) Model = aReader.WS()->Model();
|
||||
Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader();
|
||||
if (!TR.IsNull()) {
|
||||
Handle(Transfer_TransientProcess) TP = /*TransientProcess();*/TR->TransientProcess();
|
||||
Standard_Integer nb = Model->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i++) {
|
||||
Handle(IGESData_IGESEntity) ent = Handle(IGESData_IGESEntity)::DownCast(Model->Value(i));
|
||||
if (ent.IsNull() || ! ent->HasName()) continue;
|
||||
|
||||
// find target shape
|
||||
Handle(Transfer_Binder) binder = TP->Find(ent);
|
||||
if (binder.IsNull()) continue;
|
||||
TopoDS_Shape S = TransferBRep::ShapeResult(binder);
|
||||
if (S.IsNull()) continue;
|
||||
|
||||
// create label and set shape
|
||||
TDF_Label L;
|
||||
TDF_TagSource aTag;
|
||||
L = aTag.NewChild(theShapeLabel);
|
||||
TNaming_Builder tnBuild (L);
|
||||
tnBuild.Generated(S);
|
||||
|
||||
// set a name
|
||||
TCollection_AsciiString string = ent->NameValue()->String();
|
||||
string.LeftAdjust();
|
||||
string.RightAdjust();
|
||||
TCollection_ExtendedString str (string);
|
||||
TDataStd_Name::Set(L, str);
|
||||
}
|
||||
}
|
||||
// END: Store names
|
||||
} else {
|
||||
// switch (status) {
|
||||
// case IFSelect_RetVoid:
|
||||
|
@ -16,13 +16,12 @@
|
||||
#
|
||||
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
#
|
||||
|
||||
# File : Makefile.in
|
||||
# Author : Pavel TELKOV
|
||||
# Modified by : Alexander BORODIN (OCN) - autotools usage
|
||||
# Module : GEOM
|
||||
# $Header$
|
||||
#
|
||||
|
||||
include $(top_srcdir)/adm_local/unix/make_common_starter.am
|
||||
|
||||
# Libraries targets
|
||||
@ -39,5 +38,5 @@ libIGESImport_la_CPPFLAGS = \
|
||||
|
||||
libIGESImport_la_LDFLAGS = \
|
||||
$(STDLIB) \
|
||||
$(CAS_LDPATH) -lTKIGES \
|
||||
$(CAS_LDPATH) -lTKIGES -lTKCAF -lTKLCAF \
|
||||
$(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics
|
||||
|
@ -24,7 +24,7 @@
|
||||
SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM \
|
||||
BREPExport BREPImport IGESExport IGESImport STEPExport \
|
||||
STEPImport STLExport VTKExport ShHealOper GEOMImpl GEOM_I \
|
||||
GEOMClient GEOM_I_Superv GEOM_SWIG
|
||||
GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY
|
||||
|
||||
if GEOM_ENABLE_GUI
|
||||
SUBDIRS += OBJECT DlgRef GEOMFiltersSelection GEOMGUI GEOMBase GEOMToolsGUI \
|
||||
@ -40,4 +40,4 @@ DIST_SUBDIRS = ARCHIMEDE NMTDS NMTTools GEOMAlgo SKETCHER OCC2VTK GEOM BREPExpor
|
||||
GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI \
|
||||
EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI \
|
||||
RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI \
|
||||
GEOM_SWIG_WITHIHM
|
||||
GEOM_SWIG_WITHIHM GEOM_PY
|
||||
|
@ -118,5 +118,5 @@ libMeasureGUI_la_CPPFLAGS = \
|
||||
|
||||
libMeasureGUI_la_LDFLAGS = \
|
||||
$(CAS_LDFLAGS) -lTKGeomBase \
|
||||
../GEOMBase/libGEOMBase.la
|
||||
../GEOMBase/libGEOMBase.la ../DlgRef/libDlgRef.la
|
||||
|
||||
|
@ -196,7 +196,9 @@ void MeasureGUI_AngleDlg::processObject()
|
||||
|
||||
double anAngle = 0.;
|
||||
if (getParameters(anAngle)) {
|
||||
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle));
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "angle_precision", 6 );
|
||||
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(anAngle, aPrecision));
|
||||
redisplayPreview();
|
||||
}
|
||||
else {
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "GeometryGUI.h"
|
||||
|
||||
#include <GEOMBase.h>
|
||||
#include <DlgRef.h>
|
||||
|
||||
#include <GEOM_Function.hxx>
|
||||
#include <GEOM_Object.hxx>
|
||||
@ -143,14 +144,17 @@ void MeasureGUI_BndBoxDlg::processObject()
|
||||
myGrp->LineEdit32->setText( "" );
|
||||
}
|
||||
else {
|
||||
myGrp->LineEdit11->setText( tr( "%1" ).arg( aXMin, 12, 'f', 6 ) );
|
||||
myGrp->LineEdit12->setText( tr( "%1" ).arg( aXMax, 12, 'f', 6 ) );
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
|
||||
myGrp->LineEdit21->setText( tr( "%1" ).arg( aYMin, 12, 'f', 6 ) );
|
||||
myGrp->LineEdit22->setText( tr( "%1" ).arg( aYMax, 12, 'f', 6 ) );
|
||||
myGrp->LineEdit11->setText( DlgRef::PrintDoubleValue( aXMin, aPrecision ) );
|
||||
myGrp->LineEdit12->setText( DlgRef::PrintDoubleValue( aXMax, aPrecision ) );
|
||||
|
||||
myGrp->LineEdit31->setText( tr( "%1" ).arg( aZMin, 12, 'f', 6 ) );
|
||||
myGrp->LineEdit32->setText( tr( "%1" ).arg( aZMax, 12, 'f', 6 ) );
|
||||
myGrp->LineEdit21->setText( DlgRef::PrintDoubleValue( aYMin, aPrecision ) );
|
||||
myGrp->LineEdit22->setText( DlgRef::PrintDoubleValue( aYMax, aPrecision ) );
|
||||
|
||||
myGrp->LineEdit31->setText( DlgRef::PrintDoubleValue( aZMin, aPrecision ) );
|
||||
myGrp->LineEdit32->setText( DlgRef::PrintDoubleValue( aZMax, aPrecision ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,9 +244,12 @@ void MeasureGUI_CenterMassDlg::processObject()
|
||||
getParameters( x, y, z );
|
||||
|
||||
myGrp->LineEdit1->setText( GEOMBase::GetName( myObj ) );
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( x ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( y ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( z ) );
|
||||
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( x, aPrecision ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( y, aPrecision ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( z, aPrecision ) );
|
||||
|
||||
displayPreview();
|
||||
}
|
||||
|
@ -180,12 +180,15 @@ void MeasureGUI_DistanceDlg::processObject()
|
||||
gp_Pnt aPnt1, aPnt2;
|
||||
double aDist = 0.;
|
||||
if (getParameters(aDist, aPnt1, aPnt2)) {
|
||||
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist));
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
|
||||
myGrp->LineEdit3->setText(DlgRef::PrintDoubleValue(aDist, aPrecision));
|
||||
|
||||
gp_XYZ aVec = aPnt2.XYZ() - aPnt1.XYZ();
|
||||
myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X()));
|
||||
myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y()));
|
||||
myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z()));
|
||||
myGrp->LineEdit4->setText(DlgRef::PrintDoubleValue(aVec.X(), aPrecision));
|
||||
myGrp->LineEdit5->setText(DlgRef::PrintDoubleValue(aVec.Y(), aPrecision));
|
||||
myGrp->LineEdit6->setText(DlgRef::PrintDoubleValue(aVec.Z(), aPrecision));
|
||||
|
||||
redisplayPreview();
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "MeasureGUI_Widgets.h"
|
||||
|
||||
#include <GEOMBase.h>
|
||||
#include <DlgRef.h>
|
||||
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
@ -142,21 +143,21 @@ void MeasureGUI_InertiaDlg::processObject()
|
||||
myGrp->LineEdit43->setText( "" );
|
||||
}
|
||||
else {
|
||||
myGrp->LineEdit11->setText( QString( "%1" ).arg( aMat( 1, 1 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit12->setText( QString( "%1" ).arg( aMat( 1, 2 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit13->setText( QString( "%1" ).arg( aMat( 1, 3 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit11->setText( DlgRef::PrintDoubleValue( aMat( 1, 1 ), -6 ) );
|
||||
myGrp->LineEdit12->setText( DlgRef::PrintDoubleValue( aMat( 1, 2 ), -6 ) );
|
||||
myGrp->LineEdit13->setText( DlgRef::PrintDoubleValue( aMat( 1, 3 ), -6 ) );
|
||||
|
||||
myGrp->LineEdit21->setText( QString( "%1" ).arg( aMat( 2, 1 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit22->setText( QString( "%1" ).arg( aMat( 2, 2 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit23->setText( QString( "%1" ).arg( aMat( 2, 3 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit21->setText( DlgRef::PrintDoubleValue( aMat( 2, 1 ), -6 ) );
|
||||
myGrp->LineEdit22->setText( DlgRef::PrintDoubleValue( aMat( 2, 2 ), -6 ) );
|
||||
myGrp->LineEdit23->setText( DlgRef::PrintDoubleValue( aMat( 2, 3 ), -6 ) );
|
||||
|
||||
myGrp->LineEdit31->setText( QString( "%1" ).arg( aMat( 3, 1 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit32->setText( QString( "%1" ).arg( aMat( 3, 2 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit33->setText( QString( "%1" ).arg( aMat( 3, 3 ), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit31->setText( DlgRef::PrintDoubleValue( aMat( 3, 1 ), -6 ) );
|
||||
myGrp->LineEdit32->setText( DlgRef::PrintDoubleValue( aMat( 3, 2 ), -6 ) );
|
||||
myGrp->LineEdit33->setText( DlgRef::PrintDoubleValue( aMat( 3, 3 ), -6 ) );
|
||||
|
||||
myGrp->LineEdit41->setText( QString( "%1" ).arg( anIXYZ.X(), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit42->setText( QString( "%1" ).arg( anIXYZ.Y(), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit43->setText( QString( "%1" ).arg( anIXYZ.Z(), 12, 'e', 4 ) );
|
||||
myGrp->LineEdit41->setText( DlgRef::PrintDoubleValue( anIXYZ.X(), -6 ) );
|
||||
myGrp->LineEdit42->setText( DlgRef::PrintDoubleValue( anIXYZ.Y(), -6 ) );
|
||||
myGrp->LineEdit43->setText( DlgRef::PrintDoubleValue( anIXYZ.Z(), -6 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
//
|
||||
#include "MeasureGUI_MaxToleranceDlg.h"
|
||||
#include "MeasureGUI_Widgets.h"
|
||||
#include "DlgRef.h"
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
@ -131,14 +132,17 @@ void MeasureGUI_MaxToleranceDlg::processObject()
|
||||
double invalidMin = RealLast();
|
||||
double invalidMax = -RealLast();
|
||||
|
||||
myGrp->LineEdit11->setText( aMinFaceToler != invalidMin ? QString( "%1" ).arg( aMinFaceToler, 5, 'e', 8 ) : QString("") );
|
||||
myGrp->LineEdit12->setText( aMaxFaceToler != invalidMax ? QString( "%1" ).arg( aMaxFaceToler, 5, 'e', 8 ) : QString("") );
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "len_tol_precision", -9);
|
||||
|
||||
myGrp->LineEdit21->setText( aMinEdgeToler != invalidMin ? QString( "%1" ).arg( aMinEdgeToler, 5, 'e', 8 ) : QString("") );
|
||||
myGrp->LineEdit22->setText( aMaxEdgeToler != invalidMax ? QString( "%1" ).arg( aMaxEdgeToler, 5, 'e', 8 ) : QString("") );
|
||||
myGrp->LineEdit11->setText( aMinFaceToler != invalidMin ? DlgRef::PrintDoubleValue( aMinFaceToler, aPrecision ) : QString("") );
|
||||
myGrp->LineEdit12->setText( aMaxFaceToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxFaceToler, aPrecision ) : QString("") );
|
||||
|
||||
myGrp->LineEdit31->setText( aMinVertexToler != invalidMin ? QString( "%1" ).arg( aMinVertexToler, 5, 'e', 8 ) : QString("") );
|
||||
myGrp->LineEdit32->setText( aMaxVertexToler != invalidMax ? QString( "%1" ).arg( aMaxVertexToler, 5, 'e', 8 ) : QString("") );
|
||||
myGrp->LineEdit21->setText( aMinEdgeToler != invalidMin ? DlgRef::PrintDoubleValue( aMinEdgeToler, aPrecision ) : QString("") );
|
||||
myGrp->LineEdit22->setText( aMaxEdgeToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxEdgeToler, aPrecision ) : QString("") );
|
||||
|
||||
myGrp->LineEdit31->setText( aMinVertexToler != invalidMin ? DlgRef::PrintDoubleValue( aMinVertexToler, aPrecision ) : QString("") );
|
||||
myGrp->LineEdit32->setText( aMaxVertexToler != invalidMax ? DlgRef::PrintDoubleValue( aMaxVertexToler, aPrecision ) : QString("") );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -172,9 +172,11 @@ void MeasureGUI_PointDlg::SelectionIntoArgument()
|
||||
if ( !aPoint.IsNull() ) {
|
||||
gp_Pnt aPnt = BRep_Tool::Pnt( aPoint );
|
||||
myGrp->LineEdit1->setText( aName );
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aPnt.X() ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( aPnt.Y() ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aPnt.Z() ) );
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
|
@ -139,9 +139,11 @@ void MeasureGUI_PropertiesDlg::processObject()
|
||||
myGrp->LineEdit4->setText( "" );
|
||||
}
|
||||
else {
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aLength ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( anArea ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aVolume ) );
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
myGrp->LineEdit2->setText( DlgRef::PrintDoubleValue( aLength, aPrecision ) );
|
||||
myGrp->LineEdit3->setText( DlgRef::PrintDoubleValue( anArea, aPrecision ) );
|
||||
myGrp->LineEdit4->setText( DlgRef::PrintDoubleValue( aVolume, aPrecision ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,9 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
QString aKindStr("");
|
||||
theParameters = "";
|
||||
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
int aLenPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
|
||||
|
||||
if ( myObj->_is_nil() )
|
||||
return aKindStr;
|
||||
|
||||
@ -253,7 +256,7 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
if ( !anOper->IsDone() )
|
||||
return aKindStr;
|
||||
|
||||
#define PRINT_DOUBLE(val) QString(" %1").arg( DlgRef::PrintDoubleValue( val ) )
|
||||
#define PRINT_DOUBLE(val, tol) DlgRef::PrintDoubleValue( val, tol )
|
||||
switch ( aKind )
|
||||
{
|
||||
case GEOM::GEOM_IKindOfShape::COMPOUND:
|
||||
@ -284,84 +287,84 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
case GEOM::GEOM_IKindOfShape::SPHERE:
|
||||
aKindStr = tr( "GEOM_SPHERE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::CYLINDER:
|
||||
aKindStr = tr( "GEOM_CYLINDER" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::BOX:
|
||||
aKindStr = tr( "GEOM_BOX" );
|
||||
theParameters = tr( "GEOM_CENTER") +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + "Ax :" + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + "Ay :" + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + "Az :" + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::ROTATED_BOX:
|
||||
aKindStr = tr( "GEOM_BOX" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\nZ Axis:" +
|
||||
"\n" + "Zx :" + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + "Zy :" + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + "Zz :" + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + "Zx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + "Zy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + "Zz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\nX Axis:" +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
|
||||
"\nDimensions along local axes:" +
|
||||
"\n" + "Ax :" + PRINT_DOUBLE( aDbls[9] ) +
|
||||
"\n" + "Ay :" + PRINT_DOUBLE( aDbls[10] ) +
|
||||
"\n" + "Az :" + PRINT_DOUBLE( aDbls[11] );
|
||||
"\n" + "Ax :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
|
||||
"\n" + "Ay :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
|
||||
"\n" + "Az :" + PRINT_DOUBLE( aDbls[11], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::TORUS:
|
||||
aKindStr = tr( "GEOM_TORUS" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::CONE:
|
||||
aKindStr = tr( "GEOM_CONE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8] );
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::POLYHEDRON:
|
||||
aKindStr = tr( "GEOM_POLYHEDRON" );
|
||||
@ -373,114 +376,114 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
case GEOM::GEOM_IKindOfShape::SPHERE2D:
|
||||
aKindStr = tr( "GEOM_SURFSPHERE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::CYLINDER2D:
|
||||
aKindStr = tr( "GEOM_SURFCYLINDER" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::TORUS2D:
|
||||
aKindStr = tr( "GEOM_SURFTORUS" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::CONE2D:
|
||||
aKindStr = tr( "GEOM_SURFCONE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_AXIS" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7] ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8] );
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::DISK_CIRCLE:
|
||||
aKindStr = tr( "GEOM_DISK_CIRCLE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE:
|
||||
aKindStr = tr( "GEOM_DISK_ELLIPSE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::POLYGON:
|
||||
aKindStr = tr( "GEOM_POLYGON" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::PLANE:
|
||||
aKindStr = tr( "GEOM_PLANE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::PLANAR:
|
||||
aKindStr = tr( "GEOM_PLANAR_FACE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::FACE:
|
||||
aKindStr = tr( "GEOM_FACE" );
|
||||
@ -489,94 +492,94 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
case GEOM::GEOM_IKindOfShape::CIRCLE:
|
||||
aKindStr = tr( "GEOM_CIRCLE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] );
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::ARC_CIRCLE:
|
||||
aKindStr = tr( "GEOM_ARC" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_POINT_I" ).arg( 1 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12] );
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::ELLIPSE:
|
||||
aKindStr = tr( "GEOM_ELLIPSE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] );
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE:
|
||||
aKindStr = tr( "GEOM_ARC_ELLIPSE" );
|
||||
theParameters = tr( "GEOM_CENTER" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_NORMAL" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIMENSIONS" ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7] ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_POINT_I" ).arg( 1 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13] );
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::LINE:
|
||||
aKindStr = tr( "GEOM_LINE" );
|
||||
theParameters = tr( "GEOM_POSITION" ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DIRECTION" ) +
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::SEGMENT:
|
||||
aKindStr = tr( "GEOM_SEGMENT" );
|
||||
theParameters = tr( "GEOM_POINT_I" ).arg( 1 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2] ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_POINT_I" ).arg( 2 ) +
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3] ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4] ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5] );
|
||||
"\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::EDGE:
|
||||
aKindStr = tr( "GEOM_EDGE" );
|
||||
@ -584,9 +587,9 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters )
|
||||
case GEOM::GEOM_IKindOfShape::VERTEX:
|
||||
aKindStr = tr( "GEOM_VERTEX" );
|
||||
theParameters = tr( "GEOM_COORDINATES" ) +
|
||||
"\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0] ) +
|
||||
"\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1] ) +
|
||||
"\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2] );
|
||||
"\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
|
||||
"\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision );
|
||||
break;
|
||||
case GEOM::GEOM_IKindOfShape::ADVANCED:
|
||||
{
|
||||
|
@ -38,6 +38,7 @@ salomeinclude_HEADERS = \
|
||||
RepairGUI_FreeFacesDlg.h \
|
||||
RepairGUI_ChangeOrientationDlg.h \
|
||||
RepairGUI_GlueDlg.h \
|
||||
RepairGUI_LimitToleranceDlg.h \
|
||||
RepairGUI_RemoveExtraEdgesDlg.h
|
||||
|
||||
# Libraries targets
|
||||
@ -56,6 +57,7 @@ dist_libRepairGUI_la_SOURCES = \
|
||||
RepairGUI_FreeFacesDlg.h \
|
||||
RepairGUI_ChangeOrientationDlg.h \
|
||||
RepairGUI_GlueDlg.h \
|
||||
RepairGUI_LimitToleranceDlg.h \
|
||||
RepairGUI_RemoveExtraEdgesDlg.h \
|
||||
\
|
||||
RepairGUI.cxx \
|
||||
@ -70,6 +72,7 @@ dist_libRepairGUI_la_SOURCES = \
|
||||
RepairGUI_FreeFacesDlg.cxx \
|
||||
RepairGUI_ChangeOrientationDlg.cxx \
|
||||
RepairGUI_GlueDlg.cxx \
|
||||
RepairGUI_LimitToleranceDlg.cxx \
|
||||
RepairGUI_RemoveExtraEdgesDlg.cxx
|
||||
|
||||
MOC_FILES = \
|
||||
@ -84,6 +87,7 @@ MOC_FILES = \
|
||||
RepairGUI_FreeFacesDlg_moc.cxx \
|
||||
RepairGUI_ChangeOrientationDlg_moc.cxx \
|
||||
RepairGUI_GlueDlg_moc.cxx \
|
||||
RepairGUI_LimitToleranceDlg_moc.cxx \
|
||||
RepairGUI_RemoveExtraEdgesDlg_moc.cxx
|
||||
|
||||
nodist_libRepairGUI_la_SOURCES = \
|
||||
|
@ -19,11 +19,10 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : RepairGUI.cxx
|
||||
// Author : Damien COQUERET, Open CASCADE S.A.S.
|
||||
//
|
||||
|
||||
#include "RepairGUI.h"
|
||||
|
||||
#include <GeometryGUI.h>
|
||||
@ -43,6 +42,7 @@
|
||||
#include "RepairGUI_FreeBoundDlg.h" // Method FREE BOUNDARIES
|
||||
#include "RepairGUI_FreeFacesDlg.h" // Method FREE FACES
|
||||
#include "RepairGUI_GlueDlg.h" // Method GLUE FACES
|
||||
#include "RepairGUI_LimitToleranceDlg.h" // Method LIMIT TOLERANCE
|
||||
#include "RepairGUI_ChangeOrientationDlg.h" // Method CHANGE ORIENTATION
|
||||
#include "RepairGUI_RemoveExtraEdgesDlg.h" // Method REMOVE EXTRA EDGES
|
||||
|
||||
@ -77,18 +77,19 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
|
||||
QDialog* aDlg = NULL;
|
||||
switch ( theCommandID ) {
|
||||
case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpShapeProcess: aDlg = new RepairGUI_ShapeProcessDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpCloseContour: aDlg = new RepairGUI_CloseContourDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpRemoveIntWires: aDlg = new RepairGUI_RemoveIntWiresDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpAddPointOnEdge: aDlg = new RepairGUI_DivideEdgeDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg ( getGeometryGUI(), parent ); break;
|
||||
case GEOMOp::OpSewing: aDlg = new RepairGUI_SewingDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpGlueFaces: aDlg = new RepairGUI_GlueDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpLimitTolerance: aDlg = new RepairGUI_LimitToleranceDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpSuppressFaces: aDlg = new RepairGUI_SuppressFacesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpSuppressHoles: aDlg = new RepairGUI_RemoveHolesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpShapeProcess: aDlg = new RepairGUI_ShapeProcessDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpCloseContour: aDlg = new RepairGUI_CloseContourDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpRemoveIntWires: aDlg = new RepairGUI_RemoveIntWiresDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpAddPointOnEdge: aDlg = new RepairGUI_DivideEdgeDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpFreeBoundaries: aDlg = new RepairGUI_FreeBoundDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpFreeFaces: aDlg = new RepairGUI_FreeFacesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpOrientation: aDlg = new RepairGUI_ChangeOrientationDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
|
||||
default:
|
||||
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
|
||||
break;
|
||||
|
441
src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx
Normal file
441
src/RepairGUI/RepairGUI_LimitToleranceDlg.cxx
Normal file
@ -0,0 +1,441 @@
|
||||
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// GEOM RepairGUI : GUI for Geometry component
|
||||
// File : RepairGUI_LimitToleranceDlg.cxx
|
||||
|
||||
#include "RepairGUI_LimitToleranceDlg.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
#include <SalomeApp_Tools.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_MessageBox.h>
|
||||
#include <SUIT_OverrideCursor.h>
|
||||
#include <SUIT_ResourceMgr.h>
|
||||
#include <SUIT_ViewWindow.h>
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <OCCViewer_ViewModel.h>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
|
||||
#define DEFAULT_TOLERANCE_VALUE 1e-07
|
||||
|
||||
//=================================================================================
|
||||
// class : RepairGUI_LimitToleranceDlg()
|
||||
// purpose : Constructs a RepairGUI_LimitToleranceDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
RepairGUI_LimitToleranceDlg::RepairGUI_LimitToleranceDlg(GeometryGUI* theGeometryGUI,
|
||||
QWidget* parent, bool modal)
|
||||
: GEOMBase_Skeleton(theGeometryGUI, parent, modal)
|
||||
{
|
||||
QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_LIMIT_TOLERANCE")));
|
||||
QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
|
||||
|
||||
setWindowTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
mainFrame()->GroupConstructors->setTitle(tr("GEOM_LIMIT_TOLERANCE_TITLE"));
|
||||
mainFrame()->RadioButton1->setIcon(image0);
|
||||
mainFrame()->RadioButton2->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
GroupPoints = new DlgRef_1SelExt(centralWidget());
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_SELECTED_SHAPE"));
|
||||
GroupPoints->PushButton1->setIcon(image1);
|
||||
GroupPoints->LineEdit1->setReadOnly(true);
|
||||
|
||||
QLabel* aTolLab = new QLabel(tr("GEOM_TOLERANCE"), GroupPoints->Box);
|
||||
myTolEdt = new SalomeApp_DoubleSpinBox(GroupPoints->Box);
|
||||
initSpinBox(myTolEdt, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
|
||||
myTolEdt->setValue(DEFAULT_TOLERANCE_VALUE);
|
||||
|
||||
QGridLayout* boxLayout = new QGridLayout(GroupPoints->Box);
|
||||
boxLayout->setMargin(0); boxLayout->setSpacing(6);
|
||||
boxLayout->addWidget(aTolLab, 0, 0);
|
||||
boxLayout->addWidget(myTolEdt, 0, 2);
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
|
||||
setHelpFileName("limit_tolerance_operation_page.html");
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~RepairGUI_LimitToleranceDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
RepairGUI_LimitToleranceDlg::~RepairGUI_LimitToleranceDlg()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
myObject = GEOM::GEOM_Object::_nil();
|
||||
|
||||
//myGeomGUI->SetState(0);
|
||||
//globalSelection(GEOM_COMPOUND);
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
initName(tr("LIMIT_TOLERANCE_NEW_OBJ_NAME"));
|
||||
|
||||
ConstructorsClicked(0);
|
||||
|
||||
activateSelection();
|
||||
updateButtonState();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
|
||||
|
||||
GroupPoints->show();
|
||||
GroupPoints->LineEdit1->setText("");
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myEditCurrentArgument->setFocus();
|
||||
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
qApp->processEvents();
|
||||
updateGeometry();
|
||||
resize(minimumSizeHint());
|
||||
|
||||
updateButtonState();
|
||||
activateSelection();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose : Same than click on apply but close this dialog.
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::ClickOnOk()
|
||||
{
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool RepairGUI_LimitToleranceDlg::ClickOnApply()
|
||||
{
|
||||
if (!onAcceptLocal())
|
||||
return false;
|
||||
|
||||
initName();
|
||||
|
||||
ConstructorsClicked(0);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("");
|
||||
myObject = GEOM::GEOM_Object::_nil();
|
||||
|
||||
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
|
||||
SALOME_ListIO aSelList;
|
||||
aSelMgr->selectedObjects(aSelList);
|
||||
|
||||
if (aSelList.Extent() == 1) {
|
||||
Handle(SALOME_InteractiveObject) anIO = aSelList.First();
|
||||
Standard_Boolean aRes;
|
||||
myObject = GEOMBase::ConvertIOinGEOMObject(anIO, aRes);
|
||||
if (aRes)
|
||||
myEditCurrentArgument->setText(GEOMBase::GetName(myObject));
|
||||
}
|
||||
updateButtonState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::SetEditCurrentArgument()
|
||||
{
|
||||
const QObject* send = sender();
|
||||
if (send == GroupPoints->PushButton1) {
|
||||
myEditCurrentArgument->setFocus();
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::LineEditReturnPressed()
|
||||
{
|
||||
const QObject* send = sender();
|
||||
if (send == GroupPoints->LineEdit1) {
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::ActivateThisDialog()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
activateSelection();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose : Mouse enter onto the dialog to activate it
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::enterEvent(QEvent*)
|
||||
{
|
||||
if (!mainFrame()->GroupConstructors->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : createOperation
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOM::GEOM_IOperations_ptr RepairGUI_LimitToleranceDlg::createOperation()
|
||||
{
|
||||
return getGeomEngine()->GetIHealingOperations(getStudyId());
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : isValid
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool RepairGUI_LimitToleranceDlg::isValid(QString& msg)
|
||||
{
|
||||
double v = myTolEdt->value();
|
||||
bool ok = myTolEdt->isValid(msg, true);
|
||||
return !myObject->_is_nil() && (v > 0.) && ok;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : execute
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool RepairGUI_LimitToleranceDlg::execute(ObjectList& objects)
|
||||
{
|
||||
bool aResult = false;
|
||||
objects.clear();
|
||||
|
||||
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
|
||||
GEOM::GEOM_Object_var anObj = anOper->LimitTolerance(myObject, myTolEdt->value());
|
||||
aResult = !anObj->_is_nil();
|
||||
if (aResult) {
|
||||
QStringList aParameters;
|
||||
aParameters << myTolEdt->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
objects.push_back(anObj._retn());
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//================================================================
|
||||
// Function : onAccept
|
||||
// Purpose : This method should be called from dialog's slots onOk() and onApply()
|
||||
// It perfroms user input validation, then it
|
||||
// performs a proper operation and manages transactions, etc.
|
||||
//================================================================
|
||||
bool RepairGUI_LimitToleranceDlg::onAcceptLocal()
|
||||
{
|
||||
if (!getStudy() || !(getStudy()->studyDS()))
|
||||
return false;
|
||||
|
||||
_PTR(Study) aStudy = getStudy()->studyDS();
|
||||
|
||||
bool aLocked = aStudy->GetProperties()->IsLocked();
|
||||
if (aLocked) {
|
||||
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
|
||||
SUIT_MessageBox::warning(this, tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"), tr("BUT_OK"));
|
||||
return false;
|
||||
}
|
||||
|
||||
QString msg;
|
||||
if (!isValid(msg)) {
|
||||
showError(msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (openCommand()) {
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
myGeomGUI->getApp()->putInfo("");
|
||||
ObjectList objects;
|
||||
|
||||
if (!execute(objects)) {
|
||||
wc.suspend();
|
||||
abortCommand();
|
||||
showError();
|
||||
}
|
||||
else {
|
||||
const int nbObjs = objects.size();
|
||||
for (ObjectList::iterator it = objects.begin(); it != objects.end(); ++it) {
|
||||
QString aName = getNewObjectName();
|
||||
if (nbObjs > 1) {
|
||||
if (aName.isEmpty())
|
||||
aName = getPrefix(*it);
|
||||
aName = GEOMBase::GetDefaultName(aName);
|
||||
}
|
||||
else {
|
||||
// PAL6521: use a prefix, if some dialog box doesn't reimplement getNewObjectName()
|
||||
if (aName.isEmpty())
|
||||
aName = GEOMBase::GetDefaultName(getPrefix(*it));
|
||||
}
|
||||
addInStudy(*it, aName.toLatin1().data());
|
||||
display(*it, false);
|
||||
}
|
||||
|
||||
if (nbObjs) {
|
||||
commitCommand();
|
||||
updateObjBrowser();
|
||||
myGeomGUI->getApp()->putInfo(QObject::tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
else {
|
||||
abortCommand();
|
||||
}
|
||||
|
||||
// JFA 28.12.2004 BEGIN // To enable warnings
|
||||
GEOM::GEOM_IHealingOperations_var anOper = GEOM::GEOM_IHealingOperations::_narrow(getOperation());
|
||||
if (!CORBA::is_nil(anOper) && !anOper->IsDone()) {
|
||||
wc.suspend();
|
||||
QString msgw = QObject::tr(anOper->GetErrorCode());
|
||||
SUIT_MessageBox::warning(this, tr("WRN_WARNING"), msgw, tr("BUT_OK"));
|
||||
}
|
||||
// JFA 28.12.2004 END
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& e) {
|
||||
SalomeApp_Tools::QtCatchCorbaException(e);
|
||||
abortCommand();
|
||||
}
|
||||
|
||||
updateViewer();
|
||||
activateSelection();
|
||||
updateButtonState();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : activateSelection
|
||||
// purpose : Activate selection
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::activateSelection()
|
||||
{
|
||||
disconnect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
globalSelection(GEOM_ALLSHAPES);
|
||||
if (myObject->_is_nil())
|
||||
SelectionIntoArgument();
|
||||
|
||||
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
|
||||
this, SLOT(SelectionIntoArgument()));
|
||||
updateViewer();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : updateButtonState
|
||||
// purpose : Update button state
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::updateButtonState()
|
||||
{
|
||||
bool hasMainObj = !myObject->_is_nil();
|
||||
buttonOk()->setEnabled(hasMainObj);
|
||||
buttonApply()->setEnabled(hasMainObj);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : restoreSubShapes
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void RepairGUI_LimitToleranceDlg::restoreSubShapes(SALOMEDS::Study_ptr theStudy,
|
||||
SALOMEDS::SObject_ptr theSObject)
|
||||
{
|
||||
if (mainFrame()->CheckBoxRestoreSS->isChecked()) {
|
||||
// empty list of arguments means that all arguments should be restored
|
||||
getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, GEOM::ListOfGO(),
|
||||
GEOM::FSM_GetInPlace, /*theInheritFirstArg=*/true,
|
||||
mainFrame()->CheckBoxAddPrefix->isChecked());
|
||||
}
|
||||
}
|
83
src/RepairGUI/RepairGUI_LimitToleranceDlg.h
Normal file
83
src/RepairGUI/RepairGUI_LimitToleranceDlg.h
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : RepairGUI_LimitToleranceDlg.h
|
||||
|
||||
#ifndef REPAIRGUI_LIMITTOLERANCEDLG_H
|
||||
#define REPAIRGUI_LIMITTOLERANCEDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
|
||||
class DlgRef_1SelExt;
|
||||
class SalomeApp_DoubleSpinBox;
|
||||
class QPushButton;
|
||||
class QCheckBox;
|
||||
|
||||
//=================================================================================
|
||||
// class : RepairGUI_LimitToleranceDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class RepairGUI_LimitToleranceDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RepairGUI_LimitToleranceDlg (GeometryGUI*, QWidget* = 0, bool = false);
|
||||
~RepairGUI_LimitToleranceDlg();
|
||||
|
||||
protected:
|
||||
// redefined from GEOMBase_Helper
|
||||
virtual GEOM::GEOM_IOperations_ptr createOperation();
|
||||
virtual bool isValid (QString&);
|
||||
virtual bool execute (ObjectList&);
|
||||
virtual void restoreSubShapes (SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr);
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent (QEvent*);
|
||||
void initSelection();
|
||||
|
||||
bool onAcceptLocal();
|
||||
|
||||
void activateSelection();
|
||||
void updateButtonState();
|
||||
|
||||
private:
|
||||
GEOM::GEOM_Object_var myObject;
|
||||
|
||||
DlgRef_1SelExt* GroupPoints;
|
||||
SalomeApp_DoubleSpinBox* myTolEdt;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
|
||||
void ActivateThisDialog();
|
||||
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
|
||||
void ConstructorsClicked( int );
|
||||
};
|
||||
|
||||
#endif // REPAIRGUI_LIMITTOLERANCEDLG_H
|
@ -252,6 +252,7 @@ void RepairGUI_RemoveExtraEdgesDlg::enterEvent(QEvent* e)
|
||||
void RepairGUI_RemoveExtraEdgesDlg::activateSelection()
|
||||
{
|
||||
TColStd_MapOfInteger aTypes;
|
||||
aTypes.Add( GEOM_SHELL );
|
||||
aTypes.Add( GEOM_SOLID );
|
||||
aTypes.Add( GEOM_COMPOUND );
|
||||
globalSelection( aTypes );
|
||||
|
@ -43,4 +43,4 @@ libSTEPImport_la_CPPFLAGS = \
|
||||
libSTEPImport_la_LDFLAGS = \
|
||||
$(KERNEL_LDFLAGS) -lSALOMELocalTrace -lSALOMEBasics \
|
||||
$(STDLIB) \
|
||||
$(CAS_LDPATH) -lTKSTEP
|
||||
$(CAS_LDPATH) -lTKSTEP -lTKCAF -lTKLCAF -lTKSTEPBase
|
||||
|
@ -19,12 +19,10 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// File: STEPImport.cxx
|
||||
// Created: Wed May 19 14:41:10 2004
|
||||
// Author: Pavel TELKOV
|
||||
// <ptv@mutex.nnov.opencascade.com>
|
||||
//
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <Basics_Utils.hxx>
|
||||
@ -34,13 +32,31 @@
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
|
||||
#include <STEPControl_Reader.hxx>
|
||||
#include <StepBasic_ProductDefinition.hxx>
|
||||
#include <StepBasic_ProductDefinitionFormation.hxx>
|
||||
#include <StepBasic_Product.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
#include <XSControl_TransferReader.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
|
||||
#include <Transfer_Binder.hxx>
|
||||
#include <TNaming_Builder.hxx>
|
||||
#include <TDataStd_Name.hxx>
|
||||
#include <Transfer_TransientProcess.hxx>
|
||||
#include <TransferBRep.hxx>
|
||||
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TDF_Label.hxx>
|
||||
#include <TDF_Tool.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
|
||||
|
||||
@ -70,11 +86,11 @@
|
||||
|
||||
extern "C"
|
||||
{
|
||||
STEPIMPORT_EXPORT
|
||||
STEPIMPORT_EXPORT
|
||||
TopoDS_Shape Import (const TCollection_AsciiString& theFileName,
|
||||
const TCollection_AsciiString& /*theFormatName*/,
|
||||
TCollection_AsciiString& theError,
|
||||
const TDF_Label&)
|
||||
const TDF_Label& theShapeLabel)
|
||||
{
|
||||
MESSAGE("Import STEP model from file " << theFileName.ToCString());
|
||||
// Set "C" numeric locale to save numbers correctly
|
||||
@ -87,7 +103,7 @@ STEPIMPORT_EXPORT
|
||||
//VRV: OCC 4.0 migration
|
||||
TopoDS_Compound compound;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound( compound );
|
||||
B.MakeCompound(compound);
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
OCC_CATCH_SIGNALS;
|
||||
@ -95,13 +111,13 @@ STEPIMPORT_EXPORT
|
||||
IFSelect_ReturnStatus status = aReader.ReadFile(theFileName.ToCString());
|
||||
|
||||
if (status == IFSelect_RetDone) {
|
||||
Standard_Boolean failsonly = Standard_False ;
|
||||
aReader.PrintCheckLoad (failsonly, IFSelect_ItemsByEntity);
|
||||
Standard_Boolean failsonly = Standard_False;
|
||||
aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity);
|
||||
/* Root transfers */
|
||||
Standard_Integer nbr = aReader.NbRootsForTransfer();
|
||||
aReader.PrintCheckTransfer (failsonly, IFSelect_ItemsByEntity);
|
||||
aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity);
|
||||
|
||||
for ( Standard_Integer n=1; n <= nbr; n++) {
|
||||
for (Standard_Integer n = 1; n <= nbr; n++) {
|
||||
Standard_Boolean ok = aReader.TransferRoot(n);
|
||||
/* Collecting resulting entities */
|
||||
Standard_Integer nbs = aReader.NbShapes();
|
||||
@ -116,22 +132,76 @@ STEPIMPORT_EXPORT
|
||||
break;
|
||||
}
|
||||
|
||||
for ( Standard_Integer i=1; i<=nbs; i++ ) {
|
||||
for (Standard_Integer i = 1; i <= nbs; i++) {
|
||||
TopoDS_Shape aShape = aReader.Shape(i);
|
||||
if ( aShape.IsNull() ) {
|
||||
if (aShape.IsNull()) {
|
||||
// THROW_SALOME_CORBA_EXCEPTION("Null shape in GEOM_Gen_i::ImportStep", SALOME::BAD_PARAM) ;
|
||||
//return aResShape;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
B.Add( compound, aShape ) ;
|
||||
B.Add(compound, aShape);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( aResShape.IsNull() )
|
||||
if (aResShape.IsNull())
|
||||
aResShape = compound;
|
||||
|
||||
} else {
|
||||
// BEGIN: Store names of sub-shapes from file
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
TopExp::MapShapes(aResShape, anIndices);
|
||||
|
||||
Handle(Interface_InterfaceModel) Model = aReader.WS()->Model();
|
||||
Handle(XSControl_TransferReader) TR = aReader.WS()->TransferReader();
|
||||
if (!TR.IsNull()) {
|
||||
Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
|
||||
Handle(Standard_Type) tPD = STANDARD_TYPE(StepBasic_ProductDefinition);
|
||||
|
||||
Standard_Integer nb = Model->NbEntities();
|
||||
for (Standard_Integer ie = 1; ie <= nb; ie++) {
|
||||
Handle(Standard_Transient) enti = Model->Value(ie);
|
||||
if (enti->DynamicType() != tPD) continue;
|
||||
|
||||
Handle(StepBasic_ProductDefinition) PD =
|
||||
Handle(StepBasic_ProductDefinition)::DownCast(enti);
|
||||
if (PD.IsNull()) continue;
|
||||
|
||||
Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct();
|
||||
if (Prod->Name()->UsefullLength() <= 0) continue;
|
||||
|
||||
Handle(TCollection_HAsciiString) aName = Prod->Name();
|
||||
TCollection_ExtendedString aNameExt (aName->ToCString());
|
||||
|
||||
// find target shape
|
||||
Handle(Transfer_Binder) binder = TP->Find(enti);
|
||||
if (binder.IsNull()) continue;
|
||||
TopoDS_Shape S = TransferBRep::ShapeResult(binder);
|
||||
if (S.IsNull()) continue;
|
||||
|
||||
// as PRODUCT can be included in the main shape
|
||||
// several times, we look here for all iclusions.
|
||||
Standard_Integer isub, nbSubs = anIndices.Extent();
|
||||
for (isub = 1; isub <= nbSubs; isub++)
|
||||
{
|
||||
TopoDS_Shape aSub = anIndices.FindKey(isub);
|
||||
if (aSub.IsPartner(S)) {
|
||||
// create label and set shape
|
||||
TDF_Label L;
|
||||
TDF_TagSource aTag;
|
||||
L = aTag.NewChild(theShapeLabel);
|
||||
TNaming_Builder tnBuild (L);
|
||||
//tnBuild.Generated(S);
|
||||
tnBuild.Generated(aSub);
|
||||
|
||||
// set a name
|
||||
TDataStd_Name::Set(L, aNameExt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// END: Store names
|
||||
}
|
||||
else {
|
||||
// switch (status) {
|
||||
// case IFSelect_RetVoid:
|
||||
// theError = "Nothing created or No data to process";
|
||||
|
Loading…
Reference in New Issue
Block a user