--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+find_package(SWIG REQUIRED)
+include(${SWIG_USE_FILE})
+
+#TODO(spo): is -threads necessary?
+set(CMAKE_SWIG_FLAGS -threads -Wall)
+
+# Using doxy2swig:
+# Add to ModuleName.i before any %inlcude:
+# %include "doxyhelp.i"
+# Add to CMakeLists.txt before SWIG_ADD_MODULE(...):
+# SET(SWIG_MODULE_ModuleName_EXTRA_DEPS ${SWIG_MODULE_ModuleName_EXTRA_DEPS} doxyhelp.i)
+
+#TODO(spo): why not use FindDoxygen.cmake module?
+if(WIN32)
+ find_program(DOXYGEN_EXECUTABLE Doxygen)
+else()
+ find_program(DOXYGEN_EXECUTABLE doxygen)
+endif()
+
+set(EXCLUDE_DOC_DIR "*/Test/* */Mock/*")
+
+configure_file(${PROJECT_SOURCE_DIR}/doc/swig/doxyfile.in doxyfile @ONLY)
+
+set(doc_sources)
+foreach(it "*.h;*.cpp;*.hpp;*.cxx")
+ file(GLOB doc_source RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${it})
+ list(APPEND doc_sources ${doc_source})
+endforeach()
+#message(STATUS "${doc_sources}")
+
+add_custom_command(OUTPUT doxyhelp.i
+ COMMAND "${DOXYGEN_EXECUTABLE}"
+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/scripts/doxy2swig.py xml/index.xml doxyhelp.i
+ DEPENDS ${doc_sources} ${PROJECT_SOURCE_DIR}/doc/swig/doxyfile.in
+)
ADD_SUBDIRECTORY (src/Config)
ADD_SUBDIRECTORY (src/Events)
ADD_SUBDIRECTORY (src/Model)
-ADD_SUBDIRECTORY (src/ModelAPI)
ADD_SUBDIRECTORY (src/GeomAPI)
+ADD_SUBDIRECTORY (src/ModelAPI)
ADD_SUBDIRECTORY (src/GeomAlgoAPI)
ADD_SUBDIRECTORY (src/GeomAlgoImpl)
ADD_SUBDIRECTORY (src/GeomData)
ADD_SUBDIRECTORY (src/ParametersPlugin)
ADD_SUBDIRECTORY (src/PythonAddons)
ADD_SUBDIRECTORY (src/PythonAPI)
+# High Level C++/Python API
+ADD_SUBDIRECTORY (src/ModelHighAPI)
+ADD_SUBDIRECTORY (src/BuildAPI)
+ADD_SUBDIRECTORY (src/ConnectorAPI)
+ADD_SUBDIRECTORY (src/ConstructionAPI)
+ADD_SUBDIRECTORY (src/ExchangeAPI)
+ADD_SUBDIRECTORY (src/FeaturesAPI)
+ADD_SUBDIRECTORY (src/ParametersAPI)
+ADD_SUBDIRECTORY (src/PartSetAPI)
+ADD_SUBDIRECTORY (src/SketchAPI)
IF(${HAVE_SALOME})
ADD_SUBDIRECTORY (src/SHAPERGUI)
--- /dev/null
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+DOXYFILE_ENCODING = UTF-8
+PROJECT_NAME = @CMAKE_PROJECT_NAME@
+PROJECT_NUMBER = @SHAPER_Version@
+PROJECT_BRIEF =
+PROJECT_LOGO =
+OUTPUT_DIRECTORY =
+CREATE_SUBDIRS = NO
+OUTPUT_LANGUAGE = English
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = YES
+INLINE_INHERITED_MEMB = YES
+FULL_PATH_NAMES = YES
+STRIP_FROM_PATH = @PROJECT_BINARY_DIR@ \
+ @PROJECT_SOURCE_DIR@
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+QT_AUTOBRIEF = NO
+MULTILINE_CPP_IS_BRIEF = NO
+INHERIT_DOCS = YES
+SEPARATE_MEMBER_PAGES = NO
+TAB_SIZE = 5
+ALIASES =
+TCL_SUBST =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = NO
+OPTIMIZE_FOR_FORTRAN = NO
+OPTIMIZE_OUTPUT_VHDL = NO
+EXTENSION_MAPPING =
+MARKDOWN_SUPPORT = YES
+AUTOLINK_SUPPORT = YES
+BUILTIN_STL_SUPPORT = NO
+CPP_CLI_SUPPORT = NO
+SIP_SUPPORT = NO
+IDL_PROPERTY_SUPPORT = YES
+DISTRIBUTE_GROUP_DOC = NO
+SUBGROUPING = YES
+INLINE_GROUPED_CLASSES = NO
+INLINE_SIMPLE_STRUCTS = NO
+TYPEDEF_HIDES_STRUCT = NO
+SYMBOL_CACHE_SIZE = 0
+LOOKUP_CACHE_SIZE = 0
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL = NO
+EXTRACT_PRIVATE = NO
+EXTRACT_PACKAGE = NO
+EXTRACT_STATIC = YES
+EXTRACT_LOCAL_CLASSES = YES
+EXTRACT_LOCAL_METHODS = NO
+EXTRACT_ANON_NSPACES = NO
+HIDE_UNDOC_MEMBERS = NO
+HIDE_UNDOC_CLASSES = NO
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
+INTERNAL_DOCS = YES
+CASE_SENSE_NAMES = YES
+HIDE_SCOPE_NAMES = NO
+SHOW_INCLUDE_FILES = NO
+FORCE_LOCAL_INCLUDES = NO
+INLINE_INFO = YES
+SORT_MEMBER_DOCS = NO
+SORT_BRIEF_DOCS = NO
+SORT_MEMBERS_CTORS_1ST = NO
+SORT_GROUP_NAMES = NO
+SORT_BY_SCOPE_NAME = YES
+STRICT_PROTO_MATCHING = NO
+GENERATE_TODOLIST = NO
+GENERATE_TESTLIST = NO
+GENERATE_BUGLIST = NO
+GENERATE_DEPRECATEDLIST= NO
+ENABLED_SECTIONS =
+MAX_INITIALIZER_LINES = 25
+SHOW_USED_FILES = NO
+SHOW_FILES = YES
+SHOW_NAMESPACES = YES
+FILE_VERSION_FILTER =
+LAYOUT_FILE =
+CITE_BIB_FILES =
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET = NO
+WARNINGS = YES
+WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
+WARN_NO_PARAMDOC = NO
+WARN_FORMAT = "$file:$line: $text"
+WARN_LOGFILE = log.txt
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT = @CMAKE_CURRENT_SOURCE_DIR@
+INPUT_ENCODING = UTF-8
+FILE_PATTERNS = *.h \
+ *.cpp \
+ *.hxx \
+ *.cxx \
+ *.doc \
+ *.py
+RECURSIVE = YES
+EXCLUDE =
+EXCLUDE_SYMLINKS = NO
+EXCLUDE_PATTERNS = */Test/* @EXCLUDE_DOC_DIR@
+EXCLUDE_SYMBOLS =
+EXAMPLE_PATH =
+EXAMPLE_PATTERNS =
+EXAMPLE_RECURSIVE = NO
+IMAGE_PATH = @CMAKE_CURRENT_SOURCE_DIR@
+INPUT_FILTER =
+FILTER_PATTERNS =
+FILTER_SOURCE_FILES = NO
+FILTER_SOURCE_PATTERNS =
+USE_MDFILE_AS_MAINPAGE =
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER = NO
+INLINE_SOURCES = NO
+STRIP_CODE_COMMENTS = YES
+REFERENCED_BY_RELATION = NO
+REFERENCES_RELATION = NO
+REFERENCES_LINK_SOURCE = YES
+USE_HTAGS = NO
+VERBATIM_HEADERS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX = YES
+COLS_IN_ALPHA_INDEX = 3
+IGNORE_PREFIX =
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML = NO
+HTML_OUTPUT = .
+HTML_FILE_EXTENSION = .html
+HTML_HEADER =
+HTML_FOOTER =
+HTML_STYLESHEET =
+HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_FILES =
+HTML_COLORSTYLE_HUE = 220
+HTML_COLORSTYLE_SAT = 100
+HTML_COLORSTYLE_GAMMA = 80
+HTML_TIMESTAMP = YES
+HTML_DYNAMIC_SECTIONS = NO
+HTML_INDEX_NUM_ENTRIES = 100
+GENERATE_DOCSET = NO
+DOCSET_FEEDNAME = "Doxygen generated docs"
+DOCSET_BUNDLE_ID = org.doxygen.Project
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+DOCSET_PUBLISHER_NAME = Publisher
+GENERATE_HTMLHELP = NO
+CHM_FILE =
+HHC_LOCATION =
+GENERATE_CHI = NO
+CHM_INDEX_ENCODING =
+BINARY_TOC = YES
+TOC_EXPAND = YES
+GENERATE_QHP = NO
+QCH_FILE =
+QHP_NAMESPACE = org.doxygen.Project
+QHP_VIRTUAL_FOLDER = doc
+QHP_CUST_FILTER_NAME =
+QHP_SECT_FILTER_ATTRS =
+QHG_LOCATION =
+GENERATE_ECLIPSEHELP = NO
+ECLIPSE_DOC_ID = org.doxygen.Project
+DISABLE_INDEX = NO
+GENERATE_TREEVIEW = YES
+ENUM_VALUES_PER_LINE = 4
+TREEVIEW_WIDTH = 250
+EXT_LINKS_IN_WINDOW = NO
+FORMULA_FONTSIZE = 10
+FORMULA_TRANSPARENT = YES
+USE_MATHJAX = NO
+MATHJAX_FORMAT = HTML-CSS
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+MATHJAX_EXTENSIONS =
+SEARCHENGINE = YES
+SERVER_BASED_SEARCH = NO
+EXTERNAL_SEARCH = NO
+SEARCHENGINE_URL =
+SEARCHDATA_FILE = searchdata.xml
+EXTERNAL_SEARCH_ID =
+EXTRA_SEARCH_MAPPINGS =
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX = NO
+LATEX_OUTPUT = latex
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
+COMPACT_LATEX = NO
+PAPER_TYPE = a4wide
+EXTRA_PACKAGES =
+LATEX_HEADER =
+LATEX_FOOTER =
+PDF_HYPERLINKS = NO
+USE_PDFLATEX = NO
+LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+LATEX_SOURCE_CODE = NO
+LATEX_BIB_STYLE = plain
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF = NO
+RTF_OUTPUT = rtf
+COMPACT_RTF = NO
+RTF_HYPERLINKS = NO
+RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN = NO
+MAN_OUTPUT = man
+MAN_EXTENSION = .3
+MAN_LINKS = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = YES
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
+XML_PROGRAMLISTING = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING = YES
+MACRO_EXPANSION = YES
+EXPAND_ONLY_PREDEF = NO
+SEARCH_INCLUDES = YES
+INCLUDE_PATH = @PROJECT_SOURCE_DIR@/src/ModelHighAPI
+INCLUDE_FILE_PATTERNS =
+PREDEFINED = Standard_EXPORT __Standard_API __Draw_API Handle(a):=Handle DEFINE_STANDARD_ALLOC DEFINE_NCOLLECTION_ALLOC DEFINE_STANDARD_HANDLE DEFINE_STANDARD_RTTI
+EXPAND_AS_DEFINED =
+SKIP_FUNCTION_MACROS = NO
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+TAGFILES =
+GENERATE_TAGFILE =
+ALLEXTERNALS = NO
+EXTERNAL_GROUPS = YES
+PERL_PATH = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS = YES
+MSCGEN_PATH =
+HIDE_UNDOC_RELATIONS = NO
+HAVE_DOT = YES
+DOT_NUM_THREADS = 0
+DOT_FONTNAME = Arial
+DOT_FONTSIZE = 10
+DOT_FONTPATH =
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+GROUP_GRAPHS = NO
+UML_LOOK = NO
+UML_LIMIT_NUM_FIELDS = 10
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = YES
+INCLUDED_BY_GRAPH = NO
+CALL_GRAPH = NO
+CALLER_GRAPH = NO
+GRAPHICAL_HIERARCHY = NO
+DIRECTORY_GRAPH = NO
+DOT_IMAGE_FORMAT = png
+INTERACTIVE_SVG = NO
+DOT_PATH =
+DOTFILE_DIRS =
+MSCFILE_DIRS =
+DOT_GRAPH_MAX_NODES = 50
+MAX_DOT_GRAPH_DEPTH = 0
+DOT_TRANSPARENT = NO
+DOT_MULTI_TARGETS = NO
+GENERATE_LEGEND = NO
+DOT_CLEANUP = YES
*
*/
+/**
+ * \defgroup CPPHighAPI C++ High API
+ *
+ * \brief C++ API for using fetures concentrated in plugins.
+ *
+ * The API intendend to be wrapped by SWIG and used in Python.
+ *
+ */
+
/**
* \defgroup Config Config
*
* (like in ExchangePlugin_ImportFormatValidator).
*
*/
-
# for example use the pattern */test/*
# Python unit tests excluded
-EXCLUDE_PATTERNS = */Test/*.py \
+EXCLUDE_PATTERNS = */Test/* \
@EXCLUDE_DOC_DIR@
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# contain include files that are not input files but should be processed by
# the preprocessor.
-INCLUDE_PATH =
+INCLUDE_PATH = @PROJECT_SOURCE_DIR@/src/ModelHighAPI
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
#!/bin/bash
source env.sh
-source env_standalone.sh
+source env_salome.sh
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
#!/bin/bash
source env.sh
-source env_standalone.sh
+source env_salome.sh
-export PATH=${INSTALL_DIR}/bin:${PATH}
+export PATH=${SHAPER_ROOT_DIR}/bin:${PATH}
cd ${BUILD_DIR}
--- /dev/null
+#!/usr/bin/env python
+"""doxy2swig.py [options] index.xml output.i
+
+Doxygen XML to SWIG docstring converter (improved version).
+
+Converts Doxygen generated XML files into a file containing docstrings
+for use by SWIG.
+
+index.xml is your doxygen generated XML file and output.i is where the
+output will be written (the file will be clobbered).
+"""
+#
+# The current version of this code is hosted on a github repository:
+# https://github.com/m7thon/doxy2swig
+#
+# This code is implemented using Mark Pilgrim's code as a guideline:
+# http://www.faqs.org/docs/diveintopython/kgp_divein.html
+#
+# Original Author: Prabhu Ramachandran
+# Modified by: Michael Thon (June 2015)
+# License: BSD style
+#
+# Thanks:
+# Johan Hake: the include_function_definition feature
+# Bill Spotz: bug reports and testing.
+# Sebastian Henschel: Misc. enhancements.
+#
+# Changes:
+# June 2015 (Michael Thon):
+# - class documentation:
+# -c: add constructor call signatures and a "Constructors" section
+# collecting the respective docs (e.g. for python)
+# -a: add "Attributes" section collecting the documentation for member
+# variables (e.g. for python)
+# - overloaded functions:
+# -o: collect all documentation into one "Overloaded function" section
+# - option to include function definition / signature renamed to -f
+# - formatting:
+# + included function signatures slightly reformatted
+# + option (-t) to turn off/on type information for funciton signatures
+# + lists (incl. nested and ordered)
+# + attempt to produce docstrings that render nicely as markdown
+# + translate code, emphasis, bold, linebreak, hruler, blockquote,
+# verbatim, heading tags to markdown
+# + new text-wrapping and option -w to specify the text width
+#
+
+from xml.dom import minidom
+import re
+import textwrap
+import sys
+import os.path
+import optparse
+
+
+def my_open_read(source):
+ if hasattr(source, "read"):
+ return source
+ else:
+ try:
+ return open(source, encoding='utf-8')
+ except TypeError:
+ return open(source)
+
+def my_open_write(dest):
+ if hasattr(dest, "write"):
+ return dest
+ else:
+ try:
+ return open(dest, 'w', encoding='utf-8')
+ except TypeError:
+ return open(dest, 'w')
+
+# MARK: Text handling:
+def shift(txt, indent = ' ', prepend = ''):
+ """Return a list corresponding to the lines of text in the `txt` list
+ indented by `indent`. Prepend instead the string given in `prepend` to the
+ beginning of the first line. Note that if len(prepend) > len(indent), then
+ `prepend` will be truncated (doing better is tricky!). This preserves a
+ special '' entry at the end of `txt` (see `do_para` for the meaning).
+ """
+ if type(indent) is int:
+ indent = indent * ' '
+ special_end = txt[-1:] == ['']
+ lines = ''.join(txt).splitlines(True)
+ for i in range(1,len(lines)):
+ if lines[i].strip() or indent.strip():
+ lines[i] = indent + lines[i]
+ if not lines:
+ return prepend
+ prepend = prepend[:len(indent)]
+ indent = indent[len(prepend):]
+ lines[0] = prepend + indent + lines[0]
+ ret = [''.join(lines)]
+ if special_end:
+ ret.append('')
+ return ret
+
+class Doxy2SWIG:
+ """Converts Doxygen generated XML files into a file containing
+ docstrings that can be used by SWIG-1.3.x that have support for
+ feature("docstring"). Once the data is parsed it is stored in
+ self.pieces.
+
+ """
+
+ def __init__(self, src,
+ with_function_signature = False,
+ with_type_info = False,
+ with_constructor_list = False,
+ with_attribute_list = False,
+ with_overloaded_functions = False,
+ textwidth = 80,
+ quiet = False):
+ """Initialize the instance given a source object. `src` can
+ be a file or filename. If you do not want to include function
+ definitions from doxygen then set
+ `include_function_definition` to `False`. This is handy since
+ this allows you to use the swig generated function definition
+ using %feature("autodoc", [0,1]).
+
+ """
+ # options:
+ self.with_function_signature = with_function_signature
+ self.with_type_info = with_type_info
+ self.with_constructor_list = with_constructor_list
+ self.with_attribute_list = with_attribute_list
+ self.with_overloaded_functions = with_overloaded_functions
+ self.textwidth = textwidth
+ self.quiet = quiet
+
+ # state:
+ self.indent = 0
+ self.listitem = ''
+ self.pieces = []
+
+ f = my_open_read(src)
+ self.my_dir = os.path.dirname(f.name)
+ self.xmldoc = minidom.parse(f).documentElement
+ f.close()
+
+ self.pieces.append('\n// File: %s\n' %
+ os.path.basename(f.name))
+
+ self.space_re = re.compile(r'\s+')
+ self.lead_spc = re.compile(r'^(%feature\S+\s+\S+\s*?)"\s+(\S)')
+ self.multi = 0
+ self.ignores = ['inheritancegraph', 'param', 'listofallmembers',
+ 'innerclass', 'name', 'declname', 'incdepgraph',
+ 'invincdepgraph', 'programlisting', 'type',
+ 'references', 'referencedby', 'location',
+ 'collaborationgraph', 'reimplements',
+ 'reimplementedby', 'derivedcompoundref',
+ 'basecompoundref',
+ 'argsstring', 'definition', 'exceptions']
+ #self.generics = []
+
+ def generate(self):
+ """Parses the file set in the initialization. The resulting
+ data is stored in `self.pieces`.
+
+ """
+ self.parse(self.xmldoc)
+
+ def write(self, fname):
+ o = my_open_write(fname)
+ o.write(''.join(self.pieces))
+ o.write('\n')
+ o.close()
+
+ def parse(self, node):
+ """Parse a given node. This function in turn calls the
+ `parse_<nodeType>` functions which handle the respective
+ nodes.
+
+ """
+ pm = getattr(self, "parse_%s" % node.__class__.__name__)
+ pm(node)
+
+ def parse_Document(self, node):
+ self.parse(node.documentElement)
+
+ def parse_Text(self, node):
+ txt = node.data
+ if txt == ' ':
+ # this can happen when two tags follow in a text, e.g.,
+ # " ...</emph> <formaula>$..." etc.
+ # here we want to keep the space.
+ self.add_text(txt)
+ return
+ txt = txt.replace('\\', r'\\')
+ txt = txt.replace('"', r'\"')
+ # ignore pure whitespace
+ m = self.space_re.match(txt)
+ if m and len(m.group()) == len(txt):
+ pass
+ else:
+ self.add_text(txt)
+
+ def parse_Comment(self, node):
+ """Parse a `COMMENT_NODE`. This does nothing for now."""
+ return
+
+ def parse_Element(self, node):
+ """Parse an `ELEMENT_NODE`. This calls specific
+ `do_<tagName>` handers for different elements. If no handler
+ is available the `subnode_parse` method is called. All
+ tagNames specified in `self.ignores` are simply ignored.
+
+ """
+ name = node.tagName
+ ignores = self.ignores
+ if name in ignores:
+ return
+ attr = "do_%s" % name
+ if hasattr(self, attr):
+ handlerMethod = getattr(self, attr)
+ handlerMethod(node)
+ else:
+ self.subnode_parse(node)
+ #if name not in self.generics: self.generics.append(name)
+
+# MARK: Special format parsing
+ def subnode_parse(self, node, pieces=None, indent=0, ignore=[], restrict=None):
+ """Parse the subnodes of a given node. Subnodes with tags in the
+ `ignore` list are ignored. If pieces is given, use this as target for
+ the parse results instead of self.pieces. Indent all lines by the amount
+ given in `indent`. Note that the initial content in `pieces` is not
+ indented. The final result is in any case added to self.pieces."""
+ if pieces is not None:
+ old_pieces, self.pieces = self.pieces, pieces
+ else:
+ old_pieces = []
+ if type(indent) is int:
+ indent = indent * ' '
+ if len(indent) > 0:
+ pieces = ''.join(self.pieces)
+ i_piece = pieces[:len(indent)]
+ if self.pieces[-1:] == ['']:
+ self.pieces = [pieces[len(indent):]] + ['']
+ elif self.pieces != []:
+ self.pieces = [pieces[len(indent):]]
+ self.indent += len(indent)
+ for n in node.childNodes:
+ if restrict is not None:
+ if n.nodeType == n.ELEMENT_NODE and n.tagName in restrict:
+ self.parse(n)
+ elif n.nodeType != n.ELEMENT_NODE or n.tagName not in ignore:
+ self.parse(n)
+ if len(indent) > 0:
+ self.pieces = shift(self.pieces, indent, i_piece)
+ self.indent -= len(indent)
+ old_pieces.extend(self.pieces)
+ self.pieces = old_pieces
+
+ def surround_parse(self, node, pre_char, post_char):
+ """Parse the subnodes of a given node. Subnodes with tags in the
+ `ignore` list are ignored. Prepend `pre_char` and append `post_char` to
+ the output in self.pieces."""
+ self.add_text(pre_char)
+ self.subnode_parse(node)
+ self.add_text(post_char)
+
+# MARK: Helper functions
+ def get_specific_subnodes(self, node, name, recursive=0):
+ """Given a node and a name, return a list of child `ELEMENT_NODEs`, that
+ have a `tagName` matching the `name`. Search recursively for `recursive`
+ levels.
+ """
+ children = [x for x in node.childNodes if x.nodeType == x.ELEMENT_NODE]
+ ret = [x for x in children if x.tagName == name]
+ if recursive > 0:
+ for x in children:
+ ret.extend(self.get_specific_subnodes(x, name, recursive-1))
+ return ret
+
+ def get_specific_nodes(self, node, names):
+ """Given a node and a sequence of strings in `names`, return a
+ dictionary containing the names as keys and child
+ `ELEMENT_NODEs`, that have a `tagName` equal to the name.
+
+ """
+ nodes = [(x.tagName, x) for x in node.childNodes
+ if x.nodeType == x.ELEMENT_NODE and
+ x.tagName in names]
+ return dict(nodes)
+
+ def add_text(self, value):
+ """Adds text corresponding to `value` into `self.pieces`."""
+ if isinstance(value, (list, tuple)):
+ self.pieces.extend(value)
+ else:
+ self.pieces.append(value)
+
+ def start_new_paragraph(self):
+ """Make sure to create an empty line. This is overridden, if the previous
+ text ends with the special marker ''. In that case, nothing is done.
+ """
+ if self.pieces[-1:] == ['']: # respect special marker
+ return
+ elif self.pieces == []: # first paragraph, add '\n', override with ''
+ self.pieces = ['\n']
+ elif self.pieces[-1][-1:] != '\n': # previous line not ended
+ self.pieces.extend([' \n' ,'\n'])
+ else: #default
+ self.pieces.append('\n')
+
+ def add_line_with_subsequent_indent(self, line, indent=4):
+ """Add line of text and wrap such that subsequent lines are indented
+ by `indent` spaces.
+ """
+ if isinstance(line, (list, tuple)):
+ line = ''.join(line)
+ line = line.strip()
+ width = self.textwidth-self.indent-indent
+ wrapped_lines = textwrap.wrap(line[indent:], width=width)
+ for i in range(len(wrapped_lines)):
+ if wrapped_lines[i] != '':
+ wrapped_lines[i] = indent * ' ' + wrapped_lines[i]
+ self.pieces.append(line[:indent] + '\n'.join(wrapped_lines)[indent:] + ' \n')
+
+ def extract_text(self, node):
+ """Return the string representation of the node or list of nodes by parsing the
+ subnodes, but returning the result as a string instead of adding it to `self.pieces`.
+ Note that this allows extracting text even if the node is in the ignore list.
+ """
+ if not isinstance(node, (list, tuple)):
+ node = [node]
+ pieces, self.pieces = self.pieces, ['']
+ for n in node:
+ for sn in n.childNodes:
+ self.parse(sn)
+ ret = ''.join(self.pieces)
+ self.pieces = pieces
+ return ret
+
+ def get_function_signature(self, node):
+ """Returns the function signature string for memberdef nodes."""
+ name = self.extract_text(self.get_specific_subnodes(node, 'name'))
+ if self.with_type_info:
+ argsstring = self.extract_text(self.get_specific_subnodes(node, 'argsstring'))
+ else:
+ argsstring = []
+ param_id = 1
+ for n_param in self.get_specific_subnodes(node, 'param'):
+ declname = self.extract_text(self.get_specific_subnodes(n_param, 'declname'))
+ if not declname:
+ declname = 'arg' + str(param_id)
+ defval = self.extract_text(self.get_specific_subnodes(n_param, 'defval'))
+ if defval:
+ defval = '=' + defval
+ argsstring.append(declname + defval)
+ param_id = param_id + 1
+ argsstring = '(' + ', '.join(argsstring) + ')'
+ type = self.extract_text(self.get_specific_subnodes(node, 'type'))
+ function_definition = name + argsstring
+ if type != '' and type != 'void':
+ function_definition = function_definition + ' -> ' + type
+ return '`' + function_definition + '` '
+
+# MARK: Special parsing tasks (need to be called manually)
+ def make_constructor_list(self, constructor_nodes, classname):
+ """Produces the "Constructors" section and the constructor signatures
+ (since swig does not do so for classes) for class docstrings."""
+ if constructor_nodes == []:
+ return
+ self.add_text(['\n', 'Constructors',
+ '\n', '------------'])
+ for n in constructor_nodes:
+ self.add_text('\n')
+ self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n))
+ self.subnode_parse(n, pieces = [], indent=4, ignore=['definition', 'name'])
+
+ def make_attribute_list(self, node):
+ """Produces the "Attributes" section in class docstrings for public
+ member variables (attributes).
+ """
+ atr_nodes = []
+ for n in self.get_specific_subnodes(node, 'memberdef', recursive=2):
+ if n.attributes['kind'].value == 'variable' and n.attributes['prot'].value == 'public':
+ atr_nodes.append(n)
+ if not atr_nodes:
+ return
+ self.add_text(['\n', 'Attributes',
+ '\n', '----------'])
+ for n in atr_nodes:
+ name = self.extract_text(self.get_specific_subnodes(n, 'name'))
+ self.add_text(['\n* ', '`', name, '`', ' : '])
+ self.add_text(['`', self.extract_text(self.get_specific_subnodes(n, 'type')), '`'])
+ self.add_text(' \n')
+ restrict = ['briefdescription', 'detaileddescription']
+ self.subnode_parse(n, pieces=[''], indent=4, restrict=restrict)
+
+ def get_memberdef_nodes_and_signatures(self, node, kind):
+ """Collects the memberdef nodes and corresponding signatures that
+ correspond to public function entries that are at most depth 2 deeper
+ than the current (compounddef) node. Returns a dictionary with
+ function signatures (what swig expects after the %feature directive)
+ as keys, and a list of corresponding memberdef nodes as values."""
+ sig_dict = {}
+ sig_prefix = ''
+ if kind in ('file', 'namespace'):
+ ns_node = node.getElementsByTagName('innernamespace')
+ if not ns_node and kind == 'namespace':
+ ns_node = node.getElementsByTagName('compoundname')
+ if ns_node:
+ sig_prefix = self.extract_text(ns_node[0]) + '::'
+ elif kind in ('class', 'struct'):
+ # Get the full function name.
+ cn_node = node.getElementsByTagName('compoundname')
+ sig_prefix = self.extract_text(cn_node[0]) + '::'
+
+ md_nodes = self.get_specific_subnodes(node, 'memberdef', recursive=2)
+ for n in md_nodes:
+ if n.attributes['prot'].value != 'public':
+ continue
+ if n.attributes['kind'].value in ['variable', 'typedef']:
+ continue
+ if not self.get_specific_subnodes(n, 'definition'):
+ continue
+ name = self.extract_text(self.get_specific_subnodes(n, 'name'))
+ if name[:8] == 'operator':
+ continue
+ sig = sig_prefix + name
+ if sig in sig_dict:
+ sig_dict[sig].append(n)
+ else:
+ sig_dict[sig] = [n]
+ return sig_dict
+
+ def handle_typical_memberdefs_no_overload(self, signature, memberdef_nodes):
+ """Produce standard documentation for memberdef_nodes."""
+ for n in memberdef_nodes:
+ self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n'])
+ if self.with_function_signature:
+ self.add_line_with_subsequent_indent(self.get_function_signature(n))
+ self.subnode_parse(n, pieces=[], ignore=['definition', 'name'])
+ self.add_text(['";', '\n'])
+
+ def handle_typical_memberdefs(self, signature, memberdef_nodes):
+ """Produces docstring entries containing an "Overloaded function"
+ section with the documentation for each overload, if the function is
+ overloaded and self.with_overloaded_functions is set. Else, produce
+ normal documentation.
+ """
+ if len(memberdef_nodes) == 1 or not self.with_overloaded_functions:
+ self.handle_typical_memberdefs_no_overload(signature, memberdef_nodes)
+ return
+
+ self.add_text(['\n', '%feature("docstring") ', signature, ' "', '\n'])
+ if self.with_function_signature:
+ for n in memberdef_nodes:
+ self.add_line_with_subsequent_indent(self.get_function_signature(n))
+ self.add_text('\n')
+ self.add_text(['Overloaded function', '\n',
+ '-------------------'])
+ for n in memberdef_nodes:
+ self.add_text('\n')
+ self.add_line_with_subsequent_indent('* ' + self.get_function_signature(n))
+ self.subnode_parse(n, pieces=[], indent=4, ignore=['definition', 'name'])
+ self.add_text(['";', '\n'])
+
+
+# MARK: Tag handlers
+ def do_linebreak(self, node):
+ self.add_text(' ')
+
+ def do_ndash(self, node):
+ self.add_text('--')
+
+ def do_mdash(self, node):
+ self.add_text('---')
+
+ def do_emphasis(self, node):
+ self.surround_parse(node, '*', '*')
+
+ def do_bold(self, node):
+ self.surround_parse(node, '**', '**')
+
+ def do_computeroutput(self, node):
+ self.surround_parse(node, '`', '`')
+
+ def do_heading(self, node):
+ self.start_new_paragraph()
+ pieces, self.pieces = self.pieces, ['']
+ level = int(node.attributes['level'].value)
+ self.subnode_parse(node)
+ if level == 1:
+ self.pieces.insert(0, '\n')
+ self.add_text(['\n', len(''.join(self.pieces).strip()) * '='])
+ elif level == 2:
+ self.add_text(['\n', len(''.join(self.pieces).strip()) * '-'])
+ elif level >= 3:
+ self.pieces.insert(0, level * '#' + ' ')
+ # make following text have no gap to the heading:
+ pieces.extend([''.join(self.pieces) + ' \n', ''])
+ self.pieces = pieces
+
+ def do_verbatim(self, node):
+ self.start_new_paragraph()
+ self.subnode_parse(node, pieces=[''], indent=4)
+
+ def do_blockquote(self, node):
+ self.start_new_paragraph()
+ self.subnode_parse(node, pieces=[''], indent='> ')
+
+ def do_hruler(self, node):
+ self.start_new_paragraph()
+ self.add_text('* * * * * \n')
+
+ def do_includes(self, node):
+ self.add_text('\nC++ includes: ')
+ self.subnode_parse(node)
+ self.add_text('\n')
+
+# MARK: Para tag handler
+ def do_para(self, node):
+ """This is the only place where text wrapping is automatically performed.
+ Generally, this function parses the node (locally), wraps the text, and
+ then adds the result to self.pieces. However, it may be convenient to
+ allow the previous content of self.pieces to be included in the text
+ wrapping. For this, use the following *convention*:
+ If self.pieces ends with '', treat the _previous_ entry as part of the
+ current paragraph. Else, insert new-line and start a new paragraph
+ and "wrapping context".
+ Paragraphs always end with ' \n', but if the parsed content ends with
+ the special symbol '', this is passed on.
+ """
+ if self.pieces[-1:] == ['']:
+ pieces, self.pieces = self.pieces[:-2], self.pieces[-2:-1]
+ else:
+ self.add_text('\n')
+ pieces, self.pieces = self.pieces, ['']
+ self.subnode_parse(node)
+ dont_end_paragraph = self.pieces[-1:] == ['']
+ # Now do the text wrapping:
+ width = self.textwidth - self.indent
+ wrapped_para = []
+ for line in ''.join(self.pieces).splitlines():
+ keep_markdown_newline = line[-2:] == ' '
+ w_line = textwrap.wrap(line, width=width, break_long_words=False)
+ if w_line == []:
+ w_line = ['']
+ if keep_markdown_newline:
+ w_line[-1] = w_line[-1] + ' '
+ for wl in w_line:
+ wrapped_para.append(wl + '\n')
+ if wrapped_para:
+ if wrapped_para[-1][-3:] != ' \n':
+ wrapped_para[-1] = wrapped_para[-1][:-1] + ' \n'
+ if dont_end_paragraph:
+ wrapped_para.append('')
+ pieces.extend(wrapped_para)
+ self.pieces = pieces
+
+# MARK: List tag handlers
+ def do_itemizedlist(self, node):
+ if self.listitem == '':
+ self.start_new_paragraph()
+ elif self.pieces != [] and self.pieces[-1:] != ['']:
+ self.add_text('\n')
+ listitem = self.listitem
+ if self.listitem in ['*', '-']:
+ self.listitem = '-'
+ else:
+ self.listitem = '*'
+ self.subnode_parse(node)
+ self.listitem = listitem
+
+ def do_orderedlist(self, node):
+ if self.listitem == '':
+ self.start_new_paragraph()
+ elif self.pieces != [] and self.pieces[-1:] != ['']:
+ self.add_text('\n')
+ listitem = self.listitem
+ self.listitem = 0
+ self.subnode_parse(node)
+ self.listitem = listitem
+
+ def do_listitem(self, node):
+ try:
+ self.listitem = int(self.listitem) + 1
+ item = str(self.listitem) + '. '
+ except:
+ item = str(self.listitem) + ' '
+ self.subnode_parse(node, item, indent=4)
+
+# MARK: Parameter list tag handlers
+ def do_parameterlist(self, node):
+ self.start_new_paragraph()
+ text = 'unknown'
+ for key, val in node.attributes.items():
+ if key == 'kind':
+ if val == 'param':
+ text = 'Parameters'
+ elif val == 'exception':
+ text = 'Exceptions'
+ elif val == 'retval':
+ text = 'Returns'
+ else:
+ text = val
+ break
+ if self.indent == 0:
+ self.add_text([text, '\n', len(text) * '-', '\n'])
+ else:
+ self.add_text([text, ': \n'])
+ self.subnode_parse(node)
+
+ def do_parameteritem(self, node):
+ self.subnode_parse(node, pieces=['* ', ''])
+
+ def do_parameternamelist(self, node):
+ self.subnode_parse(node)
+ self.add_text([' :', ' \n'])
+
+ def do_parametername(self, node):
+ if self.pieces != [] and self.pieces != ['* ', '']:
+ self.add_text(', ')
+ data = self.extract_text(node)
+ self.add_text(['`', data, '`'])
+
+ def do_parameterdescription(self, node):
+ self.subnode_parse(node, pieces=[''], indent=4)
+
+# MARK: Section tag handler
+ def do_simplesect(self, node):
+ kind = node.attributes['kind'].value
+ if kind in ('date', 'rcs', 'version'):
+ return
+ self.start_new_paragraph()
+ if kind == 'warning':
+ self.subnode_parse(node, pieces=['**Warning**: ',''], indent=4)
+ elif kind == 'see':
+ self.subnode_parse(node, pieces=['See also: ',''], indent=4)
+ elif kind == 'return':
+ if self.indent == 0:
+ pieces = ['Returns', '\n', len('Returns') * '-', '\n', '']
+ else:
+ pieces = ['Returns:', '\n', '']
+ self.subnode_parse(node, pieces=pieces)
+ else:
+ self.subnode_parse(node, pieces=[kind + ': ',''], indent=4)
+
+# MARK: %feature("docstring") producing tag handlers
+ def do_compounddef(self, node):
+ """This produces %feature("docstring") entries for classes, and handles
+ class, namespace and file memberdef entries specially to allow for
+ overloaded functions. For other cases, passes parsing on to standard
+ handlers (which may produce unexpected results).
+ """
+ kind = node.attributes['kind'].value
+ if kind in ('class', 'struct'):
+ prot = node.attributes['prot'].value
+ if prot != 'public':
+ return
+ self.add_text('\n\n')
+ classdefn = self.extract_text(self.get_specific_subnodes(node, 'compoundname'))
+ classname = classdefn.split('::')[-1]
+ self.add_text('%%feature("docstring") %s "\n' % classdefn)
+
+ if self.with_constructor_list:
+ constructor_nodes = []
+ for n in self.get_specific_subnodes(node, 'memberdef', recursive=2):
+ if n.attributes['prot'].value == 'public':
+ if self.extract_text(self.get_specific_subnodes(n, 'definition')) == classdefn + '::' + classname:
+ constructor_nodes.append(n)
+ for n in constructor_nodes:
+ self.add_line_with_subsequent_indent(self.get_function_signature(n))
+
+ names = ('briefdescription','detaileddescription')
+ sub_dict = self.get_specific_nodes(node, names)
+ for n in ('briefdescription','detaileddescription'):
+ if n in sub_dict:
+ self.parse(sub_dict[n])
+ if self.with_constructor_list:
+ self.make_constructor_list(constructor_nodes, classname)
+ if self.with_attribute_list:
+ self.make_attribute_list(node)
+
+ sub_list = self.get_specific_subnodes(node, 'includes')
+ if sub_list:
+ self.parse(sub_list[0])
+ self.add_text(['";', '\n'])
+
+ names = ['compoundname', 'briefdescription','detaileddescription', 'includes']
+ self.subnode_parse(node, ignore = names)
+
+ elif kind in ('file', 'namespace'):
+ nodes = node.getElementsByTagName('sectiondef')
+ for n in nodes:
+ self.parse(n)
+
+ # now explicitely handle possibly overloaded member functions.
+ if kind in ['class', 'struct','file', 'namespace']:
+ md_nodes = self.get_memberdef_nodes_and_signatures(node, kind)
+ for sig in md_nodes:
+ self.handle_typical_memberdefs(sig, md_nodes[sig])
+
+ def do_memberdef(self, node):
+ """Handle cases outside of class, struct, file or namespace. These are
+ now dealt with by `handle_overloaded_memberfunction`.
+ Do these even exist???
+ """
+ prot = node.attributes['prot'].value
+ id = node.attributes['id'].value
+ kind = node.attributes['kind'].value
+ tmp = node.parentNode.parentNode.parentNode
+ compdef = tmp.getElementsByTagName('compounddef')[0]
+ cdef_kind = compdef.attributes['kind'].value
+ if cdef_kind in ('file', 'namespace', 'class', 'struct'):
+ # These cases are now handled by `handle_typical_memberdefs`
+ return
+ if prot != 'public':
+ return
+ first = self.get_specific_nodes(node, ('definition', 'name'))
+ name = self.extract_text(first['name'])
+ if name[:8] == 'operator': # Don't handle operators yet.
+ return
+ if not 'definition' in first or kind in ['variable', 'typedef']:
+ return
+
+ data = self.extract_text(first['definition'])
+ self.add_text('\n')
+ self.add_text(['/* where did this entry come from??? */', '\n'])
+ self.add_text('%feature("docstring") %s "\n%s' % (data, data))
+
+ for n in node.childNodes:
+ if n not in first.values():
+ self.parse(n)
+ self.add_text(['";', '\n'])
+
+# MARK: Entry tag handlers (dont print anything meaningful)
+ def do_sectiondef(self, node):
+ kind = node.attributes['kind'].value
+ if kind in ('public-func', 'func', 'user-defined', ''):
+ self.subnode_parse(node)
+
+ def do_header(self, node):
+ """For a user defined section def a header field is present
+ which should not be printed as such, so we comment it in the
+ output."""
+ data = self.extract_text(node)
+ self.add_text('\n/*\n %s \n*/\n' % data)
+ # If our immediate sibling is a 'description' node then we
+ # should comment that out also and remove it from the parent
+ # node's children.
+ parent = node.parentNode
+ idx = parent.childNodes.index(node)
+ if len(parent.childNodes) >= idx + 2:
+ nd = parent.childNodes[idx + 2]
+ if nd.nodeName == 'description':
+ nd = parent.removeChild(nd)
+ self.add_text('\n/*')
+ self.subnode_parse(nd)
+ self.add_text('\n*/\n')
+
+ def do_member(self, node):
+ kind = node.attributes['kind'].value
+ refid = node.attributes['refid'].value
+ if kind == 'function' and refid[:9] == 'namespace':
+ self.subnode_parse(node)
+
+ def do_doxygenindex(self, node):
+ self.multi = 1
+ comps = node.getElementsByTagName('compound')
+ for c in comps:
+ refid = c.attributes['refid'].value
+ fname = refid + '.xml'
+ if not os.path.exists(fname):
+ fname = os.path.join(self.my_dir, fname)
+ if not self.quiet:
+ print("parsing file: %s" % fname)
+ p = Doxy2SWIG(fname,
+ with_function_signature = self.with_function_signature,
+ with_type_info = self.with_type_info,
+ with_constructor_list = self.with_constructor_list,
+ with_attribute_list = self.with_attribute_list,
+ with_overloaded_functions = self.with_overloaded_functions,
+ textwidth = self.textwidth,
+ quiet = self.quiet)
+ p.generate()
+ self.pieces.extend(p.pieces)
+
+# MARK: main
+def main():
+ usage = __doc__
+ parser = optparse.OptionParser(usage)
+ parser.add_option("-f", '--function-signature',
+ action='store_true',
+ default=False,
+ dest='f',
+ help='include function signature in the documentation. This is handy when not using swig auto-generated function definitions %feature("autodoc", [0,1])')
+ parser.add_option("-t", '--type-info',
+ action='store_true',
+ default=False,
+ dest='t',
+ help='include type information for arguments in function signatures. This is similar to swig autodoc level 1')
+ parser.add_option("-c", '--constructor-list',
+ action='store_true',
+ default=False,
+ dest='c',
+ help='generate a constructor list for class documentation. Useful for target languages where the object construction should be documented in the class documentation.')
+ parser.add_option("-a", '--attribute-list',
+ action='store_true',
+ default=False,
+ dest='a',
+ help='generate an attributes list for class documentation. Useful for target languages where class attributes should be documented in the class documentation.')
+ parser.add_option("-o", '--overloaded-functions',
+ action='store_true',
+ default=False,
+ dest='o',
+ help='collect all documentation for overloaded functions. Useful for target languages that have no concept of overloaded functions, but also to avoid having to attach the correct docstring to each function overload manually')
+ parser.add_option("-w", '--width', type="int",
+ action='store',
+ dest='w',
+ default=80,
+ help='textwidth for wrapping (default: 80). Note that the generated lines may include 2 additional spaces (for markdown).')
+ parser.add_option("-q", '--quiet',
+ action='store_true',
+ default=False,
+ dest='q',
+ help='be quiet and minimize output')
+
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error("no input and output specified")
+
+ p = Doxy2SWIG(args[0],
+ with_function_signature = options.f,
+ with_type_info = options.t,
+ with_constructor_list = options.c,
+ with_attribute_list = options.a,
+ with_overloaded_functions = options.o,
+ textwidth = options.w,
+ quiet = options.q)
+ p.generate()
+ p.write(args[1])
+
+if __name__ == '__main__':
+ main()
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef BUILDAPI_H
+#define BUILDAPI_H
+
+#if defined BUILDAPI_EXPORTS
+#if defined WIN32
+#define BUILDAPI_EXPORT __declspec( dllexport )
+#else
+#define BUILDAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define BUILDAPI_EXPORT __declspec( dllimport )
+#else
+#define BUILDAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* FeaturesAPI.i */
+
+%module BuildAPI
+
+%{
+ #include "BuildAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define BUILDAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(BuildAPI_Edge)
+%shared_ptr(BuildAPI_Face)
+%shared_ptr(BuildAPI_Shell)
+%shared_ptr(BuildAPI_SubShapes)
+%shared_ptr(BuildAPI_Vertex)
+%shared_ptr(BuildAPI_Wire)
+
+// all supported interfaces
+%include "BuildAPI_Edge.h"
+%include "BuildAPI_Face.h"
+%include "BuildAPI_Shell.h"
+%include "BuildAPI_SubShapes.h"
+%include "BuildAPI_Vertex.h"
+%include "BuildAPI_Wire.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Edge.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Edge.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Edge::BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Edge::~BuildAPI_Edge()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Edge::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+EdgePtr addEdge(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Edge::ID());
+ return EdgePtr(new BuildAPI_Edge(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Edge.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Edge_H_
+#define BuildAPI_Edge_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Edge.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Edge
+/// \ingroup CPPHighAPI
+/// \brief Interface for Edge feature.
+class BuildAPI_Edge: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Edge(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Edge();
+
+ INTERFACE_1(BuildPlugin_Edge::ID(),
+ baseObjects, BuildPlugin_Edge::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Edge object.
+typedef std::shared_ptr<BuildAPI_Edge> EdgePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Edge feature.
+BUILDAPI_EXPORT
+EdgePtr addEdge(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Edge_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Face.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Face.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Face::BuildAPI_Face(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Face::BuildAPI_Face(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Face::~BuildAPI_Face()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Face::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+FacePtr addFace(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Face::ID());
+ return FacePtr(new BuildAPI_Face(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Face.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Face_H_
+#define BuildAPI_Face_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Face.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Face
+/// \ingroup CPPHighAPI
+/// \brief Interface for Face feature.
+class BuildAPI_Face: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Face(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Face(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Face();
+
+ INTERFACE_1(BuildPlugin_Face::ID(),
+ baseObjects, BuildPlugin_Face::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Face object.
+typedef std::shared_ptr<BuildAPI_Face> FacePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Face feature.
+BUILDAPI_EXPORT
+FacePtr addFace(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Face_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Shell.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Shell.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Shell::BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Shell::~BuildAPI_Shell()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Shell::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+ShellPtr addShell(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Shell::ID());
+ return ShellPtr(new BuildAPI_Shell(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Shell.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Shell_H_
+#define BuildAPI_Shell_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Shell.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Shell
+/// \ingroup CPPHighAPI
+/// \brief Interface for Shell feature.
+class BuildAPI_Shell: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Shell(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Shell();
+
+ INTERFACE_1(BuildPlugin_Shell::ID(),
+ baseObjects, BuildPlugin_Shell::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Shell object.
+typedef std::shared_ptr<BuildAPI_Shell> ShellPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Shell feature.
+BUILDAPI_EXPORT
+ShellPtr addShell(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Shell_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_SubShapes.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_SubShapes.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_SubShapes::BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theBaseShape,
+ const std::list<ModelHighAPI_Selection>& theSubShapes)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseShape, mybaseShape);
+ setSubShapes(theSubShapes);
+ }
+}
+
+//==================================================================================================
+BuildAPI_SubShapes::~BuildAPI_SubShapes()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_SubShapes::setBaseShape(const ModelHighAPI_Selection& theBaseShape)
+{
+ fillAttribute(theBaseShape, mybaseShape);
+
+ execute();
+}
+
+//==================================================================================================
+void BuildAPI_SubShapes::setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+ fillAttribute(theSubShapes, mysubShapes);
+
+ execute();
+}
+
+//==================================================================================================
+SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theBaseShape,
+ const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_SubShapes::ID());
+ return SubShapesPtr(new BuildAPI_SubShapes(aFeature, theBaseShape, theSubShapes));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_SubShapes.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_SubShapes_H_
+#define BuildAPI_SubShapes_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_SubShapes.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_SubShapes
+/// \ingroup CPPHighAPI
+/// \brief Interface for SubShapes feature.
+class BuildAPI_SubShapes: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_SubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theBaseShape,
+ const std::list<ModelHighAPI_Selection>& theSubShapes);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_SubShapes();
+
+ INTERFACE_2(BuildPlugin_SubShapes::ID(),
+ baseShape, BuildPlugin_SubShapes::BASE_SHAPE_ID(), ModelAPI_AttributeSelection, /** Base shape */,
+ subShapes, BuildPlugin_SubShapes::SUBSHAPES_ID(), ModelAPI_AttributeSelectionList, /** Sub-shapes */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBaseShape(const ModelHighAPI_Selection& theBaseShape);
+
+ /// Modify sub-shapes attribute of the feature.
+ BUILDAPI_EXPORT
+ void setSubShapes(const std::list<ModelHighAPI_Selection>& theSubShapes);
+};
+
+/// Pointer on SubShapes object.
+typedef std::shared_ptr<BuildAPI_SubShapes> SubShapesPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create SubShapes feature.
+BUILDAPI_EXPORT
+SubShapesPtr addSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theBaseShape,
+ const std::list<ModelHighAPI_Selection>& theSubShapes);
+
+#endif // BuildAPI_SubShapes_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Vertex.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Vertex.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Vertex::BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Vertex::~BuildAPI_Vertex()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Vertex::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+VertexPtr addVertex(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Vertex::ID());
+ return VertexPtr(new BuildAPI_Vertex(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Vertex.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Vertex_H_
+#define BuildAPI_Vertex_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Vertex.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Vertex
+/// \ingroup CPPHighAPI
+/// \brief Interface for Vertex feature.
+class BuildAPI_Vertex: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Vertex(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Vertex();
+
+ INTERFACE_1(BuildPlugin_Vertex::ID(),
+ baseObjects, BuildPlugin_Vertex::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Vertex object.
+typedef std::shared_ptr<BuildAPI_Vertex> VertexPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Vertex feature.
+BUILDAPI_EXPORT
+VertexPtr addVertex(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Vertex_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Wire.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "BuildAPI_Wire.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+BuildAPI_Wire::BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+BuildAPI_Wire::~BuildAPI_Wire()
+{
+
+}
+
+//==================================================================================================
+void BuildAPI_Wire::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void BuildAPI_Wire::addContour()
+{
+ feature()->customAction(BuildPlugin_Wire::ADD_CONTOUR_ACTION_ID());
+}
+
+//==================================================================================================
+WirePtr addWire(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(BuildAPI_Wire::ID());
+ return WirePtr(new BuildAPI_Wire(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: BuildAPI_Wire.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef BuildAPI_Wire_H_
+#define BuildAPI_Wire_H_
+
+#include "BuildAPI.h"
+
+#include <BuildPlugin_Wire.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class BuildAPI_Wire
+/// \ingroup CPPHighAPI
+/// \brief Interface for Wire feature.
+class BuildAPI_Wire: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ BUILDAPI_EXPORT
+ explicit BuildAPI_Wire(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ BUILDAPI_EXPORT
+ virtual ~BuildAPI_Wire();
+
+ INTERFACE_1(BuildPlugin_Wire::ID(),
+ baseObjects, BuildPlugin_Wire::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ BUILDAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Adds closed contour.
+ BUILDAPI_EXPORT
+ void addContour();
+};
+
+/// Pointer on Wire object.
+typedef std::shared_ptr<BuildAPI_Wire> WirePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Wire feature.
+BUILDAPI_EXPORT
+WirePtr addWire(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // BuildAPI_Wire_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesAPI_swig.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_swig_H_
+#define FeaturesAPI_swig_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "BuildAPI_Edge.h"
+ #include "BuildAPI_Face.h"
+ #include "BuildAPI_Shell.h"
+ #include "BuildAPI_SubShapes.h"
+ #include "BuildAPI_Vertex.h"
+ #include "BuildAPI_Wire.h"
+
+#endif // FeaturesAPI_swig_H_
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ BuildAPI.h
+ BuildAPI_Edge.h
+ BuildAPI_Face.h
+ BuildAPI_Shell.h
+ BuildAPI_SubShapes.h
+ BuildAPI_Vertex.h
+ BuildAPI_Wire.h
+)
+
+SET(PROJECT_SOURCES
+ BuildAPI_Edge.cpp
+ BuildAPI_Face.cpp
+ BuildAPI_Shell.cpp
+ BuildAPI_SubShapes.cpp
+ BuildAPI_Vertex.cpp
+ BuildAPI_Wire.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/BuildPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DBUILDAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(BuildAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(BuildAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(BuildAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(BuildAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ BuildAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_BuildAPI_EXTRA_DEPS ${SWIG_MODULE_BuildAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(BuildAPI python BuildAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(BuildAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_BuildAPI PROPERTIES DEBUG_OUTPUT_NAME _BuildAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _BuildAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS BuildAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/BuildAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+)
+
+# ADD_SUBDIRECTORY (Test)
//=================================================================================================
bool BuildPlugin_Wire::customAction(const std::string& theActionId)
{
- if(theActionId == "add_contour") {
+ if(theActionId == ADD_CONTOUR_ACTION_ID()) {
return addContour();
} else {
std::string aMsg = "Error: Feature \"%1\" does not support action \"%2\".";
return MY_BASE_OBJECTS_ID;
}
+ /// Attribute name of base objects.
+ inline static const std::string& ADD_CONTOUR_ACTION_ID()
+ {
+ static const std::string MY_ADD_CONTOUR_ACTION_ID("add_contour");
+ return MY_ADD_CONTOUR_ACTION_ID;
+ }
+
/// \return the kind of a feature.
BUILDPLUGIN_EXPORT virtual const std::string& getKind()
{
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ConnectorAPI.h
+ ConnectorAPI_Connector.h
+)
+
+SET(PROJECT_SOURCES
+ ConnectorAPI_Connector.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ConnectorPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ConnectorPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ConnectorAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ConnectorAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ConnectorAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ ConnectorAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ConnectorAPI_EXTRA_DEPS ${SWIG_MODULE_ConnectorAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ConnectorAPI python ConnectorAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ConnectorAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ConnectorAPI PROPERTIES DEBUG_OUTPUT_NAME _ConnectorAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ConnectorAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ConnectorAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ConnectorAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef CONNECTORAPI_H
+#define CONNECTORAPI_H
+
+#if defined CONNECTORAPI_EXPORTS
+#if defined WIN32
+#define CONNECTORAPI_EXPORT __declspec( dllexport )
+#else
+#define CONNECTORAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONNECTORAPI_EXPORT __declspec( dllimport )
+#else
+#define CONNECTORAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ConnectorAPI.i */
+
+%module ConnectorAPI
+
+%{
+ #include "ConnectorAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define CONNECTORAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// all supported interfaces
+%include "ConnectorAPI_Connector.h"
--- /dev/null
+// Name : ConnectorAPI_Connector.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ConnectorAPI_Connector.h"
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+//--------------------------------------------------------------------------------------
+void exportToGEOM(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature("ExportToGEOM");
+ aFeature->execute();
+}
--- /dev/null
+// Name : ConnectorAPI_Connector.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_CONNECTORAPI_CONNECTORAPI_PART_H_
+#define SRC_CONNECTORAPI_CONNECTORAPI_PART_H_
+
+//--------------------------------------------------------------------------------------
+#include "ConnectorAPI.h"
+//--------------------------------------------------------------------------------------
+#include <memory>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/**\ingroup CPPHighAPI
+ * \brief Export to GEOM
+ */
+CONNECTORAPI_EXPORT
+void exportToGEOM(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_CONNECTORAPI_CONNECTORAPI_PART_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ConnectorAPI_swig.h
+// Created: 16/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_
+#define SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "ConnectorAPI_Connector.h"
+
+#endif /* SRC_CONNECTORAPI_CONNECTORAPI_SWIG_H_ */
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ConstructionAPI.h
+ ConstructionAPI_Axis.h
+ ConstructionAPI_Plane.h
+ ConstructionAPI_Point.h
+)
+
+SET(PROJECT_SOURCES
+ ConstructionAPI_Axis.cpp
+ ConstructionAPI_Plane.cpp
+ ConstructionAPI_Point.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ConstructionPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ConstructionPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ConstructionAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ConstructionAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ConstructionAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ ConstructionAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ConstructionAPI_EXTRA_DEPS ${SWIG_MODULE_ConstructionAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ConstructionAPI python ConstructionAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ConstructionAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ConstructionAPI PROPERTIES DEBUG_OUTPUT_NAME _ConstructionAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ConstructionAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ConstructionAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ConstructionAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+ TestPoint.py
+)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef CONSTRUCTIONAPI_H
+#define CONSTRUCTIONAPI_H
+
+#if defined CONSTRUCTIONAPI_EXPORTS
+#if defined WIN32
+#define CONSTRUCTIONAPI_EXPORT __declspec( dllexport )
+#else
+#define CONSTRUCTIONAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define CONSTRUCTIONAPI_EXPORT __declspec( dllimport )
+#else
+#define CONSTRUCTIONAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ConstructionAPI.i */
+
+%module ConstructionAPI
+
+%{
+ #include "ConstructionAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define CONSTRUCTIONAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(ConstructionAPI_Axis)
+%shared_ptr(ConstructionAPI_Plane)
+%shared_ptr(ConstructionAPI_Point)
+
+// all supported interfaces
+%include "ConstructionAPI_Axis.h"
+%include "ConstructionAPI_Plane.h"
+%include "ConstructionAPI_Point.h"
--- /dev/null
+// Name : ConstructionAPI_Axis.cpp
+// Purpose:
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI_Axis.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ConstructionAPI_Axis::ConstructionAPI_Axis(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ConstructionAPI_Axis::ConstructionAPI_Axis(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setPoints(thePoint1, thePoint2);
+}
+
+ConstructionAPI_Axis::ConstructionAPI_Axis(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theCylindricalFace)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setCylindricalFace(theCylindricalFace);
+}
+
+ConstructionAPI_Axis::ConstructionAPI_Axis(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setPointAndDirection(thePoint, theX, theY, theZ);
+}
+
+ConstructionAPI_Axis::~ConstructionAPI_Axis()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void ConstructionAPI_Axis::setPoints(
+ const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2)
+{
+ fillAttribute("AxisByPointsCase", creationMethod());
+ fillAttribute(thePoint1, firstPoint());
+ fillAttribute(thePoint2, secondPoint());
+
+ execute();
+}
+
+void ConstructionAPI_Axis::setCylindricalFace(
+ const ModelHighAPI_Selection & theCylindricalFace)
+{
+ fillAttribute("AxisByCylindricalFaceCase", creationMethod());
+ fillAttribute(theCylindricalFace, cylindricalFace());
+
+ execute();
+}
+
+void ConstructionAPI_Axis::setPointAndDirection(
+ const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ)
+{
+ fillAttribute("AxisByPointAndDirection", creationMethod());
+ fillAttribute(thePoint, firstPoint());
+ fillAttribute(theX, xDirection());
+ fillAttribute(theY, yDirection());
+ fillAttribute(theZ, zDirection());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
+ return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint1, thePoint2));
+}
+
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theCylindricalFace)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
+ return AxisPtr(new ConstructionAPI_Axis(aFeature, theCylindricalFace));
+}
+
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Axis::ID());
+ return AxisPtr(new ConstructionAPI_Axis(aFeature, thePoint, theX, theY, theZ));
+}
--- /dev/null
+// Name : ConstructionAPI_Axis.h
+// Purpose:
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_
+#define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI.h"
+
+#include <ConstructionPlugin_Axis.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class ConstructionAPI_Axis
+ * \ingroup CPPHighAPI
+ * \brief Interface for Axis feature
+ */
+class ConstructionAPI_Axis : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ CONSTRUCTIONAPI_EXPORT
+ explicit ConstructionAPI_Axis(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Axis(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Axis(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theCylindricalFace);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Axis(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+ /// Destructor
+ CONSTRUCTIONAPI_EXPORT
+ virtual ~ConstructionAPI_Axis();
+
+ INTERFACE_7(ConstructionPlugin_Axis::ID(),
+ creationMethod, ConstructionPlugin_Axis::METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ firstPoint, ConstructionPlugin_Axis::POINT_FIRST(), ModelAPI_AttributeSelection, /** First point */,
+ secondPoint, ConstructionPlugin_Axis::POINT_SECOND(), ModelAPI_AttributeSelection, /** Second point */,
+ cylindricalFace, ConstructionPlugin_Axis::CYLINDRICAL_FACE(), ModelAPI_AttributeSelection, /** Cylindrical face */,
+ xDirection, ConstructionPlugin_Axis::X_DIRECTION(), ModelAPI_AttributeDouble, /** X direction */,
+ yDirection, ConstructionPlugin_Axis::Y_DIRECTION(), ModelAPI_AttributeDouble, /** Y direction */,
+ zDirection, ConstructionPlugin_Axis::Z_DIRECTION(), ModelAPI_AttributeDouble, /** Z direction */
+ )
+
+ /// Set points
+ CONSTRUCTIONAPI_EXPORT
+ void setPoints(const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2);
+
+ /// Set cylindrical face
+ CONSTRUCTIONAPI_EXPORT
+ void setCylindricalFace(const ModelHighAPI_Selection & theCylindricalFace);
+
+ /// Set direction
+ CONSTRUCTIONAPI_EXPORT
+ void setPointAndDirection(const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+};
+
+//! Pointer on Axis object
+typedef std::shared_ptr<ConstructionAPI_Axis> AxisPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Axis feature
+ */
+CONSTRUCTIONAPI_EXPORT
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & thePoint1,
+ const ModelHighAPI_Selection & thePoint2);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Axis feature
+ */
+CONSTRUCTIONAPI_EXPORT
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theCylindricalFace);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Axis feature
+ */
+CONSTRUCTIONAPI_EXPORT
+AxisPtr addAxis(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & thePoint,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_AXIS_H_ */
--- /dev/null
+// Name : ConstructionAPI_Plane.cpp
+// Purpose:
+//
+// History:
+// 27/05/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI_Plane.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ConstructionAPI_Plane::ConstructionAPI_Plane(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ConstructionAPI_Plane::ConstructionAPI_Plane(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setFaceAndDistance(theFace, theDistance);
+}
+
+ConstructionAPI_Plane::ConstructionAPI_Plane(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setGeneralEquation(theA, theB, theC, theD);
+}
+
+ConstructionAPI_Plane::~ConstructionAPI_Plane()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void ConstructionAPI_Plane::setFaceAndDistance(
+ const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance)
+{
+ fillAttribute(theFace, myface);
+ fillAttribute(theDistance, mydistance);
+
+ execute();
+}
+
+void ConstructionAPI_Plane::setGeneralEquation(
+ const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD)
+{
+ fillAttribute(theA, myA);
+ fillAttribute(theB, myB);
+ fillAttribute(theC, myC);
+ fillAttribute(theD, myD);
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
+ return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance));
+}
+
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
+ return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD));
+}
--- /dev/null
+// Name : ConstructionAPI_Plane.h
+// Purpose:
+//
+// History:
+// 27/05/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_
+#define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI.h"
+
+#include <ConstructionPlugin_Plane.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class ConstructionAPI_Plane
+ * \ingroup CPPHighAPI
+ * \brief Interface for Plane feature
+ */
+class ConstructionAPI_Plane : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ CONSTRUCTIONAPI_EXPORT
+ explicit ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Plane(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD);
+ /// Destructor
+ CONSTRUCTIONAPI_EXPORT
+ virtual ~ConstructionAPI_Plane();
+
+ INTERFACE_7(ConstructionPlugin_Plane::ID(),
+ creationMethod, ConstructionPlugin_Plane::METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ face, ConstructionPlugin_Plane::FACE(), ModelAPI_AttributeSelection, /** Plane face */,
+ distance, ConstructionPlugin_Plane::DISTANCE(), ModelAPI_AttributeDouble, /** Distance */,
+ A, ConstructionPlugin_Plane::A(), ModelAPI_AttributeDouble, /** Parameter A for general equation */,
+ B, ConstructionPlugin_Plane::B(), ModelAPI_AttributeDouble, /** Parameter B for general equation */,
+ C, ConstructionPlugin_Plane::C(), ModelAPI_AttributeDouble, /** Parameter C for general equation */,
+ D, ConstructionPlugin_Plane::D(), ModelAPI_AttributeDouble, /** Parameter D for general equation */
+ )
+
+ /// Set face and distance
+ CONSTRUCTIONAPI_EXPORT
+ void setFaceAndDistance(const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance);
+
+ /// Set GeneralEquation parameters of the feature
+ CONSTRUCTIONAPI_EXPORT
+ void setGeneralEquation(const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD);
+};
+
+//! Pointer on Plane object
+typedef std::shared_ptr<ConstructionAPI_Plane> PlanePtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Plane feature
+ */
+CONSTRUCTIONAPI_EXPORT
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theFace,
+ const ModelHighAPI_Double & theDistance);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Plane feature
+ */
+CONSTRUCTIONAPI_EXPORT
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double & theA,
+ const ModelHighAPI_Double & theB,
+ const ModelHighAPI_Double & theC,
+ const ModelHighAPI_Double & theD);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */
--- /dev/null
+// Name : ConstructionAPI_Point.cpp
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI_Point.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ConstructionAPI_Point::ConstructionAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ConstructionAPI_Point::ConstructionAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setPoint(theX, theY, theZ);
+}
+
+ConstructionAPI_Point::~ConstructionAPI_Point()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void ConstructionAPI_Point::setPoint(const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ)
+{
+ fillAttribute(theX, myx);
+ fillAttribute(theY, myy);
+ fillAttribute(theZ, myz);
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+PointPtr addPoint(
+ const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double& theX,
+ const ModelHighAPI_Double& theY,
+ const ModelHighAPI_Double& theZ)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+ return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
+}
--- /dev/null
+// Name : ConstructionAPI_Point.h
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
+#define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_
+
+//--------------------------------------------------------------------------------------
+#include "ConstructionAPI.h"
+
+#include <ConstructionPlugin_Point.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelAPI_AttributeDouble;
+class ModelAPI_Document;
+class ModelHighAPI_Double;
+//--------------------------------------------------------------------------------------
+/**\class ConstructionAPI_Point
+ * \ingroup CPPHighAPI
+ * \brief Interface for Point feature
+ */
+class ConstructionAPI_Point : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ CONSTRUCTIONAPI_EXPORT
+ explicit ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ CONSTRUCTIONAPI_EXPORT
+ ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+ /// Destructor
+ CONSTRUCTIONAPI_EXPORT
+ virtual ~ConstructionAPI_Point();
+
+ INTERFACE_3(ConstructionPlugin_Point::ID(),
+ x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
+ y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
+ z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */
+ )
+
+ /// Set point values
+ CONSTRUCTIONAPI_EXPORT
+ void setPoint(const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+};
+
+//! Pointer on Point object
+typedef std::shared_ptr<ConstructionAPI_Point> PointPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Point feature
+ */
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Double & theX,
+ const ModelHighAPI_Double & theY,
+ const ModelHighAPI_Double & theZ);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ConstructionAPI_swig.h
+// Created: Mar 29, 2016
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_
+#define SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "ConstructionAPI.h"
+ #include "ConstructionAPI_Axis.h"
+ #include "ConstructionAPI_Plane.h"
+ #include "ConstructionAPI_Point.h"
+
+#endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_SWIG_H_ */
--- /dev/null
+import unittest
+
+import ModelAPI
+import ConstructionAPI
+
+class PointTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.session = ModelAPI.ModelAPI_Session.get()
+ self.doc = self.session.moduleDocument()
+ self.session.startOperation()
+ self.feature = self.doc.addFeature("Point")
+ self.feature.execute()
+ self.session.finishOperation()
+
+ def tearDown(self):
+ self.session.closeAll()
+
+ def test_ConstructorWithValues(self):
+ point = ConstructionAPI.ConstructionAPI_Point(self.feature, 10, "20", "x + 30")
+ self.assertEqual(10, point.x().value())
+ self.assertEqual("20", point.y().text())
+ self.assertEqual("x + 30", point.z().text())
+
+ def test_setValue(self):
+ point = ConstructionAPI.ConstructionAPI_Point(self.feature)
+ self.assertEqual(0, point.x().value())
+ self.assertEqual(0, point.y().value())
+ self.assertEqual(0, point.z().value())
+
+ point.setPoint(10, "20", "x + 30")
+ self.assertEqual(10, point.x().value())
+ self.assertEqual("20", point.y().text())
+ self.assertEqual("x + 30", point.z().text())
+
+if __name__ == "__main__":
+ unittest.main()
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ExchangeAPI.h
+ ExchangeAPI_Export.h
+ ExchangeAPI_Import.h
+)
+
+SET(PROJECT_SOURCES
+ ExchangeAPI_Export.cpp
+ ExchangeAPI_Import.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ExchangePlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ExchangePlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DEXCHANGEAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ExchangeAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ExchangeAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ExchangeAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ExchangeAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ ExchangeAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ExchangeAPI_EXTRA_DEPS ${SWIG_MODULE_ExchangeAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ExchangeAPI python ExchangeAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ExchangeAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ExchangeAPI PROPERTIES DEBUG_OUTPUT_NAME _ExchangeAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ExchangeAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ExchangeAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ExchangeAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+ TestExchange.py
+)
+
+# ADD_SUBDIRECTORY (Test)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef EXCHANGEAPI_H
+#define EXCHANGEAPI_H
+
+#if defined EXCHANGEAPI_EXPORTS
+#if defined WIN32
+#define EXCHANGEAPI_EXPORT __declspec( dllexport )
+#else
+#define EXCHANGEAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define EXCHANGEAPI_EXPORT __declspec( dllimport )
+#else
+#define EXCHANGEAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ExchangeAPI.i */
+
+%module ExchangeAPI
+
+%{
+ #include "ExchangeAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define EXCHANGEAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_list.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(ExchangeAPI_Export)
+%shared_ptr(ExchangeAPI_Import)
+
+// all supported interfaces
+%include "ExchangeAPI_Export.h"
+%include "ExchangeAPI_Import.h"
--- /dev/null
+// Name : ExchangeAPI_Export.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ExchangeAPI_Export.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ExchangeAPI_Export::ExchangeAPI_Export(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ExchangeAPI_Export::ExchangeAPI_Export(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theFilePath,
+ const std::string & theFileFormat,
+ const std::list<ModelHighAPI_Selection> & theSelectionList)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ setFilePath(theFilePath);
+ setFileFormat(theFileFormat);
+ setSelectionList(theSelectionList);
+ execute();
+ }
+}
+
+ExchangeAPI_Export::~ExchangeAPI_Export()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void ExchangeAPI_Export::setFilePath(const std::string & theFilePath)
+{
+ fillAttribute(theFilePath, myfilePath);
+}
+
+void ExchangeAPI_Export::setFileFormat(const std::string & theFileFormat)
+{
+ fillAttribute(theFileFormat, myfileFormat);
+}
+
+void ExchangeAPI_Export::setSelectionList(
+ const std::list<ModelHighAPI_Selection> & theSelectionList)
+{
+ fillAttribute(theSelectionList, myselectionList);
+}
+
+//--------------------------------------------------------------------------------------
+ExportPtr exportToFile(
+ const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theFilePath,
+ const std::string & theFileFormat,
+ const std::list<ModelHighAPI_Selection> & theSelectionList)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Export::ID());
+ return ExportPtr(new ExchangeAPI_Export(aFeature, theFilePath, theFileFormat, theSelectionList));
+}
--- /dev/null
+// Name : ExchangeAPI_Export.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
+#define SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_
+
+//--------------------------------------------------------------------------------------
+#include "ExchangeAPI.h"
+
+#include <list>
+#include <string>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+#include <ExchangePlugin_ExportFeature.h>
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class ExchangeAPI_Export
+ * \ingroup CPPHighAPI
+ * \brief Interface for Export feature
+ */
+class ExchangeAPI_Export : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ EXCHANGEAPI_EXPORT
+ explicit ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ EXCHANGEAPI_EXPORT
+ ExchangeAPI_Export(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theFilePath,
+ const std::string & theFileFormat,
+ const std::list<ModelHighAPI_Selection> & theSelectionList);
+ /// Destructor
+ EXCHANGEAPI_EXPORT
+ virtual ~ExchangeAPI_Export();
+
+ INTERFACE_3(ExchangePlugin_ExportFeature::ID(),
+ filePath, ExchangePlugin_ExportFeature::FILE_PATH_ID(), ModelAPI_AttributeString, /** File path */,
+ fileFormat, ExchangePlugin_ExportFeature::FILE_FORMAT_ID(), ModelAPI_AttributeString, /** File format */,
+ selectionList, ExchangePlugin_ExportFeature::SELECTION_LIST_ID(), ModelAPI_AttributeSelectionList, /** Selection list */
+ )
+
+ /// Set file path (without execute)
+ EXCHANGEAPI_EXPORT
+ void setFilePath(const std::string & theFilePath);
+
+ /// Set file format (without execute)
+ EXCHANGEAPI_EXPORT
+ void setFileFormat(const std::string & theFileFormat);
+
+
+ /// Set selection list (without execute)
+ EXCHANGEAPI_EXPORT
+ void setSelectionList(const std::list<ModelHighAPI_Selection> & theSelectionList);
+};
+
+//! Pointer on Export object
+typedef std::shared_ptr<ExchangeAPI_Export> ExportPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Export feature
+ */
+EXCHANGEAPI_EXPORT
+ExportPtr exportToFile(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theFilePath,
+ const std::string & theFileFormat,
+ const std::list<ModelHighAPI_Selection> & theSelectionList);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_EXPORT_H_ */
--- /dev/null
+// Name : ExchangeAPI_Import.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ExchangeAPI_Import.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ExchangeAPI_Import::ExchangeAPI_Import(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ExchangeAPI_Import::ExchangeAPI_Import(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theFilePath)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize())
+ setFilePath(theFilePath);
+}
+
+ExchangeAPI_Import::~ExchangeAPI_Import()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void ExchangeAPI_Import::setFilePath(const std::string & theFilePath)
+{
+ fillAttribute(theFilePath, myfilePath);
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+ImportPtr addImport(
+ const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theFilePath)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ExchangeAPI_Import::ID());
+ return ImportPtr(new ExchangeAPI_Import(aFeature, theFilePath));
+}
--- /dev/null
+// Name : ExchangeAPI_Import.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_
+#define SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_
+
+//--------------------------------------------------------------------------------------
+#include "ExchangeAPI.h"
+
+#include <string>
+
+#include <ExchangePlugin_ImportFeature.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+/**\class ExchangeAPI_Import
+ * \ingroup CPPHighAPI
+ * \brief Interface for Import feature
+ */
+class ExchangeAPI_Import : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ EXCHANGEAPI_EXPORT
+ explicit ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ EXCHANGEAPI_EXPORT
+ ExchangeAPI_Import(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theFilePath);
+ /// Destructor
+ EXCHANGEAPI_EXPORT
+ virtual ~ExchangeAPI_Import();
+
+ INTERFACE_1(ExchangePlugin_ImportFeature::ID(),
+ filePath, ExchangePlugin_ImportFeature::FILE_PATH_ID(), ModelAPI_AttributeString, /** File path */
+ )
+
+ /// Set point values
+ EXCHANGEAPI_EXPORT
+ void setFilePath(const std::string & theFilePath);
+};
+
+//! Pointer on Import object
+typedef std::shared_ptr<ExchangeAPI_Import> ImportPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Import feature
+ */
+EXCHANGEAPI_EXPORT
+ImportPtr addImport(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theFilePath);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_IMPORT_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ExchangeAPI_swig.h
+// Created: 07/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_
+#define SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "ExchangeAPI.h"
+ #include "ExchangeAPI_Export.h"
+ #include "ExchangeAPI_Import.h"
+
+#endif /* SRC_EXCHANGEAPI_EXCHANGEAPI_SWIG_H_ */
--- /dev/null
+import unittest
+
+import ModelAPI
+import ExchangeAPI
+
+class ExchangeTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.session = ModelAPI.ModelAPI_Session.get()
+ self.doc = self.session.moduleDocument()
+
+ def tearDown(self):
+ self.session.closeAll()
+
+ def test_addImport(self):
+ self.session.startOperation()
+ self.feature = ExchangeAPI.addImport(self.doc, "file_path")
+ self.session.finishOperation()
+
+ def test_addExport(self):
+ self.session.startOperation()
+ self.feature = ExchangeAPI.exportToFile(self.doc, "file_path", "file_format", [])
+ self.session.finishOperation()
+
+if __name__ == "__main__":
+ unittest.main()
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ FeaturesAPI.h
+ FeaturesAPI_Boolean.h
+ FeaturesAPI_Extrusion.h
+ FeaturesAPI_ExtrusionBoolean.h
+ FeaturesAPI_Group.h
+ FeaturesAPI_Intersection.h
+ FeaturesAPI_Partition.h
+ FeaturesAPI_Pipe.h
+ FeaturesAPI_Placement.h
+ FeaturesAPI_RemoveSubShapes.h
+ FeaturesAPI_Revolution.h
+ FeaturesAPI_RevolutionBoolean.h
+ FeaturesAPI_Rotation.h
+ FeaturesAPI_Translation.h
+)
+
+SET(PROJECT_SOURCES
+ FeaturesAPI_Boolean.cpp
+ FeaturesAPI_Extrusion.cpp
+ FeaturesAPI_ExtrusionBoolean.cpp
+ FeaturesAPI_Group.cpp
+ FeaturesAPI_Intersection.cpp
+ FeaturesAPI_Partition.cpp
+ FeaturesAPI_Pipe.cpp
+ FeaturesAPI_Placement.cpp
+ FeaturesAPI_RemoveSubShapes.cpp
+ FeaturesAPI_Revolution.cpp
+ FeaturesAPI_RevolutionBoolean.cpp
+ FeaturesAPI_Rotation.cpp
+ FeaturesAPI_Translation.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/FeaturesPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DFEATURESAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(FeaturesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(FeaturesAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ FeaturesAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_FeaturesAPI_EXTRA_DEPS ${SWIG_MODULE_FeaturesAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(FeaturesAPI python FeaturesAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(FeaturesAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_FeaturesAPI PROPERTIES DEBUG_OUTPUT_NAME _FeaturesAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _FeaturesAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS FeaturesAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/FeaturesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+)
+
+# ADD_SUBDIRECTORY (Test)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef FEATURESAPI_H
+#define FEATURESAPI_H
+
+#if defined FEATURESAPI_EXPORTS
+#if defined WIN32
+#define FEATURESAPI_EXPORT __declspec( dllexport )
+#else
+#define FEATURESAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define FEATURESAPI_EXPORT __declspec( dllimport )
+#else
+#define FEATURESAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* FeaturesAPI.i */
+
+%module FeaturesAPI
+
+%{
+ #include "FeaturesAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define FEATURESAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(FeaturesAPI_Boolean)
+%shared_ptr(FeaturesAPI_Extrusion)
+%shared_ptr(FeaturesAPI_ExtrusionBoolean)
+%shared_ptr(FeaturesAPI_ExtrusionCut)
+%shared_ptr(FeaturesAPI_ExtrusionFuse)
+%shared_ptr(FeaturesAPI_Group)
+%shared_ptr(FeaturesAPI_Intersection)
+%shared_ptr(FeaturesAPI_Partition)
+%shared_ptr(FeaturesAPI_Pipe)
+%shared_ptr(FeaturesAPI_Placement)
+%shared_ptr(FeaturesAPI_RemoveSubShapes)
+%shared_ptr(FeaturesAPI_Revolution)
+%shared_ptr(FeaturesAPI_RevolutionBoolean)
+%shared_ptr(FeaturesAPI_RevolutionCut)
+%shared_ptr(FeaturesAPI_RevolutionFuse)
+%shared_ptr(FeaturesAPI_Rotation)
+%shared_ptr(FeaturesAPI_Translation)
+
+// all supported interfaces
+%include "FeaturesAPI_Boolean.h"
+%include "FeaturesAPI_Extrusion.h"
+%include "FeaturesAPI_ExtrusionBoolean.h"
+%include "FeaturesAPI_Group.h"
+%include "FeaturesAPI_Intersection.h"
+%include "FeaturesAPI_Partition.h"
+%include "FeaturesAPI_Pipe.h"
+%include "FeaturesAPI_Placement.h"
+%include "FeaturesAPI_RemoveSubShapes.h"
+%include "FeaturesAPI_Revolution.h"
+%include "FeaturesAPI_RevolutionBoolean.h"
+%include "FeaturesAPI_Rotation.h"
+%include "FeaturesAPI_Translation.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Boolean.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Boolean.h"
+
+#include <ModelHighAPI_Integer.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Integer& theBoolType,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBoolType, myboolType);
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Boolean::~FeaturesAPI_Boolean()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setBoolType(const ModelHighAPI_Integer& theBoolType)
+{
+ fillAttribute(theBoolType, myboolType);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+//==================================================================================================
+BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_CUT,
+ theMainObjects,
+ theToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ std::list<ModelHighAPI_Selection> aToolObjects;
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_FUSE,
+ theObjects,
+ aToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_FUSE,
+ theMainObjects,
+ theToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_COMMON,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Boolean.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Boolean_H_
+#define FeaturesAPI_Boolean_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Boolean.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean feature.
+class FeaturesAPI_Boolean: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Integer& theBoolType,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Boolean();
+
+ INTERFACE_3(FeaturesPlugin_Boolean::ID(),
+ boolType, FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger, /** Operation type */,
+ mainObjects, FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_Boolean::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set operation type.
+ FEATURESAPI_EXPORT
+ void setBoolType(const ModelHighAPI_Integer& theBoolType);
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_Boolean> BooleanPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Cut feature.
+FEATURESAPI_EXPORT
+BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Common feature.
+FEATURESAPI_EXPORT
+BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_Boolean_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Extrusion.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Extrusion.h"
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ setSizes(theSize, ModelHighAPI_Double());
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ setSizes(theSize, ModelHighAPI_Double());
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ setSizes(theToSize, theFromSize);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ setSizes(theToSize, theFromSize);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Extrusion::~FeaturesAPI_Extrusion()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setDirection(const ModelHighAPI_Selection& theDirection)
+{
+ fillAttribute(theDirection, mydirection);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setSizes(const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setSize(const ModelHighAPI_Double& theSize)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Extrusion::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+
+ execute();
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theDirection, theSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature, theBaseObjects, theToSize, theFromSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToSize,
+ theFromSize));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+ theBaseObjects,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset));
+}
+
+//==================================================================================================
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Extrusion::ID());
+ return ExtrusionPtr(new FeaturesAPI_Extrusion(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Extrusion.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Extrusion_H_
+#define FeaturesAPI_Extrusion_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Extrusion.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Extrusion
+/// \ingroup CPPHighAPI
+/// \brief Interface for Extrusion feature.
+class FeaturesAPI_Extrusion: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize);
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Extrusion(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Extrusion();
+
+ INTERFACE_10(FeaturesPlugin_Extrusion::ID(),
+ baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, /** To size */,
+ fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, /** From size */,
+ toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
+ toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
+ fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
+ fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
+ direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */,
+ sketchLauncher, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify direction_object attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setDirection(const ModelHighAPI_Selection& theDirection);
+
+ /// Modify CreationMethod, to_size, from_size attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
+
+ /// Modify creation_method, to_size, from_size attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setSize(const ModelHighAPI_Double& theSize);
+
+ /// Modify creation_method, to_object, to_offset, from_object, from_offset attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+};
+
+/// Pointer on Extrusion object.
+typedef std::shared_ptr<FeaturesAPI_Extrusion> ExtrusionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Extrusion feature.
+FEATURESAPI_EXPORT
+ExtrusionPtr addExtrusion(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+#endif // FeaturesAPI_Extrusion_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_ExtrusionBoolean.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_ExtrusionBoolean.h"
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_ExtrusionBoolean::FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionBoolean::~FeaturesAPI_ExtrusionBoolean()
+{
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setDirection(const ModelHighAPI_Selection& theDirection)
+{
+ fillAttribute(theDirection, mydirection);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setSizes(const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setSize(const ModelHighAPI_Double& theSize)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_SIZES(), mycreationMethod);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ fillAttribute(FeaturesPlugin_Extrusion::CREATION_METHOD_BY_PLANES(), mycreationMethod);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_ExtrusionBoolean::setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ fillAttribute(theBooleanObjects, mybooleanObjects);
+
+ execute();
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionCut::FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToSize,
+ theFromSize,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
+ theBaseObjects,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionCut::ID());
+ return ExtrusionCutPtr(new FeaturesAPI_ExtrusionCut(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
+
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theSize, mytoSize);
+ fillAttribute(ModelHighAPI_Double(), myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theToSize, mytoSize);
+ fillAttribute(theFromSize, myfromSize);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_ExtrusionFuse::FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_ExtrusionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theDirection, mydirection);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theDirection, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature, theBaseObjects, theToSize, theFromSize, theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToSize,
+ theFromSize,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
+ theBaseObjects,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_ExtrusionFuse::ID());
+ return ExtrusionFusePtr(new FeaturesAPI_ExtrusionFuse(aFeature,
+ theBaseObjects,
+ theDirection,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_ExtrusionBoolean.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_ExtrusionBoolean_H_
+#define FeaturesAPI_ExtrusionBoolean_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_CompositeBoolean.h>
+#include <FeaturesPlugin_ExtrusionCut.h>
+#include <FeaturesPlugin_ExtrusionFuse.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_ExtrusionBoolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for ExtrusionBoolean feature.
+class FeaturesAPI_ExtrusionBoolean: public ModelHighAPI_Interface
+{
+public:
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_ExtrusionBoolean();
+
+ INTERFACE_11("",
+ sketchLauncher, FeaturesPlugin_Extrusion::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */,
+ baseObjects, FeaturesPlugin_Extrusion::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ direction, FeaturesPlugin_Extrusion::DIRECTION_OBJECT_ID(), ModelAPI_AttributeSelection, /** Direction */,
+ creationMethod, FeaturesPlugin_Extrusion::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ toSize, FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble, /** To size */,
+ fromSize, FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble, /** From size */,
+ toObject, FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
+ toOffset, FeaturesPlugin_Extrusion::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
+ fromObject, FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
+ fromOffset, FeaturesPlugin_Extrusion::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
+ booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Boolean objects */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify direction_object attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setDirection(const ModelHighAPI_Selection& theDirection);
+
+ /// Modify CreationMethod, to_size, from_size attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setSizes(const ModelHighAPI_Double& theToSize, const ModelHighAPI_Double& theFromSize);
+
+ /// Modify creation_method, to_size, from_size attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setSize(const ModelHighAPI_Double& theSize);
+
+ /// Modify creation_method, to_object, to_offset, from_object, from_offset attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+ /// Modiyfy main_objects attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+protected:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+};
+
+class FeaturesAPI_ExtrusionCut: public FeaturesAPI_ExtrusionBoolean
+{
+public:
+ FEATURESAPI_EXPORT
+ virtual std::string getID() {
+ return FeaturesPlugin_ExtrusionCut::ID();
+ }
+
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+};
+
+/// Pointer on ExtrusionCut object.
+typedef std::shared_ptr<FeaturesAPI_ExtrusionCut> ExtrusionCutPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionCut feature.
+FEATURESAPI_EXPORT
+ExtrusionCutPtr addExtrusionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+class FeaturesAPI_ExtrusionFuse: public FeaturesAPI_ExtrusionBoolean
+{
+public:
+ FEATURESAPI_EXPORT
+ virtual std::string getID() {
+ return FeaturesPlugin_ExtrusionFuse::ID();
+ }
+
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_ExtrusionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+};
+
+/// Pointer on ExtrusionFuse object.
+typedef std::shared_ptr<FeaturesAPI_ExtrusionFuse> ExtrusionFusePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Double& theToSize,
+ const ModelHighAPI_Double& theFromSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create ExtrusionFuse feature.
+FEATURESAPI_EXPORT
+ExtrusionFusePtr addExtrusionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theDirection,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+#endif // FeaturesAPI_ExtrusionBoolean_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Group.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Group.h"
+
+#include <ModelHighAPI_Integer.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Group::FeaturesAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Group::FeaturesAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theGroupList)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setGroupList(theGroupList);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Group::~FeaturesAPI_Group()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Group::setGroupList(const std::list<ModelHighAPI_Selection>& theGroupList)
+{
+ fillAttribute(theGroupList, mygroupList);
+
+ execute();
+}
+
+//==================================================================================================
+GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theGroupList)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Group::ID());
+ return GroupPtr(new FeaturesAPI_Group(aFeature, theGroupList));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Group.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Group_H_
+#define FeaturesAPI_Group_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Group.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Group
+/// \ingroup CPPHighAPI
+/// \brief Interface for Group feature.
+class FeaturesAPI_Group: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Group(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theGroupList);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Group();
+
+ INTERFACE_1(FeaturesPlugin_Group::ID(),
+ groupList, FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList, /** Group list*/)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setGroupList(const std::list<ModelHighAPI_Selection>& theGroupList);
+};
+
+/// Pointer on Group object.
+typedef std::shared_ptr<FeaturesAPI_Group> GroupPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Group feature.
+FEATURESAPI_EXPORT
+GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theGroupList);
+
+#endif // FeaturesAPI_Group_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Intersection.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Intersection.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const std::list<ModelHighAPI_Selection>& theTools)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theObjects, myobjects);
+ fillAttribute(theTools, mytools);
+
+ execute();
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Intersection::~FeaturesAPI_Intersection()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Intersection::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ fillAttribute(theObjects, myobjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>& theTools)
+{
+ fillAttribute(theTools, mytools);
+
+ execute();
+}
+
+//==================================================================================================
+IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const std::list<ModelHighAPI_Selection>& theTools)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Intersection::ID());
+ return IntersectionPtr(new FeaturesAPI_Intersection(aFeature, theObjects, theTools));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Intersection.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Intersection_H_
+#define FeaturesAPI_Intersection_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Intersection.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Intersection
+/// \ingroup CPPHighAPI
+/// \brief Interface for Intersection feature.
+class FeaturesAPI_Intersection: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const std::list<ModelHighAPI_Selection>& theTools);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Intersection();
+
+ INTERFACE_2(FeaturesPlugin_Intersection::ID(),
+ objects, FeaturesPlugin_Intersection::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Objects */,
+ tools, FeaturesPlugin_Intersection::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tools */)
+
+ /// Modify objects attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
+
+ /// Modify tools attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setTools(const std::list<ModelHighAPI_Selection>& theTools);
+};
+
+/// Pointer on Intersection object.
+typedef std::shared_ptr<FeaturesAPI_Intersection> IntersectionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Intersection feature.
+FEATURESAPI_EXPORT
+IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const std::list<ModelHighAPI_Selection>& theTools);
+
+#endif // FeaturesAPI_Intersection_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Partition.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Partition.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBaseObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Partition::~FeaturesAPI_Partition()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Partition::ID());
+ return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Partition.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Partition_H_
+#define FeaturesAPI_Partition_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Partition.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Partition
+/// \ingroup CPPHighAPI
+/// \brief Interface for Partition feature.
+class FeaturesAPI_Partition: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Partition();
+
+ INTERFACE_1(FeaturesPlugin_Partition::ID(),
+ baseObjects, FeaturesPlugin_Partition::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+};
+
+/// Pointer on Partition object.
+typedef std::shared_ptr<FeaturesAPI_Partition> PartitionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Partition feature.
+FEATURESAPI_EXPORT
+PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+#endif // FeaturesAPI_Partition_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Pipe.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Pipe.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ setPath(thePath);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setByBasePathBiNormal(theBaseObjects, thePath, theBiNoramal);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setByBasePathLocations(theBaseObjects, thePath, theLocations);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Pipe::~FeaturesAPI_Pipe()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setPath(const ModelHighAPI_Selection& thePath)
+{
+ fillAttribute(thePath, mypath);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePath(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_SIMPLE(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePathBiNormal(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_BINORMAL(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+ fillAttribute(theBiNoramal, mybiNormal);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Pipe::setByBasePathLocations(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+{
+ fillAttribute(FeaturesPlugin_Pipe::CREATION_METHOD_LOCATIONS(), mycreationMethod);
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(thePath, mypath);
+ fillAttribute(theLocations, mylocations);
+
+ execute();
+}
+
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath));
+}
+
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theBiNoramal));
+}
+
+//==================================================================================================
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Pipe::ID());
+ return PipePtr(new FeaturesAPI_Pipe(aFeature, theBaseObjects, thePath, theLocations));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Pipe.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Pipe_H_
+#define FeaturesAPI_Pipe_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Pipe.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Pipe
+/// \ingroup CPPHighAPI
+/// \brief Interface for Pipe feature.
+class FeaturesAPI_Pipe: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Pipe(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Pipe();
+
+ INTERFACE_5(FeaturesPlugin_Pipe::ID(),
+ baseObjects, FeaturesPlugin_Pipe::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ path, FeaturesPlugin_Pipe::PATH_OBJECT_ID(), ModelAPI_AttributeSelection, /** Path */,
+ creationMethod, FeaturesPlugin_Pipe::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ biNormal, FeaturesPlugin_Pipe::BINORMAL_ID(), ModelAPI_AttributeSelection, /** Bi-Normal */,
+ locations, FeaturesPlugin_Pipe::LOCATIONS_ID(), ModelAPI_AttributeSelectionList, /** Locations */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify path attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setPath(const ModelHighAPI_Selection& thePath);
+
+ /// Modify creation method, base and path.
+ FEATURESAPI_EXPORT
+ void setByBasePath(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+ /// Modify creation method, base, path and bi-normal.
+ FEATURESAPI_EXPORT
+ void setByBasePathBiNormal(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+ /// Modify creation method, base, path and locations.
+ FEATURESAPI_EXPORT
+ void setByBasePathLocations(const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+};
+
+/// Pointer on Pipe object.
+typedef std::shared_ptr<FeaturesAPI_Pipe> PipePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const ModelHighAPI_Selection& theBiNoramal);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Pipe feature.
+FEATURESAPI_EXPORT
+PipePtr addPipe(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& thePath,
+ const std::list<ModelHighAPI_Selection>& theLocations);
+
+#endif // FeaturesAPI_Pipe_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Placement.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Placement.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection,
+ const bool theCentering)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theObjects, myobjects);
+ fillAttribute(theStartShape, mystartShape);
+ fillAttribute(theEndShape, myendShape);
+ fillAttribute(theReverseDirection, myreverseDirection);
+ setCentering(theCentering);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Placement::~FeaturesAPI_Placement()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ fillAttribute(theObjects, myobjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setStartShape(const ModelHighAPI_Selection& theStartShape)
+{
+ fillAttribute(theStartShape, mystartShape);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setEndShape(const ModelHighAPI_Selection& theEndShape)
+{
+ fillAttribute(theEndShape, myendShape);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setReverseDirection(const bool theReverseDirection)
+{
+ fillAttribute(theReverseDirection, myreverseDirection);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setCentering(const bool theCentering)
+{
+ fillAttribute(theCentering, mycentering);
+
+ execute();
+}
+
+//==================================================================================================
+PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection,
+ const bool theCentering)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Placement::ID());
+ return PlacementPtr(new FeaturesAPI_Placement(aFeature,
+ theObjects,
+ theStartShape,
+ theEndShape,
+ theReverseDirection,
+ theCentering));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Placement.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Placement_H_
+#define FeaturesAPI_Placement_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Placement.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Placement
+/// \ingroup CPPHighAPI
+/// \brief Interface for Placement feature.
+class FeaturesAPI_Placement: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection = false,
+ const bool theCentering = false);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Placement();
+
+ INTERFACE_5(FeaturesPlugin_Placement::ID(),
+ objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ startShape, FeaturesPlugin_Placement::START_SHAPE_ID(), ModelAPI_AttributeSelection, /** Start shape */,
+ endShape, FeaturesPlugin_Placement::END_SHAPE_ID(), ModelAPI_AttributeSelection, /** End shape */,
+ reverseDirection, FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean, /** Reverse direction flag */,
+ centering, FeaturesPlugin_Placement::CENTERING_ID(), ModelAPI_AttributeBoolean, /** Centering flag */)
+
+ /// Set objects.
+ FEATURESAPI_EXPORT
+ void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
+
+ /// Set start shape.
+ FEATURESAPI_EXPORT
+ void setStartShape(const ModelHighAPI_Selection& theStartShape);
+
+ /// Set end shape.
+ FEATURESAPI_EXPORT
+ void setEndShape(const ModelHighAPI_Selection& theEndShape);
+
+ /// Set reverse direction flag.
+ FEATURESAPI_EXPORT
+ void setReverseDirection(const bool theReverseDirection);
+
+ /// Set centering flag.
+ FEATURESAPI_EXPORT
+ void setCentering(const bool theCentering);
+};
+
+/// Pointer on Placement object.
+typedef std::shared_ptr<FeaturesAPI_Placement> PlacementPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Placement feature.
+FEATURESAPI_EXPORT
+PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection = false,
+ const bool theCentering = false);
+
+#endif // FeaturesAPI_Placement_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_RemoveSubShapes.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_RemoveSubShapes.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theBase)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBase(theBase);
+
+ execute();
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RemoveSubShapes::~FeaturesAPI_RemoveSubShapes()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_RemoveSubShapes::setBase(const ModelHighAPI_Selection& theBase)
+{
+ fillAttribute(theBase, mybase);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RemoveSubShapes::setSubShapesToKeep(const std::list<ModelHighAPI_Selection>& theSubShapes)
+{
+ fillAttribute(theSubShapes, mysubshapes);
+
+ execute();
+}
+
+//==================================================================================================
+RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theBase)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_RemoveSubShapes::ID());
+ return RemoveSubShapesPtr(new FeaturesAPI_RemoveSubShapes(aFeature, theBase));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_RemoveSubShapes.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_RemoveSubShapes_H_
+#define FeaturesAPI_RemoveSubShapes_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_RemoveSubShapes.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_RemoveSubShapes
+/// \ingroup CPPHighAPI
+/// \brief Interface for RemoveSubShapes feature.
+class FeaturesAPI_RemoveSubShapes: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RemoveSubShapes(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theBase);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_RemoveSubShapes();
+
+ INTERFACE_2(FeaturesPlugin_RemoveSubShapes::ID(),
+ base, FeaturesPlugin_RemoveSubShapes::BASE_SHAPE_ID(), ModelAPI_AttributeSelection, /** Base */,
+ subshapes, FeaturesPlugin_RemoveSubShapes::SUBSHAPES_ID(), ModelAPI_AttributeSelectionList, /** Subshapes */)
+
+ /// Modify objects attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const ModelHighAPI_Selection& theBase);
+
+ /// Modify tools attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setSubShapesToKeep(const std::list<ModelHighAPI_Selection>& theSubShapes);
+};
+
+/// Pointer on RemoveSubShapes object.
+typedef std::shared_ptr<FeaturesAPI_RemoveSubShapes> RemoveSubShapesPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create RemoveSubShapes feature.
+FEATURESAPI_EXPORT
+RemoveSubShapesPtr addRemoveSubShapes(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const ModelHighAPI_Selection& theBase);
+
+#endif // FeaturesAPI_RemoveSubShapes_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Revolution.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Revolution.h"
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ setAngles(theAngle, ModelHighAPI_Double());
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ setAngles(theToAngle, theFromAngle);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Revolution::FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ setPlanesAndOffsets(theToObject, theToOffset, theFromObject, theFromOffset);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Revolution::~FeaturesAPI_Revolution()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::setAxis(const ModelHighAPI_Selection& theAxis)
+{
+ fillAttribute(theAxis, myaxis);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::setAngles(const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle)
+{
+ fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
+ fillAttribute(theToAngle, mytoAngle);
+ fillAttribute(theFromAngle, myfromAngle);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::setAngle(const ModelHighAPI_Double& theAngle)
+{
+ fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
+ fillAttribute(theAngle, mytoAngle);
+ fillAttribute(ModelHighAPI_Double(), myfromAngle);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Revolution::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ fillAttribute("ByPlanesAndOffsets", mycreationMethod);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+
+ execute();
+}
+
+//==================================================================================================
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
+ return RevolutionPtr(new FeaturesAPI_Revolution(aFeature, theBaseObjects, theAxis, theAngle));
+}
+
+//==================================================================================================
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
+ return RevolutionPtr(new FeaturesAPI_Revolution(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToAngle,
+ theFromAngle));
+}
+
+//==================================================================================================
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Revolution::ID());
+ return RevolutionPtr(new FeaturesAPI_Revolution(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Revolution.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Revolution_H_
+#define FeaturesAPI_Revolution_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Revolution.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Revolution
+/// \ingroup CPPHighAPI
+/// \brief Interface for Revolution feature.
+class FeaturesAPI_Revolution: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Revolution(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Revolution();
+
+ INTERFACE_10(FeaturesPlugin_Revolution::ID(),
+ baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis */,
+ creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble, /** To angle */,
+ fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(), ModelAPI_AttributeDouble, /** From angle */,
+ toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
+ toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
+ fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
+ fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
+ sketchLauncher, FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify axis_object attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setAxis(const ModelHighAPI_Selection& theAxis);
+
+ /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle);
+
+ /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setAngle(const ModelHighAPI_Double& theAngle);
+
+ /// Modify CreationMethod, to_object, to_offset, from_object, from_offset attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+};
+
+/// Pointer on Revolution object.
+typedef std::shared_ptr<FeaturesAPI_Revolution> RevolutionPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Revolution feature.
+FEATURESAPI_EXPORT
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Revolution feature.
+FEATURESAPI_EXPORT
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Revolution feature.
+FEATURESAPI_EXPORT
+RevolutionPtr addRevolution(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+#endif // FeaturesAPI_Revolution_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_RevolutionBoolean.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_RevolutionBoolean.h"
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_RevolutionBoolean::FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionBoolean::~FeaturesAPI_RevolutionBoolean()
+{
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
+{
+ fillAttribute(theBaseObjects, mybaseObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setAxis(const ModelHighAPI_Selection& theAxis)
+{
+ fillAttribute(theAxis, myaxis);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setAngles(const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle)
+{
+ fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
+ fillAttribute(theToAngle, mytoAngle);
+ fillAttribute(theFromAngle, myfromAngle);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setAngle(const ModelHighAPI_Double& theAngle)
+{
+ fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_ANGLES(), mycreationMethod);
+ fillAttribute(theAngle, mytoAngle);
+ fillAttribute(ModelHighAPI_Double(), myfromAngle);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset)
+{
+ fillAttribute(FeaturesPlugin_Revolution::CREATION_METHOD_BY_PLANES(), mycreationMethod);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_RevolutionBoolean::setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ fillAttribute(theBooleanObjects, mybooleanObjects);
+
+ execute();
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theSize, mytoAngle);
+ fillAttribute(ModelHighAPI_Double(), myfromAngle);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theToAngle, mytoAngle);
+ fillAttribute(theFromAngle, myfromAngle);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionCut::FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
+ return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
+ return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToAngle,
+ theFromAngle,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionCut::ID());
+ return RevolutionCutPtr(new FeaturesAPI_RevolutionCut(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
+
+
+//==================================================================================================
+FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theSize, mytoAngle);
+ fillAttribute(ModelHighAPI_Double(), myfromAngle);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theToAngle, mytoAngle);
+ fillAttribute(theFromAngle, myfromAngle);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_RevolutionFuse::FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+: FeaturesAPI_RevolutionBoolean(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theBaseObjects, mybaseObjects);
+ fillAttribute(theAxis, myaxis);
+ fillAttribute(theToObject, mytoObject);
+ fillAttribute(theToOffset, mytoOffset);
+ fillAttribute(theFromObject, myfromObject);
+ fillAttribute(theFromOffset, myfromOffset);
+ setBooleanObjects(theBooleanObjects);
+ }
+}
+
+//==================================================================================================
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theSize,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
+ return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature, theBaseObjects, theAxis, theSize, theBooleanObjects));
+}
+
+//==================================================================================================
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
+ return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToAngle,
+ theFromAngle,
+ theBooleanObjects));
+}
+
+//==================================================================================================
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesPlugin_RevolutionFuse::ID());
+ return RevolutionFusePtr(new FeaturesAPI_RevolutionFuse(aFeature,
+ theBaseObjects,
+ theAxis,
+ theToObject,
+ theToOffset,
+ theFromObject,
+ theFromOffset,
+ theBooleanObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_RevolutionBoolean.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_RevolutionBoolean_H_
+#define FeaturesAPI_RevolutionBoolean_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_CompositeBoolean.h>
+#include <FeaturesPlugin_RevolutionCut.h>
+#include <FeaturesPlugin_RevolutionFuse.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_RevolutionBoolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for RevolutionBoolean feature.
+class FeaturesAPI_RevolutionBoolean: public ModelHighAPI_Interface
+{
+public:
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_RevolutionBoolean();
+
+ INTERFACE_11("",
+ sketchLauncher, FeaturesPlugin_Revolution::SKETCH_ID(), ModelAPI_AttributeReference, /** Sketch launcher */,
+ baseObjects, FeaturesPlugin_Revolution::BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Base objects */,
+ axis, FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis */,
+ creationMethod, FeaturesPlugin_Revolution::CREATION_METHOD(), ModelAPI_AttributeString, /** Creation method */,
+ toAngle, FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble, /** To angle */,
+ fromAngle, FeaturesPlugin_Revolution::FROM_ANGLE_ID(), ModelAPI_AttributeDouble, /** From angle */,
+ toObject, FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection, /** To object */,
+ toOffset, FeaturesPlugin_Revolution::TO_OFFSET_ID(), ModelAPI_AttributeDouble, /** To offset */,
+ fromObject, FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection, /** From object */,
+ fromOffset, FeaturesPlugin_Revolution::FROM_OFFSET_ID(), ModelAPI_AttributeDouble, /** From offset */,
+ booleanObjects, FeaturesPlugin_CompositeBoolean::OBJECTS_ID(), ModelAPI_AttributeSelectionList, /** Boolean objects */)
+
+ /// Modify base attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects);
+
+ /// Modify axis_object attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setAxis(const ModelHighAPI_Selection& theAxis);
+
+ /// Modify CreationMethod, to_angle, from_angle attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setAngles(const ModelHighAPI_Double& theToAngle, const ModelHighAPI_Double& theFromAngle);
+
+ /// Modify creation_method, to_angle, from_angle attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setAngle(const ModelHighAPI_Double& theAngle);
+
+ /// Modify creation_method, to_object, to_offset, from_object, from_offset attributes of the feature.
+ FEATURESAPI_EXPORT
+ void setPlanesAndOffsets(const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset);
+
+ /// Modiyfy main_objects attribute of the feature.
+ FEATURESAPI_EXPORT
+ void setBooleanObjects(const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+protected:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionBoolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+};
+
+class FeaturesAPI_RevolutionCut: public FeaturesAPI_RevolutionBoolean
+{
+public:
+ FEATURESAPI_EXPORT
+ virtual std::string getID() {
+ return FeaturesPlugin_RevolutionCut::ID();
+ }
+
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+};
+
+/// Pointer on RevolutionCut object.
+typedef std::shared_ptr<FeaturesAPI_RevolutionCut> RevolutionCutPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionCut feature.
+FEATURESAPI_EXPORT
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionCut feature.
+FEATURESAPI_EXPORT
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionCut feature.
+FEATURESAPI_EXPORT
+RevolutionCutPtr addRevolutionCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+class FeaturesAPI_RevolutionFuse: public FeaturesAPI_RevolutionBoolean
+{
+public:
+ FEATURESAPI_EXPORT
+ virtual std::string getID() {
+ return FeaturesPlugin_RevolutionFuse::ID();
+ }
+
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_RevolutionFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+};
+
+/// Pointer on RevolutionFuse object.
+typedef std::shared_ptr<FeaturesAPI_RevolutionFuse> RevolutionFusePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionFuse feature.
+FEATURESAPI_EXPORT
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionFuse feature.
+FEATURESAPI_EXPORT
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Double& theToAngle,
+ const ModelHighAPI_Double& theFromAngle,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create RevolutionFuse feature.
+FEATURESAPI_EXPORT
+RevolutionFusePtr addRevolutionFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theBaseObjects,
+ const ModelHighAPI_Selection& theAxis,
+ const ModelHighAPI_Selection& theToObject,
+ const ModelHighAPI_Double& theToOffset,
+ const ModelHighAPI_Selection& theFromObject,
+ const ModelHighAPI_Double& theFromOffset,
+ const std::list<ModelHighAPI_Selection>& theBooleanObjects);
+
+#endif // FeaturesAPI_RevolutionBoolean_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Rotation.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Rotation.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theAngle)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theAxisObject, myaxisObject);
+ setAngle(theAngle);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Rotation::~FeaturesAPI_Rotation()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
+{
+ fillAttribute(theAxisObject, myaxisObject);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle)
+{
+ fillAttribute(theAngle, myangle);
+
+ execute();
+}
+
+//==================================================================================================
+RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID());
+ return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theDistance));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Rotation.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Rotation_H_
+#define FeaturesAPI_Rotation_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Rotation.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Rotation
+/// \ingroup CPPHighAPI
+/// \brief Interface for Rotation feature.
+class FeaturesAPI_Rotation: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theAngle);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Rotation();
+
+ INTERFACE_3(FeaturesPlugin_Rotation::ID(),
+ mainObjects, FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ axisObject, FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis object */,
+ angle, FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set axis object.
+ FEATURESAPI_EXPORT
+ void setAxisObject(const ModelHighAPI_Selection& theAxisObject);
+
+ /// Set angle.
+ FEATURESAPI_EXPORT
+ void setAngle(const ModelHighAPI_Double& theAngle);
+};
+
+/// Pointer on Rotation object.
+typedef std::shared_ptr<FeaturesAPI_Rotation> RotationPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Rotation feature.
+FEATURESAPI_EXPORT
+RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+#endif // FeaturesAPI_Rotation_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Translation.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Translation.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ fillAttribute(theMainObjects, mymainObjects);
+ fillAttribute(theAxisObject, myaxisObject);
+ setDistance(theDistance);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Translation::~FeaturesAPI_Translation()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
+{
+ fillAttribute(theAxisObject, myaxisObject);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setDistance(const ModelHighAPI_Double& theDistance)
+{
+ fillAttribute(theDistance, mydistance);
+
+ execute();
+}
+
+//==================================================================================================
+TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
+ return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theAxisObject, theDistance));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Translation.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Translation_H_
+#define FeaturesAPI_Translation_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Translation.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Translation
+/// \ingroup CPPHighAPI
+/// \brief Interface for Translation feature.
+class FeaturesAPI_Translation: public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Translation();
+
+ INTERFACE_3(FeaturesPlugin_Translation::ID(),
+ mainObjects, FeaturesPlugin_Translation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ axisObject, FeaturesPlugin_Translation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis object */,
+ distance, FeaturesPlugin_Translation::DISTANCE_ID(), ModelAPI_AttributeDouble, /** Distance */)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set axis object.
+ FEATURESAPI_EXPORT
+ void setAxisObject(const ModelHighAPI_Selection& theAxisObject);
+
+ /// Set distance.
+ FEATURESAPI_EXPORT
+ void setDistance(const ModelHighAPI_Double& theDistance);
+};
+
+/// Pointer on Translation object.
+typedef std::shared_ptr<FeaturesAPI_Translation> TranslationPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Translation feature.
+FEATURESAPI_EXPORT
+TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document>& thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+#endif // FeaturesAPI_Translation_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesAPI_swig.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_swig_H_
+#define FeaturesAPI_swig_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "FeaturesAPI.h"
+ #include "FeaturesAPI_Boolean.h"
+ #include "FeaturesAPI_Extrusion.h"
+ #include "FeaturesAPI_ExtrusionBoolean.h"
+ #include "FeaturesAPI_Group.h"
+ #include "FeaturesAPI_Intersection.h"
+ #include "FeaturesAPI_Partition.h"
+ #include "FeaturesAPI_Pipe.h"
+ #include "FeaturesAPI_Placement.h"
+ #include "FeaturesAPI_RemoveSubShapes.h"
+ #include "FeaturesAPI_Revolution.h"
+ #include "FeaturesAPI_RevolutionBoolean.h"
+ #include "FeaturesAPI_Rotation.h"
+ #include "FeaturesAPI_Translation.h"
+
+#endif // FeaturesAPI_swig_H_
double aToSize = 0.0;
double aFromSize = 0.0;
- if(string(CREATION_METHOD())->value() == "BySizes") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_SIZES()) {
aToSize = real(TO_SIZE_ID())->value();
aFromSize = real(FROM_SIZE_ID())->value();
} else {
GeomShapePtr aToShape;
GeomShapePtr aFromShape;
- if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) {
aSelection = selection(TO_OBJECT_ID());
if(aSelection.get()) {
aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aSelection->value());
return MY_CREATION_METHOD_ID;
}
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BY_SIZES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("BySizes");
+ return MY_CREATION_METHOD_ID;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BY_PLANES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
+ return MY_CREATION_METHOD_ID;
+ }
+
/// Attribute name of an object to which the extrusion grows.
inline static const std::string& DIRECTION_OBJECT_ID()
{
}
// Searching faces with common edges.
- if(aCreationMethod == "simple") {
+ if(aCreationMethod == CREATION_METHOD_SIMPLE()) {
ListOfShape aShells;
ListOfShape aFreeFaces;
std::shared_ptr<GeomAPI_Shape> aFacesCompound = GeomAlgoAPI_CompoundBuilder::compound(aBaseFacesList);
// Getting Bi-Normal
std::shared_ptr<GeomAPI_Shape> aBiNormal;
- if(aCreationMethod == "binormal") {
+ if(aCreationMethod == CREATION_METHOD_BINORMAL()) {
AttributeSelectionPtr aBiNormalSelection = selection(BINORMAL_ID());
if(!aBiNormalSelection.get()) {
setError("Error: Bi-Normal selection is empty.");
// Getting locations.
ListOfShape aLocations;
- if(aCreationMethod == "locations") {
+ if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
AttributeSelectionListPtr aLocationsSelectionList = selectionList(LOCATIONS_ID());
if(!aLocationsSelectionList.get()) {
setError("Error: Could not get locations selection list.");
// Generating result for each object.
int aResultIndex = 0;
- if(aCreationMethod == "simple" || aCreationMethod == "binormal") {
+ if(aCreationMethod == CREATION_METHOD_SIMPLE() || aCreationMethod == CREATION_METHOD_BINORMAL()) {
for(ListOfShape::const_iterator anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
- GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod == "simple" ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
- GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
+ GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod ==
+ CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
+ GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
if(!aPipeAlgo.isDone()) {
setError("Error: Pipe algorithm failed.");
storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
}
- } else if(aCreationMethod == "locations") {
+ } else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
GeomAlgoAPI_Pipe aPipeAlgo = GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape);
if(!aPipeAlgo.isDone()) {
return MY_CREATION_METHOD;
}
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_SIMPLE()
+ {
+ static const std::string MY_CREATION_METHOD("simple");
+ return MY_CREATION_METHOD;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BINORMAL()
+ {
+ static const std::string MY_CREATION_METHOD("binormal");
+ return MY_CREATION_METHOD;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_LOCATIONS()
+ {
+ static const std::string MY_CREATION_METHOD("locations");
+ return MY_CREATION_METHOD;
+ }
+
/// Attribute name of base objects.
inline static const std::string& BASE_OBJECTS_ID()
{
double aToAngle = 0.0;
double aFromAngle = 0.0;
- if(string(CREATION_METHOD())->value() == "ByAngles") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_ANGLES()) {
aToAngle = real(TO_ANGLE_ID())->value();
aFromAngle = real(FROM_ANGLE_ID())->value();
} else {
GeomShapePtr aToShape;
GeomShapePtr aFromShape;
- if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+ if(string(CREATION_METHOD())->value() == CREATION_METHOD_BY_PLANES()) {
aSelection = selection(TO_OBJECT_ID());
if(aSelection.get()) {
aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aSelection->value());
return MY_CREATION_METHOD_ID;
}
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BY_ANGLES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("ByAngles");
+ return MY_CREATION_METHOD_ID;
+ }
+
+ /// Attribute name for creation method.
+ inline static const std::string& CREATION_METHOD_BY_PLANES()
+ {
+ static const std::string MY_CREATION_METHOD_ID("ByPlanesAndOffsets");
+ return MY_CREATION_METHOD_ID;
+ }
+
/// Attribute name of an revolution axis.
inline static const std::string& AXIS_OBJECT_ID()
{
GEOMAPI_EXPORT
GeomAPI_Ax1();
- /** \brief Ñonstructor.
+ /** \brief Constructor.
* \param[in] theOrigin point of origin.
* \param[in] theDir direction of axis.
*/
GEOMAPI_EXPORT
GeomAPI_Ax2();
- /** \brief Ñonstructor.
+ /** \brief Constructor.
* \param[in] theOrigin point of origin.
* \param[in] theN direction of axis.
* \param[in] theVX x direction of axis.
std::shared_ptr<GeomAPI_Dir> theN,
std::shared_ptr<GeomAPI_Dir> theVX);
- /** \brief Ñonstructor.
+ /** \brief Constructor.
* \param[in] theOrigin point of origin.
* \param[in] theDir direction of axis.
*/
GEOMAPI_EXPORT
GeomAPI_Ax3();
- /// Ñonstructor
+ /// Constructor
/// \param theOrigin point of origin
/// \param theDirX direction of X axis
/// \param theNorm direction of normal vector
#include "GeomAlgoAPI_swig.h"
%}
+// import other modules
+%import "GeomAPI.i"
+
// to avoid error on this
#define GEOMALGOAPI_EXPORT
%include "std_list.i"
%include "std_shared_ptr.i"
+// shared pointers
+%shared_ptr(GeomAlgoAPI_Boolean)
+%shared_ptr(GeomAlgoAPI_Intersection)
+%shared_ptr(GeomAlgoAPI_MakeShape)
+%shared_ptr(GeomAlgoAPI_MakeShapeCustom)
+%shared_ptr(GeomAlgoAPI_MakeShapeList)
+%shared_ptr(GeomAlgoAPI_MakeSweep)
+%shared_ptr(GeomAlgoAPI_PaveFiller)
+%shared_ptr(GeomAlgoAPI_Pipe)
+%shared_ptr(GeomAlgoAPI_Placement)
+%shared_ptr(GeomAlgoAPI_Prism)
+%shared_ptr(GeomAlgoAPI_Revolution)
+%shared_ptr(GeomAlgoAPI_Rotation)
+%shared_ptr(GeomAlgoAPI_Sewing)
+%shared_ptr(GeomAlgoAPI_ShapeBuilder)
+%shared_ptr(GeomAlgoAPI_Translation)
+%shared_ptr(GeomAlgoAPI_Transform)
+
// all supported interfaces
%include "GeomAlgoAPI_MakeShape.h"
%include "GeomAlgoAPI_Boolean.h"
#ifndef SRC_GEOMALGOAPI_GEOMALGOAPI_SWIG_H_
#define SRC_GEOMALGOAPI_GEOMALGOAPI_SWIG_H_
+ #include <GeomAPI_swig.h>
+
#include "GeomAlgoAPI.h"
#include "GeomAlgoAPI_MakeShape.h"
#include "GeomAlgoAPI_Boolean.h"
%}
// import other modules
+%import "GeomAPI.i"
%import "ModelAPI.i"
// to avoid error on this
#ifndef SRC_GEOMDATAAPI_GEOMDATAAPI_SWIG_H_
#define SRC_GEOMDATAAPI_GEOMDATAAPI_SWIG_H_
- #include "ModelAPI_swig.h"
+ #include <GeomAPI_swig.h>
+ #include <ModelAPI_swig.h>
#include "GeomDataAPI.h"
#include "GeomDataAPI_Point.h"
return aResult;
}
-// macro for gthe generic returning of the attribute by the ID
+// macro for the generic returning of the attribute by the ID
#define GET_ATTRIBUTE_BY_ID(ATTR_TYPE, METHOD_NAME) \
std::shared_ptr<ATTR_TYPE> Model_Data::METHOD_NAME(const std::string& theID) { \
std::shared_ptr<ATTR_TYPE> aRes; \
/// Returns a textual string of the selection
/// \param theDefaultValue a value, which is used if the naming name can not be obtained
virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
-
+
/// Returns an id of the selection
virtual int Id() = 0;
class ModelAPI_AttributeString : public ModelAPI_Attribute
{
public:
- /// Defines the double value
+ /// Defines the string value
MODELAPI_EXPORT virtual void setValue(const std::string& theValue) = 0;
- /// Returns the double value
+ /// Returns the string value
MODELAPI_EXPORT virtual std::string value() = 0;
/// Returns the type of this class of attributes
MODELAPI_EXPORT ModelAPI_AttributeString();
};
-//! Pointer on double attribute
+//! Pointer on string attribute
typedef std::shared_ptr<ModelAPI_AttributeString> AttributeStringPtr;
#endif
#ifndef SRC_MODELAPI_MODELAPI_SWIG_H_
#define SRC_MODELAPI_MODELAPI_SWIG_H_
- #include "GeomAPI_swig.h"
+ #include <GeomAPI_swig.h>
#include "ModelAPI.h"
#include "ModelAPI_Entity.h"
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ModelHighAPI.h
+ ModelHighAPI_Double.h
+ ModelHighAPI_Integer.h
+ ModelHighAPI_Interface.h
+ ModelHighAPI_Macro.h
+ ModelHighAPI_RefAttr.h
+ ModelHighAPI_Selection.h
+ ModelHighAPI_Services.h
+ ModelHighAPI_Tools.h
+)
+
+SET(PROJECT_SOURCES
+ ModelHighAPI_Double.cpp
+ ModelHighAPI_Integer.cpp
+ ModelHighAPI_Interface.cpp
+ ModelHighAPI_RefAttr.cpp
+ ModelHighAPI_Selection.cpp
+ ModelHighAPI_Services.cpp
+ ModelHighAPI_Tools.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ Config
+ Events
+ GeomAPI
+ GeomDataAPI
+ ModelAPI
+)
+
+ADD_DEFINITIONS(-DMODELHIGHAPI_EXPORTS)
+ADD_LIBRARY(ModelHighAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+#TODO(spo): is it necessary?
+SET_TARGET_PROPERTIES(ModelHighAPI PROPERTIES LINKER_LANGUAGE CXX)
+TARGET_LINK_LIBRARIES(ModelHighAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ModelHighAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+SET(SWIG_LINK_LIBRARIES
+ ModelHighAPI
+ ${PYTHON_LIBRARIES}
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+)
+
+set(SWIG_MODULE_ModelHighAPI_EXTRA_DEPS
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ModelHighAPI python ModelHighAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ModelHighAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ModelHighAPI PROPERTIES DEBUG_OUTPUT_NAME _ModelHighAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ModelHighAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ModelHighAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ModelHighAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+ TestDouble.py
+ TestInteger.py
+ TestRefAttr.py
+)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockEvents_Listener_H_
+#define MockEvents_Listener_H_
+
+#include <gmock/gmock.h>
+
+#include <Events_Listener.h>
+
+class MockEvents_Listener : public Events_Listener {
+public:
+ MOCK_METHOD1(processEvent,
+ void(const std::shared_ptr<Events_Message>& theMessage));
+};
+
+#endif // MockEvents_Listener_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_AttributeDouble_H_
+#define MockModelAPI_AttributeDouble_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_AttributeDouble.h>
+
+class MockModelAPI_AttributeDouble : public ModelAPI_AttributeDouble {
+ public:
+ MOCK_METHOD1(setValue,
+ void(const double theValue));
+ MOCK_METHOD0(value,
+ double());
+ MOCK_METHOD1(setCalculatedValue,
+ void(const double theValue));
+ MOCK_METHOD1(setText,
+ void(const std::string& theText));
+ MOCK_METHOD0(text,
+ std::string());
+ MOCK_METHOD1(setExpressionInvalid,
+ void(const bool theFlag));
+ MOCK_METHOD0(expressionInvalid,
+ bool());
+ MOCK_METHOD1(setExpressionError,
+ void(const std::string& theError));
+ MOCK_METHOD0(expressionError,
+ std::string());
+ MOCK_METHOD1(setUsedParameters,
+ void(const std::set<std::string>& theUsedParameters));
+ MOCK_CONST_METHOD0(usedParameters,
+ std::set<std::string>());
+};
+
+#endif // MockModelAPI_AttributeDouble_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_AttributeSelection_H_
+#define MockModelAPI_AttributeSelection_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_AttributeSelection.h>
+
+class MockModelAPI_AttributeSelection : public ModelAPI_AttributeSelection {
+ public:
+ MOCK_METHOD3(setValue,
+ void(const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
+ const bool theTemporarily));
+ MOCK_METHOD0(value,
+ std::shared_ptr<GeomAPI_Shape>());
+ MOCK_METHOD0(context,
+ ResultPtr());
+ MOCK_METHOD0(update,
+ bool());
+ MOCK_METHOD1(namingName,
+ std::string(const std::string& theDefaultValue));
+ MOCK_METHOD0(Id,
+ int());
+ MOCK_METHOD2(selectSubShape,
+ void(const std::string& theType, const std::string& theSubShapeName));
+ MOCK_METHOD0(isInvalid,
+ bool());
+};
+
+#endif // MockModelAPI_AttributeSelection_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_Data_H_
+#define MockModelAPI_Data_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_Data.h>
+
+class MockModelAPI_Data : public ModelAPI_Data {
+ public:
+ MOCK_METHOD0(name,
+ std::string());
+ MOCK_METHOD1(setName,
+ void(const std::string& theName));
+ MOCK_METHOD1(document,
+ std::shared_ptr<ModelAPI_AttributeDocRef>(const std::string& theID));
+ MOCK_METHOD1(real,
+ std::shared_ptr<ModelAPI_AttributeDouble>(const std::string& theID));
+ MOCK_METHOD1(integer,
+ std::shared_ptr<ModelAPI_AttributeInteger>(const std::string& theID));
+ MOCK_METHOD1(reference,
+ std::shared_ptr<ModelAPI_AttributeReference>(const std::string& theID));
+ MOCK_METHOD1(selection,
+ std::shared_ptr<ModelAPI_AttributeSelection>(const std::string& theID));
+ MOCK_METHOD1(selectionList,
+ std::shared_ptr<ModelAPI_AttributeSelectionList>(const std::string& theID));
+ MOCK_METHOD1(refattr,
+ std::shared_ptr<ModelAPI_AttributeRefAttr>(const std::string& theID));
+ MOCK_METHOD1(reflist,
+ std::shared_ptr<ModelAPI_AttributeRefList>(const std::string& theID));
+ MOCK_METHOD1(refattrlist,
+ std::shared_ptr<ModelAPI_AttributeRefAttrList>(const std::string& theID));
+ MOCK_METHOD1(boolean,
+ std::shared_ptr<ModelAPI_AttributeBoolean>(const std::string& theID));
+ MOCK_METHOD1(string,
+ std::shared_ptr<ModelAPI_AttributeString>(const std::string& theID));
+ MOCK_METHOD1(intArray,
+ std::shared_ptr<ModelAPI_AttributeIntArray>(const std::string& theID));
+ MOCK_METHOD1(attribute,
+ std::shared_ptr<ModelAPI_Attribute>(const std::string& theID));
+ MOCK_METHOD1(attributes,
+ std::list<std::shared_ptr<ModelAPI_Attribute> >(const std::string& theType));
+ MOCK_METHOD1(attributesIDs,
+ std::list<std::string>(const std::string& theType));
+ MOCK_METHOD1(id,
+ const std::string&(const std::shared_ptr<ModelAPI_Attribute>& theAttr));
+ MOCK_METHOD1(isEqual,
+ bool(const std::shared_ptr<ModelAPI_Data>& theData));
+ MOCK_METHOD0(isValid,
+ bool());
+ MOCK_METHOD2(addAttribute,
+ std::shared_ptr<ModelAPI_Attribute>(const std::string& theID, const std::string theAttrType));
+ MOCK_METHOD1(sendAttributeUpdated,
+ void(ModelAPI_Attribute* theAttr));
+ MOCK_METHOD1(blockSendAttributeUpdated,
+ void(const bool theBlock));
+ MOCK_METHOD0(erase,
+ void());
+ MOCK_METHOD1(execState,
+ void(const ModelAPI_ExecState theState));
+ MOCK_METHOD0(execState,
+ ModelAPI_ExecState());
+ MOCK_METHOD2(setError,
+ void(const std::string& theError, bool theSend));
+ MOCK_CONST_METHOD0(error,
+ std::string());
+ MOCK_CONST_METHOD0(featureId,
+ int());
+ MOCK_METHOD0(refsToMe,
+ const std::set<std::shared_ptr<ModelAPI_Attribute> >&());
+ MOCK_METHOD1(referencesToObjects,
+ void(std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >& theRefs));
+ MOCK_METHOD1(copyTo,
+ void(std::shared_ptr<ModelAPI_Data> theTarget));
+ MOCK_METHOD0(invalidPtr,
+ std::shared_ptr<ModelAPI_Data>());
+ MOCK_METHOD0(updateID,
+ int());
+ MOCK_METHOD1(setUpdateID,
+ void(const int theID));
+ MOCK_METHOD0(owner,
+ std::shared_ptr<ModelAPI_Object>());
+ MOCK_METHOD0(isDeleted,
+ bool());
+ MOCK_METHOD1(setIsDeleted,
+ void(const bool theFlag));
+ MOCK_METHOD0(isInHistory,
+ bool());
+ MOCK_METHOD1(setIsInHistory,
+ void(const bool theFlag));
+ MOCK_METHOD0(isDisplayed,
+ bool());
+ MOCK_METHOD1(setDisplayed,
+ void(const bool theDisplay));
+};
+
+#endif // MockModelAPI_Data_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_Document_H_
+#define MockModelAPI_Document_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_Document.h>
+
+class MockModelAPI_Document : public ModelAPI_Document {
+ public:
+ MOCK_CONST_METHOD0(kind,
+ const std::string&());
+ MOCK_METHOD1(close,
+ void(bool));
+ MOCK_METHOD2(addFeature,
+ std::shared_ptr<ModelAPI_Feature>(std::string, bool));
+ MOCK_METHOD3(refsToFeature,
+ void(std::shared_ptr<ModelAPI_Feature> theFeature,
+ std::set<std::shared_ptr<ModelAPI_Feature> >& theRefs,
+ const bool isSendError));
+ MOCK_METHOD1(removeFeature,
+ void(std::shared_ptr<ModelAPI_Feature> theFeature));
+ MOCK_METHOD2(moveFeature,
+ void(std::shared_ptr<ModelAPI_Feature> theMoved, std::shared_ptr<ModelAPI_Feature> theAfterThis));
+ MOCK_CONST_METHOD0(id,
+ const int());
+ MOCK_METHOD2(object,
+ std::shared_ptr<ModelAPI_Object>(const std::string& theGroupID, const int theIndex));
+ MOCK_METHOD2(objectByName,
+ std::shared_ptr<ModelAPI_Object>(const std::string& theGroupID, const std::string& theName));
+ MOCK_METHOD1(index,
+ const int(std::shared_ptr<ModelAPI_Object> theObject));
+ MOCK_METHOD1(size,
+ int(const std::string& theGroupID));
+ MOCK_METHOD1(currentFeature,
+ std::shared_ptr<ModelAPI_Feature>(const bool theVisible));
+ MOCK_METHOD2(setCurrentFeature,
+ void(std::shared_ptr<ModelAPI_Feature> theCurrent, const bool theVisible));
+ MOCK_METHOD0(setCurrentFeatureUp,
+ void());
+ MOCK_METHOD0(numInternalFeatures,
+ int());
+ MOCK_METHOD1(internalFeature,
+ std::shared_ptr<ModelAPI_Feature>(const int theIndex));
+ MOCK_METHOD0(synchronizeTransactions,
+ void());
+ MOCK_METHOD1(featureById,
+ std::shared_ptr<ModelAPI_Feature>(const int theId));
+ MOCK_METHOD2(createConstruction,
+ std::shared_ptr<ModelAPI_ResultConstruction>(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD2(createBody,
+ std::shared_ptr<ModelAPI_ResultBody>(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD2(createPart,
+ std::shared_ptr<ModelAPI_ResultPart>(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD3(copyPart,
+ std::shared_ptr<ModelAPI_ResultPart>(const std::shared_ptr<ModelAPI_ResultPart>& theOrigin,
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD2(createGroup,
+ std::shared_ptr<ModelAPI_ResultGroup>(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD2(createParameter,
+ std::shared_ptr<ModelAPI_ResultParameter>(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex));
+ MOCK_METHOD1(feature,
+ std::shared_ptr<ModelAPI_Feature>(const std::shared_ptr<ModelAPI_Result>& theResult));
+ MOCK_METHOD0(allFeatures,
+ std::list<std::shared_ptr<ModelAPI_Feature> >());
+ MOCK_METHOD1(setActive,
+ void(const bool theFlag));
+ MOCK_CONST_METHOD0(isActive,
+ bool());
+ MOCK_METHOD0(isOpened,
+ bool());
+ MOCK_METHOD2(producedByFeature,
+ std::shared_ptr<ModelAPI_Feature>(std::shared_ptr<ModelAPI_Result> theResult, const std::shared_ptr<GeomAPI_Shape>& theShape));
+ MOCK_CONST_METHOD2(isLater,
+ bool(std::shared_ptr<ModelAPI_Feature> theLater, std::shared_ptr<ModelAPI_Feature> theCurrent));
+ MOCK_METHOD1(updateHistory,
+ void(const std::shared_ptr<ModelAPI_Object> theObject));
+ MOCK_METHOD1(updateHistory,
+ void(const std::string theGroup));
+};
+
+#endif // MockMockModelAPI_Document_H_
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_Feature_H_
+#define MockModelAPI_Feature_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_Feature.h>
+
+class MockModelAPI_Feature : public ModelAPI_Feature {
+ // ModelAPI_Object
+ public:
+ MOCK_METHOD0(groupName,
+ std::string());
+ MOCK_METHOD0(initAttributes,
+ void());
+ MOCK_METHOD0(isDisabled,
+ bool());
+ MOCK_METHOD3(colorConfigInfo,
+ void(std::string& theSection, std::string& theName, std::string& theDefault));
+ MOCK_METHOD0(init,
+ void());
+ MOCK_CONST_METHOD0(data,
+ std::shared_ptr<ModelAPI_Data>());
+
+ // ModelAPI_Feature
+ public:
+ MOCK_METHOD0(getKind,
+ const std::string&());
+ MOCK_CONST_METHOD0(document,
+ std::shared_ptr<ModelAPI_Document>());
+ MOCK_METHOD0(execute,
+ void());
+ MOCK_METHOD1(compute,
+ bool(const std::string& theAttributeId));
+ MOCK_METHOD2(setError,
+ void(std::string, bool));
+ MOCK_CONST_METHOD0(error,
+ std::string());
+ MOCK_METHOD0(isPersistentResult,
+ bool());
+ MOCK_METHOD0(isAction,
+ bool());
+};
+
+#endif // MockModelAPI_Feature_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MockModelAPI_Object_H_
+#define MockModelAPI_Object_H_
+
+#include <gmock/gmock.h>
+
+#include <ModelAPI_Object.h>
+
+class MockModelAPI_Object : public ModelAPI_Object {
+ public:
+ MOCK_METHOD0(groupName,
+ std::string());
+ MOCK_METHOD0(initAttributes,
+ void());
+ MOCK_METHOD0(isDisabled,
+ bool());
+ MOCK_METHOD3(colorConfigInfo,
+ void(std::string& theSection, std::string& theName, std::string& theDefault));
+ MOCK_METHOD0(init,
+ virtual void MODELAPI_EXPORT());
+};
+
+#endif // MockModelAPI_Object_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef MODELHIGHAPI_H
+#define MODELHIGHAPI_H
+
+#if defined MODELHIGHAPI_EXPORTS
+#if defined WIN32
+#define MODELHIGHAPI_EXPORT __declspec( dllexport )
+#else
+#define MODELHIGHAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define MODELHIGHAPI_EXPORT __declspec( dllimport )
+#else
+#define MODELHIGHAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ModelHighAPI.i */
+%module ModelHighAPI
+
+%{
+ #include "ModelHighAPI_swig.h"
+
+ // fix for SWIG v2.0.4
+ #define SWIGPY_SLICE_ARG(obj) ((PySliceObject*)(obj))
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "GeomAPI.i"
+%import "ModelAPI.i"
+%import "GeomDataAPI.i"
+
+// to avoid error on this
+#define MODELHIGHAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_list.i"
+%include "std_string.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(ModelHighAPI_Interface)
+
+// typemaps
+
+%typemap(in) const ModelHighAPI_Double & (ModelHighAPI_Double temp) {
+ if (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input)) {
+ temp = ModelHighAPI_Double(PyFloat_AsDouble($input));
+ $1 = &temp;
+ } else if (PyString_Check($input)) {
+ temp = ModelHighAPI_Double(PyString_AsString($input));
+ $1 = &temp;
+ } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Double, float, int or string.");
+ return NULL;
+ }
+}
+%typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Double, const ModelHighAPI_Double & {
+ $1 = (PyFloat_Check($input) || PyInt_Check($input) || PyLong_Check($input) || PyString_Check($input)) ? 1 : 0;
+}
+
+%typemap(in) const ModelHighAPI_Integer & (ModelHighAPI_Integer temp) {
+ if (PyInt_Check($input)) {
+ temp = ModelHighAPI_Integer(static_cast<int>(PyInt_AsLong($input)));
+ $1 = &temp;
+ } else if (PyString_Check($input)) {
+ temp = ModelHighAPI_Integer(PyString_AsString($input));
+ $1 = &temp;
+ } else if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_Integer, int or string.");
+ return NULL;
+ }
+}
+%typecheck(SWIG_TYPECHECK_POINTER) ModelHighAPI_Integer, const ModelHighAPI_Integer & {
+ $1 = (PyInt_Check($input) || PyString_Check($input)) ? 1 : 0;
+}
+
+%typemap(in) const ModelHighAPI_RefAttr & (ModelHighAPI_RefAttr temp) {
+ std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
+ std::shared_ptr<ModelAPI_Object> * temp_object;
+ std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
+ int newmem = 0;
+ if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_attribute) {
+ PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+ temp = ModelHighAPI_RefAttr(*temp_attribute);
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_attribute;
+ }
+ $1 = &temp;
+ } else
+ if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_object) {
+ PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+ temp = ModelHighAPI_RefAttr(*temp_object);
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_object;
+ }
+ $1 = &temp;
+ } else
+ if ((SWIG_ConvertPtrAndOwn($input, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_interface) {
+ PyErr_SetString(PyExc_TypeError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+ temp = ModelHighAPI_RefAttr(*temp_interface);
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_interface;
+ }
+ $1 = &temp;
+ } else
+ if ((SWIG_ConvertPtr($input, (void **)&$1, $1_descriptor, SWIG_POINTER_EXCEPTION)) == 0) {
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+}
+
+%typemap(out) const ModelHighAPI_Selection & {
+ $1_basetype * ptr = new $1_basetype(*$1);
+ $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
+}
+
+// std::list -> []
+%template(SelectionList) std::list<ModelHighAPI_Selection>;
+%template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
+
+// all supported interfaces
+%include "ModelHighAPI_Double.h"
+%include "ModelHighAPI_Integer.h"
+%include "ModelHighAPI_Interface.h"
+%include "ModelHighAPI_RefAttr.h"
+%include "ModelHighAPI_Selection.h"
+%include "ModelHighAPI_Services.h"
+%include "ModelHighAPI_Macro.h"
+%include "ModelHighAPI_Tools.h"
--- /dev/null
+// Name : ModelHighAPI_Double.cpp
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Double.h"
+
+#include <ModelAPI_AttributeDouble.h>
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+ModelHighAPI_Double::ModelHighAPI_Double(double theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Double::ModelHighAPI_Double(const std::string & theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Double::ModelHighAPI_Double(const char * theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Double::~ModelHighAPI_Double()
+{
+}
+
+//--------------------------------------------------------------------------------------
+struct fill_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeDouble> myAttribute;
+
+ fill_visitor(const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(double theValue) const { myAttribute->setValue(theValue); }
+ void operator()(const std::string & theValue) const { myAttribute->setText(theValue); }
+};
+
+void ModelHighAPI_Double::fillAttribute(
+ const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute) const
+{
+ boost::apply_visitor(fill_visitor(theAttribute), myValue);
+}
--- /dev/null
+// Name : ModelHighAPI_Double.h
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <memory>
+#include <string>
+
+#include <boost/variant.hpp>
+//--------------------------------------------------------------------------------------
+class ModelAPI_AttributeDouble;
+//--------------------------------------------------------------------------------------
+/**\class ModelHighAPI_Double
+ * \ingroup CPPHighAPI
+ * \brief Class for filling ModelAPI_AttributeDouble
+ */
+class ModelHighAPI_Double
+{
+public:
+ /// Constructor for double
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Double(double theValue = 0.);
+ /// Constructor for std::string
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Double(const std::string & theValue);
+ /// Constructor for char *
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Double(const char * theValue);
+ /// Destructor
+ MODELHIGHAPI_EXPORT
+ virtual ~ModelHighAPI_Double();
+
+ /// Fill attribute values
+ MODELHIGHAPI_EXPORT
+ virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute) const;
+
+private:
+ boost::variant<double, std::string> myValue;
+};
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_DOUBLE_H_ */
--- /dev/null
+// Name : ModelHighAPI_Integer.cpp
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Integer.h"
+
+#include <ModelAPI_AttributeInteger.h>
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+ModelHighAPI_Integer::ModelHighAPI_Integer(int theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Integer::ModelHighAPI_Integer(const std::string & theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Integer::ModelHighAPI_Integer(const char * theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_Integer::~ModelHighAPI_Integer()
+{
+}
+
+//--------------------------------------------------------------------------------------
+struct fill_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeInteger> myAttribute;
+
+ fill_visitor(const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(int theValue) const { myAttribute->setValue(theValue); }
+ void operator()(const std::string & theValue) const { myAttribute->setText(theValue); }
+};
+
+void ModelHighAPI_Integer::fillAttribute(
+ const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute) const
+{
+ boost::apply_visitor(fill_visitor(theAttribute), myValue);
+}
--- /dev/null
+// Name : ModelHighAPI_Integer.h
+// Purpose:
+//
+// History:
+// 29/03/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTEGER_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_INTEGER_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <memory>
+#include <string>
+
+#include <boost/variant.hpp>
+//--------------------------------------------------------------------------------------
+class ModelAPI_AttributeInteger;
+//--------------------------------------------------------------------------------------
+/**\class ModelHighAPI_Integer
+ * \ingroup CPPHighAPI
+ * \brief Class for filling ModelAPI_AttributeInteger
+ */
+class ModelHighAPI_Integer
+{
+public:
+ /// Constructor for int
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Integer(int theValue = 0.);
+ /// Constructor for std::string
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Integer(const std::string & theValue);
+ /// Constructor for char *
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Integer(const char * theValue);
+ /// Destructor
+ MODELHIGHAPI_EXPORT
+ virtual ~ModelHighAPI_Integer();
+
+ /// Fill attribute values
+ MODELHIGHAPI_EXPORT
+ virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute) const;
+
+private:
+ boost::variant<int, std::string> myValue;
+};
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTEGER_H_ */
--- /dev/null
+// Name : ModelHighAPI_Interface.cpp
+// Purpose:
+//
+// History:
+// 17/05/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Interface.h"
+//--------------------------------------------------------------------------------------
+#include <Events_InfoMessage.h>
+
+#include <ModelAPI_Feature.h>
+
+#include "ModelHighAPI_Selection.h"
+//--------------------------------------------------------------------------------------
+ModelHighAPI_Interface::ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: myFeature(theFeature)
+{
+
+}
+
+ModelHighAPI_Interface::~ModelHighAPI_Interface()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Feature> ModelHighAPI_Interface::feature() const
+{
+ return myFeature;
+}
+
+const std::string& ModelHighAPI_Interface::getKind() const
+{
+ return feature()->getKind();
+}
+
+void ModelHighAPI_Interface::execute()
+{
+ feature()->execute();
+}
+
+std::list<ModelHighAPI_Selection> ModelHighAPI_Interface::result() const
+{
+ // TODO(spo): should I use more common function for the whole model to prepare results?
+ const_cast<ModelHighAPI_Interface*>(this)->execute();
+
+ std::list<ModelHighAPI_Selection> aSelectionList;
+
+ std::list<std::shared_ptr<ModelAPI_Result> > aResults = feature()->results();
+ for (auto it = aResults.begin(), end = aResults.end(); it != end; ++it) {
+ aSelectionList.push_back(ModelHighAPI_Selection(*it));
+ }
+
+ return aSelectionList;
+}
+
+std::shared_ptr<ModelAPI_Result> ModelHighAPI_Interface::defaultResult() const
+{
+ return feature()->lastResult();
+}
+
+void ModelHighAPI_Interface::throwException(const std::string & theDescription)
+{
+ Events_InfoMessage("ModelHighAPI_Interface", theDescription).send();
+}
--- /dev/null
+// Name : ModelHighAPI_Interface.h
+// Purpose:
+//
+// History:
+// 17/05/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <list>
+#include <memory>
+#include <string>
+#include <iostream>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Feature;
+class ModelAPI_Result;
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class ModelHighAPI_Interface
+ * \ingroup CPPHighAPI
+ * \brief Base class for feature interfaces
+ */
+class ModelHighAPI_Interface
+{
+public:
+ /// Constructor
+ MODELHIGHAPI_EXPORT
+ explicit ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Destructor
+ MODELHIGHAPI_EXPORT
+ virtual ~ModelHighAPI_Interface();
+
+ /// Return ModelAPI_Feature
+ MODELHIGHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> feature() const;
+
+ /// Shortcut for feature()->getKind()
+ MODELHIGHAPI_EXPORT
+ const std::string& getKind() const;
+
+ /// Shortcut for feature()->execute()
+ MODELHIGHAPI_EXPORT
+ void execute();
+
+ // TODO(spo): rename to selectAll()
+ /// Return all objects of the feature
+ MODELHIGHAPI_EXPORT
+ virtual std::list<ModelHighAPI_Selection> result() const;
+
+ /// Return default result. Default implementation feature()->lastResult()
+ MODELHIGHAPI_EXPORT
+ virtual std::shared_ptr<ModelAPI_Result> defaultResult() const;
+
+ /// Throw exception to event loop
+ MODELHIGHAPI_EXPORT
+ void throwException(const std::string & theDescription);
+
+protected:
+ std::shared_ptr<ModelAPI_Feature> myFeature;
+};
+
+//! Pointer on Interface object
+typedef std::shared_ptr<ModelHighAPI_Interface> InterfacePtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */
--- /dev/null
+// Name : ModelHighAPI_Macro.h
+// Purpose:
+//
+// History:
+// 27/05/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_
+
+//--------------------------------------------------------------------------------------
+#include <GeomDataAPI_Dir.h>
+#include <GeomDataAPI_Point.h>
+#include <GeomDataAPI_Point2D.h>
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeIntArray.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeRefAttrList.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_Feature.h>
+
+//--------------------------------------------------------------------------------------
+#define VAR_NAME(NAME) my##NAME
+
+//--------------------------------------------------------------------------------------
+// Used in INTERFACE_N for create variable and getter
+#define DEFINE_ATTRIBUTE(NAME, TYPE, COMMENT) \
+ COMMENT \
+ std::shared_ptr<TYPE> NAME() const { return VAR_NAME(NAME); } \
+ protected: \
+ std::shared_ptr<TYPE> VAR_NAME(NAME); \
+ public:
+
+//--------------------------------------------------------------------------------------
+// Used in INTERFACE_N inside START_INIT/END_INIT for set variable with attribute received from feature
+#define SET_ATTRIBUTE(NAME, TYPE, ATT_NAME) \
+ VAR_NAME(NAME) = std::dynamic_pointer_cast<TYPE>(feature()->attribute(ATT_NAME)); \
+ if (!VAR_NAME(NAME)) \
+ return false;
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_COMMON(KIND) \
+ static std::string ID() { return KIND; }\
+ virtual std::string getID() { return ID(); }
+
+//--------------------------------------------------------------------------------------
+#define START_INIT() \
+ bool initialize() { \
+ if (!feature()) { \
+ throwException(ID() + " exception: The feature is NULL."); \
+ return false; \
+ } \
+ if (getKind() != getID()) { \
+ throwException(ID() + " exception: Wrong feature kind."); \
+ return false; \
+ }
+
+//--------------------------------------------------------------------------------------
+#define END_INIT() \
+ return true; \
+ }
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_0(KIND) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ protected: \
+ START_INIT() \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_1(KIND, \
+ N_0, AN_0, T_0, C_0) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_2(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_3(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_4(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_5(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_6(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_7(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_8(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_9(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_10(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_11(KIND, \
+ N_0, AN_0, T_0, C_0, \
+ N_1, AN_1, T_1, C_1, \
+ N_2, AN_2, T_2, C_2, \
+ N_3, AN_3, T_3, C_3, \
+ N_4, AN_4, T_4, C_4, \
+ N_5, AN_5, T_5, C_5, \
+ N_6, AN_6, T_6, C_6, \
+ N_7, AN_7, T_7, C_7, \
+ N_8, AN_8, T_8, C_8, \
+ N_9, AN_9, T_9, C_9, \
+ N_10, AN_10, T_10, C_10) \
+ public: \
+ INTERFACE_COMMON(KIND) \
+ DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+ DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+ DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+ DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+ DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+ DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+ DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+ DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+ DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+ DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+ DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+ protected: \
+ START_INIT() \
+ SET_ATTRIBUTE(N_0, T_0, AN_0) \
+ SET_ATTRIBUTE(N_1, T_1, AN_1) \
+ SET_ATTRIBUTE(N_2, T_2, AN_2) \
+ SET_ATTRIBUTE(N_3, T_3, AN_3) \
+ SET_ATTRIBUTE(N_4, T_4, AN_4) \
+ SET_ATTRIBUTE(N_5, T_5, AN_5) \
+ SET_ATTRIBUTE(N_6, T_6, AN_6) \
+ SET_ATTRIBUTE(N_7, T_7, AN_7) \
+ SET_ATTRIBUTE(N_8, T_8, AN_8) \
+ SET_ATTRIBUTE(N_9, T_9, AN_9) \
+ SET_ATTRIBUTE(N_10, T_10, AN_10) \
+ END_INIT() \
+ public:
+
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */
--- /dev/null
+// Name : ModelHighAPI_RefAttr.cpp
+// Purpose:
+//
+// History:
+// 08/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_RefAttr.h"
+
+#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeRefAttrList.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
+#include "ModelHighAPI_Interface.h"
+//--------------------------------------------------------------------------------------
+ModelHighAPI_RefAttr::ModelHighAPI_RefAttr()
+{
+}
+
+ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
+ const std::shared_ptr<ModelAPI_Attribute> & theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
+ const std::shared_ptr<ModelAPI_Object> & theValue)
+: myValue(theValue)
+{
+}
+
+ModelHighAPI_RefAttr::ModelHighAPI_RefAttr(
+ const std::shared_ptr<ModelHighAPI_Interface> & theValue)
+: myValue(std::shared_ptr<ModelAPI_Object>(theValue->defaultResult()))
+{
+}
+
+ModelHighAPI_RefAttr::~ModelHighAPI_RefAttr()
+{
+}
+
+//--------------------------------------------------------------------------------------
+struct fill_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeRefAttr> myAttribute;
+
+ fill_visitor(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(const std::shared_ptr<ModelAPI_Attribute>& theValue) const { myAttribute->setAttr(theValue); }
+ void operator()(const std::shared_ptr<ModelAPI_Object>& theValue) const { myAttribute->setObject(theValue); }
+};
+
+void ModelHighAPI_RefAttr::fillAttribute(
+ const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const
+{
+ boost::apply_visitor(fill_visitor(theAttribute), myValue);
+}
+
+//--------------------------------------------------------------------------------------
+struct append_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeRefAttrList> myAttribute;
+
+ append_visitor(const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(const std::shared_ptr<ModelAPI_Attribute>& theValue) const { myAttribute->append(theValue); }
+ void operator()(const std::shared_ptr<ModelAPI_Object>& theValue) const { myAttribute->append(theValue); }
+};
+
+void ModelHighAPI_RefAttr::appendToList(
+ const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const
+{
+ boost::apply_visitor(append_visitor(theAttribute), myValue);
+}
--- /dev/null
+// Name : ModelHighAPI_RefAttr.h
+// Purpose:
+//
+// History:
+// 08/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_REFATTR_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_REFATTR_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <memory>
+#include <string>
+
+#include <boost/variant.hpp>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Attribute;
+class ModelAPI_AttributeRefAttr;
+class ModelAPI_AttributeRefAttrList;
+class ModelAPI_Object;
+class ModelHighAPI_Interface;
+//--------------------------------------------------------------------------------------
+/**\class ModelHighAPI_RefAttr
+ * \ingroup CPPHighAPI
+ * \brief Class for filling ModelAPI_AttributeRefAttr
+ */
+class ModelHighAPI_RefAttr
+{
+public:
+ /// Default constructor
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_RefAttr();
+ /// Constructor for attribute
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_RefAttr(const std::shared_ptr<ModelAPI_Attribute> & theValue);
+ /// Constructor for object
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_RefAttr(const std::shared_ptr<ModelAPI_Object> & theValue);
+ /// Constructor for Interface (use result() for object)
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_RefAttr(const std::shared_ptr<ModelHighAPI_Interface> & theValue);
+ /// Destructor
+ MODELHIGHAPI_EXPORT
+ virtual ~ModelHighAPI_RefAttr();
+
+ /// Fill attribute values
+ MODELHIGHAPI_EXPORT
+ virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute) const;
+
+ /// Append to list attribute
+ MODELHIGHAPI_EXPORT
+ virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute) const;
+
+private:
+ boost::variant<
+ std::shared_ptr<ModelAPI_Attribute>,
+ std::shared_ptr<ModelAPI_Object>
+ > myValue;
+};
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_REFATTR_H_ */
--- /dev/null
+// Name : ModelHighAPI_Selection.cpp
+// Purpose:
+//
+// History:
+// 06/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Selection.h"
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
+//--------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------
+ModelHighAPI_Selection::ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext,
+ const std::shared_ptr<GeomAPI_Shape>& theSubShape)
+: myValue(ResultSubShapePair(theContext, theSubShape))
+{
+}
+
+ModelHighAPI_Selection::ModelHighAPI_Selection(const std::string& theType,
+ const std::string& theSubShapeName)
+: myValue(TypeSubShapeNamePair(theType, theSubShapeName))
+{
+}
+
+ModelHighAPI_Selection::~ModelHighAPI_Selection()
+{
+}
+
+//--------------------------------------------------------------------------------------
+struct fill_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeSelection> myAttribute;
+
+ fill_visitor(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(const ResultSubShapePair & thePair) const { myAttribute->setValue(thePair.first, thePair.second); }
+ void operator()(const TypeSubShapeNamePair & thePair) const { myAttribute->selectSubShape(thePair.first, thePair.second); }
+};
+
+void ModelHighAPI_Selection::fillAttribute(
+ const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const
+{
+ boost::apply_visitor(fill_visitor(theAttribute), myValue);
+}
+
+//--------------------------------------------------------------------------------------
+struct append_visitor : boost::static_visitor<void>
+{
+ mutable std::shared_ptr<ModelAPI_AttributeSelectionList> myAttribute;
+
+ append_visitor(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
+ : myAttribute(theAttribute) {}
+
+ void operator()(const ResultSubShapePair & thePair) const { myAttribute->append(thePair.first, thePair.second); }
+ void operator()(const TypeSubShapeNamePair & thePair) const {
+ // Note: the reverse order (first - type, second - sub-shape name)
+ myAttribute->append(thePair.second, thePair.first);
+ }
+};
+
+void ModelHighAPI_Selection::appendToList(
+ const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const
+{
+ boost::apply_visitor(append_visitor(theAttribute), myValue);
+}
--- /dev/null
+// Name : ModelHighAPI_Selection.h
+// Purpose:
+//
+// History:
+// 06/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <memory>
+#include <string>
+#include <utility>
+
+#include <boost/variant.hpp>
+//--------------------------------------------------------------------------------------
+class GeomAPI_Shape;
+class ModelAPI_AttributeSelection;
+class ModelAPI_AttributeSelectionList;
+class ModelAPI_Result;
+//--------------------------------------------------------------------------------------
+typedef std::pair<std::shared_ptr<ModelAPI_Result>, std::shared_ptr<GeomAPI_Shape> > ResultSubShapePair;
+typedef std::pair<std::string, std::string> TypeSubShapeNamePair;
+//--------------------------------------------------------------------------------------
+/**\class ModelHighAPI_Selection
+ * \ingroup CPPHighAPI
+ * \brief Class for filling ModelAPI_AttributeSelection
+ */
+class ModelHighAPI_Selection
+{
+public:
+ /// Constructor for result and sub-shape
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Selection(const std::shared_ptr<ModelAPI_Result>& theContext = std::shared_ptr<ModelAPI_Result>(),
+ const std::shared_ptr<GeomAPI_Shape>& theSubShape = std::shared_ptr<GeomAPI_Shape>());
+ /// Constructor for sub-shape by the textual Name
+ MODELHIGHAPI_EXPORT
+ ModelHighAPI_Selection(const std::string& theType,
+ const std::string& theSubShapeName);
+ /// Destructor
+ MODELHIGHAPI_EXPORT
+ virtual ~ModelHighAPI_Selection();
+
+ /// Fill attribute values
+ MODELHIGHAPI_EXPORT
+ virtual void fillAttribute(const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute) const;
+
+ /// Append to list attribute
+ MODELHIGHAPI_EXPORT
+ virtual void appendToList(const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute) const;
+
+private:
+ boost::variant<ResultSubShapePair, TypeSubShapeNamePair> myValue;
+};
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SELECTION_H_ */
--- /dev/null
+// Name : ModelHighAPI_Services.cpp
+// Purpose:
+//
+// History:
+// 17/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Services.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Ax3.h>
+#include <GeomAPI_Pnt.h>
+#include <ModelAPI_Session.h>
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Document> moduleDocument()
+{
+ return ModelAPI_Session::get()->moduleDocument();
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Document> activeDocument()
+{
+ return ModelAPI_Session::get()->activeDocument();
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<GeomAPI_Ax3> defaultPlane( const std::string& theName )
+{
+ std::shared_ptr<GeomAPI_Pnt> o(new GeomAPI_Pnt(0, 0, 0));
+ std::shared_ptr<GeomAPI_Dir> n, x;
+ if (theName == "XOY") {
+ n.reset(new GeomAPI_Dir(0, 0, 1));
+ x.reset(new GeomAPI_Dir(1, 0, 0));
+ } else if (theName == "XOZ") {
+ n.reset(new GeomAPI_Dir(0, -1, 0));
+ x.reset(new GeomAPI_Dir(1, 0, 0));
+ } else if (theName == "YOZ") {
+ n.reset(new GeomAPI_Dir(1, 0, 0));
+ x.reset(new GeomAPI_Dir(0, 1, 0));
+ }
+
+ return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(o, x, n));
+}
+
+//--------------------------------------------------------------------------------------
+void begin()
+{
+ ModelAPI_Session::get()->startOperation();
+}
+void end()
+{
+ ModelAPI_Session::get()->finishOperation();
+}
+void apply()
+{
+ auto aSession = ModelAPI_Session::get();
+ aSession->finishOperation();
+ aSession->startOperation();
+}
+
+//--------------------------------------------------------------------------------------
+void undo()
+{
+ ModelAPI_Session::get()->undo();
+}
+void redo()
+{
+ ModelAPI_Session::get()->redo();
+}
+
+//--------------------------------------------------------------------------------------
+void reset()
+{
+ ModelAPI_Session::get()->closeAll();
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : ModelHighAPI_Services.h
+// Purpose:
+//
+// History:
+// 17/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <memory>
+#include <string>
+//--------------------------------------------------------------------------------------
+class GeomAPI_Ax3;
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/// Return the main document (the Partset) created or open from the Modeler.
+MODELHIGHAPI_EXPORT
+std::shared_ptr<ModelAPI_Document> moduleDocument();
+
+/** Return the active document.
+ *
+ * This document can be either the main application document (i.e. the Partset) or one of documents
+ * referred to by the main document (a Part).
+ */
+MODELHIGHAPI_EXPORT
+std::shared_ptr<ModelAPI_Document> activeDocument();
+
+/** Return one of the three planes defined by the global coordinate system.
+ *
+ * These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
+ */
+MODELHIGHAPI_EXPORT
+std::shared_ptr<GeomAPI_Ax3> defaultPlane(const std::string & theName);
+
+/** Start a data structure transaction.
+ *
+ * Make a control point for being able to discard or undo
+ * all operations done during this transaction.
+ */
+MODELHIGHAPI_EXPORT
+void begin();
+
+/** Commit the data structure transaction.
+ *
+ * Make all operations done since the last control point undo-able.
+ */
+MODELHIGHAPI_EXPORT
+void end();
+
+/** Commit the data structure transaction and start the new one.
+ *
+ * Make all operations done since the last control point undo-able
+ * and continue with the new transaction.
+ */
+MODELHIGHAPI_EXPORT
+void apply();
+
+/// Roll-back the data structure to the previous control point.
+MODELHIGHAPI_EXPORT
+void undo();
+
+/// Restore the data structure rolled-back by the last undo.
+MODELHIGHAPI_EXPORT
+void redo();
+
+/// Reset the data structure to initial state.
+MODELHIGHAPI_EXPORT
+void reset();
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SERVICES_H_ */
--- /dev/null
+// Name : ModelHighAPI_Tools.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Tools.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Dir.h>
+#include <GeomAPI_Pnt.h>
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <GeomDataAPI_Dir.h>
+#include <GeomDataAPI_Point.h>
+#include <GeomDataAPI_Point2D.h>
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeIntArray.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeRefAttrList.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI_Double.h"
+#include "ModelHighAPI_Integer.h"
+#include "ModelHighAPI_RefAttr.h"
+#include "ModelHighAPI_Selection.h"
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
+ const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
+ double theX, double theY)
+{
+ theAttribute->setValue(theX, theY);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
+ const std::shared_ptr<GeomDataAPI_Dir> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
+ const std::shared_ptr<GeomDataAPI_Point> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(bool theValue,
+ const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const ModelHighAPI_Double & theValue,
+ const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
+{
+ theValue.fillAttribute(theAttribute);
+}
+void fillAttribute(double theValue,
+ const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const ModelHighAPI_Integer & theValue,
+ const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute)
+{
+ theValue.fillAttribute(theAttribute);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const ModelHighAPI_RefAttr & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute)
+{
+ theValue.fillAttribute(theAttribute);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute)
+{
+ theAttribute->clear();
+ for (auto it = theValue.begin(); it != theValue.end(); ++it)
+ it->appendToList(theAttribute);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute)
+{
+ theAttribute->clear();
+ for (auto it = theValue.begin(); it != theValue.end(); ++it)
+ theAttribute->append(*it);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const ModelHighAPI_Selection & theValue,
+ const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute)
+{
+ theValue.fillAttribute(theAttribute);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute)
+{
+ theAttribute->clear();
+ for (auto it = theValue.begin(); it != theValue.end(); ++it)
+ it->appendToList(theAttribute);
+}
+
+//--------------------------------------------------------------------------------------
+void fillAttribute(const std::string & theValue,
+ const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+void fillAttribute(const char * theValue,
+ const std::shared_ptr<ModelAPI_AttributeString> & theAttribute)
+{
+ theAttribute->setValue(theValue);
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : ModelHighAPI_Tools.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_
+
+//--------------------------------------------------------------------------------------
+#include "ModelHighAPI.h"
+
+#include <list>
+#include <memory>
+#include <string>
+//--------------------------------------------------------------------------------------
+class GeomAPI_Dir;
+class GeomAPI_Pnt;
+class GeomAPI_Pnt2d;
+//--------------------------------------------------------------------------------------
+class GeomDataAPI_Dir;
+class GeomDataAPI_Point;
+class GeomDataAPI_Point2D;
+//--------------------------------------------------------------------------------------
+class ModelAPI_AttributeBoolean;
+class ModelAPI_AttributeDocRef;
+class ModelAPI_AttributeDouble;
+class ModelAPI_AttributeIntArray;
+class ModelAPI_AttributeInteger;
+class ModelAPI_AttributeRefAttr;
+class ModelAPI_AttributeRefAttrList;
+class ModelAPI_AttributeReference;
+class ModelAPI_AttributeRefList;
+class ModelAPI_AttributeSelection;
+class ModelAPI_AttributeSelectionList;
+class ModelAPI_AttributeString;
+class ModelAPI_Object;
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Double;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<GeomAPI_Pnt2d> & theValue,
+ const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<GeomDataAPI_Point2D> & theAttribute,
+ double theX, double theY);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<GeomAPI_Dir> & theValue,
+ const std::shared_ptr<GeomDataAPI_Dir> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<GeomAPI_Pnt> & theValue,
+ const std::shared_ptr<GeomDataAPI_Point> & theAttribute);
+
+//--------------------------------------------------------------------------------------
+MODELHIGHAPI_EXPORT
+void fillAttribute(bool theValue,
+ const std::shared_ptr<ModelAPI_AttributeBoolean> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const ModelHighAPI_Double & theValue,
+ const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(double theValue,
+ const std::shared_ptr<ModelAPI_AttributeDouble> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const ModelHighAPI_Integer & theValue,
+ const std::shared_ptr<ModelAPI_AttributeInteger> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const ModelHighAPI_RefAttr & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefAttr> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::list<ModelHighAPI_RefAttr> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefAttrList> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::shared_ptr<ModelAPI_Object> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeReference> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::list<std::shared_ptr<ModelAPI_Object> > & theValue,
+ const std::shared_ptr<ModelAPI_AttributeRefList> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const ModelHighAPI_Selection & theValue,
+ const std::shared_ptr<ModelAPI_AttributeSelection> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::list<ModelHighAPI_Selection> & theValue,
+ const std::shared_ptr<ModelAPI_AttributeSelectionList> & theAttribute);
+
+MODELHIGHAPI_EXPORT
+void fillAttribute(const std::string & theValue,
+ const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
+MODELHIGHAPI_EXPORT
+void fillAttribute(const char * theValue,
+ const std::shared_ptr<ModelAPI_AttributeString> & theAttribute);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_TOOLS_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModelHighAPI_swig.h
+// Created: Mar 29, 2016
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_
+#define SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_
+
+ #include <GeomAPI_swig.h>
+ #include <ModelAPI_swig.h>
+ #include <GeomDataAPI_swig.h>
+
+ #include "ModelHighAPI.h"
+ #include "ModelHighAPI_Double.h"
+ #include "ModelHighAPI_Integer.h"
+ #include "ModelHighAPI_Interface.h"
+ #include "ModelHighAPI_Macro.h"
+ #include "ModelHighAPI_RefAttr.h"
+ #include "ModelHighAPI_Selection.h"
+ #include "ModelHighAPI_Services.h"
+ #include "ModelHighAPI_Tools.h"
+
+#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_SWIG_H_ */
--- /dev/null
+import unittest
+
+import ModelHighAPI
+
+class DoubleTestCase(unittest.TestCase):
+
+ def test_create_default(self):
+ default = ModelHighAPI.ModelHighAPI_Double()
+
+ def test_create_from_double(self):
+ from_double = ModelHighAPI.ModelHighAPI_Double(100.)
+
+ def test_create_from_text(self):
+ from_string = ModelHighAPI.ModelHighAPI_Double("200 + x")
+
+
+if __name__ == "__main__":
+ unittest.main()
--- /dev/null
+import unittest
+
+import ModelHighAPI
+
+class IntegerTestCase(unittest.TestCase):
+
+ def test_create_default(self):
+ default = ModelHighAPI.ModelHighAPI_Integer()
+
+ def test_create_from_integer(self):
+ from_integer = ModelHighAPI.ModelHighAPI_Integer(100)
+
+ def test_create_from_text(self):
+ from_string = ModelHighAPI.ModelHighAPI_Integer("200 + x")
+
+
+if __name__ == "__main__":
+ unittest.main()
--- /dev/null
+import unittest
+
+import ModelAPI
+import ModelHighAPI
+import model
+
+class FeaturesFixture(unittest.TestCase):
+
+ def setUp(self):
+ model.begin()
+ # Create part
+ partset = model.moduleDocument()
+ self.part = model.addPart(partset).document()
+ model.do()
+ self.feature = model.addPoint(self.part, 0, 0, 0)
+
+ def tearDown(self):
+ model.end()
+ model.reset()
+
+
+class RefAttrTestCase(FeaturesFixture):
+
+ def test_create_default(self):
+ ModelHighAPI.ModelHighAPI_RefAttr()
+
+ def test_create_from_attribute(self):
+ print(self.feature.x())
+ ModelHighAPI.ModelHighAPI_RefAttr(self.feature.x())
+
+ def test_create_from_object(self):
+ ModelHighAPI.ModelHighAPI_RefAttr(self.feature.feature())
+
+ def test_create_from_None(self):
+ ModelHighAPI.ModelHighAPI_RefAttr(None)
+
+
+if __name__ == "__main__":
+ unittest.main()
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ ParametersAPI.h
+ ParametersAPI_Parameter.h
+)
+
+SET(PROJECT_SOURCES
+ ParametersAPI_Parameter.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ParametersPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ParametersPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(ParametersAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(ParametersAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(ParametersAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(ParametersAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ ParametersAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_ParametersAPI_EXTRA_DEPS ${SWIG_MODULE_ParametersAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(ParametersAPI python ParametersAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(ParametersAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_ParametersAPI PROPERTIES DEBUG_OUTPUT_NAME _ParametersAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _ParametersAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS ParametersAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ParametersAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef PARAMETERSAPI_H
+#define PARAMETERSAPI_H
+
+#if defined PARAMETERSAPI_EXPORTS
+#if defined WIN32
+#define PARAMETERSAPI_EXPORT __declspec( dllexport )
+#else
+#define PARAMETERSAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define PARAMETERSAPI_EXPORT __declspec( dllimport )
+#else
+#define PARAMETERSAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* ParametersAPI.i */
+
+%module ParametersAPI
+
+%{
+ #include "ParametersAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define PARAMETERSAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(ParametersAPI_Parameter)
+
+// all supported interfaces
+%include "ParametersAPI_Parameter.h"
--- /dev/null
+// Name : ParametersAPI_Parameter.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "ParametersAPI_Parameter.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+ParametersAPI_Parameter::ParametersAPI_Parameter(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+ParametersAPI_Parameter::ParametersAPI_Parameter(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theName,
+ const std::string & theExpression,
+ const std::string & theComment)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theName, name());
+ fillAttribute(theExpression, expression());
+ fillAttribute(theComment, comment());
+
+ execute();
+ }
+}
+
+ParametersAPI_Parameter::~ParametersAPI_Parameter()
+{
+}
+
+//--------------------------------------------------------------------------------------
+ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theName,
+ const std::string & theExpression,
+ const std::string & theComment)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
+ return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
+}
--- /dev/null
+// Name : ParametersAPI_Parameter.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
+#define SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_
+
+//--------------------------------------------------------------------------------------
+#include "ParametersAPI.h"
+
+#include <ParametersPlugin_Parameter.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Double;
+//--------------------------------------------------------------------------------------
+/**\class ParametersAPI_Parameter
+ * \ingroup CPPHighAPI
+ * \brief Interface for Parameter feature
+ */
+class ParametersAPI_Parameter : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ PARAMETERSAPI_EXPORT
+ explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ PARAMETERSAPI_EXPORT
+ explicit ParametersAPI_Parameter(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theName,
+ const std::string & theExpression,
+ const std::string & theComment = std::string());
+ /// Destructor
+ PARAMETERSAPI_EXPORT
+ virtual ~ParametersAPI_Parameter();
+
+ INTERFACE_3(ParametersPlugin_Parameter::ID(),
+ name, ParametersPlugin_Parameter::VARIABLE_ID(), ModelAPI_AttributeString, /** Name */,
+ expression, ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeString, /** Expression */,
+ comment, ParametersPlugin_Parameter::COMMENT_ID(), ModelAPI_AttributeString, /** Comment */
+ )
+
+};
+
+//! Pointer on Parameter object
+typedef std::shared_ptr<ParametersAPI_Parameter> ParameterPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Parameter feature
+ */
+PARAMETERSAPI_EXPORT
+ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theName,
+ const std::string & theExpression,
+ const std::string & theComment = std::string());
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ParametersAPI_swig.h
+// Created: 16/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_
+#define SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "ParametersAPI_Parameter.h"
+
+#endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_SWIG_H_ */
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ PartSetAPI.h
+ PartSetAPI_Part.h
+)
+
+SET(PROJECT_SOURCES
+ PartSetAPI_Part.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify PartSetPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ # TODO(spo): it is for *_swig.h files. Can we eliminate it?
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/PartSetPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DCONSTRUCTIONAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(PartSetAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(PartSetAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(PartSetAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(PartSetAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ PartSetAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_PartSetAPI_EXTRA_DEPS ${SWIG_MODULE_PartSetAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(PartSetAPI python PartSetAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(PartSetAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_PartSetAPI PROPERTIES DEBUG_OUTPUT_NAME _PartSetAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _PartSetAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS PartSetAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PartSetAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef PARTSETAPI_H
+#define PARTSETAPI_H
+
+#if defined PARTSETAPI_EXPORTS
+#if defined WIN32
+#define PARTSETAPI_EXPORT __declspec( dllexport )
+#else
+#define PARTSETAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define PARTSETAPI_EXPORT __declspec( dllimport )
+#else
+#define PARTSETAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* PartSetAPI.i */
+
+%module PartSetAPI
+
+%{
+ #include "PartSetAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define PARTSETAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(PartSetAPI_Part)
+
+// all supported interfaces
+%include "PartSetAPI_Part.h"
--- /dev/null
+// Name : PartSetAPI_Part.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "PartSetAPI_Part.h"
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_ResultPart.h>
+//--------------------------------------------------------------------------------------
+#include <PartSetPlugin_Duplicate.h>
+#include <PartSetPlugin_Remove.h>
+//--------------------------------------------------------------------------------------
+PartSetAPI_Part::PartSetAPI_Part(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+PartSetAPI_Part::~PartSetAPI_Part()
+{
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Document> PartSetAPI_Part::document() const
+{
+ return std::dynamic_pointer_cast<ModelAPI_ResultPart>(defaultResult())->partDoc();
+}
+
+//--------------------------------------------------------------------------------------
+PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetAPI_Part::ID());
+ aFeature->execute();
+ return PartPtr(new PartSetAPI_Part(aFeature));
+}
+
+PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Duplicate::ID());
+ aFeature->execute();
+ return PartPtr(new PartSetAPI_Part(aFeature));
+}
+
+void removePart(const std::shared_ptr<ModelAPI_Document> & thePart)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(PartSetPlugin_Remove::ID());
+ aFeature->execute();
+}
--- /dev/null
+// Name : PartSetAPI_Part.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_PARTSETAPI_PARTSETAPI_PART_H_
+#define SRC_PARTSETAPI_PARTSETAPI_PART_H_
+
+//--------------------------------------------------------------------------------------
+#include "PartSetAPI.h"
+
+#include <PartSetPlugin_Part.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelAPI_Document;
+//--------------------------------------------------------------------------------------
+/**\class PartSetAPI_Part
+ * \ingroup CPPHighAPI
+ * \brief Interface for Part feature
+ */
+class PartSetAPI_Part : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ PARTSETAPI_EXPORT
+ explicit PartSetAPI_Part(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Destructor
+ PARTSETAPI_EXPORT
+ virtual ~PartSetAPI_Part();
+
+ INTERFACE_0(PartSetPlugin_Part::ID())
+
+ /// Return document
+ PARTSETAPI_EXPORT
+ std::shared_ptr<ModelAPI_Document> document() const;
+};
+
+//! Pointer on Part object
+typedef std::shared_ptr<PartSetAPI_Part> PartPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Part feature
+ */
+PARTSETAPI_EXPORT
+PartPtr addPart(const std::shared_ptr<ModelAPI_Document> & thePartSet);
+
+/**\ingroup CPPHighAPI
+ * \brief Duplicate Part feature
+ */
+PARTSETAPI_EXPORT
+PartPtr duplicatePart(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+/**\ingroup CPPHighAPI
+ * \brief Remove Part feature
+ */
+PARTSETAPI_EXPORT
+void removePart(const std::shared_ptr<ModelAPI_Document> & thePart);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_PARTSETAPI_PARTSETAPI_PART_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: PartSetAPI_swig.h
+// Created: 16/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_PARTSETAPI_PARTSETAPI_SWIG_H_
+#define SRC_PARTSETAPI_PARTSETAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "PartSetAPI_Part.h"
+
+#endif /* SRC_PARTSETAPI_PARTSETAPI_SWIG_H_ */
TestSketcherSetPerpendicular.py
TestSketcherSetHorizontal.py
TestSketcherSetVertical.py
- TestSketcherSetRigid.py
+ TestSketcherSetFixed.py
TestSketcherSetLength.py
TestSketcherSetRadius.py
#TestSketcherSetAngle.py
class FeaturesTestCase(FeaturesFixture):
- def test_assert_error_on_empty_args(self):
- features = [
- "addPoint", "addAxis", "addPlane",
- "addImport", "exportToFile",
- "addAddition", "addSubtraction", "addIntersection",
- "addExtrusion",
- # "addExtrusionCut", "addExtrusionFuse",
- "addRevolution",
- # "addRevolutionCut", "addRevolutionFuse",
- "addPlacement", "addRotation", "addTranslation",
- "addGroup",
- "addParameter",
- ]
- for name in features:
- try:
- with self.assertRaises(AssertionError):
- feature = getattr(model, name)(self.part)
- except AssertionError as e:
- self.fail("%s does not check empty args" % name)
+ # def test_assert_error_on_empty_args(self):
+ # features = [
+ # # Implemented in C++, add* without arguments doesn't exist
+ # # "addPoint", "addPlane",
+ # # "addImport", "exportToFile",
+ #
+ # "addAxis",
+ # "addCut", "addFuse", "addCommon",
+ # "addExtrusion",
+ # # "addExtrusionCut", "addExtrusionFuse",
+ # "addRevolution",
+ # # "addRevolutionCut", "addRevolutionFuse",
+ # "addPlacement", "addRotation", "addTranslation",
+ # "addGroup",
+ # "addParameter",
+ # ]
+ # for name in features:
+ # try:
+ # with self.assertRaises(AssertionError):
+ # feature = getattr(model, name)(self.part)
+ # except AssertionError as e:
+ # self.fail("%s does not check empty args" % name)
+
+ def test_addPoint(self):
+ model.addPoint(self.part, 10, "20", "x + 30")
def test_initialize_without_attributes(self):
- model.construction.axis.Axis(self.part.addFeature("Axis"))
- model.construction.plane.Plane(self.part.addFeature("Plane"))
- model.construction.point.Point(self.part.addFeature("Point"))
-
- model.exchange.Import(self.part.addFeature("Import"))
- model.exchange.Export(self.part.addFeature("Export"))
-
- model.features.boolean.Boolean(self.part.addFeature("Boolean"))
- model.features.extrusion.Extrusion(self.part.addFeature("Extrusion"))
- # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut"))
- # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse"))
- model.features.revolution.Revolution(self.part.addFeature("Revolution"))
- # model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut"))
- # model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse"))
- model.features.placement.Placement(self.part.addFeature("Placement"))
- model.features.rotation.Rotation(self.part.addFeature("Rotation"))
- model.features.translation.Translation(self.part.addFeature("Translation"))
- model.features.group.Group(self.part.addFeature("Group"))
-
- model.parameter.Parameter(self.part.addFeature("Parameter"))
+ import ConstructionAPI
+ ConstructionAPI.ConstructionAPI_Axis(self.part.addFeature("Axis"))
+ ConstructionAPI.ConstructionAPI_Plane(self.part.addFeature("Plane"))
+ ConstructionAPI.ConstructionAPI_Point(self.part.addFeature("Point"))
+
+ import ExchangeAPI
+ ExchangeAPI.ExchangeAPI_Import(self.part.addFeature("Import"))
+ ExchangeAPI.ExchangeAPI_Export(self.part.addFeature("Export"))
+
+ import FeaturesAPI
+ FeaturesAPI.FeaturesAPI_Boolean(self.part.addFeature("Boolean"))
+ FeaturesAPI.FeaturesAPI_Extrusion(self.part.addFeature("Extrusion"))
+ FeaturesAPI.FeaturesAPI_ExtrusionCut(self.part.addFeature("ExtrusionCut"))
+ FeaturesAPI.FeaturesAPI_ExtrusionFuse(self.part.addFeature("ExtrusionFuse"))
+ FeaturesAPI.FeaturesAPI_Revolution(self.part.addFeature("Revolution"))
+ FeaturesAPI.FeaturesAPI_RevolutionCut(self.part.addFeature("RevolutionCut"))
+ FeaturesAPI.FeaturesAPI_RevolutionFuse(self.part.addFeature("RevolutionFuse"))
+ FeaturesAPI.FeaturesAPI_Placement(self.part.addFeature("Placement"))
+ FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation"))
+ FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
+ FeaturesAPI.FeaturesAPI_Group(self.part.addFeature("Group"))
+
+ import ParametersAPI
+ ParametersAPI.ParametersAPI_Parameter(self.part.addFeature("Parameter"))
#-----------------------------------------------------------------------------
circle = sketch.addCircle(0, 0, 10)
model.do()
- base = sketch.selectFace(circle.result())
+ base = sketch.selectFace()
self.extrusion = model.addExtrusion(self.part, base, 10, 0)
model.do()
class FeaturesAddExtrusionTestCase(FeaturesAddExtrusionFixture):
- def test_add_extrusion_no_base(self):
- try:
- extrusion = model.addExtrusion(self.part)
- fail("addExtrusion should assert if base is not None")
- except AssertionError:
- pass
-
def test_add_extrusion_by_face_and_size(self):
sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
circle = sketch.addCircle(0, 0, 10)
model.do()
- base = sketch.selectFace(circle.result())
+ base = sketch.selectFace()
extrusion = model.addExtrusion(self.part, base, 10, 0)
model.do()
- self.assertEqual(extrusion.getCreationMethod().value(), "BySizes")
- self.assertEqual(extrusion.getToSize().value(), 10)
- self.assertEqual(extrusion.getFromSize().value(), 0)
- self.assertEqual(extrusion.getToObject().context(), None)
- self.assertEqual(extrusion.getToOffset().value(), 0)
- self.assertEqual(extrusion.getFromObject().context(), None)
- self.assertEqual(extrusion.getFromOffset().value(), 0)
+ self.assertEqual(extrusion.creationMethod().value(), "BySizes")
+ self.assertEqual(extrusion.toSize().value(), 10)
+ self.assertEqual(extrusion.fromSize().value(), 0)
+ self.assertEqual(extrusion.toObject().context(), None)
+ self.assertEqual(extrusion.toOffset().value(), 0)
+ self.assertEqual(extrusion.fromObject().context(), None)
+ self.assertEqual(extrusion.fromOffset().value(), 0)
def test_add_extrusion_by_face_and_planes(self):
# base
base_circle = base_sketch.addCircle(0, 0, 10)
# to
to_plane = model.defaultPlane("XOY")
- to_plane.location().setZ(10)
+ to_plane.origin().setZ(10)
to_sketch = model.addSketch(self.part, to_plane)
to_circle = to_sketch.addCircle(0, 0, 10)
# from
from_plane = model.defaultPlane("XOY")
- from_plane.location().setZ(-10)
+ from_plane.origin().setZ(-10)
from_sketch = model.addSketch(self.part, from_plane)
from_circle = from_sketch.addCircle(0, 0, 10)
model.do()
- base = base_sketch.selectFace(base_circle.result())
- to_object = to_sketch.selectFace(to_circle.result())[0]
- from_object = from_sketch.selectFace(from_circle.result())[0]
+ base = base_sketch.selectFace()
+ to_object = to_sketch.selectFace()[0]
+ from_object = from_sketch.selectFace()[0]
extrusion = model.addExtrusion(self.part, base,
to_object, 15,
from_object, 20)
- self.assertEqual(extrusion.getCreationMethod().value(), "ByPlanesAndOffsets")
- self.assertEqual(extrusion.getToSize().value(), 0)
- self.assertEqual(extrusion.getFromSize().value(), 0)
+ self.assertEqual(extrusion.creationMethod().value(), "ByPlanesAndOffsets")
+ self.assertEqual(extrusion.toSize().value(), 0)
+ self.assertEqual(extrusion.fromSize().value(), 0)
# self.assertEqual(extrusion.getToObject().context(),
# to_sketch.result())
- self.assertEqual(extrusion.getToOffset().value(), 15)
+ self.assertEqual(extrusion.toOffset().value(), 15)
# self.assertEqual(extrusion.getFromObject().context(),
# from_sketch.result())
- self.assertEqual(extrusion.getFromOffset().value(), 20)
+ self.assertEqual(extrusion.fromOffset().value(), 20)
class FeaturesExtrusionTestCase(FeaturesExtrusionFixture):
def test_extrusion_get_attribute(self):
# call method of the feature
- self.assertTrue(isinstance(self.extrusion.getBase(),
+ self.assertTrue(isinstance(self.extrusion.baseObjects(),
ModelAPI.ModelAPI_AttributeSelectionList))
- self.assertTrue(isinstance(self.extrusion.getCreationMethod(),
+ self.assertTrue(isinstance(self.extrusion.creationMethod(),
ModelAPI.ModelAPI_AttributeString))
- self.assertTrue(isinstance(self.extrusion.getToSize(),
+ self.assertTrue(isinstance(self.extrusion.toSize(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.extrusion.getFromSize(),
+ self.assertTrue(isinstance(self.extrusion.fromSize(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.extrusion.getToObject(),
+ self.assertTrue(isinstance(self.extrusion.toObject(),
ModelAPI.ModelAPI_AttributeSelection))
- self.assertTrue(isinstance(self.extrusion.getToOffset(),
+ self.assertTrue(isinstance(self.extrusion.toOffset(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.extrusion.getFromObject(),
+ self.assertTrue(isinstance(self.extrusion.fromObject(),
ModelAPI.ModelAPI_AttributeSelection))
- self.assertTrue(isinstance(self.extrusion.getFromOffset(),
+ self.assertTrue(isinstance(self.extrusion.fromOffset(),
ModelAPI.ModelAPI_AttributeDouble))
def test_extrusion_set_sizes(self):
self.extrusion.setSizes(15, 20)
- self.assertEqual(self.extrusion.getCreationMethod().value(), "BySizes")
- self.assertEqual(self.extrusion.getToSize().value(), 15)
- self.assertEqual(self.extrusion.getFromSize().value(), 20)
- self.assertEqual(self.extrusion.getToObject().context(), None)
- self.assertEqual(self.extrusion.getToOffset().value(), 0)
- self.assertEqual(self.extrusion.getFromObject().context(), None)
- self.assertEqual(self.extrusion.getFromOffset().value(), 0)
+ self.assertEqual(self.extrusion.creationMethod().value(), "BySizes")
+ self.assertEqual(self.extrusion.toSize().value(), 15)
+ self.assertEqual(self.extrusion.fromSize().value(), 20)
+ self.assertEqual(self.extrusion.toObject().context(), None)
+ self.assertEqual(self.extrusion.toOffset().value(), 0)
+ self.assertEqual(self.extrusion.fromObject().context(), None)
+ self.assertEqual(self.extrusion.fromOffset().value(), 0)
def test_extrusion_set_planes_and_offsets(self):
# to
to_plane = model.defaultPlane("XOY")
- to_plane.location().setZ(10)
+ to_plane.origin().setZ(10)
to_sketch = model.addSketch(self.part, to_plane)
to_circle = to_sketch.addCircle(0, 0, 10)
# from
from_plane = model.defaultPlane("XOY")
- from_plane.location().setZ(-10)
+ from_plane.origin().setZ(-10)
from_sketch = model.addSketch(self.part, from_plane)
from_circle = from_sketch.addCircle(0, 0, 10)
model.do()
- to_object = to_sketch.selectFace(to_circle.result())[0]
- from_object = from_sketch.selectFace(from_circle.result())[0]
+ to_object = to_sketch.selectFace()[0]
+ from_object = from_sketch.selectFace()[0]
self.extrusion.setPlanesAndOffsets(to_object, 15, from_object, 20)
# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
circle = base_sketch.addCircle(0, 0, 10)
- # axis
- axis_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
- line = axis_sketch.addLine(20, -10, 20, 10)
model.do()
- base = base_sketch.selectFace(circle.lastResult())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ base = base_sketch.selectFace()
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
- self.revolution = model.addRevolution(self.part, base, axis_object,
+ self.revolution = model.addRevolution(self.part, base, axis_object[0],
0, 180)
model.do()
class FeaturesAddRevolutionTestCase(FeaturesAddRevolutionFixture):
- def test_add_revolution_no_base(self):
- try:
- revolution = model.addRevolution(self.part)
- fail("addRevolution should assert if base is not None")
- except AssertionError:
- pass
-
def test_add_revolution_by_face_and_angles(self):
# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
circle = base_sketch.addCircle(0, 0, 10)
- # axis
- axis_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
- line = axis_sketch.addLine(20, -10, 20, 10)
model.do()
- base = base_sketch.selectFace(circle.lastResult())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
+ base = base_sketch.selectFace()
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
- revolution = model.addRevolution(self.part, base, axis_object,
+ revolution = model.addRevolution(self.part, base, axis_object[0],
0, 180)
- self.assertEqual(revolution.getCreationMethod().value(), "ByAngles")
- self.assertEqual(revolution.getToAngle().value(), 0)
- self.assertEqual(revolution.getFromAngle().value(), 180)
- self.assertEqual(revolution.getToObject().context(), None)
- self.assertEqual(revolution.getToOffset().value(), 0)
- self.assertEqual(revolution.getFromObject().context(), None)
- self.assertEqual(revolution.getFromOffset().value(), 0)
+ self.assertEqual(revolution.creationMethod().value(), "ByAngles")
+ self.assertEqual(revolution.toAngle().value(), 0)
+ self.assertEqual(revolution.fromAngle().value(), 180)
+ self.assertEqual(revolution.toObject().context(), None)
+ self.assertEqual(revolution.toOffset().value(), 0)
+ self.assertEqual(revolution.fromObject().context(), None)
+ self.assertEqual(revolution.fromOffset().value(), 0)
def test_add_revolution_by_face_and_planes(self):
# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
base_circle = base_sketch.addCircle(0, 0, 10)
- # axis
- axis_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
- line = axis_sketch.addLine(20, -10, 20, 10)
# to
to_plane = model.defaultPlane("XOY")
- to_plane.location().setZ(10)
+ to_plane.origin().setZ(10)
to_sketch = model.addSketch(self.part, to_plane)
to_circle = to_sketch.addCircle(0, 0, 10)
# from
from_plane = model.defaultPlane("XOY")
- from_plane.location().setZ(-10)
+ from_plane.origin().setZ(-10)
from_sketch = model.addSketch(self.part, from_plane)
from_circle = from_sketch.addCircle(0, 0, 10)
model.do()
- base = base_sketch.selectFace(base_circle.result())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
- to_obejct = to_sketch.selectFace(to_circle.result())[0]
- from_object = from_sketch.selectFace(from_circle.result())[0]
+ base = base_sketch.selectFace()
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ to_obejct = to_sketch.selectFace()[0]
+ from_object = from_sketch.selectFace()[0]
- revolution = model.addRevolution(self.part, base, axis_object,
+ revolution = model.addRevolution(self.part, base, axis_object[0],
to_obejct, 15,
from_object, 20)
- self.assertEqual(revolution.getCreationMethod().value(), "ByPlanesAndOffsets")
- self.assertEqual(revolution.getToAngle().value(), 0)
- self.assertEqual(revolution.getFromAngle().value(), 0)
+ self.assertEqual(revolution.creationMethod().value(), "ByPlanesAndOffsets")
+ self.assertEqual(revolution.toAngle().value(), 0)
+ self.assertEqual(revolution.fromAngle().value(), 0)
# self.assertEqual(revolution.getToObject().context(),
# to_sketch.result())
- self.assertEqual(revolution.getToOffset().value(), 15)
+ self.assertEqual(revolution.toOffset().value(), 15)
# self.assertEqual(revolution.getFromObject().context(),
# from_sketch.result())
- self.assertEqual(revolution.getFromOffset().value(), 20)
+ self.assertEqual(revolution.fromOffset().value(), 20)
class FeaturesRevolutionTestCase(FeaturesRevolutionFixture):
def test_revolution_get_attribute(self):
# call method of the feature
- self.assertTrue(isinstance(self.revolution.getBase(),
+ self.assertTrue(isinstance(self.revolution.baseObjects(),
ModelAPI.ModelAPI_AttributeSelectionList))
- self.assertTrue(isinstance(self.revolution.getAxisObject(),
+ self.assertTrue(isinstance(self.revolution.axis(),
ModelAPI.ModelAPI_AttributeSelection))
- self.assertTrue(isinstance(self.revolution.getCreationMethod(),
+ self.assertTrue(isinstance(self.revolution.creationMethod(),
ModelAPI.ModelAPI_AttributeString))
- self.assertTrue(isinstance(self.revolution.getToAngle(),
+ self.assertTrue(isinstance(self.revolution.toAngle(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.revolution.getFromAngle(),
+ self.assertTrue(isinstance(self.revolution.fromAngle(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.revolution.getToObject(),
+ self.assertTrue(isinstance(self.revolution.toObject(),
ModelAPI.ModelAPI_AttributeSelection))
- self.assertTrue(isinstance(self.revolution.getToOffset(),
+ self.assertTrue(isinstance(self.revolution.toOffset(),
ModelAPI.ModelAPI_AttributeDouble))
- self.assertTrue(isinstance(self.revolution.getFromObject(),
+ self.assertTrue(isinstance(self.revolution.fromObject(),
ModelAPI.ModelAPI_AttributeSelection))
- self.assertTrue(isinstance(self.revolution.getFromOffset(),
+ self.assertTrue(isinstance(self.revolution.fromOffset(),
ModelAPI.ModelAPI_AttributeDouble))
def test_revolution_set_angles(self):
self.revolution.setAngles(90, 270)
- self.assertEqual(self.revolution.getCreationMethod().value(), "ByAngles")
- self.assertEqual(self.revolution.getToAngle().value(), 90)
- self.assertEqual(self.revolution.getFromAngle().value(), 270)
- self.assertEqual(self.revolution.getToObject().context(), None)
- self.assertEqual(self.revolution.getToOffset().value(), 0)
- self.assertEqual(self.revolution.getFromObject().context(), None)
- self.assertEqual(self.revolution.getFromOffset().value(), 0)
+ self.assertEqual(self.revolution.creationMethod().value(), "ByAngles")
+ self.assertEqual(self.revolution.toAngle().value(), 90)
+ self.assertEqual(self.revolution.fromAngle().value(), 270)
+ self.assertEqual(self.revolution.toObject().context(), None)
+ self.assertEqual(self.revolution.toOffset().value(), 0)
+ self.assertEqual(self.revolution.fromObject().context(), None)
+ self.assertEqual(self.revolution.fromOffset().value(), 0)
def test_revolution_set_planes_and_offsets(self):
# base
base_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
base_circle = base_sketch.addCircle(0, 0, 10)
- # axis
- axis_sketch = model.addSketch(self.part, model.defaultPlane("XOY"))
- line = axis_sketch.addLine(20, -10, 20, 10)
# to
to_plane = model.defaultPlane("XOY")
- to_plane.location().setZ(10)
+ to_plane.origin().setZ(10)
to_sketch = model.addSketch(self.part, to_plane)
to_circle = to_sketch.addCircle(0, 0, 10)
# from
from_plane = model.defaultPlane("XOY")
- from_plane.location().setZ(-10)
+ from_plane.origin().setZ(-10)
from_sketch = model.addSketch(self.part, from_plane)
from_circle = from_sketch.addCircle(0, 0, 10)
model.do()
- base = base_sketch.selectFace(base_circle.result())
- axis_object = Selection(axis_sketch.firstResult(),
- line.firstResult().shape())
- to_obejct = to_sketch.selectFace(to_circle.result())[0]
- from_object = from_sketch.selectFace(from_circle.result())[0]
+ base = base_sketch.selectFace()
+ axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
+ axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
+ axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ to_obejct = to_sketch.selectFace()[0]
+ from_object = from_sketch.selectFace()[0]
self.revolution.setPlanesAndOffsets(to_obejct, 15, from_object, 20)
- self.assertEqual(self.revolution.getCreationMethod().value(), "ByPlanesAndOffsets")
- self.assertEqual(self.revolution.getToAngle().value(), 0)
- self.assertEqual(self.revolution.getFromAngle().value(), 0)
+ self.assertEqual(self.revolution.creationMethod().value(), "ByPlanesAndOffsets")
+ # self.assertEqual(self.revolution.toAngle().value(), 0)
+ # self.assertEqual(self.revolution.fromAngle().value(), 0)
# self.assertEqual(self.revolution.getToObject().context(), None)
- self.assertEqual(self.revolution.getToOffset().value(), 15)
+ self.assertEqual(self.revolution.toOffset().value(), 15)
# self.assertEqual(self.revolution.getFromObject().context(), None)
- self.assertEqual(self.revolution.getFromOffset().value(), 20)
+ self.assertEqual(self.revolution.fromOffset().value(), 20)
if __name__ == "__main__":
import model
import geom
-from model import WrongNumberOfArguments
from TestSketcher import SketcherTestCase
class SketcherAddArc(SketcherTestCase):
def test_arc_by_coords(self):
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
center = geom.Pnt2d(0, 1)
start = geom.Pnt2d(0, 0)
end = geom.Pnt2d(1, 1)
- arc = self.sketch.addArc(center, start, end)
+ arc = self.sketch.addArc(center, start, end, 0)
model.do()
self.assertEqual(arc.startPoint().x(), 0)
self.assertEqual(arc.startPoint().y(), 0)
- def test_number_of_args(self):
- with self.assertRaises(WrongNumberOfArguments):
- self.sketch.addArc(0, 1, 1, 1)
- with self.assertRaises(WrongNumberOfArguments):
- self.sketch.addArc(0, 1)
-
def test_modify_arc(self):
# Note: arc will modify startPoint and endPoint to be in circle
- arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
- arc.setCenter(0, 0)
- arc.setStartPoint(1, 1)
- arc.setEndPoint(-1, -1)
+ arc = self.sketch.addArc(0, 1, 0, 0, 1, 1, 0)
+ arc.setByCenterStartEnd(0, 0, 1, 1, -1, -1, 0)
model.do()
self.assertEqual(arc.center().x(), 0)
self.assertEqual(arc.center().y(), 0)
import model
from TestSketcher import SketcherTestCase
-class SketcherAddCircle(SketcherTestCase):
+class SketcherAddCircle(SketcherTestCase):
def test_add_cricle(self):
circle = self.sketch.addCircle(0, 10, 20)
model.do()
- self.assertEqual(circle.center().x(), 0.0)
+ self.assertEqual(circle.center().x(), 0.0)
self.assertEqual(circle.center().y(), 10.0)
- self.assertEqual(circle.radius(), 20.0)
-
+ self.assertEqual(circle.radius().value(), 20.0)
+
def test_modify_circle(self):
circle = self.sketch.addCircle(0, 10, 20)
model.do()
circle.setCenter(10, 10)
circle.setRadius(30)
model.do()
- self.assertEqual(circle.center().x(), 10.0)
+ self.assertEqual(circle.center().x(), 10.0)
self.assertEqual(circle.center().y(), 10.0)
- self.assertEqual(circle.radius(), 30.0)
-
-
+ self.assertEqual(circle.radius().value(), 30.0)
+
+
if __name__ == "__main__":
- unittest.main(verbosity=2)
\ No newline at end of file
+ unittest.main(verbosity=2)
import model
from TestSketcher import SketcherTestCase
-class SketcherAddLine(SketcherTestCase):
+class SketcherAddLine(SketcherTestCase):
def test_add_line(self):
line = self.sketch.addLine(0, 0, 0, 1)
model.do()
- self.assertEqual(line.getStartPoint().x(), line.getEndPoint().x())
- self.assertNotEqual(line.getStartPoint().y(), line.getEndPoint().y())
+ self.assertEqual(line.startPoint().x(), line.endPoint().x())
+ self.assertNotEqual(line.startPoint().y(), line.endPoint().y())
def test_modify_line(self):
line = self.sketch.addLine(0, 0, 0, 1)
model.do()
line.setStartPoint(0, 1)
line.setEndPoint(1, 1)
- self.assertEqual(line.getStartPoint().x(), 0)
- self.assertEqual(line.getStartPoint().y(), 1)
- self.assertEqual(line.getEndPoint().x(), 1)
- self.assertEqual(line.getEndPoint().y(), 1)
+ self.assertEqual(line.startPoint().x(), 0)
+ self.assertEqual(line.startPoint().y(), 1)
+ self.assertEqual(line.endPoint().x(), 1)
+ self.assertEqual(line.endPoint().y(), 1)
if __name__ == "__main__":
model.do()
def test_add_mirror(self):
- mirror = self.sketch.addMirror(
- self.line.result(), self.circle_1.result()
- )
+ mirror = self.sketch.addMirror(self.line, [self.circle_1])
model.do()
mirrored_objects = mirror.mirroredObjects()
mirrored_circle = mirrored_objects.object(0)
circle_feature = ModelAPI_Feature.feature(mirrored_circle)
center = geomDataAPI_Point2D(circle_feature.attribute("CircleCenter"))
- self.assertEqual(center.x(), -30, msg="%s" % center.x())
+ self.assertEqual(center.x(), -30)
# dir(mirrored_circle)
# center = geomDataAPI_Point2D(mirrored_circle.data().attribute("CircleCenter"))
# self.assertEqual(center.x(), -30, msg="%s"%(dir(mirrored_circle)))
import model
from TestSketcher import SketcherTestCase
-class SketcherAddPoint(SketcherTestCase):
+class SketcherAddPoint(SketcherTestCase):
def test_add_point(self):
point = self.sketch.addPoint(0, 1)
model.do()
- self.assertEqual(point.pointData().x(), 0.0)
- self.assertEqual(point.pointData().y(), 1.0)
-
+ self.assertEqual(point.coordinates().x(), 0.0)
+ self.assertEqual(point.coordinates().y(), 1.0)
+
def test_modify_point(self):
point = self.sketch.addPoint(0, 1)
- point.setValue(1, 2)
+ point.setCoordinates(1, 2)
model.do()
- self.assertEqual(point.pointData().x(), 1.0)
- self.assertEqual(point.pointData().y(), 2.0)
-
- def test_empty_args(self):
- with self.assertRaises(TypeError):
- self.sketch.addPoint()
-
-
+ self.assertEqual(point.coordinates().x(), 1.0)
+ self.assertEqual(point.coordinates().y(), 2.0)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
import model
from TestSketcher import SketcherTestCase
-class SketcherSetCoincident(SketcherTestCase):
+class SketcherSetCoincident(SketcherTestCase):
def test_set_coincident(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
model.do()
-
+
def test_none_type_arguments(self):
l2 = self.sketch.addLine(0, 1, 1, 1)
with self.assertRaises(TypeError):
self.sketch.setCoincident(None, l2.startPoint())
-
+
def test_empty_arguments(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
with self.assertRaises(TypeError):
import model
from TestSketcher import SketcherTestCase
-class SketcherSetFillet(SketcherTestCase):
+class SketcherSetFillet(SketcherTestCase):
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
- self.sketch.setFillet(l1.endPoint(), 10.0)
+ self.sketch.setFillet([l1.endPoint()], 10.0)
model.do()
if __name__ == "__main__":
--- /dev/null
+import unittest
+import model
+from TestSketcher import SketcherTestCase
+
+class SketcherSetFixed(SketcherTestCase):
+ def runTest(self):
+ circle = self.sketch.addCircle(0, 10, 20)
+ self.sketch.setFixed(circle)
+ model.do()
+ circle.setCenter(0, 0)
+ model.do()
+ self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
import model
from TestSketcher import SketcherTestCase
-class SketcherSetHorizontal(SketcherTestCase):
+class SketcherSetHorizontal(SketcherTestCase):
def runTest(self):
line = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setHorizontal(line.result())
+ self.sketch.setHorizontal(line)
model.do()
self.assertEqual(line.startPoint().y(), line.endPoint().y())
import TestSketcher
from TestSketcher import SketcherTestCase
-class SketcherSetLength(SketcherTestCase):
+class SketcherSetLength(SketcherTestCase):
def runTest(self):
# Set the constraint
line = self.sketch.addLine(0, 0, 0, 1)
- self.sketch.setLength(line.result(), 25.0)
+ self.sketch.setLength(line, 25.0)
# Commit the transaction
model.do()
# Check the result
math.pow((line.endPoint().y() - line.startPoint().y()), 2)
)
self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA)
-
+
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
import model
from TestSketcher import SketcherTestCase
-class SketcherSetParallel(SketcherTestCase):
+class SketcherSetParallel(SketcherTestCase):
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
- self.sketch.setParallel(l1.result(), l2.result())
+ self.sketch.setParallel(l1, l2)
model.do()
if __name__ == "__main__":
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setPerpendicular(l1.result(), l2.result())
+ self.sketch.setPerpendicular(l1, l2)
model.do()
-
+
dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \
(l2.endPoint().x() - l2.startPoint().x()) + \
(l1.endPoint().y() - l1.startPoint().y()) * \
import model
from TestSketcher import SketcherTestCase
-class SketcherSetRadius(SketcherTestCase):
+class SketcherSetRadius(SketcherTestCase):
def test_set_radius(self):
circle = self.sketch.addCircle(0, 10, 20)
- self.sketch.setRadius(circle.result(), 30)
+ self.sketch.setRadius(circle, 30)
model.do()
- self.assertEqual(circle.radius(), 30.0)
-
+ self.assertEqual(circle.radius().value(), 30.0)
+
def test_modify_radius(self):
circle = self.sketch.addCircle(0, 10, 20)
- radius_constraint = self.sketch.setRadius(circle.result(), 30)
+ radius_constraint = self.sketch.setRadius(circle, 30)
model.do()
- self.sketch.setValue(radius_constraint, 20)
+ self.sketch.setValue(radius_constraint, 25)
model.do()
- self.assertEqual(circle.radius(), 20.0)
-
+ self.assertEqual(circle.radius().value(), 25.0)
+
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
+++ /dev/null
-import unittest
-import model
-from TestSketcher import SketcherTestCase
-
-class SketcherSetRigid(SketcherTestCase):
- def runTest(self):
- circle = self.sketch.addCircle(0, 10, 20)
- self.sketch.setRigid(circle.result())
- model.do()
- circle.setCenter(0, 0)
- model.do()
- self.assertEqual((circle.center().x(), circle.center().y()), (0, 10))
-
-if __name__ == "__main__":
- unittest.main(verbosity=2)
)
def test_set_tangent(self):
- self.sketch.setTangent(self.line.result(), self.arc.result())
+ self.sketch.setTangent(self.line, self.arc)
model.do()
# TODO : find a way to check that the constraint as been set
def test_none_type_arguments(self):
with self.assertRaises(TypeError):
- self.sketch.setTangent(None, self.arc.result())
+ self.sketch.setTangent(None, self.arc)
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
import model
from TestSketcher import SketcherTestCase
-class SketcherSetVertical(SketcherTestCase):
+class SketcherSetVertical(SketcherTestCase):
def runTest(self):
line = self.sketch.addLine(0, 0, 1, 1)
- self.sketch.setVertical(line.result())
+ self.sketch.setVertical(line)
model.do()
self.assertEqual(line.startPoint().x(), line.endPoint().x())
mybase.setCoincident(l3.endPoint(), l4.startPoint())
mybase.setCoincident(l4.endPoint(), l1.startPoint())
-mybase.setParallel(l1.result(), l3.result())
-mybase.setParallel(l2.result(), l4.result())
+mybase.setParallel(l1, l3)
+mybase.setParallel(l2, l4)
-mybase.setPerpendicular(l1.result(), l4.result())
+mybase.setPerpendicular(l1, l4)
-mywidth = mybase.setLength(l1.result(), 50)
-mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50)
+mywidth = mybase.setLength(l1, 50)
+mylength = mybase.setDistance(l1.startPoint(), l3, 50)
# Creating the extrusion
mystand = model.addSketch(mypart, thisface)
c1 = mystand.addCircle(0, 25, 5)
-mystand.setDistance(c1.center(), thisxmin, 10)
-mystand.setDistance(c1.center(), thiszmax, 10)
+mystand.setDistance(c1.center(), mystand.addLine(thisxmin), 10)
+mystand.setDistance(c1.center(), mystand.addLine(thiszmax), 10)
-myboss = model.addExtrusion(mypart, mystand.selectFace(c1.result()), -5)
+
+myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
# Subtracting the cylinder to the box
-model.addSubtraction(mypart, mybox.result(), myboss.result())
+model.addCut(mypart, mybox.result(), myboss.result())
model.end()
p3 = geom.Pnt2d(1, 1)
p4 = geom.Pnt2d(1, 0)
-line = mybase.addPolygon(p1, p2, p3, p4)
+line = model.addPolygon(mybase, p1, p2, p3, p4)
-mybase.setParallel(line[0].result(), line[2].result())
-mybase.setParallel(line[1].result(), line[3].result())
-mybase.setPerpendicular(line[0].result(), line[3].result())
+mybase.setParallel(line[0], line[2])
+mybase.setParallel(line[1], line[3])
+mybase.setPerpendicular(line[0], line[3])
-mywidth = mybase.setLength(line[0].result(), 50)
-mylength = mybase.setDistance(line[0].startPoint(), line[2].result(), 50)
+mywidth = mybase.setLength(line[0], 50)
+mylength = mybase.setDistance(line[0].startPoint(), line[2], 50)
# Creating the extrusion
mystand = model.addSketch(mypart, thisface)
circle = mystand.addCircle(0, 25, 5)
-mystand.setDistance(circle.center(), thisxmin, 10)
-mystand.setDistance(circle.center(), thiszmax, 10)
+mystand.setDistance(circle.center(), mystand.addLine(thisxmin), 10)
+mystand.setDistance(circle.center(), mystand.addLine(thiszmax), 10)
myboss = model.addExtrusion(mypart, mystand.selectFace(), -5)
# Subtracting the cylinder to the box
-model.addSubtraction(mypart, mybox.result(), myboss.result())
+model.addCut(mypart, mybox.result(), myboss.result())
model.end()
P = 80
# Create Parameters
-model.addParameter(part, "L", L)
-model.addParameter(part, "E", E)
-model.addParameter(part, "P", P)
+model.addParameter(part, "L", str(L))
+model.addParameter(part, "E", str(E))
+model.addParameter(part, "P", str(P))
def vertical_body():
# Create YOZ sketch
points = [(0, 0), (0, L), (L, L), (L, 0)]
geom_points = [geom.Pnt2d(*p) for p in points]
- left, top, right, bottom = sketch.addPolygon(*geom_points)
+ left, top, right, bottom = model.addPolygon(sketch, *geom_points)
# Set constraints
- sketch.setRigid(left.startPoint())
+ sketch.setFixed(left.startPoint())
- sketch.setHorizontal(bottom.result())
- sketch.setHorizontal(top.result())
+ sketch.setHorizontal(bottom)
+ sketch.setHorizontal(top)
- sketch.setVertical(right.result())
- sketch.setVertical(left.result())
+ sketch.setVertical(right)
+ sketch.setVertical(left)
- sketch.setLength(top.result(), "L")
- sketch.setLength(left.result(), "L")
+ sketch.setLength(top, "L")
+ sketch.setLength(left, "L")
- sketch.setFillet(left.endPoint(), 32)
+ sketch.setFillet([left.endPoint()], 32)
model.do() #!!!
points = [(0, 0), (0, L), (P, L), (P, 16 + 16), (P - 20, 16 + 16), (P - 20, 16), (P, 16), (P, 0)]
points = [(p[0], -p[1]) for p in points] # as we look to back of the face
geom_points = [geom.Pnt2d(*p) for p in points]
- left, top, v2, h2, v1, h1, right, bottom = sketch.addPolygon(*geom_points)
+ left, top, v2, h2, v1, h1, right, bottom = model.addPolygon(sketch, *geom_points)
points = [(P - 20, 16 + 16 / 2), (P - 20, 16), (P - 20, 16 + 16)]
points = [(p[0], -p[1]) for p in points] # as we look to back of the face
center, start, end = [geom.Pnt2d(*p) for p in points]
- arc = sketch.addArc(center, start, end, inversed=True)
+ arc = sketch.addArc(center, start, end, True)
# Set Auxiliarity
v1.setAuxiliary(True)
# Set constraints
- sketch.setParallel(left.result(), right.result())
- sketch.setParallel(left.result(), v2.result())
- sketch.setParallel(bottom.result(), h1.result())
- sketch.setParallel(top.result(), h2.result())
+ sketch.setParallel(left, right)
+ sketch.setParallel(left, v2)
+ sketch.setParallel(bottom, h1)
+ sketch.setParallel(top, h2)
- sketch.setPerpendicular(left.result(), bottom.result())
- sketch.setPerpendicular(left.result(), top.result())
+ sketch.setPerpendicular(left, bottom)
+ sketch.setPerpendicular(left, top)
- sketch.setEqual(top.result(), bottom.result())
- sketch.setEqual(h1.result(), h2.result())
+ sketch.setEqual(top, bottom)
+ sketch.setEqual(h1, h2)
- sketch.setCoincident(arc.center(), v1.result())
+ sketch.setCoincident(arc.center(), v1)
sketch.setCoincident(arc.startPoint(), h2.endPoint())
sketch.setCoincident(arc.endPoint(), h1.startPoint())
model.do() #!!!
# Dimensions
- sketch.setLength(v1.result(), 16)
- sketch.setLength(h2.result(), 20)
- sketch.setLength(right.result(), 16)
- sketch.setLength(top.result(), "P")
+ sketch.setLength(v1, 16)
+ sketch.setLength(h2, 20)
+ sketch.setLength(right, 16)
+ sketch.setLength(top, "P")
model.do()
# Create extrusion
points = [(0, 0), (0, H), (l, H), (l + 2 * r, H), (L, H), (L, 0)]
points = [(p[0], -p[1]) for p in points] # as we look to back of the face
geom_points = [geom.Pnt2d(*p) for p in points]
- left, top_left, top_middle, top_right, right, bottom, = sketch.addPolygon(*geom_points)
+ left, top_left, top_middle, top_right, right, bottom, = model.addPolygon(sketch, *geom_points)
points = [(l + r, H), (l + 2 * r, H), (l, H)]
points = [(p[0], -p[1]) for p in points] # as we look to back of the face
center, start, end = [geom.Pnt2d(*p) for p in points]
- arc = sketch.addArc(center, start, end)
+ arc = sketch.addArc(center, start, end, False)
# Set Auxiliarity
top_middle.setAuxiliary(True)
# Set constraints
- sketch.setParallel(bottom.result(), top_left.result())
- sketch.setParallel(bottom.result(), top_right.result())
+ sketch.setParallel(bottom, top_left)
+ sketch.setParallel(bottom, top_right)
- sketch.setPerpendicular(bottom.result(), left.result())
- sketch.setPerpendicular(bottom.result(), right.result())
+ sketch.setPerpendicular(bottom, left)
+ sketch.setPerpendicular(bottom, right)
- sketch.setEqual(left.result(), right.result())
+ sketch.setEqual(left, right)
- sketch.setLength(bottom.result(), L)
- sketch.setLength(right.result(), H)
- sketch.setLength(top_left.result(), l)
+ sketch.setLength(bottom, L)
+ sketch.setLength(right, H)
+ sketch.setLength(top_left, l)
- sketch.setCoincident(top_middle.result(), arc.center())
+ sketch.setCoincident(top_middle, arc.center())
sketch.setCoincident(top_middle.endPoint(), arc.startPoint())
sketch.setCoincident(top_middle.startPoint(), arc.endPoint())
- sketch.setRadius(arc.result(), r)
+ sketch.setRadius(arc, r)
# Binding
bottom_e = sketch.addLine("Boolean_1_1/Modified_5&Boolean_1_1/Modified_8")
- sketch.setCoincident(bottom_e.result(), bottom.startPoint())
+ sketch.setCoincident(bottom_e, bottom.startPoint())
sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
model.do() #!!!
points = [(0, 0), (0, 1), (1, 0)]
points = [(p[0], -p[1]) for p in points] # as we look to back of the face
geom_points = [geom.Pnt2d(*p) for p in points]
- left, diagonal, bottom = sketch.addPolygon(*geom_points)
+ left, diagonal, bottom = model.addPolygon(sketch, *geom_points)
# Binding
bottom_e = sketch.addLine("Boolean_2_1/Modified_3&Boolean_2_1/Modified_4")
b1 = vertical_body()
b2 = bottom_body()
-boolean = model.addAddition(part, b1.result() + b2.result())
+boolean = model.addFuse(part, b1.result() + b2.result())
model.do()
b3 = body_3()
-boolean = model.addAddition(part, boolean.result() + b3.result())
+boolean = model.addFuse(part, boolean.result() + b3.result())
model.do()
# START DEBUG PURPOSES
# END DEBUG PURPOSES
b4 = body_4()
-boolean = model.addAddition(part, boolean.result() + b4.result())
-model.do()
+boolean = model.addFuse(part, boolean.result() + b4.result())
+model.end()
from services import *
from roots import *
-from tools import Selection
# Built-in features
-from sketcher.sketch import addSketch
+from sketcher import *
from connection import *
from construction import *
from exchange import *
from features import *
from parameter import *
from partset import *
-
-# Custom exceptions
-
-from errors import WrongNumberOfArguments
-from errors import FeatureInputInvalid
"""Package for Connection plugin for the Parametric Geometry API of the Modeler.
"""
-from connection import exportToGEOM
\ No newline at end of file
+from ConnectorAPI import exportToGEOM
\ No newline at end of file
+++ /dev/null
-"""Export to GEOM Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def exportToGEOM(part):
- """Export the Part to GEOM module.
-
- Args:
- part (ModelAPI_Document): part document
- """
- feature = part.addFeature("ExportToGEOM")
- feature.execute()
"""Package for Construction plugin for the Parametric Geometry API of the Modeler.
"""
-from point import addPoint
-from axis import addAxis
-from plane import addPlane
+from ConstructionAPI import addAxis, addPlane, addPoint
+++ /dev/null
-"""Axis Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addAxis(part, *args):
- """Add an Axis feature to the Part.
-
- .. function:: addAxis(part, p1, p2)
-
- Args:
- part (ModelAPI_Document): part document
- p1 (Selection): first point
- p2 (Selection): second point
-
- .. function:: addAxis(part, face)
-
- Args:
- part (ModelAPI_Document): part document
- face (Selection): cylindrical face
-
- Returns:
- Axis: axis object
- """
- assert(args)
- feature = part.addFeature("Axis")
- return Axis(feature, *args)
-
-
-class Axis(Interface):
- """Interface class for Axis feature.
-
- .. function:: Axis(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Axis(feature, p1, p2)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: Axis(feature, face)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Axis")
-
- self._CreationMethod = self._feature.data().string("CreationMethod")
- self._FirstPoint = self._feature.data().selection("FirstPoint")
- self._SecondPoint = self._feature.data().selection("SecondPoint")
- self._CylindricalFace = self._feature.data().selection("CylindricalFace")
-
- assert(self._CreationMethod)
- assert(self._FirstPoint)
- assert(self._SecondPoint)
- assert(self._CylindricalFace)
-
- if not args:
- return
-
- assert(len(args) in (1, 2))
- if len(args) == 2:
- self.setPoints(*args)
- elif len(args) == 1:
- self.setCylindricalFace(*args)
-
- self.execute()
- pass
-
- def __clear(self):
- self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
- self._fillAttribute(self._FirstPoint, None)
- self._fillAttribute(self._SecondPoint, None)
- self._fillAttribute(self._CylindricalFace, None)
-
- def setPoints(self, p1, p2):
- """Modify points attribute of the feature.
-
- See __init__.
- """
- self.__clear()
- self._fillAttribute(self._CreationMethod, "AxisByPointsCase")
- self._fillAttribute(self._FirstPoint, p1)
- self._fillAttribute(self._SecondPoint, p2)
- pass
-
- def setCylindricalFace(self, face):
- """Modify CylindricalFace attribute of the feature.
-
- See __init__.
- """
- self.__clear()
- self._fillAttribute(self._CreationMethod, "AxisByCylindricalFaceCase")
- self._fillAttribute(self._CylindricalFace, face)
- pass
+++ /dev/null
-"""Plane Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addPlane(part, *args):
- """Add a Plane feature to the Part and return Plane.
-
- .. function:: addPartition(part, face, distance)
-
- Args:
- part (ModelAPI_Document): part document
- face (Selection): plane face
- distance (double): distance
-
- .. function:: addPartition(part, a, b, c, d)
-
- Args:
- part (ModelAPI_Document): part document
- a (double): general equation parameter
- b (double): general equation parameter
- c (double): general equation parameter
- d (double): general equation parameter
-
- Returns:
- Plane: plane object
- """
- assert(args)
- feature = part.addFeature("Plane")
- return Plane(feature, *args)
-
-
-class Plane(Interface):
- """Interface class for Plane feature.
-
- .. function:: Plane(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Plane(feature, face, distance)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: Plane(feature, a, b, c, d)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Plane")
-
- self._CreationMethod = self._feature.data().string("CreationMethod")
- self._plane_face = self._feature.data().selection("planeFace")
- self._distance = self._feature.data().real("distance")
- self._a = self._feature.data().real("A")
- self._b = self._feature.data().real("B")
- self._c = self._feature.data().real("C")
- self._d = self._feature.data().real("D")
-
- assert(self._CreationMethod)
- assert(self._plane_face)
- assert(self._distance)
- assert(self._a)
- assert(self._b)
- assert(self._c)
- assert(self._d)
-
- if not args:
- return
-
- assert(len(args) in (2, 4))
- if len(args) == 2:
- self.setFaceAndDistance(*args)
- elif len(args) == 4:
- self.setGeneralEquation(*args)
-
- self.execute()
- pass
-
- def __clear(self):
- self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
- self._fillAttribute(self._plane_face, None)
- self._fillAttribute(self._distance, 0)
- self._fillAttribute(self._a, 0)
- self._fillAttribute(self._b, 0)
- self._fillAttribute(self._c, 0)
- self._fillAttribute(self._d, 0)
-
- def setFaceAndDistance(self, face, distance):
- """Modify face and distance attribute of the feature.
-
- See __init__.
- """
- self.__clear()
- self._fillAttribute(self._CreationMethod, "PlaneByFaceAndDistance")
- self._fillAttribute(self._plane_face, face)
- self._fillAttribute(self._distance, distance)
- pass
-
- def setGeneralEquation(self, a, b, c, d):
- """Modify GeneralEquation parameters of the feature.
-
- See __init__.
- """
- self.__clear()
- self._fillAttribute(self._CreationMethod, "PlaneByGeneralEquation")
- self._fillAttribute(self._a, a)
- self._fillAttribute(self._b, b)
- self._fillAttribute(self._c, c)
- self._fillAttribute(self._d, d)
- pass
+++ /dev/null
-"""Point Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addPoint(part, *args):
- """Add an Point feature to the Part and return Point.
-
- .. function:: addPoint(part, x, y, z)
-
- Args:
- part (ModelAPI_Document): part document
- x (double): X coordinate for the point
- y (double): Y coordinate for the point
- z (double): Z coordinate for the point
-
- Returns:
- Point: point object
- """
- assert(args)
- feature = part.addFeature("Point")
- return Point(feature, *args)
-
-
-class Point(Interface):
- """Interface class for Point feature.
-
- .. function:: Point(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Point(feature, x, y, z)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Point")
-
- self._x = self._feature.data().real("x")
- self._y = self._feature.data().real("y")
- self._z = self._feature.data().real("z")
-
- assert(self._x)
- assert(self._y)
- assert(self._z)
-
- if not args:
- return
-
- assert(len(args) == 3)
- self.setPoint(*args)
-
- self.execute()
- pass
-
- def setPoint(self, x, y, z):
- """Modify base attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._x, x)
- self._fillAttribute(self._y, y)
- self._fillAttribute(self._z, z)
- pass
+++ /dev/null
-# Package exceptions
-
-class ModelError(Exception):
- """Base class for exceptions in this package."""
- pass
-
-class WrongNumberOfArguments(ModelError):
- """Exception raised when a wrong number of arguments is given."""
- pass
-
-class FeatureInputInvalid(ModelError):
- """Exception raised if a feature input is invalid."""
- pass
-
- #Attributes:
- #expr -- input expression in which the error occurred
- #msg -- explanation of the error
- #"""
-
- #def __init__(self, expr, msg):
- #self.expr = expr
- #self.msg = msg
"""Package for Exchange plugin for the Parametric Geometry API of the Modeler.
"""
-from exchange import addImport, exportToFile
\ No newline at end of file
+from ExchangeAPI import addImport, exportToFile
\ No newline at end of file
+++ /dev/null
-"""Import Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addImport(part, *args):
- """Add an Import feature to the Part.
-
- .. function:: addImport(part, file_path)
-
- Args:
- part (ModelAPI_Document): part document
- file_path (string): path to the imported file
-
- Returns:
- Import: import object
- """
- assert(args)
- feature = part.addFeature("Import")
- return Import(feature, *args)
-
-
-class Import(Interface):
- """Interface class for Import feature.
-
- .. function:: Import(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Import(feature, file_path)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Import")
-
- self._file_path = self._feature.data().string("file_path")
-
- assert(self._file_path)
-
- if not args:
- return
-
- assert(len(args) == 1)
- self.setFilePath(args[0])
-
- self.execute()
- pass
-
- def setFilePath(self, file_path):
- """Modify file path attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._file_path, file_path)
- pass
-
-
-def exportToFile(part, *args):
- """Perform export from the Part to file.
-
- .. function:: exportToFile(part, file_path, file_format, selection_list)
-
- Args:
- part (ModelAPI_Document): part document
- file_path (string): path to the exported file
- file_format (string): format of to the exported file
- selection_list (list of Selection): objects to export
-
- Returns:
- Export: export object
- """
- assert(args)
- feature = part.addFeature("Export")
- return Export(feature, *args)
-
-
-class Export(Interface):
- """Interface class for Export feature.
-
- .. function:: Export(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Export(feature, file_path, file_format, selection_list)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Export")
-
- self._file_path = self._feature.data().string("file_path")
- self._file_format = self._feature.data().string("file_format")
- self._objects = self._feature.data().selectionList("selection_list")
-
- assert(self._file_path)
- assert(self._file_format)
- assert(self._objects)
-
- if not args:
- return
-
- assert(len(args) == 3)
- self.setFilePath(args[0])
- self.setFileFormat(args[1])
- self.setObjects(args[2])
-
- self.execute()
- pass
-
- def setFilePath(self, file_path):
- """Modify file path attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._file_path, file_path)
- pass
-
- def setFileFormat(self, file_format):
- """Modify file path attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._file_format, file_format)
- pass
-
- def setObjects(self, objects):
- """Modify file path attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._objects, object)
- pass
"""Package for Features plugin for the Parametric Geometry API of the Modeler.
"""
-from boolean import addAddition, addSubtraction, addIntersection
+from FeaturesAPI import addPlacement, addRotation, addTranslation
-from partition import addPartition
+from FeaturesAPI import addFuse, addCut, addCommon
-from extrusion import addExtrusion
-from extrusion_boolean import addExtrusionCut, addExtrusionFuse
+from FeaturesAPI import addPartition
-from revolution import addRevolution
-from revolution_boolean import addRevolutionCut, addRevolutionFuse
+from FeaturesAPI import addExtrusion, addExtrusionCut, addExtrusionFuse
+from FeaturesAPI import addRevolution, addRevolutionCut, addRevolutionFuse
-from placement import addPlacement
-from rotation import addRotation
-from translation import addTranslation
-
-from group import addGroup
+from FeaturesAPI import addGroup
+++ /dev/null
-"""Boolean operations Interface
-Author: Daniel Brunier-Coulin with contribution by Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from GeomAlgoAPI import GeomAlgoAPI_Boolean
-
-from model.roots import Interface
-from model import Selection
-
-def addAddition(part, *args):
- """Perform addition in the Part.
-
- .. function:: addAddition(part, main_objects, tool_objects)
-
- This operation adds tools to the given objects.
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): (optional) tool_objects objects
-
- Returns:
- Boolean: boolean object
- """
- assert(args)
- feature = part.addFeature("Boolean")
- return Boolean(
- feature, GeomAlgoAPI_Boolean.BOOL_FUSE, *args)
-
-
-def addSubtraction(part, *args):
- """Perform subtraction in the Part.
-
- .. function:: addSubtraction(part, main_objects, tool_objects)
-
- This operation subtracts tools from the given objects.
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): tool_objects objects
-
- Returns:
- Boolean: boolean object
- """
- assert(args)
- main_objects, tool_objects = args
- feature = part.addFeature("Boolean")
- return Boolean(
- feature, GeomAlgoAPI_Boolean.BOOL_CUT, main_objects, tool_objects)
-
-
-def addIntersection(part, *args):
- """Perform intersection in the Part.
-
- .. function:: addIntersection(part, main_objects, tool_objects)
-
- This operation intersects tools with the given objects.
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of :class:`model.Selection`): main objects
- tool_objects (list of :class:`model.Selection`): tool_objects objects
-
- Returns:
- Boolean: boolean object
- """
- assert(args)
- main_objects, tool_objects = args
- feature = part.addFeature("Boolean")
- return Boolean(
- feature, GeomAlgoAPI_Boolean.BOOL_COMMON, main_objects, tool_objects)
-
-
-class Boolean(Interface):
- """Interface class for Boolean features.
-
- .. function:: Boolean(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Boolean(feature, bool_type, main_objects)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: Boolean(feature, bool_type, main_objects, tool_objects)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Boolean")
-
- self._main_objects = self._feature.selectionList("main_objects")
- self._tool_objects = self._feature.selectionList("tool_objects")
- self._bool_type = self._feature.integer("bool_type")
-
- assert(self._main_objects)
- assert(self._tool_objects)
- assert(self._bool_type)
-
- if not args:
- return
-
- assert(len(args) in (2, 3))
- bool_type, main_objects = args[:2]
-
- self.setBoolType(bool_type)
- self.setMainObjects(main_objects)
-
- if len(args) == 3:
- tool_objects = args[2]
- self.setToolObjects(tool_objects)
-
- self.execute()
- pass
-
- def setMainObjects(self, main_objects):
- """Modify main_objects attribute of the feature.
-
- Args:
- main_objects (list of :class:`model.Selection`): main objects
- """
- self._fillAttribute(self._main_objects, main_objects)
- pass
-
- def setToolObjects(self, tool_objects):
- """Modify tool_objects attribute of the feature.
-
- Args:
- tool_objects (list of :class:`model.Selection`): tool objects
- """
- self._fillAttribute(self._tool_objects, tool_objects)
- pass
-
- def setBoolType(self, bool_type):
- """Modify bool_type attribute of the feature.
-
- Args:
- bool_type (integer): type of operation
-
- Available types:
-
- * GeomAlgoAPI_Boolean.BOOL_FUSE
- * GeomAlgoAPI_Boolean.BOOL_CUT
- * GeomAlgoAPI_Boolean.BOOL_COMMON
- """
- self._fillAttribute(self._bool_type, bool_type)
- pass
-
- def result(self):
- """F.result() -> list of Selection objects"""
- return [Selection(result, result.shape()) for result in (self.firstResult(),)]
+++ /dev/null
-"""Extrusion Interface
-Author: Daniel Brunier-Coulin with contribution by Mikhail Ponikarov
- and Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-from model import Selection
-
-def addExtrusion(part, *args):
- """Add an Extrusion feature to the Part and return Extrusion.
-
- This function has *3 signatures*:
-
- .. function:: addExtrusion(base, size)
-
- Arguments:
- base(str, Sketch or list): base object(s)
- size(double): size of the extrusion, the side is decided by the sign
-
- .. function:: addExtrusion(base, to_size, from_size)
-
- Arguments:
- base(str, Sketch or list): base object(s)
- to_size(double): upper size of the extrusion
- from_size(double): lower size of the extrusion
-
- .. function:: addExtrusion(base, to_object, to_offset, from_object, from_offset)
-
- Arguments:
- base(str, Sketch or list): base object(s)
- to_object(plane): upper plane
- to_offset(double): offset from upper object
- from_object(plane): lower plane
- from_offset(double): offset from lower plane
-
- In all three cases the function returns an extrusion object
-
- Returns:
- Extrusion: extrusion object
- """
- assert(args)
- feature = part.addFeature("Extrusion")
- return Extrusion(feature, *args)
-
-
-class Extrusion(Interface):
- """Interface class for Extrusion feature.
- """
-
- def __init__(self, feature, *args):
- """
- Extrusion(feature) -> feature interface without initialization
- Extrusion(feature, base, size) ->
- feature interface initialized from arguments:
- - base -- name, sketch or list of names and sketches
- - size -- if positive -> to_size, if negative -> from_size
- Extrusion(feature, base, to_size, from_size) ->
- feature interface initialized from arguments:
- - base -- name, sketch or list of names and sketches
- - to_size -- upper size
- - from_size -- lower size
- Extrusion(feature, base, to_object, to_offset, from_object, from_offset) ->
- feature interface initialized from arguments:
- - base -- name, sketch or list of names and sketches
- - to_object -- upper object (plane)
- - to_offset -- offset from upper object
- - from_object -- lower object (plane)
- - from_offset -- offset from lower object
- """
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Extrusion")
-
- self._base = self._feature.data().selectionList("base")
- self._CreationMethod = self._feature.string("CreationMethod")
- self._to_size = self._feature.data().real("to_size")
- self._from_size = self._feature.data().real("from_size")
- self._to_object = self._feature.data().selection("to_object")
- self._to_offset = self._feature.data().real("to_offset")
- self._from_object = self._feature.data().selection("from_object")
- self._from_offset = self._feature.data().real("from_offset")
-
- assert(self._base)
- assert(self._CreationMethod)
- assert(self._to_size)
- assert(self._from_size)
- assert(self._to_object)
- assert(self._to_offset)
- assert(self._from_object)
- assert(self._from_offset)
-
- if not args:
- return
-
- assert(len(args) in (2, 3, 5))
- base = args[0]
- args = args[1:]
-
- self.setBase(base)
-
- if len(args) == 4:
- self.setPlanesAndOffsets(*args)
- elif len(args) == 2:
- self.setSizes(*args)
- elif len(args) == 1:
- self.setSize(args[0])
-
- self.execute()
- pass
-
- def __clear(self):
- self._CreationMethod.setValue("BySizes")
- self._fillAttribute(self._to_size, 0)
- self._fillAttribute(self._from_size, 0)
- self._fillAttribute(self._to_object, None)
- self._fillAttribute(self._to_offset, 0)
- self._fillAttribute(self._from_object, None)
- self._fillAttribute(self._from_offset, 0)
- pass
-
- def setBase(self, base):
- """Modify base attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._base, base)
- pass
-
- def setSizes(self, to_size, from_size, to_size_text="", from_size_text=""):
- """Modify the to_size, from_size attributes of the feature.
-
- See __init__.
- """
- # MPV: with "clear" calling here the extrusion all the time becomes modificed (height is set to
- # zero and then to actual value, but this function is used in macro Bax, that causes "modified"
- # values without changes that causes cyclic dependency
- #self.__clear()
- self._fillAttribute(self._CreationMethod, "BySizes")
- if to_size_text == "":
- self._fillAttribute(self._to_size, to_size)
- else:
- self._fillAttribute(self._to_size, to_size_text)
-
- if from_size_text == "":
- self._fillAttribute(self._from_size, from_size)
- else:
- self._fillAttribute(self._to_size, from_size_text)
- pass
-
- def setSize(self, size, text=""):
- """Modify the size of the feature.
-
- If size is positive then initialize to_size with size.
- If size is negative then initialize from_size with -size.
- """
- to_size, from_size = 0, 0
- to_size_text, from_size_text = "", ""
- if size >= 0:
- to_size = size
- to_size_text = text
- else:
- from_size = -size
- from_size_text = text
-
- self.setSizes(to_size, from_size, to_size_text, from_size_text)
-
- pass
-
- def setPlanesAndOffsets(self, to_object, to_offset,
- from_object, from_offset):
- """Modify planes and offsets attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByPlanesAndOffsets")
- self._fillAttribute(self._to_object, to_object)
- self._fillAttribute(self._to_offset, to_offset)
- self._fillAttribute(self._from_object, from_object)
- self._fillAttribute(self._from_offset, from_offset)
- pass
-
- def result(self):
- """F.result() -> list of Selection objects"""
- return [Selection(result, result.shape()) for result in (self.firstResult(),)]
+++ /dev/null
-"""ExtrusionCut and ExtrusionFuse Interfaces
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from .roots import CompositeBoolean
-
-
-def addExtrusionCut(part, *args):
- """Add an ExtrusionCut feature to the Part.
-
- .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_size, from_size)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- to_size (double): upper size of the extrusion
- from_size (double): lower size of the extrusion
-
- .. function:: addExtrusionCut(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- to_object (Selection): upper plane
- to_offset (double): offset from upper plane
- from_object (Selection): lower plane
- from_offset (double): offset from lower plane
-
- Returns:
- ExtrusionBoolean: extrusion boolean object
- """
- assert(args)
- feature = part.addFeature("ExtrusionCut")
- return ExtrusionBoolean(feature, *args)
-
-def addExtrusionFuse(part, *args):
- """Add an ExtrusionFuse feature to the Part and return ExtrusionBoolean.
-
- .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_size, from_size)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- to_size (double): upper size of the extrusion
- from_size (double): lower size of the extrusion
-
- .. function:: addExtrusionFuse(part, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- to_object (Selection): upper plane
- to_offset (double): offset from upper plane
- from_object (Selection): lower plane
- from_offset (double): offset from lower plane
-
- Returns:
- ExtrusionBoolean: extrusion boolean object
- """
- assert(args)
- feature = part.addFeature("ExtrusionFuse")
- return ExtrusionBoolean(feature, *args)
-
-
-class ExtrusionBoolean(CompositeBoolean):
- """Interface class for ExtrusionBoolean features.
-
- Supported features:
-
- * ExtrusionCut
- * ExtrusionFuse
-
- .. function:: ExtrusionBoolean(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_size, from_size)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: ExtrusionBoolean(feature, sketch, sketch_selection, boolean_objects, to_object, to_offset, from_object, from_offset)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- CompositeBoolean.__init__(self, feature, *args[:3])
- args = args[3:]
-
- self._CreationMethod = self._feature.string("CreationMethod")
- self._to_size = self._feature.data().real("to_size")
- self._from_size = self._feature.data().real("from_size")
- self._to_object = self._feature.data().selection("to_object")
- self._to_offset = self._feature.data().real("to_offset")
- self._from_object = self._feature.data().selection("from_object")
- self._from_offset = self._feature.data().real("from_offset")
-
- assert(self._CreationMethod)
- assert(self._to_size)
- assert(self._from_size)
- assert(self._to_object)
- assert(self._to_offset)
- assert(self._from_object)
- assert(self._from_offset)
-
- if not args:
- return
-
- assert(len(args) in (2, 4))
- if len(args) == 4:
- self.setPlanesAndOffsets(*args)
- elif len(args) == 2:
- self.setSizes(*args)
-
- self.execute()
- pass
-
- def __clear(self):
- self._CreationMethod.setValue("BySizes")
- self._fillAttribute(self._to_size, 0)
- self._fillAttribute(self._from_size, 0)
- self._fillAttribute(self._to_object, None)
- self._fillAttribute(self._to_offset, 0)
- self._fillAttribute(self._from_object, None)
- self._fillAttribute(self._from_offset, 0)
- pass
-
- def setSizes(self, to_size, from_size):
- """Modify the to_size, from_size attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("BySizes")
- self._fillAttribute(self._to_size, to_size)
- self._fillAttribute(self._from_size, from_size)
- pass
-
- def setPlanesAndOffsets(self, to_object, to_offset,
- from_object, from_offset):
- """Modify planes and offsets attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByPlanesAndOffsets")
- self._fillAttribute(self._to_object, to_object)
- self._fillAttribute(self._to_offset, to_offset)
- self._fillAttribute(self._from_object, from_object)
- self._fillAttribute(self._from_offset, from_offset)
- pass
-
+++ /dev/null
-"""Group Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addGroup(part, *args):
- """Add a Group feature to the Part.
-
- .. function:: addGroup(part, group_list)
-
- Args:
- part (ModelAPI_Document): part document
- group_list (list of Selection): list of objects
-
- Returns:
- Group: group object
- """
- assert(args)
- feature = part.addFeature("Group")
- return Group(feature, *args)
-
-
-class Group(Interface):
- """Interface class for Group feature.
-
- .. function:: Group(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Group(feature, group_list)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Group")
-
- self._group_list = self._feature.data().selectionList("group_list")
-
- assert(self._group_list)
-
- if not args:
- return
-
- assert(len(args) == 1)
- self.setGroupList(args[0])
-
- self.execute()
- pass
-
- def setGroupList(self, main_objects):
- """Modify group_list attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._group_list, group_list)
- pass
+++ /dev/null
-"""Partition Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addPartition(part, *args):
- """Add a Partition feature to the Part.
-
- .. function:: addPartition(part, main_objects, tool_objects, partition_combine)
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of Selection): main objects
- tool_objects (list of Selection): tool objects
- partition_combine (boolean):
- If True combines all results to one. If False builds separate result for each object.
-
- Returns:
- Partition: partition object
- """
- assert(len(args) > 0 and args[0] is not None)
- feature = part.addFeature("Partition")
- return Partition(feature, *args)
-
-
-class Partition(Interface):
- """Interface class for Partition feature.
-
- .. function:: Partition(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Partition(feature, main_objects, tool_objects, partition_combine)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Partition")
-
- self._main_objects = self._feature.data().selectionList("main_objects")
- self._tool_objects = self._feature.data().selectionList("tool_objects")
- self._partition_combine = self._feature.data().boolean("partition_combine")
-
- assert(self._main_objects)
- assert(self._tool_objects)
- assert(self._partition_combine)
-
- if not args:
- return
-
- assert(len(args) == 3)
- main_objects, tool_objects, partition_combine = args
-
- self.setMainObjects(main_objects)
- self.setToolObjects(tool_objects)
- self.setPartitionCombine(partition_combine)
-
- self.execute()
- pass
-
- def setMainObjects(self, main_objects):
- """Modify base attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._main_objects, main_objects)
- pass
-
- def setToolObjects(self, tool_objects):
- """Modify the to_size, from_size attributes of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._tool_objects, tool_objects)
- pass
-
- def setPartitionCombine(self, partition_combine):
- """Modify planes and offsets attributes of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._partition_combine, partition_combine)
- pass
+++ /dev/null
-"""Placement Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addPlacement(part, *args):
- """Add a Placement feature to the Part.
-
- .. function:: addPlacement(part, objects_list, start_shape, end_shape, reverse_direction, centering)
-
- Args:
- part (ModelAPI_Document): part document
- objects_list (list of Selection): solid objects
- start_shape (Selection): start face, edge or vertex
- end_shape (Selection): end face, edge or vertex
- reverse_direction (boolean): reverse placement direction
- centering (boolean): center faces under placement
-
- Returns:
- Placement: placement object
- """
- assert(args)
- feature = part.addFeature("Placement")
- return Placement(feature, *args)
-
-
-class Placement(Interface):
- """Interface class for Placement feature.
-
- .. function:: Placement(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Placement(feature, objects_list, start_shape, end_shape, reverse_direction, centering)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Placement")
-
- self._objects_list = self._feature.data().selectionList("placement_objects_list")
- self._start_shape = self._feature.data().selection("placement_start_shape")
- self._end_shape = self._feature.data().selection("placement_end_shape")
- self._reverse_direction = self._feature.data().boolean("placement_reverse_direction")
- self._centering = self._feature.data().boolean("placement_centering")
-
- assert(self._objects_list)
- assert(self._start_shape)
- assert(self._end_shape)
- assert(self._reverse_direction)
- assert(self._centering)
-
- if not args:
- return
-
- assert(len(args) == 5)
- self.setObjectList(args[0])
- self.setStartShape(args[1])
- self.setEndShape(args[2])
- self.setReverseDirection(args[3])
- self.setCentering(args[4])
-
- self.execute()
- pass
-
- def setObjectList(self, objects_list):
- """Modify placement_objects_list attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._objects_list, objects_list)
- pass
-
- def setStartShape(self, start_shape):
- """Modify start_shape attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._start_shape, start_shape)
- pass
-
- def setEndShape(self, end_shape):
- """Modify end_shape attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._end_shape, end_shape)
- pass
-
- def setReverseDirection(self, reverse_direction):
- """Modify reverse_direction attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._reverse_direction, reverse_direction)
- pass
-
- def setCentering(self, centering):
- """Modify centering attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._centering, centering)
- pass
+++ /dev/null
-"""Revolution Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addRevolution(part, *args):
- """Add a Revolution feature to the Part.
-
- .. function:: addRevolution(part, base, axis_object, to_angle, from_angle)
-
- Args:
- part (ModelAPI_Document): part document
- base (list of Selection): base objects
- axis_object (Selection): axis object
- to_angle (double): to angle
- from_angle (double): from angle
-
- .. function:: addRevolution(feature, base, axis_object, to_object, to_offset, from_object, from_offset)
-
- Args:
- part (ModelAPI_Document): part document
- base (list of Selection): base objects
- axis_object (Selection): axis object
- to_object (plane): upper plane
- to_offset (double): offset from upper object
- from_object (plane): lower plane
- from_offset (double): offset from lower plane
-
- Returns:
- Revolution: revolution object
- """
- assert(len(args) > 0 and args[0] is not None)
- feature = part.addFeature("Revolution")
- return Revolution(feature, *args)
-
-
-class Revolution(Interface):
- """Interface class for Revolution features.
-
- .. function:: Revolution(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Revolution(feature, base, axis_object, to_angle, from_angle)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: Revolution(feature, base, axis_object, to_object, to_offset, from_object, from_offset)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Revolution")
-
- self._base = self._feature.data().selectionList("base")
- self._axis_object = self._feature.data().selection("axis_object")
- self._CreationMethod = self._feature.string("CreationMethod")
- self._to_angle = self._feature.data().real("to_angle")
- self._from_angle = self._feature.data().real("from_angle")
- self._to_object = self._feature.data().selection("to_object")
- self._to_offset = self._feature.data().real("to_offset")
- self._from_object = self._feature.data().selection("from_object")
- self._from_offset = self._feature.data().real("from_offset")
-
- assert(self._base)
- assert(self._axis_object)
- assert(self._CreationMethod)
- assert(self._to_angle)
- assert(self._from_angle)
- assert(self._to_object)
- assert(self._to_offset)
- assert(self._from_object)
- assert(self._from_offset)
-
- if not args:
- return
-
- assert(len(args) in (4, 6))
-
- base, axis_object = args[:2]
- args = args[2:]
-
- self.setBase(base)
- self.setAxisObject(axis_object)
-
- if len(args) == 4:
- self.setPlanesAndOffsets(*args)
- elif len(args) == 2:
- self.setAngles(*args)
-
- self.execute()
- pass
-
- def __clear(self):
- self._CreationMethod.setValue("ByAngles")
- self._fillAttribute(self._to_angle, 0)
- self._fillAttribute(self._from_angle, 0)
- self._fillAttribute(self._to_object, None)
- self._fillAttribute(self._to_offset, 0)
- self._fillAttribute(self._from_object, None)
- self._fillAttribute(self._from_offset, 0)
- pass
-
- def setBase(self, base):
- """Modify base attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._base, base)
- pass
-
- def setAxisObject(self, axis_object):
- """Modify axis_object attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._axis_object, axis_object)
- pass
-
- def setAngles(self, to_angle, from_angle):
- """Modify the to_angle, from_angle attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByAngles")
- self._fillAttribute(self._to_angle, to_angle)
- self._fillAttribute(self._from_angle, from_angle)
- pass
-
- def setPlanesAndOffsets(self, to_object, to_offset,
- from_object, from_offset):
- """Modify planes and offsets attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByPlanesAndOffsets")
- self._fillAttribute(self._to_object, to_object)
- self._fillAttribute(self._to_offset, to_offset)
- self._fillAttribute(self._from_object, from_object)
- self._fillAttribute(self._from_offset, from_offset)
- pass
+++ /dev/null
-"""RevolutionCut and RevolutionFuse Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from .roots import CompositeBoolean
-
-
-def addRevolutionCut(part, *args):
- """Add a RevolutionCut feature to the Part.
-
- .. function:: addRevolutionCut(part, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- axis_object (Selection): axis object
- to_size (double): upper size of the extrusion
- from_size (double): lower size of the extrusion
-
- .. function:: addRevolutionCut(part, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- axis_object (Selection): axis object
- to_object (Selection): upper plane
- to_offset (double): offset from upper plane
- from_object (Selection): lower plane
- from_offset (double): offset from lower plane
-
- Returns:
- RevolutionBoolean: revolution boolean object
- """
- assert(args)
- feature = part.addFeature("RevolutionCut")
- return RevolutionBoolean(feature, *args)
-
-def addRevolutionFuse(part, *args):
- """Add a RevolutionFuse feature to the Part.
-
- .. function:: addRevolutionFuse(part, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- axis_object (Selection): axis object
- to_size (double): upper size of the extrusion
- from_size (double): lower size of the extrusion
-
- .. function:: addRevolutionFuse(part, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset)
-
- Args:
- part (ModelAPI_Document): part document
- sketch (ModelAPI_Object): sketch feature
- sketch_selection (Selection): sketch objects
- boolean_objects (list of Selection): boolean objects
- axis_object (Selection): axis object
- to_object (Selection): upper plane
- to_offset (double): offset from upper plane
- from_object (Selection): lower plane
- from_offset (double): offset from lower plane
-
-
- Pass all args to RevolutionFuse __init__ function.
-
- Returns:
- RevolutionBoolean: revolution boolean object
- """
- assert(args)
- feature = part.addFeature("RevolutionFuse")
- return RevolutionBoolean(feature, *args)
-
-
-class RevolutionBoolean(CompositeBoolean):
- """Interface class for RevolutionBoolean features.
-
- Supported features:
-
- * RevolutionCut
- * RevolutionFuse
-
- .. function:: RevolutionBoolean(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: RevolutionBoolean(feature, sketch, sketch_selection, boolean_objects, axis_object, to_angle, from_angle)
-
- Create interface for the feature and initialize the feature with arguments.
-
- .. function:: RevolutionBoolean(feature, sketch, sketch_selection, boolean_objects, axis_object, to_object, to_offset, from_object, from_offset)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- CompositeBoolean.__init__(self, feature, *args[:3])
- args = args[3:]
-
- self._axis_object = self._feature.data().selection("axis_object")
- self._CreationMethod = self._feature.string("CreationMethod")
- self._to_angle = self._feature.data().real("to_angle")
- self._from_angle = self._feature.data().real("from_angle")
- self._to_object = self._feature.data().selection("to_object")
- self._to_offset = self._feature.data().real("to_offset")
- self._from_object = self._feature.data().selection("from_object")
- self._from_offset = self._feature.data().real("from_offset")
-
- assert(self._axis_object)
- assert(self._CreationMethod)
- assert(self._to_angle)
- assert(self._from_angle)
- assert(self._to_object)
- assert(self._to_offset)
- assert(self._from_object)
- assert(self._from_offset)
-
- if not args:
- return
-
- assert(len(args) in (3, 5))
- axis_object = args[0]
- args = args[1:]
-
- self.setAxisObject(axis_object)
-
- if len(args) == 4:
- self.setPlanesAndOffsets(*args)
- elif len(args) == 2:
- self.setAngles(*args)
-
- self.execute()
- pass
-
- def __clear(self):
- self._CreationMethod.setValue("ByAngles")
- self._fillAttribute(self._to_angle, 0)
- self._fillAttribute(self._from_angle, 0)
- self._fillAttribute(self._to_object, None)
- self._fillAttribute(self._to_offset, 0)
- self._fillAttribute(self._from_object, None)
- self._fillAttribute(self._from_offset, 0)
- pass
-
- def setAxisObject(self, axis_object):
- """Modify axis_object attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._axis_object, axis_object)
- pass
-
- def setAngles(self, to_angle, from_angle):
- """Modify the to_angle, from_angle attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByAngles")
- self._fillAttribute(self._to_angle, to_angle)
- self._fillAttribute(self._from_angle, from_angle)
- pass
-
- def setPlanesAndOffsets(self, to_object, to_offset,
- from_object, from_offset):
- """Modify planes and offsets attributes of the feature.
-
- See __init__.
- """
- self.__clear()
- self._CreationMethod.setValue("ByPlanesAndOffsets")
- self._fillAttribute(self._to_object, to_object)
- self._fillAttribute(self._to_offset, to_offset)
- self._fillAttribute(self._from_object, from_object)
- self._fillAttribute(self._from_offset, from_offset)
- pass
-
+++ /dev/null
-
-from model.roots import Interface
-
-
-class CompositeBoolean(Interface):
- """Interface class for CompositeBoolean features.
-
- CompositeBoolean(feature) -> feature interface without initialization
- CompositeBoolean(feature, sketch, sketch_selection, boolean_objects) ->
- feature interface initialized from arguments:
- - sketch
- - sketch_selection
- - boolean_objects
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
-
- self._sketch = self._feature.reference("sketch")
- self._sketch_selection = self._feature.selection("sketch_selection")
- self._boolean_objects = self._feature.selectionList("boolean_objects")
-
- assert(self._sketch)
- assert(self._sketch_selection)
- assert(self._boolean_objects)
-
- if not args:
- return
-
- assert(len(args) == 3)
- sketch, sketch_selection, boolean_objects = args
-
- self.setSketch(sketch)
- self.setSketchSelection(sketch_selection)
- self.setBooleanObjects(boolean_objects)
- pass
-
- def setSketch(self, sketch):
- """Modify sketch attribute"""
- self._fillAttribute(self._sketch, sketch)
- pass
-
- def setSketchSelection(self, sketch_selection):
- """Modify sketch_selection attribute"""
- self._fillAttribute(self._sketch_selection, sketch_selection)
- pass
-
- def setBooleanObjects(self, boolean_objects):
- """Modify boolean_objects attribute"""
- self._fillAttribute(self._boolean_objects, boolean_objects)
- pass
-
-
-class CompositeSketch(Interface):
- """Interface class for CompositeSketch features.
-
- CompositeSketch(feature) -> feature interface without initialization
- CompositeSketch(feature, sketch, sketch_selection) ->
- feature interface initialized from arguments:
- - sketch
- - sketch_selection
- """
-
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
-
- self._sketch = self._feature.reference("sketch")
- self._sketch_selection = self._feature.selection("sketch_selection")
-
- assert(self._sketch)
- assert(self._sketch_selection)
-
- if not args:
- return
-
- assert(len(args) == 2)
- sketch, sketch_selection = args
-
- self.setSketch(sketch)
- self.setSketchSelection(sketch_selection)
- pass
-
- def setSketch(self, sketch):
- """Modify sketch attribute"""
- self._fillAttribute(self._sketch, sketch)
- pass
-
- def setSketchSelection(self, sketch_selection):
- """Modify sketch_selection attribute"""
- self._fillAttribute(self._sketch_selection, sketch_selection)
- pass
+++ /dev/null
-"""Rotation Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addRotation(part, *args):
- """Add a Rotation feature to the Part.
-
- .. function:: addRotation(part, main_objects, axis_object, angle)
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of Selection): main objects
- axis_object (list of Selection): axis object
- angle (double): angle
-
- Returns:
- Rotation: rotation object
- """
- assert(args)
- feature = part.addFeature("Rotation")
- return Rotation(feature, *args)
-
-
-class Rotation(Interface):
- """Interface class for Rotation features.
-
- .. function:: Rotation(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Rotation(feature, main_objects, axis_object, angle)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Rotation")
-
- self._main_objects = self._feature.data().selectionList("main_objects")
- self._axis_object = self._feature.data().selection("axis_object")
- self._angle = self._feature.data().real("angle")
-
- assert(self._main_objects)
- assert(self._axis_object)
- assert(self._angle)
-
- if not args:
- return
-
- assert(len(args) == 3)
- self.setMainObjects(args[0])
- self.setAxisObject(args[1])
- self.setAngle(args[2])
-
- self.execute()
- pass
-
- def setMainObjects(self, main_objects):
- """Modify main_objects attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._main_objects, main_objects)
- pass
-
- def setAxisObject(self, axis_object):
- """Modify axis_object attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._axis_object, axis_object)
- pass
-
- def setAngle(self, angle):
- """Modify angle attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._angle, angle)
- pass
+++ /dev/null
-"""Translation Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addTranslation(part, *args):
- """Add a Translation feature to the Part.
-
- .. function:: addTranslation(part, main_objects, axis_object, distance)
-
- Args:
- part (ModelAPI_Document): part document
- main_objects (list of Selection): main objects
- axis_object (Selection): axis objects
- distance (double): distance
-
- Returns:
- Translation: translation object
- """
- assert(args)
- feature = part.addFeature("Translation")
- return Translation(feature, *args)
-
-
-class Translation(Interface):
- """Interface class for Translation features.
-
- .. function:: Translation(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Translation(feature, main_objects, axis_object, distance)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Translation")
-
- self._main_objects = self._feature.data().selectionList("main_objects")
- self._axis_object = self._feature.data().selection("axis_object")
- self._distance = self._feature.data().real("distance")
-
- assert(self._main_objects)
- assert(self._axis_object)
- assert(self._distance)
-
- if not args:
- return
-
- assert(len(args) == 3)
- self.setMainObjects(args[0])
- self.setAxisObject(args[1])
- self.setDistance(args[2])
-
- self.execute()
- pass
-
- def setMainObjects(self, main_objects):
- """Modify main_objects attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._main_objects, main_objects)
- pass
-
- def setAxisObject(self, axis_object):
- """Modify axis_object attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._axis_object, axis_object)
- pass
-
- def setDistance(self, distance):
- """Modify distance attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._distance, distance)
- pass
"""Package for Parameter plugin for the Parametric Geometry API of the Modeler.
"""
-from parameter import addParameter
\ No newline at end of file
+from ParametersAPI import addParameter
\ No newline at end of file
+++ /dev/null
-"""Parameter Interface
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-from model.roots import Interface
-
-
-def addParameter(part, *args):
- """Add a Parameter feature to the Part and return Parameter.
-
- .. function:: addParameter(part, variable, expression)
-
- Args:
- part (ModelAPI_Document): part document
- variable (string): variable name
- expression (string): Python expression
-
- Returns:
- Parameter: parameter object
-
- Pass all args to Parameter __init__ function.
- """
- assert(args)
- feature = part.addFeature("Parameter")
- return Parameter(feature, *args)
-
-
-class Parameter(Interface):
- """Interface class for Parameter feature.
-
- .. function:: Point(feature)
-
- Create interface for the feature without initialization.
-
- .. function:: Point(feature, variable, expression)
-
- Create interface for the feature and initialize the feature with arguments.
- """
-
- def __init__(self, feature, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Parameter")
-
- self._variable = self._feature.string("variable")
- self._expression = self._feature.string("expression")
-
- assert(self._variable)
- assert(self._expression)
-
- if not args:
- return
-
- assert(len(args) == 2)
- self.setName(args[0])
- self.setExpression(args[1])
-
- self.execute()
- pass
-
- def setName(self, name):
- """Modify variable name attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._variable, name)
- pass
-
- def setExpression(self, expression):
- """Modify expression attribute of the feature.
-
- See __init__.
- """
- self._fillAttribute(self._expression, expression)
- pass
"""Package for PartSet plugin for the Parametric Geometry API of the Modeler.
"""
-from part import addPart, duplicatePart, removePart
\ No newline at end of file
+from PartSetAPI import addPart, duplicatePart, removePart
\ No newline at end of file
+++ /dev/null
-"""Part Feature Interface
-Author: Daniel Brunier-Coulin
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-import ModelAPI
-
-from model.roots import Interface
-
-
-def addPart(partset):
- """Add a Part feature to the Part and return Part.
-
- Args:
- partset (ModelAPI_Document): partset document
-
- Returns:
- Part: part object
- """
- feature = partset.addFeature("Part")
- return Part(feature)
-
-def duplicatePart(part):
- """Create a copy of the Part.
-
- Args:
- part (ModelAPI_Document): part document
-
- Returns:
- Part: part object
- """
- feature = part.addFeature("Duplicate")
- feature.execute()
- return Part(feature)
-
-def removePart(part):
- """Remove the Part.
-
- Args:
- part (ModelAPI_Document): part document
- """
- feature = part.addFeature("Remove")
- feature.execute()
-
-
-class Part(Interface):
- """Interface class for Part feature.
-
- .. function:: Part(feature)
-
- Create interface for the feature without initialization.
- """
-
- def __init__(self, feature):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Part")
-
- self.execute()
- pass
-
- def document(self):
- """Returns the Part document created by this feature."""
- result_part = ModelAPI.modelAPI_ResultPart(self._feature.firstResult())
- return result_part.partDoc()
+++ /dev/null
-"""General purpose Interface
-Author: Daniel Brunier-Coulin
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-import ModelAPI
-import GeomAPI
-
-import geom # To be removed when gp_Ax3 will be Pythonized
-
-
-def moduleDocument ():
- """Return the main document (the Partset) created or open from the Modeler.
-
- This document is unique in the application session.
- """
- return ModelAPI.ModelAPI_Session.get().moduleDocument()
-
-
-def activeDocument ():
- """Return the active document.
-
- This document can be either the main application document (i.e. the Partset) or one of documents
- referred to by the main document (a Part).
- """
- return ModelAPI.ModelAPI_Session.get().activeDocument()
-
-
-def defaultPlane (name):
- """Return one of the three planes defined by the global coordinate system.
-
- These planes are respectively referred to by name "XOY" (Z=0), "XOZ" (Y=0) or "YOZ" (X=0).
- """
- # Temporary implementation before the availability of default planes.
- o = GeomAPI.GeomAPI_Pnt(0, 0, 0)
- if name == "XOY":
- n = GeomAPI.GeomAPI_Dir(0, 0, 1)
- x = GeomAPI.GeomAPI_Dir(1, 0, 0)
- elif name == "XOZ":
- n = GeomAPI.GeomAPI_Dir(0, -1, 0)
- x = GeomAPI.GeomAPI_Dir(1, 0, 0)
- elif name == "YOZ":
- n = GeomAPI.GeomAPI_Dir(1, 0, 0)
- x = GeomAPI.GeomAPI_Dir(0, 1, 0)
-
- return geom.Ax3(o, n, x)
-
-
-def begin ():
- """Start a data structure transaction.
-
- Make a control point for being able to discard or undo
- all operations done during this transaction.
- """
- ModelAPI.ModelAPI_Session.get().startOperation()
-
-
-def end ():
- """Commit the data structure transaction.
-
- Make all operations done since the last control point undo-able.
- """
- ModelAPI.ModelAPI_Session.get().finishOperation()
-
-
-def do ():
- """Commit the data structure transaction and start the new one.
-
- Make all operations done since the last control point undo-able
- and continue with the new transaction.
- """
- session = ModelAPI.ModelAPI_Session.get()
- session.finishOperation()
- session.startOperation()
-
-
-def undo ():
- """Roll-back the data structure to the previous control point."""
- ModelAPI.ModelAPI_Session.get().undo()
-
-
-def redo ():
- """Restore the data structure rolled-back by the last undo."""
- ModelAPI.ModelAPI_Session.get().redo()
-
-
-def reset ():
- """Reset the data structure to initial state."""
- ModelAPI.ModelAPI_Session.get().closeAll()
--- /dev/null
+"""Package for services for the Parametric Geometry API of the Modeler.
+"""
+
+from ModelHighAPI import moduleDocument, activeDocument
+from ModelHighAPI import defaultPlane
+from ModelHighAPI import begin, end
+from ModelHighAPI import apply as do
+from ModelHighAPI import undo, redo
+from ModelHighAPI import reset
\ No newline at end of file
+"""Package for Sketch plugin for the Parametric Geometry API of the Modeler.
+"""
+
+from SketchAPI import addSketch
+from tools import addPolyline, addPolygon
+++ /dev/null
-"""Sketch circle feature interface."""
-
-from GeomDataAPI import geomDataAPI_Point2D
-from model.errors import WrongNumberOfArguments
-from model.roots import Interface
-
-class Arc(Interface):
- """Interface to a sketch arc feature."""
- def __init__(self, feature, *args, **kwargs):
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "SketchArc")
-
- self._center = geomDataAPI_Point2D(
- self._feature.data().attribute("ArcCenter")
- )
- self._start_point = geomDataAPI_Point2D(
- self._feature.data().attribute("ArcStartPoint")
- )
- self._end_point = geomDataAPI_Point2D(
- self._feature.data().attribute("ArcEndPoint")
- )
- self._inversed = self._feature.boolean("InversedArc")
- if len(args) == 6:
- self.__createByCoordinates(*args)
- elif len(args) == 3:
- self.__createByPoints(*args)
- else:
- raise WrongNumberOfArguments(
- "Arc takes 3 or 6 arguments (%s given)" % len(args)
- )
- if "inversed" in kwargs:
- self.setInversed(kwargs["inversed"])
- self.execute()
-
-
- ########
- #
- # Getters
- #
- ########
-
-
- def center(self):
- """Return the center point."""
- return self._center
-
- def startPoint(self):
- """Return the start point."""
- return self._start_point
-
- def endPoint(self):
- """Return the end point."""
- return self._end_point
-
- def result(self):
- """Return the arc circular line attribute."""
- return self._feature.lastResult()
-
-
- ########
- #
- # Set methods
- #
- ########
-
- def setCenter(self, x, y):
- """Set arc center."""
- self._center.setValue(x, y)
-
- def setStartPoint(self, x, y):
- """Set start point."""
- self._start_point.setValue(x, y)
-
- def setEndPoint(self, x, y):
- """Set end point value."""
- self._end_point.setValue(x, y)
-
- def setInversed(self, inversed):
- self._fillAttribute(self._inversed, inversed)
-
- ########
- #
- # Private methods
- #
- ########
-
-
- def __createByCoordinates(self, center_x, center_y,
- start_x, start_y,
- end_x, end_y):
- """Create an arc by point coordinates."""
- self.setCenter(center_x, center_y)
- self.setStartPoint(start_x, start_y)
- self.setEndPoint(end_x, end_y)
-
- def __createByPoints(self, center, start, end):
- """Create an arc with point objects."""
- self.setCenter(center.x(), center.y())
- self.setStartPoint(start.x(), start.y())
- self.setEndPoint(end.x(), end.y())
+++ /dev/null
-"""Sketch circle feature interface."""
-
-from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
-
-class Circle(Interface):
- """Interface for circle feature data manipulation."""
- def __init__(self, feature, *args):
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "SketchCircle")
-
- self._center = geomDataAPI_Point2D(
- self._feature.data().attribute("CircleCenter")
- )
- self._radius = self._feature.data().real("CircleRadius")
-
- if not args:
- return
-
- if len(args) != 3:
- raise TypeError(
- "Invalid number of arguments, 3 arguments needed (%s given)"
- % len(args)
- )
-
- self.setCenter(args[0], args[1])
- self.setRadius(args[2])
- self.execute()
-
- def setCenter(self, x, y):
- """Set the center of the circle."""
- self._center.setValue(x, y)
-
- def setRadius(self, radius):
- """Set the radius of the circle."""
- self._radius.setValue(radius)
-
- def center(self):
- """Return the center attribute of the circle."""
- return self._center
-
- def radius(self):
- """Return the radius value.
-
- :return: radius
- :rtype: double
- """
- return self._radius.value()
-
- def result(self):
- """Return the cicular line attribute."""
- return self._feature.lastResult()
+++ /dev/null
-
-from model.roots import Interface
-
-class Entity(Interface):
- """Interface for editing of a sketch entity feature."""
-
- def __init__(self, feature):
- Interface.__init__(self, feature)
-
- # Initialize attributes
- self._auxiliary = self._feature.boolean("Auxiliary")
-
- def setAuxiliary(self, a):
- """Set the Auxiliarity."""
- self._auxiliary.setValue(a)
+++ /dev/null
-from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
-from model.errors import WrongNumberOfArguments
-
-from .entity import Entity
-
-class Line(Entity):
- """Interface for editing of a sketch line feature."""
- def __init__(self, feature, *args):
- Entity.__init__(self, feature)
- assert(self._feature.getKind() == "SketchLine")
-
- # Initialize attributes
- self._start_point = geomDataAPI_Point2D(
- self._feature.data().attribute("StartPoint")
- )
- self._end_point = geomDataAPI_Point2D(
- self._feature.data().attribute("EndPoint")
- )
- self._external = self._feature.selection("External")
-
- # If no arguments are given the attributes of the feature
- # are'nt initialized
- if args is None:
- return
-
- # Set attribute values and execute
- if len(args) == 4:
- self.__createByCoordinates(*args)
- elif len(args) == 2:
- self.__createByPoints(*args)
- elif len(args) == 1:
- self.__createByName(*args)
- else:
- raise WrongNumberOfArguments(
- "Arc takes 1, 2 or 4 arguments (%s given)" % len(args)
- )
- self.execute()
-
- def __createByCoordinates(self, x1, y1, x2, y2):
- self.setStartPoint(x1, y1)
- self.setEndPoint(x2, y2)
-
- def __createByPoints(self, p1, p2):
- self.setStartPoint(p1.x(), p1.y())
- self.setEndPoint(p2.x(), p2.y())
-
- def __createByName(self, name):
- self.setExternal(name)
-
- #######
- #
- # Set methods
- #
- #######
-
- def setStartPoint(self, x, y):
- """Set the start point of the line."""
- self._start_point.setValue(x, y)
-
- def setEndPoint(self, x, y):
- """Set the end point of the line."""
- self._end_point.setValue(x, y)
-
- # TODO : methods below will be removed.
- # Kept until all tests have been updated
- def startPoint(self):
- return self._start_point
-
- def endPoint(self):
- return self._end_point
-
- def setExternal(self, name):
- """Set external edge"""
- self._external.selectSubShape("EDGE", name)
-
- def result(self):
- return self._feature.firstResult()
+++ /dev/null
-"""Sketch point feature interface."""
-
-from GeomDataAPI import geomDataAPI_Point2D
-from ModelAPI import ModelAPI_Feature
-from model.roots import Interface
-from model.errors import FeatureInputInvalid
-
-class Mirror(Interface):
- """Interface on mirror constraint for data manipulation."""
- def __init__(self, feature, mirror_line, *mirror_objects):
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "SketchConstraintMirror")
-
- self._feature.data().refattr("ConstraintEntityA").setObject(mirror_line)
- self._feature.data().reflist("ConstraintEntityB").clear()
- for object_ in mirror_objects:
- self._feature.data().reflist("ConstraintEntityB").append(object_)
- self._feature.data().reflist("ConstraintMirrorList").append(object_)
- self.execute()
-
- def mirroredObjects(self):
- return self._feature.data().reflist("ConstraintEntityC")
- #feature = ModelAPI_Feature(object_)
- #if feature.getKind() == "SketchCircle":
- #objects.append(Circle(feature))
- #elif feature.getKind() == "SketchLine":
- #objects.append(Line(feature))
- #else:
- #raise TypeError(
- #"%s is not a valid feature type" % feature.getKind()
- #)
-
+++ /dev/null
-"""Sketch point feature interface."""
-
-from GeomDataAPI import geomDataAPI_Point2D
-from model.roots import Interface
-from model.errors import FeatureInputInvalid
-
-class Point(Interface):
- """Interface on point feature for data manipulation."""
- def __init__(self, feature, x, y):
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "SketchPoint")
-
- # Initialize attributes of the feature
- self._point_data = geomDataAPI_Point2D(
- self._feature.data().attribute("PointCoordindates")
- )
- self.setValue(x, y)
- self.execute()
-
- def setValue(self, x, y):
- """Set point coordinates."""
- self._point_data.setValue(x, y)
-
- def pointData (self):
- """Return the point data."""
- return self._point_data
-
- def result (self):
- """Return the feature result."""
- return self._point_feature.firstResult()
+++ /dev/null
-# Author: Daniel Brunier-Coulin with contribution by Mikhail Ponikarov
-# finalized by Renaud Nedelec and Sergey Pokhodenko
-# Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-"""Sketcher interface.
-This interface allows to add a sketch
-in a part or partset.
-The created sketch object provides all the needed methods
-for sketch modification and constraint edition.
-
-Example of code:
-
-.. doctest::
-
- >>> import model
- >>> model.begin()
- >>> partset = model.moduleDocument()
- >>> part = model.addPart(partset).document()
- >>> plane = model.defaultPlane("XOY")
- >>> sketch = model.addSketch(part, plane)
- >>> line = sketch.addLine(0, 0, 0, 1)
- >>> line.endPoint().x()
- 0.0
- >>> line.endPoint().y()
- 1.0
-"""
-
-from ModelAPI import modelAPI_ResultConstruction, featureToCompositeFeature
-from GeomDataAPI import geomDataAPI_Point, geomDataAPI_Dir
-from GeomAlgoAPI import GeomAlgoAPI_SketchBuilder, ShapeList
-
-from model.sketcher.point import Point
-from model.sketcher.line import Line
-from model.sketcher.circle import Circle
-from model.sketcher.arc import Arc
-from model.sketcher.mirror import Mirror
-from model.roots import Interface
-from model.tools import Selection
-
-
-def addSketch(document, plane):
- """Add a sketch to a Part or PartSet.
-
- Arguments:
- document(ModelAPI_Document): part or partset document
- plane(geom.Ax3): plane on wich the sketch is built
-
- Returns:
- Sketch: sketch object
- """
- feature = featureToCompositeFeature(document.addFeature("Sketch"))
- return Sketch(feature, plane)
-
-class Sketch(Interface):
- """Interface class for Sketch feature."""
- def __init__(self, feature, *args):
- """Initialize a 2D Sketch on the given plane.
-
- The plane can be defined either by:
- - a 3D axis system (geom.Ax3),
- - an existing face identified by its topological name.
- """
- Interface.__init__(self, feature)
- assert(self._feature.getKind() == "Sketch")
-
- self._origin = geomDataAPI_Point(
- self._feature.data().attribute("Origin")
- )
- self._dir_x = geomDataAPI_Dir(
- self._feature.data().attribute("DirX")
- )
- self._norm = geomDataAPI_Dir(
- self._feature.data().attribute("Norm")
- )
- self._external = self._feature.data().selection("External")
-
- # If no arguments are given the attributes of the feature
- # are not Initialized
- if args is not None:
- plane = args[0]
- if isinstance(plane, str):
- self.__sketchOnFace(plane)
- else:
- self.__sketchOnPlane(plane)
-
- def __sketchOnPlane(self, plane):
- """Create the sketch on a plane."""
- origin = plane.location()
- normal = plane.direction()
- x_direction = plane.xDirection()
- self._origin.setValue(origin.x(), origin.y(), origin.z())
- self._norm.setValue(normal.x(), normal.y(), normal.z())
- self._dir_x.setValue(x_direction.x(), x_direction.y(), x_direction.z())
-
- def __sketchOnFace(self, name):
- """Initialize the sketch on a face given by its name."""
- self._external.selectSubShape("FACE", name)
-
- #-------------------------------------------------------------
- #
- # Creation of Geometries
- #
- #-------------------------------------------------------------
-
- def addPoint(self, *args):
- """Add a point to the sketch."""
- if not args:
- raise TypeError("No arguments given")
- point_feature = self._feature.addFeature("SketchPoint")
- return Point(point_feature, *args)
-
- def addLine(self, *args):
- """Add a line to the sketch.
-
- .. function:: addLine(name)
- Select an existing line. The line is added to the sketch with a rigid
- constraint (it cannot be modified by the sketch)
-
- Arguments:
- name(str): name of an existing line
-
- .. function:: addLine(start, end)
- Create a line by points
-
- Arguments:
- start(point): start point of the line
- end(point): end point of the line
-
- .. function:: addLine(start_x, start_y, end_x, end_y)
- Create a line by coordinates
-
- Arguments:
- start_x(double): start point x coordinate
- """
- if not args:
- raise TypeError("No arguments given")
- line_feature = self._feature.addFeature("SketchLine")
- line_interface = Line(line_feature, *args)
- # if the line is created by name add a rigid constraint
- # to the created line
- if len(args) == 1 and isinstance(args[0], str):
- constraint = self._feature.addFeature("SketchConstraintRigid")
- constraint.refattr("ConstraintEntityA").setObject(
- line_feature.firstResult()
- )
- return line_interface
-
- def addCircle(self, *args):
- """Add a circle to this Sketch."""
- if not args:
- raise TypeError("No arguments given")
- circle_feature = self._feature.addFeature("SketchCircle")
- return Circle(circle_feature, *args)
-
- def addArc(self, *args, **kwargs):
- """Add an arc of circle to the sketch and return an arc object.
-
- Two different syntaxes are allowed:
-
- .. function:: addArc(center, start, end)
-
- Arguments:
- center (point): center of the arc
- start (point): start point of the arc
- end (point): end point of the arc
-
- .. function:: addArc(center_x, center_y, start_x, start_y, end_x, end_y)
-
- Same as above but with coordinates
-
- Returns:
- Arc: arc object
- Raises:
- TypeError: if no argument is provided
- """
- if not args:
- raise TypeError("No arguments given")
- arc_feature = self._feature.addFeature("SketchArc")
- return Arc(arc_feature, *args, **kwargs)
-
- #-------------------------------------------------------------
- #
- # Creation of Geometrical and Dimensional Constraints
- #
- #-------------------------------------------------------------
-
- def setCoincident(self, p1, p2):
- """Set coincident the two given points and add the corresponding
- constraint to this Sketch."""
- # assert(p1 and p2) NOTE : if an argument is missing python
- # will raise TypeError by itself.
- # It seems better to check only that provided arguments are not
- # None
- if p1 is None or p2 is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintCoincidence")
- self._fillAttribute(constraint.refattr("ConstraintEntityA"), p1)
- self._fillAttribute(constraint.refattr("ConstraintEntityB"), p2)
- self.execute()
- return constraint
-
- def setParallel(self, l1, l2):
- """Set parallel the two given lines and add the corresponding
- constraint to this Sketch."""
- if l1 is None or l2 is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintParallel")
- constraint.data().refattr("ConstraintEntityA").setObject(l1)
- constraint.data().refattr("ConstraintEntityB").setObject(l2)
- self.execute()
- return constraint
-
- def setPerpendicular(self, l1, l2):
- """Set perpendicular the two given lines and add the corresponding
- constraint to this Sketch."""
- if l1 is None or l2 is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintPerpendicular")
- constraint.data().refattr("ConstraintEntityA").setObject(l1)
- constraint.data().refattr("ConstraintEntityB").setObject(l2)
- self.execute()
- return constraint
-
- def setHorizontal(self, line):
- """Set horizontal the given line and add the corresponding
- constraint to this Sketch."""
- if line is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintHorizontal")
- constraint.data().refattr("ConstraintEntityA").setObject(line)
- self.execute()
- return constraint
-
- def setVertical(self, line):
- """Set vertical the given line and add the corresponding
- constraint to this Sketch."""
- if line is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintVertical")
- constraint.data().refattr("ConstraintEntityA").setObject(line)
- self.execute()
- return constraint
-
- def setDistance(self, point, line, length):
- """Set the distance between the given point and line, and add
- the corresponding constraint to this Sketch."""
- if point is None or line is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintDistance")
- if isinstance(line, basestring):
- # Add the edge identified by the given topological name
- # to this Sketch
- line = self.addLine(line).result()
- constraint.data().refattr("ConstraintEntityA").setAttr(point)
- constraint.data().refattr("ConstraintEntityB").setObject(line)
- constraint.data().real("ConstraintValue").setValue(length)
- self.execute()
- return constraint
-
- def setLength(self, line, length):
- """Set the length of the given line and add the corresponding
- constraint to this Sketch."""
- if line is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintLength")
- constraint.data().refattr("ConstraintEntityA").setObject(line)
- self._fillAttribute(constraint.real("ConstraintValue"), length)
- self.execute()
- return constraint
-
- def setRadius(self, circle, radius):
- """Set the radius of the given circle and add the corresponding
- constraint to this Sketch."""
- constraint = self._feature.addFeature("SketchConstraintRadius")
- self._fillAttribute(constraint.refattr("ConstraintEntityA"), circle)
- self._fillAttribute(constraint.real("ConstraintValue"), radius)
- self.execute()
- return constraint
-
- def setEqual(self, object_1, object_2):
- """Set the radii of two circles or the length of two lines equal.
-
- The corresponding constraint is added to the sketch"""
- constraint = self._feature.addFeature("SketchConstraintEqual")
- constraint.data().refattr("ConstraintEntityA").setObject(object_1)
- constraint.data().refattr("ConstraintEntityB").setObject(object_2)
- self.execute()
- return constraint
-
- def setAngle(self, line_1, line_2, angle):
- """Set the angle between the given 2 lines and add the corresponding
- constraint to the sketch."""
- constraint = self._feature.addFeature("SketchConstraintAngle")
- constraint.data().refattr("ConstraintEntityA").setObject(line_1)
- constraint.data().refattr("ConstraintEntityB").setObject(line_2)
- constraint.data().real("ConstraintValue").setValue(angle)
- self.execute()
- return constraint
-
- def setTangent(self, object_1, object_2):
- """Set a tangential continuity between two objects
- at their coincidence point."""
- if object_1 is None or object_2 is None:
- raise TypeError("NoneType argument given")
- constraint = self._feature.addFeature("SketchConstraintTangent")
- constraint.data().refattr("ConstraintEntityA").setObject(object_1)
- constraint.data().refattr("ConstraintEntityB").setObject(object_2)
- self.execute()
- return constraint
-
- def setFillet(self, *args):
- """Set a fillet constraint between the 2 given lines with the given
- filleting radius."""
- assert(args)
- constraint = self._feature.addFeature("SketchConstraintFillet")
- if len(args) == 3:
- line_1, line_2, radius = args
- constraint.data().refattr("ConstraintEntityA").setObject(line_1)
- constraint.data().reflist("ConstraintEntityB").clear()
- constraint.data().reflist("ConstraintEntityB").append(line_2)
- elif len(args) == 2:
- point, radius = args
- self._fillAttribute(constraint.data().refattrlist("ConstraintEntityA"), [point])
- self._fillAttribute(constraint.real("ConstraintValue"), radius)
- self.execute()
- return constraint
-
- def setRigid(self, object_):
- """Set a rigid constraint on a given object."""
- constraint = self._feature.addFeature("SketchConstraintRigid")
- self._fillAttribute(constraint.refattr("ConstraintEntityA"), object_)
- self.execute()
- return constraint
-
- #-------------------------------------------------------------
- #
- # Transformation constraints
- #
- #-------------------------------------------------------------
-
- def addMirror(self, mirror_line, sketch_objects):
- """Add a mirror transformation of the given objects to the sketch.
-
- This transformation is a constraint.
-
- :return: interface to the constraint
- :rtype: Mirror object
- """
- mirror_constraint = self._feature.addFeature("SketchConstraintMirror")
- mirror_interface = Mirror(mirror_constraint, mirror_line, sketch_objects)
- self.execute()
- return mirror_interface
-
-
- #-------------------------------------------------------------
- #
- # Edition of Dimensional Constraints
- #
- #-------------------------------------------------------------
-
- def setValue(self, constraint, value):
- """Modify the value of the given dimensional constraint."""
- constraint.data().real("ConstraintValue").setValue(value)
-
- #-------------------------------------------------------------
- #
- # Edition of Dimensional Constraints
- #
- #-------------------------------------------------------------
-
- def setText(self, constraint, text):
- """Modify the value of the given dimensional constraint."""
- constraint.data().real("ConstraintValue").setText(text)
-
- #-------------------------------------------------------------
- #
- # Macro functions combining geometry creation and constraints
- #
- #-------------------------------------------------------------
-
- def addPolyline(self, *coords):
- """Add a poly-line to this Sketch.
-
- The end of consecutive segments are defined as coincident.
- """
- c0 = coords[0]
- c1 = coords[1]
- polyline = []
- line_1 = self.addLine(c0, c1)
- polyline.append(line_1)
- # Adding and connecting next lines
- for c2 in coords[2:]:
- line_2 = self.addLine(c1, c2)
- self.setCoincident(line_1.endPoint(), line_2.startPoint())
- polyline.append(line_2)
- c1 = c2
- line_1 = line_2
- return polyline
-
- def addPolygon(self, *coords):
- """Add a polygon to this Sketch.
-
- The end of consecutive segments are defined as coincident.
- """
- pg = self.addPolyline(*coords)
- # Closing the poly-line supposed being defined by at least 3 points
- c0 = coords[0]
- cn = coords[len(coords) - 1]
- ln = self.addLine(cn, c0)
- self.setCoincident(
- pg[len(coords) - 2].endPoint(), ln.startPoint()
- )
- self.setCoincident(
- ln.endPoint(), pg[0].startPoint()
- )
- pg.append(ln)
- return pg
-
- #-------------------------------------------------------------
- #
- # Getters
- #
- #-------------------------------------------------------------
-
- def selectFace(self, *args):
- """Select the geometrical entities of this Sketch on which
- the result Face must be built.
-
- When no entity is given, the face is based on all existing
- geometry of this Sketch.
- """
- if len(args) == 0:
- wire = modelAPI_ResultConstruction(
- self._feature.firstResult()
- ).shape()
- elif len(args) == 1:
- wire = args[0].shape()
- else:
- raise Exception("not yet implemented")
- # TODO: simple version now, should be a list of selected faces
- return [Selection(self.result(), self.buildShape(wire))]
-
- def buildShape(self, wire):
- """Build the result Shape of this Sketch according to the
- selected geometrical entities."""
- o = self._origin.pnt()
- dx = self._dir_x.dir()
- n = self._norm.dir()
-
- # The faces are kept otherwise they are destroyed at exit
- faces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(o, dx, n, wire, faces)
- # TODO: Deal with several faces
- return faces[0]
-
- def result(self):
- """Returns the result data of this Feature."""
- return self._feature.firstResult()
--- /dev/null
+# Author: Sergey Pokhodenko
+# Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+
+def addPolyline(sketch, *coords):
+ """Add a poly-line to sketch.
+
+ The end of consecutive segments are defined as coincident.
+ """
+ c0 = coords[0]
+ c1 = coords[1]
+ polyline = []
+ line_1 = sketch.addLine(c0, c1)
+ polyline.append(line_1)
+ # Adding and connecting next lines
+ for c2 in coords[2:]:
+ line_2 = sketch.addLine(c1, c2)
+ sketch.setCoincident(line_1.endPoint(), line_2.startPoint())
+ polyline.append(line_2)
+ c1 = c2
+ line_1 = line_2
+ return polyline
+
+
+def addPolygon(sketch, *coords):
+ """Add a polygon to sketch.
+
+ The end of consecutive segments are defined as coincident.
+ """
+ pg = addPolyline(sketch, *coords)
+ # Closing the poly-line supposed being defined by at least 3 points
+ c0 = coords[0]
+ cn = coords[len(coords) - 1]
+ ln = sketch.addLine(cn, c0)
+ sketch.setCoincident(
+ pg[len(coords) - 2].endPoint(), ln.startPoint()
+ )
+ sketch.setCoincident(
+ ln.endPoint(), pg[0].startPoint()
+ )
+ pg.append(ln)
+ return pg
\ No newline at end of file
+++ /dev/null
-"""Common tools for other modules.
-Author: Sergey Pokhodenko
-Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-"""
-
-import re
-import collections
-
-import ModelAPI
-import GeomAPI
-import GeomDataAPI
-
-# from .sketcher.sketch import Sketch
-
-
-def convert_to_underscore(name):
- """Convert CamelCase to underscore_case."""
- s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
- return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
-
-
-class Selection:
- """Class for selection.
-
- Selection() -> empty selection
- Selection(name, type) -> selection initialized with arguments:
- - name -- topological name
- - type -- type of the object
- Selection(context, shape) -> selection initialized with arguments:
- - context -- ModelAPI_Result object
- - shape -- GeomAPI_Shape shape
- """
-
- def __init__(self, *args):
- """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
-
- if not args:
- self.args = (None, None)
- return
-
- if len(args) == 1 and isinstance(args[0], basestring):
- self.args = args
- return
-
- assert(len(args) > 1 and len(args) < 4)
- assert(isinstance(args[0], basestring) or
- isinstance(args[0], ModelAPI.ModelAPI_Result))
- if isinstance(args[0], basestring):
- assert(isinstance(args[1], basestring))
- elif isinstance(args[0], ModelAPI.ModelAPI_Result) or args[0] is None:
- assert(isinstance(args[1], GeomAPI.GeomAPI_Shape))
- self.args = args
-
-
-def fill_attribute(attribute, value):
- """Set value to attribure.
-
- This function processes complex cases.
- ModelAPI_AttributeSelectionList can accept string, result + shape, list of
- strings and [result + shape]...
- ModelAPI_AttributeDouble can accept float and string
- """
- if (isinstance(attribute, ModelAPI.ModelAPI_AttributeBoolean) or
- isinstance(attribute, ModelAPI.ModelAPI_AttributeDocRef) or
- isinstance(attribute, ModelAPI.ModelAPI_AttributeReference)
- ):
- attribute.setValue(value)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeString):
- attribute.setValue(str(value))
-
- elif (isinstance(attribute, ModelAPI.ModelAPI_AttributeDouble) or
- isinstance(attribute, ModelAPI.ModelAPI_AttributeInteger)
- ):
- if isinstance(value, basestring):
- attribute.setText(value)
- else:
- attribute.setValue(value)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeIntArray):
- attrubute.setSize(len(value))
- for i in range(len(value)):
- attrubute.setValue(i, value[i])
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeRefAttr):
- assert(isinstance(value, ModelAPI.ModelAPI_Attribute) or
- isinstance(value, ModelAPI.ModelAPI_Object))
- if isinstance(value, ModelAPI.ModelAPI_Attribute):
- attribute.setAttr(value)
- elif isinstance(value, ModelAPI.ModelAPI_Object):
- attribute.setObject(value)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeRefList):
- attribute.clear()
- if not value:
- return
-
- assert(isinstance(value, collections.Iterable))
- for item in value:
- assert(isinstance(item, ModelAPI.ModelAPI_Object))
- attribute.append(item)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeRefAttrList):
- attribute.clear()
- if not value:
- return
-
- assert(isinstance(value, collections.Iterable))
- for item in value:
- assert(isinstance(item, ModelAPI.ModelAPI_Attribute))
- attribute.append(item)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeSelection):
- if value is None:
- attribute.setValue(None, None)
- return
-
- assert(isinstance(value, Selection))
- attribute.setValue(*value.args)
-
- elif isinstance(attribute, ModelAPI.ModelAPI_AttributeSelectionList):
- attribute.clear()
- if not value:
- return
-
- assert(isinstance(value, collections.Iterable))
- for item in value:
- assert(isinstance(item, Selection))
- attribute.append(*item.args)
-
- elif (isinstance(attribute, GeomDataAPI.GeomDataAPI_Dir) or
- isinstance(attribute, GeomDataAPI.GeomDataAPI_Point) or
- isinstance(attribute, GeomDataAPI.GeomDataAPI_Point2D)
- ):
- assert(isinstance(value, collections.Iterable))
- attribute.setValue(*value)
-
- else:
- raise AssertionError("Wrong attribute type: %s" % type(attribute))
p3 = geom.Pnt2d(1, 1)
p4 = geom.Pnt2d(1, 0)
- line = self.base.addPolygon(p1, p2, p3, p4)
+ line = model.addPolygon(self.base, p1, p2, p3, p4)
- self.base.setParallel(line[0].result(), line[2].result())
- self.base.setParallel(line[1].result(), line[3].result())
- self.base.setPerpendicular(line[0].result(), line[3].result())
+ self.base.setParallel(line[0], line[2])
+ self.base.setParallel(line[1], line[3])
+ self.base.setPerpendicular(line[0], line[3])
# Setting the size of the base with default values
# Width
- self.width = self.base.setLength(line[0].result(), 50) # Keeps the constraint for edition
+ self.width = self.base.setLength(line[0], 50) # Keeps the constraint for edition
# Length
- self.length = self.base.setLength(line[3].result(), 50) # Keeps the constraint for edition
+ self.length = self.base.setLength(line[3], 50) # Keeps the constraint for edition
# Creating the extrusion (the box) at default size
# A box result
def execute(self):
"""F.execute() -- execute the feature"""
# Retrieving the user inputs
- width = self.getRealInput(self.WIDTH_ID())
- length = self.getRealInput(self.LENGTH_ID())
- height = self.getRealInput(self.HEIGHT_ID())
-
- width_text = self.getTextInput(self.WIDTH_ID())
- length_text = self.getTextInput(self.LENGTH_ID())
- height_text = self.getTextInput(self.HEIGHT_ID())
+ width = self.real(self.WIDTH_ID())
+ length = self.real(self.LENGTH_ID())
+ height = self.real(self.HEIGHT_ID())
# Editing the box
- if width_text == "":
- self.base.setValue(self.width, width)
+ if width.text() == "":
+ self.base.setValue(self.width, width.value())
else:
- self.base.setText(self.width, width_text)
+ self.base.setValue(self.width, width.text())
- if length_text == "":
- self.base.setValue(self.length, length)
+ if length.text() == "":
+ self.base.setValue(self.length, length.value())
else:
- self.base.setText(self.length, length_text)
+ self.base.setValue(self.length, length.text())
- self.box.setSize(height, height_text)
+ if (height.text() == ""):
+ self.box.setSize(height.value())
+ else:
+ self.box.setSize(height.text())
# Publishing the result: not needed for Macro feature
# self.addResult( self.box.result() )
--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ SketchAPI.h
+ SketchAPI_Arc.h
+ SketchAPI_Circle.h
+ SketchAPI_IntersectionPoint.h
+ SketchAPI_Line.h
+ SketchAPI_Mirror.h
+ SketchAPI_Sketch.h
+ SketchAPI_SketchEntity.h
+ SketchAPI_Point.h
+ SketchAPI_Projection.h
+ SketchAPI_Rectangle.h
+ SketchAPI_Rotation.h
+ SketchAPI_Translation.h
+)
+
+SET(PROJECT_SOURCES
+ SketchAPI_Arc.cpp
+ SketchAPI_Circle.cpp
+ SketchAPI_IntersectionPoint.cpp
+ SketchAPI_Line.cpp
+ SketchAPI_Mirror.cpp
+ SketchAPI_Sketch.cpp
+ SketchAPI_SketchEntity.cpp
+ SketchAPI_Point.cpp
+ SketchAPI_Projection.cpp
+ SketchAPI_Rectangle.cpp
+ SketchAPI_Rotation.cpp
+ SketchAPI_Translation.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ModelAPI
+ ModelHighAPI
+)
+
+INCLUDE_DIRECTORIES(
+ ${PROJECT_SOURCE_DIR}/src/Events
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelAPI
+ ${PROJECT_SOURCE_DIR}/src/GeomDataAPI
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
+)
+
+# Plugin headers dependency
+INCLUDE_DIRECTORIES(
+ # TODO(spo): modify ConstructionPlugin headers to remove dependency on GeomAPI headers
+ ${PROJECT_SOURCE_DIR}/src/Config
+ ${PROJECT_SOURCE_DIR}/src/GeomAPI
+ ${PROJECT_SOURCE_DIR}/src/SketchPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DSKETCHAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(SketchAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(SketchAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(SketchAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(SketchAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow")
+
+#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)?
+SET(SWIG_LINK_LIBRARIES
+ SketchAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_SketchAPI_EXTRA_DEPS ${SWIG_MODULE_SketchAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(SketchAPI python SketchAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(SketchAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_SketchAPI PROPERTIES DEBUG_OUTPUT_NAME _SketchAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _SketchAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS SketchAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SketchAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+ TestSketch.py
+)
+
+# ADD_SUBDIRECTORY (Test)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef SKETCHAPI_H
+#define SKETCHAPI_H
+
+#if defined SKETCHAPI_EXPORTS
+#if defined WIN32
+#define SKETCHAPI_EXPORT __declspec( dllexport )
+#else
+#define SKETCHAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SKETCHAPI_EXPORT __declspec( dllimport )
+#else
+#define SKETCHAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* SketchAPI.i */
+
+%module SketchAPI
+
+%{
+ #include "SketchAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define SKETCHAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_list.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(SketchAPI_Arc)
+%shared_ptr(SketchAPI_Circle)
+%shared_ptr(SketchAPI_IntersectionPoint)
+%shared_ptr(SketchAPI_Line)
+%shared_ptr(SketchAPI_Mirror)
+%shared_ptr(SketchAPI_Sketch)
+%shared_ptr(SketchAPI_SketchEntity)
+%shared_ptr(SketchAPI_Point)
+%shared_ptr(SketchAPI_Projection)
+%shared_ptr(SketchAPI_Rectangle)
+%shared_ptr(SketchAPI_Rotation)
+%shared_ptr(SketchAPI_Translation)
+
+// TODO(spo): move typemaps into ModelHighAPI package
+
+// fix compilarion error: ‘res*’ was not declared in this scope
+%typemap(freearg) const std::list<ModelHighAPI_RefAttr> & {}
+%typemap(freearg) const std::list<std::shared_ptr<ModelAPI_Object> > & {}
+
+%typemap(in) const std::list<ModelHighAPI_RefAttr> & (std::list<ModelHighAPI_RefAttr> temp) {
+ std::shared_ptr<ModelAPI_Attribute> * temp_attribute;
+ int newmem = 0;
+ if (PySequence_Check($input)) {
+ for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_attribute, $descriptor(std::shared_ptr<ModelAPI_Attribute> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_attribute) {
+ PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+ temp.push_back(ModelHighAPI_RefAttr(*temp_attribute));
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_attribute;
+ }
+ }
+ Py_DECREF(item);
+ }
+ $1 = &temp;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_RefAttr, ModelHighAPI_Interface, ModelAPI_Attribute or ModelAPI_Object.");
+ return NULL;
+ }
+}
+
+%typemap(in) const std::list<std::shared_ptr<ModelAPI_Object> > & (std::list<std::shared_ptr<ModelAPI_Object> > temp) {
+ std::shared_ptr<ModelAPI_Object> * temp_object;
+ std::shared_ptr<ModelHighAPI_Interface> * temp_interface;
+ int newmem = 0;
+ if (PySequence_Check($input)) {
+ for (Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
+ PyObject * item = PySequence_GetItem($input, i);
+ if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_object, $descriptor(std::shared_ptr<ModelAPI_Object> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_object) {
+ PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
+ return NULL;
+ }
+ temp.push_back(*temp_object);
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_object;
+ }
+ } else
+ if ((SWIG_ConvertPtrAndOwn(item, (void **)&temp_interface, $descriptor(std::shared_ptr<ModelHighAPI_Interface> *), SWIG_POINTER_EXCEPTION, &newmem)) == 0) {
+ if (!temp_interface) {
+ PyErr_SetString(PyExc_TypeError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
+ return NULL;
+ }
+ temp.push_back((*temp_interface)->defaultResult());
+ if (newmem & SWIG_CAST_NEW_MEMORY) {
+ delete temp_interface;
+ }
+ }
+ Py_DECREF(item);
+ }
+ $1 = &temp;
+ } else {
+ PyErr_SetString(PyExc_ValueError, "argument must be list of ModelHighAPI_Interface or ModelAPI_Object.");
+ return NULL;
+ }
+}
+
+// all supported interfaces (the order is very important according dependencies: base class first)
+%include "SketchAPI_SketchEntity.h"
+%include "SketchAPI_Point.h"
+%include "SketchAPI_IntersectionPoint.h"
+%include "SketchAPI_Line.h"
+%include "SketchAPI_Circle.h"
+%include "SketchAPI_Arc.h"
+%include "SketchAPI_Projection.h"
+%include "SketchAPI_Mirror.h"
+%include "SketchAPI_Translation.h"
+%include "SketchAPI_Rectangle.h"
+%include "SketchAPI_Rotation.h"
+%include "SketchAPI_Sketch.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Arc.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "SketchAPI_Arc.h"
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterStartEnd(theCenterX, theCenterY, theStartX, theStartY, theEndX, theEndY, theInversed);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterStartEnd(theCenter, theStart, theEnd, theInversed);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByStartEndPassed(theStartX, theStartY, theEndX, theEndY, thePassedX, thePassedY);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByStartEndPassed(theStart, theEnd, thePassed);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByTangent(theTangentPoint, theEndX, theEndY, theInversed);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByTangent(theTangentPoint, theEnd, theInversed);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Arc::~SketchAPI_Arc()
+{
+
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByCenterStartEnd(double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_CENTER_START_END(), myarcType);
+ fillAttribute(center(), theCenterX, theCenterY);
+ fillAttribute(startPoint(), theStartX, theStartY);
+ fillAttribute(endPoint(), theEndX, theEndY);
+ fillAttribute(theInversed, myinversed);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_CENTER_START_END(), myarcType);
+ fillAttribute(theCenter, mycenter);
+ fillAttribute(theStart, mystartPoint);
+ fillAttribute(theEnd, myendPoint);
+ fillAttribute(theInversed, myinversed);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByStartEndPassed(double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_THREE_POINTS(), myarcType);
+ fillAttribute(startPoint(), theStartX, theStartY);
+ fillAttribute(endPoint(), theEndX, theEndY);
+ fillAttribute(passedPoint(), thePassedX, thePassedY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_THREE_POINTS(), myarcType);
+ fillAttribute(theStart, mystartPoint);
+ fillAttribute(theEnd, myendPoint);
+ fillAttribute(thePassed, mypassedPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_TANGENT(), myarcType);
+ fillAttribute(theTangentPoint, mytangentPoint);
+ fillAttribute(endPoint(), theEndX, theEndY);
+ fillAttribute(theInversed, myinversed);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+{
+ fillAttribute(SketchPlugin_Arc::ARC_TYPE_TANGENT(), myarcType);
+ fillAttribute(theTangentPoint, mytangentPoint);
+ fillAttribute(theEnd, myendPoint);
+ fillAttribute(theInversed, myinversed);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setRadius(double theRadius)
+{
+ fillAttribute(ModelHighAPI_Double(theRadius), myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Arc::setAngle(double theAngle)
+{
+ fillAttribute(ModelHighAPI_Double(theAngle), myangle);
+
+ execute();
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Arc.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef SketchAPI_Arc_H_
+#define SketchAPI_Arc_H_
+
+#include "SketchAPI.h"
+#include "SketchAPI_SketchEntity.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_Arc.h>
+
+class ModelHighAPI_RefAttr;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Arc feature.
+class SketchAPI_Arc: public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values.
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Arc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName);
+
+ /// Destructor.
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Arc();
+
+ INTERFACE_10(SketchPlugin_Arc::ID(),
+ arcType, SketchPlugin_Arc::ARC_TYPE(), ModelAPI_AttributeString, /** Arc type */,
+ center, SketchPlugin_Arc::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */,
+ startPoint, SketchPlugin_Arc::START_ID(), GeomDataAPI_Point2D, /** Start point */,
+ endPoint, SketchPlugin_Arc::END_ID(), GeomDataAPI_Point2D, /** End point */,
+ inversed, SketchPlugin_Arc::INVERSED_ID(), ModelAPI_AttributeBoolean, /** Inversed flag */,
+ passedPoint, SketchPlugin_Arc::PASSED_POINT_ID(), GeomDataAPI_Point2D, /** Passed point */,
+ tangentPoint, SketchPlugin_Arc::TANGENT_POINT_ID(), ModelAPI_AttributeRefAttr, /** Tangent point */,
+ radius, SketchPlugin_Arc::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */,
+ angle, SketchPlugin_Arc::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */,
+ external, SketchPlugin_Arc::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */)
+
+ /// Set by center and start, end point.
+ SKETCHAPI_EXPORT
+ void setByCenterStartEnd(double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Set by center and start, end point.
+ SKETCHAPI_EXPORT
+ void setByCenterStartEnd(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Set by start, end and passed points.
+ SKETCHAPI_EXPORT
+ void setByStartEndPassed(double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY);
+
+ /// Set by start, end and passed points.
+ SKETCHAPI_EXPORT
+ void setByStartEndPassed(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
+
+ /// Set by tangent and end point.
+ SKETCHAPI_EXPORT
+ void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Set by tangent and end point.
+ SKETCHAPI_EXPORT
+ void setByTangent(const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Set by external.
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection& theExternal);
+
+ /// Set by external name.
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string& theExternalName);
+
+ /// Set radius.
+ SKETCHAPI_EXPORT
+ void setRadius(double theRadius);
+
+ /// Set angle.
+ SKETCHAPI_EXPORT
+ void setAngle(double theAngle);
+};
+
+/// Pointer on Arc object.
+typedef std::shared_ptr<SketchAPI_Arc> ArcPtr;
+
+#endif // SketchAPI_Arc_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Circle.cpp
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#include "SketchAPI_Circle.h"
+
+#include <GeomAPI_Pnt2d.h>
+
+#include <ModelHighAPI_Double.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX,
+ double theCenterY,
+ double theRadius)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterAndRadius(theCenterX, theCenterY, theRadius);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if(initialize()) {
+ setByCenterAndRadius(theCenter, theRadius);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByThreePoints(theX1, theY1, theX2, theY2, theX3, theY3);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByThreePoints(thePoint1, thePoint2, thePoint3);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+//==================================================================================================
+SketchAPI_Circle::~SketchAPI_Circle()
+{
+
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(center(), theCenterX, theCenterY);
+ fillAttribute(theRadius, myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(theCenter, mycenter);
+ fillAttribute(theRadius, myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByThreePoints(double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(firstPoint(), theX1, theY1);
+ fillAttribute(secondPoint(), theX2, theY2);
+ fillAttribute(thirdPoint(), theX3, theY3);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint1, myfirstPoint);
+ fillAttribute(thePoint2, mysecondPoint);
+ fillAttribute(thePoint3, mythirdPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setCenter(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(center(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(theCenter, mycenter);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setRadius(double theRadius)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_CENTER_AND_RADIUS(), mycircleType);
+ fillAttribute(ModelHighAPI_Double(theRadius), myradius);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setFirstPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(firstPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, myfirstPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setSecondPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(secondPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, mysecondPoint);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setThirdPoint(double theX, double theY)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thirdPoint(), theX, theY);
+
+ execute();
+}
+
+//==================================================================================================
+void SketchAPI_Circle::setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+ fillAttribute(SketchPlugin_Circle::CIRCLE_TYPE_THREE_POINTS(), mycircleType);
+ fillAttribute(thePoint, mythirdPoint);
+
+ execute();
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: SketchAPI_Circle.h
+// Created: 09 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef SketchAPI_Circle_H_
+#define SketchAPI_Circle_H_
+
+#include "SketchAPI.h"
+#include "SketchAPI_SketchEntity.h"
+
+#include <SketchPlugin_Circle.h>
+
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Circle feature.
+class SketchAPI_Circle: public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values.
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theCenterX,
+ double theCenterY,
+ double theRadius);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const ModelHighAPI_Selection& theExternal);
+
+ /// Constructor with values.
+ SKETCHAPI_EXPORT
+ SketchAPI_Circle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const std::string& theExternalName);
+
+ /// Destructor.
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Circle();
+
+ INTERFACE_7(SketchPlugin_Circle::ID(),
+ circleType, SketchPlugin_Circle::CIRCLE_TYPE(), ModelAPI_AttributeString, /** Circle type */,
+ center, SketchPlugin_Circle::CENTER_ID(), GeomDataAPI_Point2D, /** Center point */,
+ radius, SketchPlugin_Circle::RADIUS_ID(), ModelAPI_AttributeDouble, /** Radius */,
+ firstPoint, SketchPlugin_Circle::FIRST_POINT_ID(), GeomDataAPI_Point2D, /** First point */,
+ secondPoint, SketchPlugin_Circle::SECOND_POINT_ID(), GeomDataAPI_Point2D, /** Second point */,
+ thirdPoint, SketchPlugin_Circle::THIRD_POINT_ID(), GeomDataAPI_Point2D, /** Third point */,
+ external, SketchPlugin_Circle::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */)
+
+ /// Set by center and radius.
+ SKETCHAPI_EXPORT
+ void setByCenterAndRadius(double theCenterX, double theCenterY, double theRadius);
+
+ /// Set by center and radius.
+ SKETCHAPI_EXPORT
+ void setByCenterAndRadius(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter, double theRadius);
+
+ /// Set by three points.
+ SKETCHAPI_EXPORT
+ void setByThreePoints(double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3);
+
+ /// Set by three points.
+ SKETCHAPI_EXPORT
+ void setByThreePoints(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+
+ /// Set by external.
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection& theExternal);
+
+ /// Set by external name.
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string& theExternalName);
+
+ /// Set center.
+ SKETCHAPI_EXPORT
+ void setCenter(double theX, double theY);
+
+ /// Set center.
+ SKETCHAPI_EXPORT
+ void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
+
+ /// Set radius.
+ SKETCHAPI_EXPORT
+ void setRadius(double theRadius);
+
+ /// Set first point.
+ SKETCHAPI_EXPORT
+ void setFirstPoint(double theX, double theY);
+
+ /// Set first point.
+ SKETCHAPI_EXPORT
+ void setFirstPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+
+ /// Set second point.
+ SKETCHAPI_EXPORT
+ void setSecondPoint(double theX, double theY);
+
+ /// Set second point.
+ SKETCHAPI_EXPORT
+ void setSecondPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+
+ /// Set third point.
+ SKETCHAPI_EXPORT
+ void setThirdPoint(double theX, double theY);
+
+ /// Set third point.
+ SKETCHAPI_EXPORT
+ void setThirdPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+};
+
+/// Pointer on Circle object.
+typedef std::shared_ptr<SketchAPI_Circle> CirclePtr;
+
+#endif // SketchAPI_Circle_H_
--- /dev/null
+// Name : SketchAPI_IntersectionPoint.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_IntersectionPoint.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalLine(theExternal);
+ }
+}
+
+SketchAPI_IntersectionPoint::SketchAPI_IntersectionPoint(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalLineName(theExternalName);
+ }
+}
+
+SketchAPI_IntersectionPoint::~SketchAPI_IntersectionPoint()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_IntersectionPoint::setByExternalLine(const ModelHighAPI_Selection & theExternalLine)
+{
+ fillAttribute(theExternalLine, externalLine());
+
+ execute();
+}
+
+void SketchAPI_IntersectionPoint::setByExternalLineName(const std::string & theExternalLineName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalLineName), externalLine());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_IntersectionPoint.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_
+#define SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <SketchPlugin_IntersectionPoint.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_IntersectionPoint
+ * \ingroup CPPHighAPI
+ * \brief Interface for IntersectionPoint feature
+ */
+class SketchAPI_IntersectionPoint : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_IntersectionPoint(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_IntersectionPoint();
+
+ INTERFACE_2(SketchPlugin_IntersectionPoint::ID(),
+ coordinates, SketchPlugin_IntersectionPoint::COORD_ID(), GeomDataAPI_Point2D, /** IntersectionPoint coordinates */,
+ externalLine, SketchPlugin_IntersectionPoint::EXTERNAL_LINE_ID(), ModelAPI_AttributeSelection, /** External line */
+ )
+
+ /// Set by external
+ SKETCHAPI_EXPORT
+ void setByExternalLine(const ModelHighAPI_Selection & theExternalLine);
+
+ /// Set by external name
+ SKETCHAPI_EXPORT
+ void setByExternalLineName(const std::string & theExternalLineName);
+};
+
+//! Pointer on IntersectionPoint object
+typedef std::shared_ptr<SketchAPI_IntersectionPoint> IntersectionPointPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_INTERSECTIONPOINT_H_ */
--- /dev/null
+// Name : SketchAPI_Line.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Line.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Line::SketchAPI_Line(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Line::SketchAPI_Line(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX1, double theY1, double theX2, double theY2)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByCoordinates(theX1, theY1, theX2, theY2);
+ }
+}
+
+SketchAPI_Line::SketchAPI_Line(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByPoints(theStartPoint, theEndPoint);
+ }
+}
+
+SketchAPI_Line::SketchAPI_Line(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+SketchAPI_Line::SketchAPI_Line(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+SketchAPI_Line::~SketchAPI_Line()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Line::setByCoordinates(
+ double theX1, double theY1, double theX2, double theY2)
+{
+ fillAttribute(startPoint(), theX1, theY1);
+ fillAttribute(endPoint(), theX2, theY2);
+
+ execute();
+}
+
+void SketchAPI_Line::setByPoints(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+{
+ fillAttribute(theStartPoint, startPoint());
+ fillAttribute(theEndPoint, endPoint());
+
+ execute();
+}
+
+void SketchAPI_Line::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+void SketchAPI_Line::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Line::setStartPoint(double theX, double theY)
+{
+ fillAttribute(startPoint(), theX, theY);
+
+ execute();
+}
+void SketchAPI_Line::setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
+{
+ fillAttribute(thePoint, startPoint());
+
+ execute();
+}
+void SketchAPI_Line::setEndPoint(double theX, double theY)
+{
+ fillAttribute(endPoint(), theX, theY);
+
+ execute();
+}
+void SketchAPI_Line::setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
+{
+ fillAttribute(thePoint, endPoint());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+
--- /dev/null
+// Name : SketchAPI_Line.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
+#define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_Line.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Line
+ * \ingroup CPPHighAPI
+ * \brief Interface for Line feature
+ */
+class SketchAPI_Line : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX1, double theY1, double theX2, double theY2);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Line();
+
+ INTERFACE_3(SketchPlugin_Line::ID(),
+ startPoint, SketchPlugin_Line::START_ID(), GeomDataAPI_Point2D, /** Start point */,
+ endPoint, SketchPlugin_Line::END_ID(), GeomDataAPI_Point2D, /** End point */,
+ external, SketchPlugin_Line::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
+ )
+
+ /// Set by coordinates
+ SKETCHAPI_EXPORT
+ void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
+
+ /// Set by points
+ SKETCHAPI_EXPORT
+ void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+
+ /// Set by external
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection & theExternal);
+
+ /// Set by external name
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string & theExternalName);
+
+ /// Set start point
+ SKETCHAPI_EXPORT
+ void setStartPoint(double theX, double theY);
+
+ /// Set start point
+ SKETCHAPI_EXPORT
+ void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
+
+ /// Set end point
+ SKETCHAPI_EXPORT
+ void setEndPoint(double theX, double theY);
+
+ /// Set end point
+ SKETCHAPI_EXPORT
+ void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
+};
+
+//! Pointer on Line object
+typedef std::shared_ptr<SketchAPI_Line> LinePtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */
--- /dev/null
+// Name : SketchAPI_Mirror.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Mirror.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Mirror::SketchAPI_Mirror(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Mirror::SketchAPI_Mirror(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_RefAttr & theMirrorLine,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theMirrorLine, mirrorLine());
+ fillAttribute(theObjects, mirrorList());
+
+ execute();
+ }
+}
+
+SketchAPI_Mirror::~SketchAPI_Mirror()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Mirror.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_MIRROR_H_
+#define SRC_SKETCHAPI_SKETCHAPI_MIRROR_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_ConstraintMirror.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelAPI_Object;
+class ModelHighAPI_RefAttr;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Mirror
+ * \ingroup CPPHighAPI
+ * \brief Interface for Mirror feature
+ */
+class SketchAPI_Mirror : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Mirror(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Mirror(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_RefAttr & theMirrorLine,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Mirror();
+
+ INTERFACE_4(SketchPlugin_ConstraintMirror::ID(),
+ mirrorLine, SketchPlugin_ConstraintMirror::ENTITY_A(), ModelAPI_AttributeRefAttr, /** Mirror line */,
+ mirrorList, SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), ModelAPI_AttributeRefList, /** Mirror list */,
+ referenceObjects, SketchPlugin_ConstraintMirror::ENTITY_B(), ModelAPI_AttributeRefList, /** Reference objects */,
+ mirroredObjects, SketchPlugin_ConstraintMirror::ENTITY_C(), ModelAPI_AttributeRefList, /** Mirrored objects */
+ )
+
+};
+
+//! Pointer on Mirror object
+typedef std::shared_ptr<SketchAPI_Mirror> MirrorPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_MIRROR_H_ */
--- /dev/null
+// Name : SketchAPI_Point.cpp
+// Purpose:
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Point.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Point::SketchAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Point::SketchAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX, double theY)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setCoordinates(theX, theY);
+ }
+}
+
+SketchAPI_Point::SketchAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setCoordinates(thePoint);
+ }
+}
+
+SketchAPI_Point::SketchAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternal(theExternal);
+ }
+}
+
+SketchAPI_Point::SketchAPI_Point(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
+SketchAPI_Point::~SketchAPI_Point()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Point::setCoordinates(
+ double theX, double theY)
+{
+ fillAttribute(coordinates(), theX, theY);
+
+ execute();
+}
+
+void SketchAPI_Point::setCoordinates(
+ const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
+{
+ fillAttribute(thePoint, coordinates());
+
+ execute();
+}
+
+void SketchAPI_Point::setByExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, external());
+
+ execute();
+}
+
+void SketchAPI_Point::setByExternalName(const std::string & theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("VERTEX", theExternalName), external());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Point.h
+// Purpose:
+//
+// History:
+// 15/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_POINT_H_
+#define SRC_SKETCHAPI_SKETCHAPI_POINT_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <GeomDataAPI_Point2D.h>
+
+#include <SketchPlugin_Point.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Point
+ * \ingroup CPPHighAPI
+ * \brief Interface for Point feature
+ */
+class SketchAPI_Point : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX, double theY);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Point(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Point();
+
+ INTERFACE_2(SketchPlugin_Point::ID(),
+ coordinates, SketchPlugin_Point::COORD_ID(), GeomDataAPI_Point2D, /** Point coordinates */,
+ external, SketchPlugin_Point::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
+ )
+
+ /// Set by coordinates
+ SKETCHAPI_EXPORT
+ void setCoordinates(double theX, double theY);
+
+ /// Set by points
+ SKETCHAPI_EXPORT
+ void setCoordinates(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
+
+ /// Set by external
+ SKETCHAPI_EXPORT
+ void setByExternal(const ModelHighAPI_Selection & theExternal);
+
+ /// Set by external name
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string & theExternalName);
+};
+
+//! Pointer on Point object
+typedef std::shared_ptr<SketchAPI_Point> PointPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_POINT_H_ */
--- /dev/null
+// Name : SketchAPI_Projection.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Projection.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Projection::SketchAPI_Projection(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Projection::SketchAPI_Projection(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternalFeature )
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setExternalFeature(theExternalFeature);
+ }
+}
+
+SketchAPI_Projection::~SketchAPI_Projection()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & theExternalFeature)
+{
+ fillAttribute(theExternalFeature, externalFeature());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Projection.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <SketchPlugin_Projection.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Projection
+ * \ingroup CPPHighAPI
+ * \brief Interface for Projection feature
+ */
+class SketchAPI_Projection : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternalFeature);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Projection();
+
+ INTERFACE_3(SketchPlugin_Projection::ID(),
+ externalFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), ModelAPI_AttributeSelection, /** External feature */,
+ projectedFeature, SketchPlugin_Projection::EXTERNAL_FEATURE_ID(), ModelAPI_AttributeRefAttr, /** Projected feature */,
+ external, SketchPlugin_Projection::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */
+ )
+
+ /// Set external feature
+ SKETCHAPI_EXPORT
+ void setExternalFeature(const ModelHighAPI_Selection & theExternalLine);
+};
+
+//! Pointer on Projection object
+typedef std::shared_ptr<SketchAPI_Projection> ProjectionPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_PROJECTION_H_ */
--- /dev/null
+// Name : SketchAPI_Rectangle.cpp
+// Purpose:
+//
+// History:
+// 17/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Rectangle.h"
+//--------------------------------------------------------------------------------------
+#include <GeomAPI_Pnt2d.h>
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Rectangle::SketchAPI_Rectangle(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Rectangle::SketchAPI_Rectangle(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX1, double theY1, double theX2, double theY2)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByCoordinates(theX1, theY1, theX2, theY2);
+ }
+}
+
+SketchAPI_Rectangle::SketchAPI_Rectangle(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByPoints(theStartPoint, theEndPoint);
+ }
+}
+
+SketchAPI_Rectangle::~SketchAPI_Rectangle()
+{
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Rectangle::setByCoordinates(
+ double theX1, double theY1, double theX2, double theY2)
+{
+ fillAttribute(startPoint(), theX1, theY1);
+ fillAttribute(endPoint(), theX2, theY2);
+
+ execute();
+}
+
+void SketchAPI_Rectangle::setByPoints(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+{
+ fillAttribute(theStartPoint, startPoint());
+ fillAttribute(theEndPoint, endPoint());
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+
--- /dev/null
+// Name : SketchAPI_Rectangle.h
+// Purpose:
+//
+// History:
+// 17/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
+#define SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelHighAPI_Selection;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Rectangle
+ * \ingroup CPPHighAPI
+ * \brief Interface for Rectangle feature
+ */
+class SketchAPI_Rectangle : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ double theX1, double theY1, double theX2, double theY2);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Rectangle();
+
+ INTERFACE_3("SketchRectangle",
+ startPoint, "RectStartPoint", GeomDataAPI_Point2D, /** Start point */,
+ endPoint, "RectEndPoint", GeomDataAPI_Point2D, /** End point */,
+ linesList, "RectangleList", ModelAPI_AttributeRefList, /** Lines list */
+ )
+
+ /// Set by coordinates
+ SKETCHAPI_EXPORT
+ void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
+
+ /// Set by points
+ SKETCHAPI_EXPORT
+ void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+};
+
+//! Pointer on Rectangle object
+typedef std::shared_ptr<SketchAPI_Rectangle> RectanglePtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_ */
--- /dev/null
+// Name : SketchAPI_Rotation.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Rotation.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Rotation::SketchAPI_Rotation(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Rotation::SketchAPI_Rotation(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & theCenter,
+ const ModelHighAPI_Double & theAngle,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theObjects, rotationList());
+ fillAttribute(theCenter, center());
+ fillAttribute(theAngle, angle());
+ fillAttribute(theNumberOfObjects, numberOfObjects());
+ if (theFullValue)
+ fillAttribute("SingleAngle", valueType());
+
+ execute();
+ }
+}
+
+SketchAPI_Rotation::~SketchAPI_Rotation()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Rotation.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_MultiRotation.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelAPI_Object;
+class ModelHighAPI_Double;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Rotation
+ * \ingroup CPPHighAPI
+ * \brief Interface for Rotation feature
+ */
+class SketchAPI_Rotation : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & theCenter,
+ const ModelHighAPI_Double & theAngle,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue = false);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Rotation();
+
+ INTERFACE_7(SketchPlugin_MultiRotation::ID(),
+ rotationList, SketchPlugin_MultiRotation::ROTATION_LIST_ID(), ModelAPI_AttributeRefList, /** Rotation list */,
+ center, SketchPlugin_MultiRotation::CENTER_ID(), ModelAPI_AttributeRefAttr, /** Center */,
+ angle, SketchPlugin_MultiRotation::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */,
+ numberOfObjects, SketchPlugin_MultiRotation::NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger, /** Number of objects */,
+ valueType, SketchPlugin_MultiRotation::ANGLE_TYPE(), ModelAPI_AttributeString, /** Value type */,
+ referenceObjects, SketchPlugin_MultiRotation::ENTITY_A(), ModelAPI_AttributeRefList, /** Reference objects */,
+ rotatedObjects, SketchPlugin_MultiRotation::ENTITY_B(), ModelAPI_AttributeRefList, /** Rotated objects */
+ )
+
+};
+
+//! Pointer on Rotation object
+typedef std::shared_ptr<SketchAPI_Rotation> RotationPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_ROTATION_H_ */
--- /dev/null
+// Name : SketchAPI_Sketch.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Sketch.h"
+//--------------------------------------------------------------------------------------
+#include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_ConstraintAngle.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
+#include <SketchPlugin_ConstraintCollinear.h>
+#include <SketchPlugin_ConstraintDistance.h>
+#include <SketchPlugin_ConstraintEqual.h>
+#include <SketchPlugin_ConstraintFillet.h>
+#include <SketchPlugin_ConstraintHorizontal.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintMiddle.h>
+#include <SketchPlugin_ConstraintMirror.h>
+#include <SketchPlugin_ConstraintParallel.h>
+#include <SketchPlugin_ConstraintPerpendicular.h>
+#include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_ConstraintRigid.h>
+#include <SketchPlugin_ConstraintTangent.h>
+#include <SketchPlugin_ConstraintVertical.h>
+//--------------------------------------------------------------------------------------
+#include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelHighAPI_RefAttr.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Arc.h"
+#include "SketchAPI_Circle.h"
+#include "SketchAPI_IntersectionPoint.h"
+#include "SketchAPI_Line.h"
+#include "SketchAPI_Mirror.h"
+#include "SketchAPI_Point.h"
+#include "SketchAPI_Projection.h"
+#include "SketchAPI_Rectangle.h"
+#include "SketchAPI_Rotation.h"
+#include "SketchAPI_Translation.h"
+//--------------------------------------------------------------------------------------
+SketchAPI_Sketch::SketchAPI_Sketch(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Sketch::SketchAPI_Sketch(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Ax3> & thePlane)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ setPlane(thePlane);
+ }
+}
+
+SketchAPI_Sketch::SketchAPI_Sketch(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal)
+: ModelHighAPI_Interface(theFeature)
+{
+ if (initialize()) {
+ setExternal(theExternal);
+ }
+}
+
+SketchAPI_Sketch::~SketchAPI_Sketch()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_CompositeFeature> SketchAPI_Sketch::compositeFeature() const
+{
+ return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Sketch::setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane)
+{
+ fillAttribute(thePlane->origin(), myorigin);
+ fillAttribute(thePlane->dirX(), mydirX);
+ fillAttribute(thePlane->normal(), mynormal);
+
+ execute();
+}
+
+void SketchAPI_Sketch::setExternal(const ModelHighAPI_Selection & theExternal)
+{
+ fillAttribute(theExternal, myexternal);
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
+void SketchAPI_Sketch::setValue(
+ const std::shared_ptr<ModelAPI_Feature> & theConstraint,
+ const ModelHighAPI_Double & theValue)
+{
+ // TODO(spo): check somehow that the feature is a constraint or eliminate crash if the feature have no real attribute VALUE
+ fillAttribute(theValue, theConstraint->real(SketchPlugin_Constraint::VALUE()));
+
+// theConstraint->execute();
+}
+
+//--------------------------------------------------------------------------------------
+std::list<ModelHighAPI_Selection> SketchAPI_Sketch::selectFace() const
+{
+ const_cast<SketchAPI_Sketch*>(this)->execute();
+
+ std::list<ModelHighAPI_Selection> aSelectionList;
+
+ ResultConstructionPtr aResultConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(feature()->firstResult());
+ if (aResultConstruction.get() == NULL)
+ return aSelectionList;
+
+ for (int anIndex = 0; anIndex < aResultConstruction->facesNum(); ++anIndex) {
+ aSelectionList.push_back(
+ ModelHighAPI_Selection(aResultConstruction,
+ aResultConstruction->face(anIndex)));
+ }
+
+ return aSelectionList;
+}
+
+//--------------------------------------------------------------------------------------
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::shared_ptr<GeomAPI_Ax3> & thePlane)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
+ return SketchPtr(new SketchAPI_Sketch(aFeature, thePlane));
+}
+
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theExternal)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
+ return SketchPtr(new SketchAPI_Sketch(aFeature, theExternal));
+}
+
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theExternalName)
+{
+ // TODO(spo): check that thePart is not empty
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(SketchAPI_Sketch::ID());
+ return SketchPtr(new SketchAPI_Sketch(aFeature, ModelHighAPI_Selection("FACE", theExternalName)));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
+ double theX, double theY)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
+ return PointPtr(new SketchAPI_Point(aFeature, theX, theY));
+}
+std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(
+ const std::shared_ptr<GeomAPI_Pnt2d> & thePoint)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
+ return PointPtr(new SketchAPI_Point(aFeature, thePoint));
+}
+std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
+ return PointPtr(new SketchAPI_Point(aFeature, theExternal));
+}
+std::shared_ptr<SketchAPI_Point> SketchAPI_Sketch::addPoint(const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Point::ID());
+ return PointPtr(new SketchAPI_Point(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
+ const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
+ return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternal));
+}
+std::shared_ptr<SketchAPI_IntersectionPoint> SketchAPI_Sketch::addIntersectionPoint(
+ const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_IntersectionPoint::ID());
+ return IntersectionPointPtr(new SketchAPI_IntersectionPoint(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(double theX1, double theY1, double theX2, double theY2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
+ return LinePtr(new SketchAPI_Line(aFeature, theX1, theY1, theX2, theY2));
+}
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
+ return LinePtr(new SketchAPI_Line(aFeature, theStartPoint, theEndPoint));
+}
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
+ LinePtr aLine(new SketchAPI_Line(aFeature, theExternal));
+ setFixed(InterfacePtr(aLine));
+ return aLine;
+}
+std::shared_ptr<SketchAPI_Line> SketchAPI_Sketch::addLine(const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Line::ID());
+ LinePtr aLine(new SketchAPI_Line(aFeature, theExternalName));
+ setFixed(InterfacePtr(aLine));
+ return aLine;
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Rectangle> SketchAPI_Sketch::addRectangle(double theX1, double theY1, double theX2, double theY2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchAPI_Rectangle::ID());
+ return RectanglePtr(new SketchAPI_Rectangle(aFeature, theX1, theY1, theX2, theY2));
+}
+std::shared_ptr<SketchAPI_Rectangle> SketchAPI_Sketch::addRectangle(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchAPI_Rectangle::ID());
+ return RectanglePtr(new SketchAPI_Rectangle(aFeature, theStartPoint, theEndPoint));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theCenterX,
+ double theCenterY,
+ double theRadius)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, theCenterX, theCenterY, theRadius));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, theCenter, theRadius));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, theX1, theY1, theX2, theY2, theX3, theY3));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, thePoint1, thePoint2, thePoint3));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_Circle> SketchAPI_Sketch::addCircle(const std::string & theExternalName)
+{
+ // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Circle::ID());
+ return CirclePtr(new SketchAPI_Circle(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature,
+ theCenterX, theCenterY,
+ theStartX, theStartY,
+ theEndX, theEndY,
+ theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theCenter, theStart, theEnd, theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature,
+ theStartX, theStartY,
+ theEndX, theEndY,
+ thePassedX, thePassedY));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theStart, theEnd, thePassed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEndX, theEndY, theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theTangentPoint, theEnd, theInversed));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const ModelHighAPI_Selection & theExternal)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theExternal));
+}
+
+std::shared_ptr<SketchAPI_Arc> SketchAPI_Sketch::addArc(const std::string & theExternalName)
+{
+ // TODO(spo): Add constraint SketchConstraintRigid like in PythonAPI. Is it necessary?
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Arc::ID());
+ return ArcPtr(new SketchAPI_Arc(aFeature, theExternalName));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
+ const ModelHighAPI_Selection & theExternalFeature)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID());
+ return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
+ const ModelHighAPI_RefAttr & theMirrorLine,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_ConstraintMirror::ID());
+ return MirrorPtr(new SketchAPI_Mirror(aFeature, theMirrorLine, theObjects));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Translation> SketchAPI_Sketch::addTranslation(
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiTranslation::ID());
+ return TranslationPtr(new SketchAPI_Translation(aFeature, theObjects, thePoint1, thePoint2, theNumberOfObjects, theFullValue));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<SketchAPI_Rotation> SketchAPI_Sketch::addRotation(
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & theCenter,
+ const ModelHighAPI_Double & theAngle,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_MultiRotation::ID());
+ return RotationPtr(new SketchAPI_Rotation(aFeature, theObjects, theCenter, theAngle, theNumberOfObjects, theFullValue));
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setAngle(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2,
+ const ModelHighAPI_Double & theValue)
+{
+ // TODO(spo): is support of angle type necessary?
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID());
+ fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCoincident(
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintCoincidence::ID());
+ fillAttribute(thePoint1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(thePoint2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setCollinear(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintCollinear::ID());
+ fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setDistance(
+ const ModelHighAPI_RefAttr & thePoint,
+ const ModelHighAPI_RefAttr & thePointOrLine,
+ const ModelHighAPI_Double & theValue)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintDistance::ID());
+ fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(thePointOrLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setEqual(
+ const ModelHighAPI_RefAttr & theObject1,
+ const ModelHighAPI_RefAttr & theObject2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintEqual::ID());
+ fillAttribute(theObject1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theObject2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFillet(
+ const std::list<ModelHighAPI_RefAttr> & thePoints,
+ const ModelHighAPI_Double & theRadius)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintFillet::ID());
+ fillAttribute(thePoints, aFeature->data()->refattrlist(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theRadius, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setFixed(
+ const ModelHighAPI_RefAttr & theObject)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintRigid::ID());
+ fillAttribute(theObject, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setHorizontal(
+ const ModelHighAPI_RefAttr & theLine)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintHorizontal::ID());
+ fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setLength(
+ const ModelHighAPI_RefAttr & theLine,
+ const ModelHighAPI_Double & theValue)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintLength::ID());
+ fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setMiddlePoint(
+ const ModelHighAPI_RefAttr & thePoint,
+ const ModelHighAPI_RefAttr & theLine)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintMiddle::ID());
+ fillAttribute(thePoint, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setParallel(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintParallel::ID());
+ fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setPerpendicular(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintPerpendicular::ID());
+ fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setRadius(
+ const ModelHighAPI_RefAttr & theCircleOrArc,
+ const ModelHighAPI_Double & theValue)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintRadius::ID());
+ fillAttribute(theCircleOrArc, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setTangent(
+ const ModelHighAPI_RefAttr & theLine,
+ const ModelHighAPI_RefAttr & theCircle)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintTangent::ID());
+ fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ fillAttribute(theCircle, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ aFeature->execute();
+ return aFeature;
+}
+
+std::shared_ptr<ModelAPI_Feature> SketchAPI_Sketch::setVertical(
+ const ModelHighAPI_RefAttr & theLine)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature =
+ compositeFeature()->addFeature(SketchPlugin_ConstraintVertical::ID());
+ fillAttribute(theLine, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
+ aFeature->execute();
+ return aFeature;
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Sketch.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
+#define SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_Sketch.h>
+#include <SketchPlugin_SketchEntity.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+class ModelAPI_CompositeFeature;
+class ModelAPI_Object;
+class ModelHighAPI_Double;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+class ModelHighAPI_Selection;
+class SketchAPI_Arc;
+class SketchAPI_Circle;
+class SketchAPI_IntersectionPoint;
+class SketchAPI_Line;
+class SketchAPI_Mirror;
+class SketchAPI_Point;
+class SketchAPI_Projection;
+class SketchAPI_Rectangle;
+class SketchAPI_Rotation;
+class SketchAPI_Translation;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Sketch
+ * \ingroup CPPHighAPI
+ * \brief Interface for Sketch feature
+ */
+class SketchAPI_Sketch : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::shared_ptr<GeomAPI_Ax3> & thePlane);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Sketch(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Selection & theExternal);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Sketch();
+
+ INTERFACE_7(SketchPlugin_Sketch::ID(),
+ origin, SketchPlugin_Sketch::ORIGIN_ID(), GeomDataAPI_Point, /** Origin point */,
+ dirX, SketchPlugin_Sketch::DIRX_ID(), GeomDataAPI_Dir, /** Direction of X */,
+ normal, SketchPlugin_Sketch::NORM_ID(), GeomDataAPI_Dir, /** Normal */,
+ features, SketchPlugin_Sketch::FEATURES_ID(), ModelAPI_AttributeRefList, /** Features */,
+ external, SketchPlugin_SketchEntity::EXTERNAL_ID(), ModelAPI_AttributeSelection, /** External */,
+ solverError, SketchPlugin_Sketch::SOLVER_ERROR(), ModelAPI_AttributeString, /** Solver error */,
+ solverDOF, SketchPlugin_Sketch::SOLVER_DOF(), ModelAPI_AttributeString, /** Solver DOF */
+ )
+
+ /// Set plane
+ SKETCHAPI_EXPORT
+ void setPlane(const std::shared_ptr<GeomAPI_Ax3> & thePlane);
+
+ /// Set external
+ SKETCHAPI_EXPORT
+ void setExternal(const ModelHighAPI_Selection & theExternal);
+
+ /// Add point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Point> addPoint(
+ double theX, double theY);
+ /// Add point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Point> addPoint(
+ const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
+ /// Add point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
+ /// Add point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
+
+ /// Add intersection point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const ModelHighAPI_Selection & theExternal);
+ /// Add point
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_IntersectionPoint> addIntersectionPoint(const std::string & theExternalName);
+
+ /// Add line
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Line> addLine(
+ double theX1, double theY1, double theX2, double theY2);
+ /// Add line
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Line> addLine(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+ /// Add line
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
+ /// Add line
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
+
+ /// Add rectangle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Rectangle> addRectangle(
+ double theX1, double theY1, double theX2, double theY2);
+ /// Add rectangle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Rectangle> addRectangle(
+ const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(
+ double theCenterX, double theCenterY,
+ double theRadius);
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ double theRadius);
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(
+ double theX1, double theY1,
+ double theX2, double theY2,
+ double theX3, double theY3);
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
+ /// Add circle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ double theCenterX, double theCenterY,
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ double theStartX, double theStartY,
+ double theEndX, double theEndY,
+ double thePassedX, double thePassedY);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePassed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ double theEndX, double theEndY,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(
+ const ModelHighAPI_RefAttr& theTangentPoint,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
+ bool theInversed);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(const ModelHighAPI_Selection & theExternal);
+
+ /// Add arc
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
+
+ /// Add projection
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Projection> addProjection(
+ const ModelHighAPI_Selection & theExternalFeature);
+
+ /// Add mirror
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Mirror> addMirror(
+ const ModelHighAPI_RefAttr & theMirrorLine,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects);
+
+ /// Add translation
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Translation> addTranslation(
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue = false);
+
+ /// Add rotation
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Rotation> addRotation(
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & theCenter,
+ const ModelHighAPI_Double & theAngle,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue = false);
+
+ /// Set angle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setAngle(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2,
+ const ModelHighAPI_Double & theValue);
+
+ /// Set coincident
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setCoincident(
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2);
+
+ /// Set collinear
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setCollinear(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2);
+
+ /// Set distance
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setDistance(
+ const ModelHighAPI_RefAttr & thePoint,
+ const ModelHighAPI_RefAttr & thePointOrLine,
+ const ModelHighAPI_Double & theValue);
+
+ /// Set equal
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setEqual(
+ const ModelHighAPI_RefAttr & theObject1,
+ const ModelHighAPI_RefAttr & theObject2);
+
+ /// Set fillet
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setFillet(
+ const std::list<ModelHighAPI_RefAttr> & thePoints,
+ const ModelHighAPI_Double & theRadius);
+
+ /// Set fixed
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setFixed(
+ const ModelHighAPI_RefAttr & theObject);
+
+ /// Set horizontal
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setHorizontal(
+ const ModelHighAPI_RefAttr & theLine);
+
+ /// Set length
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setLength(
+ const ModelHighAPI_RefAttr & theLine,
+ const ModelHighAPI_Double & theValue);
+
+ /// Set middle
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setMiddlePoint(
+ const ModelHighAPI_RefAttr & thePoint,
+ const ModelHighAPI_RefAttr & theLine);
+
+ /// Set parallel
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setParallel(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2);
+
+ /// Set perpendicular
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setPerpendicular(
+ const ModelHighAPI_RefAttr & theLine1,
+ const ModelHighAPI_RefAttr & theLine2);
+
+ /// Set radius
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setRadius(
+ const ModelHighAPI_RefAttr & theCircleOrArc,
+ const ModelHighAPI_Double & theValue);
+
+ /// Set tangent
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setTangent(
+ const ModelHighAPI_RefAttr & theLine,
+ const ModelHighAPI_RefAttr & theCircle);
+
+ /// Set vertical
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_Feature> setVertical(
+ const ModelHighAPI_RefAttr & theLine);
+
+ /// Set constraint value
+ SKETCHAPI_EXPORT
+ void setValue(
+ const std::shared_ptr<ModelAPI_Feature> & theConstraint,
+ const ModelHighAPI_Double & theValue);
+
+ // TODO(spo): rename to selectFaces() or faces() (or add faces() -> list to SWIG)
+ /// Select face
+ SKETCHAPI_EXPORT
+ std::list<ModelHighAPI_Selection> selectFace() const;
+
+protected:
+ std::shared_ptr<ModelAPI_CompositeFeature> compositeFeature() const;
+
+};
+
+//! Pointer on Sketch object
+typedef std::shared_ptr<SketchAPI_Sketch> SketchPtr;
+
+/**\ingroup CPPHighAPI
+ * \brief Create Sketch feature
+ */
+SKETCHAPI_EXPORT
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::shared_ptr<GeomAPI_Ax3> & thePlane);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Sketch feature
+ */
+SKETCHAPI_EXPORT
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ModelHighAPI_Selection & theExternal);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Sketch feature
+ */
+SKETCHAPI_EXPORT
+SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::string & theExternalName);
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCH_H_ */
--- /dev/null
+// Name : SketchAPI_SketchEntity.cpp
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_SketchEntity::SketchAPI_SketchEntity(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_SketchEntity::~SketchAPI_SketchEntity()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
+bool SketchAPI_SketchEntity::initialize()
+{
+ SET_ATTRIBUTE(Auxiliary, ModelAPI_AttributeBoolean, SketchPlugin_SketchEntity::AUXILIARY_ID())
+
+ return true;
+}
+
+//--------------------------------------------------------------------------------------
+std::shared_ptr<ModelAPI_AttributeBoolean> SketchAPI_SketchEntity::auxiliary() const
+{
+ return myAuxiliary;
+}
+
+void SketchAPI_SketchEntity::setAuxiliary(bool theAuxiliary)
+{
+ fillAttribute(theAuxiliary, myAuxiliary);
+
+ execute();
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_SketchEntity.h
+// Purpose:
+//
+// History:
+// 07/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_SKETCHENTITY_H_
+#define SRC_SKETCHAPI_SKETCHAPI_SKETCHENTITY_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <SketchPlugin_SketchEntity.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_SketchEntity
+ * \ingroup CPPHighAPI
+ * \brief Base class for Sketch feature interfaces
+ */
+class SketchAPI_SketchEntity : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_SketchEntity(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_SketchEntity();
+
+ /// Auxiliary
+ SKETCHAPI_EXPORT
+ std::shared_ptr<ModelAPI_AttributeBoolean> auxiliary() const;
+
+ /// Set auxiliary
+ SKETCHAPI_EXPORT
+ void setAuxiliary(bool theAuxiliary);
+
+protected:
+ std::shared_ptr<ModelAPI_AttributeBoolean> myAuxiliary;
+
+ bool initialize();
+};
+
+//! Pointer on SketchEntity object
+typedef std::shared_ptr<SketchAPI_SketchEntity> SketchEntityPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_SKETCHENTITY_H_ */
--- /dev/null
+// Name : SketchAPI_Translation.cpp
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI_Translation.h"
+//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Tools.h>
+//--------------------------------------------------------------------------------------
+SketchAPI_Translation::SketchAPI_Translation(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: SketchAPI_SketchEntity(theFeature)
+{
+ initialize();
+}
+
+SketchAPI_Translation::SketchAPI_Translation(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ fillAttribute(theObjects, translationList());
+ fillAttribute(thePoint1, startPoint());
+ fillAttribute(thePoint2, endPoint());
+ fillAttribute(theNumberOfObjects, numberOfObjects());
+ if (theFullValue)
+ fillAttribute("SingleValue", valueType());
+
+ execute();
+ }
+}
+
+SketchAPI_Translation::~SketchAPI_Translation()
+{
+
+}
+
+//--------------------------------------------------------------------------------------
--- /dev/null
+// Name : SketchAPI_Translation.h
+// Purpose:
+//
+// History:
+// 16/06/16 - Sergey POKHODENKO - Creation of the file
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_
+#define SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_
+
+//--------------------------------------------------------------------------------------
+#include "SketchAPI.h"
+
+#include <list>
+
+#include <SketchPlugin_MultiTranslation.h>
+
+#include "SketchAPI_SketchEntity.h"
+//--------------------------------------------------------------------------------------
+class ModelAPI_Object;
+class ModelHighAPI_Integer;
+class ModelHighAPI_RefAttr;
+//--------------------------------------------------------------------------------------
+/**\class SketchAPI_Translation
+ * \ingroup CPPHighAPI
+ * \brief Interface for Translation feature
+ */
+class SketchAPI_Translation : public SketchAPI_SketchEntity
+{
+public:
+ /// Constructor without values
+ SKETCHAPI_EXPORT
+ explicit SketchAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
+ const ModelHighAPI_RefAttr & thePoint1,
+ const ModelHighAPI_RefAttr & thePoint2,
+ const ModelHighAPI_Integer & theNumberOfObjects,
+ bool theFullValue = false);
+ /// Destructor
+ SKETCHAPI_EXPORT
+ virtual ~SketchAPI_Translation();
+
+ INTERFACE_7(SketchPlugin_MultiTranslation::ID(),
+ translationList, SketchPlugin_MultiTranslation::TRANSLATION_LIST_ID(), ModelAPI_AttributeRefList, /** Translation list */,
+ startPoint, SketchPlugin_MultiTranslation::START_POINT_ID(), ModelAPI_AttributeRefAttr, /** Start point */,
+ endPoint, SketchPlugin_MultiTranslation::END_POINT_ID(), ModelAPI_AttributeRefAttr, /** Start point */,
+ numberOfObjects, SketchPlugin_MultiTranslation::NUMBER_OF_OBJECTS_ID(), ModelAPI_AttributeInteger, /** Number of objects */,
+ valueType, SketchPlugin_MultiTranslation::VALUE_TYPE(), ModelAPI_AttributeString, /** Value type */,
+ referenceObjects, SketchPlugin_MultiTranslation::ENTITY_A(), ModelAPI_AttributeRefList, /** Reference objects */,
+ translatedObjects, SketchPlugin_MultiTranslation::ENTITY_B(), ModelAPI_AttributeRefList, /** Translationed objects */
+ )
+
+};
+
+//! Pointer on Translation object
+typedef std::shared_ptr<SketchAPI_Translation> TranslationPtr;
+
+//--------------------------------------------------------------------------------------
+//--------------------------------------------------------------------------------------
+#endif /* SRC_SKETCHAPI_SKETCHAPI_TRANSLATION_H_ */
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: SketchAPI_swig.h
+// Created: 07/06/16
+// Author: Sergey POKHODENKO
+
+#ifndef SRC_SKETCHAPI_SKETCHAPI_SWIG_H_
+#define SRC_SKETCHAPI_SKETCHAPI_SWIG_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "SketchAPI.h"
+ #include "SketchAPI_Arc.h"
+ #include "SketchAPI_Circle.h"
+ #include "SketchAPI_IntersectionPoint.h"
+ #include "SketchAPI_Line.h"
+ #include "SketchAPI_Mirror.h"
+ #include "SketchAPI_Sketch.h"
+ #include "SketchAPI_SketchEntity.h"
+ #include "SketchAPI_Point.h"
+ #include "SketchAPI_Projection.h"
+ #include "SketchAPI_Rectangle.h"
+ #include "SketchAPI_Rotation.h"
+ #include "SketchAPI_Translation.h"
+
+#endif /* SRC_SKETCHAPI_SKETCHAPI_SWIG_H_ */
--- /dev/null
+import unittest
+
+import ModelAPI
+import SketchAPI
+
+class SketchTestCase(unittest.TestCase):
+
+ def setUp(self):
+ self.session = ModelAPI.ModelAPI_Session.get()
+ self.doc = self.session.moduleDocument()
+
+ def tearDown(self):
+ self.session.closeAll()
+
+# TODO(spo): add tests.
+
+if __name__ == "__main__":
+ unittest.main()
const double PI =3.141592653589793238463;
namespace {
- static const std::string& ARC_TYPE_CENTER_START_END()
- {
- static const std::string TYPE("CenterStartEnd");
- return TYPE;
- }
- static const std::string& ARC_TYPE_THREE_POINTS()
- {
- static const std::string TYPE("ThreePoints");
- return TYPE;
- }
-
- static const std::string& PASSED_POINT_ID()
- {
- static const std::string PASSED_PNT("ArcPassedPoint");
- return PASSED_PNT;
- }
- static const std::string& RADIUS_ID()
- {
- static const std::string RADIUS("ArcRadius");
- return RADIUS;
- }
- static const std::string& ANGLE_ID()
- {
- static const std::string ANGLE("ArcAngle");
- return ANGLE;
- }
-
static const std::string& POINT_ID(int theIndex)
{
switch (theIndex) {
case 1: return SketchPlugin_Arc::START_ID();
case 2: return SketchPlugin_Arc::END_ID();
- case 3: return PASSED_POINT_ID();
+ case 3: return SketchPlugin_Arc::PASSED_POINT_ID();
}
static const std::string DUMMY;
return TYPE;
}
+ static const std::string& ARC_TYPE_CENTER_START_END()
+ {
+ static const std::string TYPE("CenterStartEnd");
+ return TYPE;
+ }
+ static const std::string& ARC_TYPE_THREE_POINTS()
+ {
+ static const std::string TYPE("ThreePoints");
+ return TYPE;
+ }
+
static const std::string& TANGENT_POINT_ID()
{
static const std::string TANGENT_PNT("ArcTangentPoint");
return MY_INVERSED_ID;
}
+ /// Passed point of the arc.
+ static const std::string& PASSED_POINT_ID()
+ {
+ static const std::string PASSED_PNT("ArcPassedPoint");
+ return PASSED_PNT;
+ }
+
+ /// Arc radius.
+ static const std::string& RADIUS_ID()
+ {
+ static const std::string RADIUS("ArcRadius");
+ return RADIUS;
+ }
+
+ /// Arc angle.
+ static const std::string& ANGLE_ID()
+ {
+ static const std::string ANGLE("ArcAngle");
+ return ANGLE;
+ }
+
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{
const double tolerance = 1e-7;
namespace {
- static const std::string& CIRCLE_TYPE_CENTER_AND_RADIUS()
- {
- static const std::string TYPE("CenterRadius");
- return TYPE;
- }
- static const std::string& CIRCLE_TYPE_THREE_POINTS()
- {
- static const std::string TYPE("ThreePoints");
- return TYPE;
- }
-
- static const std::string& FIRST_POINT_ID()
- {
- static const std::string FIRST_PNT("FirstPoint");
- return FIRST_PNT;
- }
- static const std::string& SECOND_POINT_ID()
- {
- static const std::string SECOND_PNT("SecondPoint");
- return SECOND_PNT;
- }
- static const std::string& THIRD_POINT_ID()
- {
- static const std::string THIRD_PNT("ThirdPoint");
- return THIRD_PNT;
- }
static const std::string& POINT_ID(int theIndex)
{
switch (theIndex) {
- case 1: return FIRST_POINT_ID();
- case 2: return SECOND_POINT_ID();
- case 3: return THIRD_POINT_ID();
+ case 1: return SketchPlugin_Circle::FIRST_POINT_ID();
+ case 2: return SketchPlugin_Circle::SECOND_POINT_ID();
+ case 3: return SketchPlugin_Circle::THIRD_POINT_ID();
}
static const std::string DUMMY;
return TYPE;
}
+ /// Creation method by center and radius.
+ inline static const std::string& CIRCLE_TYPE_CENTER_AND_RADIUS()
+ {
+ static const std::string TYPE("CenterRadius");
+ return TYPE;
+ }
+
+ /// Creation method by three points.
+ inline static const std::string& CIRCLE_TYPE_THREE_POINTS()
+ {
+ static const std::string TYPE("ThreePoints");
+ return TYPE;
+ }
+
/// 2D point - center of the circle
inline static const std::string& CENTER_ID()
{
return MY_CIRCLE_RADIUS_ID;
}
+ /// First point id.
+ inline static const std::string& FIRST_POINT_ID()
+ {
+ static const std::string FIRST_PNT("FirstPoint");
+ return FIRST_PNT;
+ }
+
+ /// Second point id.
+ inline static const std::string& SECOND_POINT_ID()
+ {
+ static const std::string SECOND_PNT("SecondPoint");
+ return SECOND_PNT;
+ }
+
+ /// Third point id.
+ inline static const std::string& THIRD_POINT_ID()
+ {
+ static const std::string THIRD_PNT("ThirdPoint");
+ return THIRD_PNT;
+ }
+
/// Returns the kind of a feature
SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
{