2012-08-09 07:58:02 +00:00
# -*- coding: iso-8859-1 -*-
2014-02-18 10:44:41 +04:00
# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
2014-02-18 10:44:41 +04:00
# version 2.1 of the License, or (at your option) any later version.
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
2008-03-07 07:45:34 +00:00
#
2013-04-04 07:06:43 +00:00
# GEOM GEOM_SWIG : binding of C++ implementation with Python
# File : geomBuilder.py
2008-03-07 07:45:34 +00:00
# Author : Paul RASCLE, EDF
# Module : GEOM
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
"""
2013-04-04 07:06:43 +00:00
\namespace geomBuilder
\brief Module geomBuilder
2008-03-07 07:45:34 +00:00
"""
2013-02-12 11:35:16 +00:00
##
2014-03-13 16:50:55 +04:00
## @defgroup geomBuilder geomBuilder Python module
2013-02-12 11:35:16 +00:00
## @{
##
## @details
##
2013-04-17 10:43:10 +00:00
## By default, all functions of geomBuilder Python module do not publish
2013-02-12 11:35:16 +00:00
## resulting geometrical objects. This can be done in the Python script
2013-04-17 10:43:10 +00:00
## by means of \ref geomBuilder.geomBuilder.addToStudy() "addToStudy()"
## or \ref geomBuilder.geomBuilder.addToStudyInFather() "addToStudyInFather()"
2013-02-12 11:35:16 +00:00
## functions.
2014-06-25 18:28:02 +04:00
##
2013-02-12 11:35:16 +00:00
## However, it is possible to publish result data in the study
2013-04-17 10:43:10 +00:00
## automatically. For this, almost each function of
## \ref geomBuilder.geomBuilder "geomBuilder" class has
2013-02-12 11:35:16 +00:00
## an additional @a theName parameter (@c None by default).
## As soon as non-empty string value is passed to this parameter,
## the result object is published in the study automatically.
2014-06-25 18:28:02 +04:00
##
2013-04-17 10:43:10 +00:00
## For example, consider the following Python script:
2014-06-25 18:28:02 +04:00
##
2013-02-12 11:35:16 +00:00
## @code
2013-04-17 10:43:10 +00:00
## import salome
## from salome.geom import geomBuilder
## geompy = geomBuilder.New(salome.myStudy)
2013-02-12 11:35:16 +00:00
## box = geompy.MakeBoxDXDYDZ(100, 100, 100) # box is not published in the study yet
## geompy.addToStudy(box, "box") # explicit publishing
## @endcode
2014-06-25 18:28:02 +04:00
##
2013-04-17 10:43:10 +00:00
## Last two lines can be replaced by one-line instruction:
2014-06-25 18:28:02 +04:00
##
2013-02-12 11:35:16 +00:00
## @code
## box = geompy.MakeBoxDXDYDZ(100, 100, 100, theName="box") # box is published in the study with "box" name
## @endcode
2014-06-25 18:28:02 +04:00
##
2013-02-12 11:35:16 +00:00
## ... or simply
2014-06-25 18:28:02 +04:00
##
2013-02-12 11:35:16 +00:00
## @code
## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "box") # box is published in the study with "box" name
## @endcode
##
## Note, that some functions produce more than one geometrical objects. For example,
2013-04-17 10:43:10 +00:00
## \ref geomBuilder.geomBuilder.GetNonBlocks() "GetNonBlocks()" function returns two objects:
## group of all non-hexa solids and group of all non-quad faces.
## For such functions it is possible to specify separate names for results.
2013-02-12 11:35:16 +00:00
##
## For example
##
## @code
## # create and publish cylinder
## cyl = geompy.MakeCylinderRH(100, 100, "cylinder")
## # get non blocks from cylinder
2015-01-22 12:14:55 +03:00
## g1, g2 = geompy.GetNonBlocks(cyl, theName="nonblock")
2013-02-12 11:35:16 +00:00
## @endcode
##
## Above example will publish both result compounds (first with non-hexa solids and
## second with non-quad faces) as two items, both named "nonblock".
## However, if second command is invoked as
##
## @code
2015-01-22 12:14:55 +03:00
## g1, g2 = geompy.GetNonBlocks(cyl, theName=("nonhexa", "nonquad"))
2013-02-12 11:35:16 +00:00
## @endcode
##
## ... the first compound will be published with "nonhexa" name, and second will be named "nonquad".
##
## Automatic publication of all results can be also enabled/disabled by means of the function
2013-04-17 10:43:10 +00:00
## \ref geomBuilder.geomBuilder.addToStudyAuto() "addToStudyAuto()". The automatic publishing
## is managed by the numeric parameter passed to this function:
2013-02-12 11:35:16 +00:00
## - if @a maxNbSubShapes = 0, automatic publishing is disabled.
## - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
## maximum number of sub-shapes allowed for publishing is unlimited; any negative
## value passed as parameter has the same effect.
## - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
## maximum number of sub-shapes allowed for publishing is set to specified value.
2014-06-25 18:28:02 +04:00
##
## When automatic publishing is enabled, you even do not need to pass @a theName parameter
2013-02-12 11:35:16 +00:00
## to the functions creating objects, instead default names will be used. However, you
## can always change the behavior, by passing explicit name to the @a theName parameter
## and it will be used instead default one.
## The publishing of the collections of objects will be done according to the above
## mentioned rules (maximum allowed number of sub-shapes).
##
## For example:
##
## @code
2013-04-17 10:43:10 +00:00
## import salome
## from salome.geom import geomBuilder
## geompy = geomBuilder.New(salome.myStudy)
2013-02-12 11:35:16 +00:00
## geompy.addToStudyAuto() # enable automatic publication
2014-06-25 18:28:02 +04:00
## box = geompy.MakeBoxDXDYDZ(100, 100, 100)
2013-02-12 11:35:16 +00:00
## # the box is created and published in the study with default name
## geompy.addToStudyAuto(5) # set max allowed number of sub-shapes to 5
2013-04-17 10:43:10 +00:00
## vertices = geompy.SubShapeAll(box, geomBuilder.ShapeType['VERTEX'])
2013-02-12 11:35:16 +00:00
## # only 5 first vertices will be published, with default names
## print len(vertices)
## # note, that result value still containes all 8 vertices
## geompy.addToStudyAuto(-1) # disable automatic publication
## @endcode
##
## This feature can be used, for example, for debugging purposes.
##
## @note
2013-04-17 10:43:10 +00:00
## - Use automatic publication feature with caution. When it is enabled, any function of
## \ref geomBuilder.geomBuilder "geomBuilder" class publishes the results in the study,
## that can lead to the huge size of the study data tree.
## For example, repeating call of \ref geomBuilder.geomBuilder.SubShapeAll() "SubShapeAll()"
## command on the same main shape each time will publish all child objects, that will lead
## to a lot of duplicated items in the study.
2013-02-12 11:35:16 +00:00
## - Sub-shapes are automatically published as child items of the parent main shape in the study if main
## shape was also published before. Otherwise, sub-shapes are published as top-level objects.
2013-11-26 10:12:49 +00:00
## - Some functions of \ref geomBuilder.geomBuilder "geomBuilder" class do not have
2013-06-17 12:42:48 +00:00
## \a theName parameter (and, thus, do not support automatic publication).
2013-04-17 10:43:10 +00:00
## For example, some transformation operations like
## \ref geomBuilder.geomBuilder.TranslateDXDYDZ() "TranslateDXDYDZ()".
2013-02-12 11:35:16 +00:00
## Refer to the documentation to check if some function has such possibility.
##
2013-11-26 10:12:49 +00:00
## It is possible to customize the representation of the geometrical
## data in the data tree; this can be done by using folders. A folder can
2014-06-25 18:28:02 +04:00
## be created in the study tree using function
## \ref geomBuilder.geomBuilder.NewFolder() "NewFolder()"
## (by default it is created under the "Geometry" root object).
## As soon as folder is created, any published geometry object
2013-11-26 10:12:49 +00:00
## can be moved into it.
2014-06-25 18:28:02 +04:00
##
2013-11-26 10:12:49 +00:00
## For example:
2014-06-25 18:28:02 +04:00
##
2013-11-26 10:12:49 +00:00
## @code
## import salome
## from salome.geom import geomBuilder
## geompy = geomBuilder.New(salome.myStudy)
2014-06-25 18:28:02 +04:00
## box = geompy.MakeBoxDXDYDZ(100, 100, 100, "Box")
2013-11-26 10:12:49 +00:00
## # the box was created and published in the study
## folder = geompy.NewFolder("Primitives")
## # an empty "Primitives" folder was created under default "Geometry" root object
## geompy.PutToFolder(box, folder)
## # the box was moved into "Primitives" folder
## @endcode
2014-06-25 18:28:02 +04:00
##
2013-11-26 10:12:49 +00:00
## Subfolders are also can be created by specifying another folder as a parent:
2014-06-25 18:28:02 +04:00
##
2013-11-26 10:12:49 +00:00
## @code
## subfolder = geompy.NewFolder("3D", folder)
## # "3D" folder was created under "Primitives" folder
## @endcode
2014-06-25 18:28:02 +04:00
##
2013-11-26 10:12:49 +00:00
## @note
## - Folder container is just a representation layer object that
2014-06-25 18:28:02 +04:00
## deals with already published objects only. So, any geometry object
## should be published in the study (for example, with
2013-11-26 10:12:49 +00:00
## \ref geomBuilder.geomBuilder.PutToFolder() "addToStudy()" function)
## BEFORE moving it into any existing folder.
## - \ref geomBuilder.geomBuilder.PutToFolder() "PutToFolder()" function
## does not change physical position of geometry object in the study tree,
## it only affects on the representation of the data tree.
## - It is impossible to publish geometry object using any folder as father.
2014-06-25 18:28:02 +04:00
##
2014-03-13 16:50:55 +04:00
## \defgroup l1_publish_data
## \defgroup l1_geomBuilder_auxiliary
## \defgroup l1_geomBuilder_purpose
2013-02-12 11:35:16 +00:00
## @}
2014-03-13 16:50:55 +04:00
## @defgroup l1_publish_data Publishing results in SALOME study
2013-02-12 11:35:16 +00:00
2013-04-17 10:43:10 +00:00
## @defgroup l1_geomBuilder_auxiliary Auxiliary data structures and methods
2009-02-13 12:16:39 +00:00
2013-04-04 07:06:43 +00:00
## @defgroup l1_geomBuilder_purpose All package methods, grouped by their purpose
2009-02-13 12:16:39 +00:00
## @{
## @defgroup l2_import_export Importing/exporting geometrical objects
## @defgroup l2_creating Creating geometrical objects
## @{
## @defgroup l3_basic_go Creating Basic Geometric Objects
## @{
## @defgroup l4_curves Creating Curves
## @}
## @defgroup l3_3d_primitives Creating 3D Primitives
## @defgroup l3_complex Creating Complex Objects
## @defgroup l3_groups Working with groups
## @defgroup l3_blocks Building by blocks
## @{
## @defgroup l4_blocks_measure Check and Improve
## @}
## @defgroup l3_sketcher Sketcher
## @defgroup l3_advanced Creating Advanced Geometrical Objects
## @{
## @defgroup l4_decompose Decompose objects
2012-08-09 07:58:02 +00:00
## @defgroup l4_decompose_d Decompose objects deprecated methods
2009-02-13 12:16:39 +00:00
## @defgroup l4_access Access to sub-shapes by their unique IDs inside the main shape
2012-08-09 07:58:02 +00:00
## @defgroup l4_obtain Access to sub-shapes by a criteria
## @defgroup l4_advanced Advanced objects creation functions
2009-02-13 12:16:39 +00:00
## @}
## @}
## @defgroup l2_transforming Transforming geometrical objects
## @{
## @defgroup l3_basic_op Basic Operations
## @defgroup l3_boolean Boolean Operations
## @defgroup l3_transform Transformation Operations
2013-02-12 11:35:16 +00:00
## @defgroup l3_transform_d Transformation Operations deprecated methods
2012-08-09 07:58:02 +00:00
## @defgroup l3_local Local Operations (Fillet, Chamfer and other Features)
2009-02-13 12:16:39 +00:00
## @defgroup l3_blocks_op Blocks Operations
## @defgroup l3_healing Repairing Operations
2012-08-09 07:58:02 +00:00
## @defgroup l3_restore_ss Restore presentation parameters and a tree of sub-shapes
2009-02-13 12:16:39 +00:00
## @}
## @defgroup l2_measure Using measurement tools
2013-09-30 11:45:32 +00:00
## @defgroup l2_field Field on Geometry
2009-02-13 12:16:39 +00:00
## @}
2012-10-08 11:16:36 +00:00
# initialize SALOME session in try/except block
# to avoid problems in some cases, e.g. when generating documentation
try :
import salome
salome . salome_init ( )
from salome import *
except :
pass
2008-03-07 07:45:34 +00:00
2009-02-13 12:16:39 +00:00
from salome_notebook import *
2008-03-07 07:45:34 +00:00
2009-02-13 12:16:39 +00:00
import GEOM
import math
2012-08-09 07:58:02 +00:00
import os
2014-06-25 18:28:02 +04:00
import functools
2008-03-07 07:45:34 +00:00
2014-09-08 16:07:16 +04:00
from salome . geom . gsketcher import Sketcher3D , Sketcher2D , Polyline2D
2008-03-07 07:45:34 +00:00
2013-02-12 11:35:16 +00:00
# service function
def _toListOfNames ( _names , _size = - 1 ) :
l = [ ]
import types
if type ( _names ) in [ types . ListType , types . TupleType ] :
for i in _names : l . append ( i )
elif _names :
l . append ( _names )
if l and len ( l ) < _size :
for i in range ( len ( l ) , _size ) : l . append ( " %s _ %d " % ( l [ 0 ] , i ) )
return l
2014-06-25 18:28:02 +04:00
# Decorator function to manage transactions for all geometric operations.
def ManageTransactions ( theOpeName ) :
def MTDecorator ( theFunction ) :
# To keep the original function name an documentation.
@functools.wraps ( theFunction )
def OpenCallClose ( self , * args , * * kwargs ) :
# Open transaction
anOperation = getattr ( self , theOpeName )
anOperation . StartOperation ( )
try :
# Call the function
res = theFunction ( self , * args , * * kwargs )
# Commit transaction
anOperation . FinishOperation ( )
return res
except :
# Abort transaction
anOperation . AbortOperation ( )
raise
return OpenCallClose
return MTDecorator
2009-02-13 12:16:39 +00:00
## Raise an Error, containing the Method_name, if Operation is Failed
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2008-03-07 07:45:34 +00:00
def RaiseIfFailed ( Method_name , Operation ) :
if Operation . IsDone ( ) == 0 and Operation . GetErrorCode ( ) != " NOT_FOUND_ANY " :
raise RuntimeError , Method_name + " : " + Operation . GetErrorCode ( )
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
## Return list of variables value from salome notebook
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2009-02-13 12:16:39 +00:00
def ParseParameters ( * parameters ) :
Result = [ ]
2012-08-09 07:58:02 +00:00
StringResult = [ ]
2009-02-13 12:16:39 +00:00
for parameter in parameters :
2012-08-09 07:58:02 +00:00
if isinstance ( parameter , list ) :
lResults = ParseParameters ( * parameter )
if len ( lResults ) > 0 :
Result . append ( lResults [ : - 1 ] )
StringResult + = lResults [ - 1 ] . split ( " : " )
pass
pass
2009-02-13 12:16:39 +00:00
else :
2012-08-09 07:58:02 +00:00
if isinstance ( parameter , str ) :
if notebook . isVariable ( parameter ) :
Result . append ( notebook . get ( parameter ) )
else :
raise RuntimeError , " Variable with name ' " + parameter + " ' doesn ' t exist!!! "
pass
else :
Result . append ( parameter )
pass
StringResult . append ( str ( parameter ) )
2009-02-13 12:16:39 +00:00
pass
pass
2012-08-09 07:58:02 +00:00
if Result :
Result . append ( " : " . join ( StringResult ) )
else :
Result = " : " . join ( StringResult )
2009-02-13 12:16:39 +00:00
return Result
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
## Return list of variables value from salome notebook
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2009-02-13 12:16:39 +00:00
def ParseList ( list ) :
Result = [ ]
StringResult = " "
for parameter in list :
if isinstance ( parameter , str ) and notebook . isVariable ( parameter ) :
Result . append ( str ( notebook . get ( parameter ) ) )
pass
else :
Result . append ( str ( parameter ) )
pass
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
StringResult = StringResult + str ( parameter )
StringResult = StringResult + " : "
pass
StringResult = StringResult [ : len ( StringResult ) - 1 ]
return Result , StringResult
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
## Return list of variables value from salome notebook
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2009-02-13 12:16:39 +00:00
def ParseSketcherCommand ( command ) :
Result = " "
StringResult = " "
sections = command . split ( " : " )
for section in sections :
parameters = section . split ( " " )
paramIndex = 1
for parameter in parameters :
if paramIndex > 1 and parameter . find ( " ' " ) != - 1 :
parameter = parameter . replace ( " ' " , " " )
if notebook . isVariable ( parameter ) :
Result = Result + str ( notebook . get ( parameter ) ) + " "
pass
else :
raise RuntimeError , " Variable with name ' " + parameter + " ' doesn ' t exist!!! "
pass
pass
else :
Result = Result + str ( parameter ) + " "
pass
if paramIndex > 1 :
StringResult = StringResult + parameter
StringResult = StringResult + " : "
pass
paramIndex = paramIndex + 1
pass
Result = Result [ : len ( Result ) - 1 ] + " : "
pass
Result = Result [ : len ( Result ) - 1 ]
return Result , StringResult
2008-03-07 07:45:34 +00:00
2012-08-09 07:58:02 +00:00
## Helper function which can be used to pack the passed string to the byte data.
## Only '1' an '0' symbols are valid for the string. The missing bits are replaced by zeroes.
## If the string contains invalid symbol (neither '1' nor '0'), the function raises an exception.
## For example,
## \code
## val = PackData("10001110") # val = 0xAE
## val = PackData("1") # val = 0x80
## \endcode
## @param data unpacked data - a string containing '1' and '0' symbols
## @return data packed to the byte stream
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2012-08-09 07:58:02 +00:00
def PackData ( data ) :
"""
Helper function which can be used to pack the passed string to the byte data .
Only ' 1 ' an ' 0 ' symbols are valid for the string . The missing bits are replaced by zeroes .
If the string contains invalid symbol ( neither ' 1 ' nor ' 0 ' ) , the function raises an exception .
Parameters :
data unpacked data - a string containing ' 1 ' and ' 0 ' symbols
Returns :
data packed to the byte stream
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Example of usage :
val = PackData ( " 10001110 " ) # val = 0xAE
val = PackData ( " 1 " ) # val = 0x80
"""
bytes = len ( data ) / 8
if len ( data ) % 8 : bytes + = 1
res = " "
for b in range ( bytes ) :
d = data [ b * 8 : ( b + 1 ) * 8 ]
val = 0
for i in range ( 8 ) :
val * = 2
if i < len ( d ) :
if d [ i ] == " 1 " : val + = 1
elif d [ i ] != " 0 " :
raise " Invalid symbol %s " % d [ i ]
pass
pass
res + = chr ( val )
pass
return res
## Read bitmap texture from the text file.
## In that file, any non-zero symbol represents '1' opaque pixel of the bitmap.
## A zero symbol ('0') represents transparent pixel of the texture bitmap.
## The function returns width and height of the pixmap in pixels and byte stream representing
## texture bitmap itself.
##
## This function can be used to read the texture to the byte stream in order to pass it to
2013-04-04 07:06:43 +00:00
## the AddTexture() function of geomBuilder class.
2012-08-09 07:58:02 +00:00
## For example,
## \code
2013-04-04 07:06:43 +00:00
## from salome.geom import geomBuilder
## geompy = geomBuilder.New(salome.myStudy)
2012-08-09 07:58:02 +00:00
## texture = geompy.readtexture('mytexture.dat')
## texture = geompy.AddTexture(*texture)
## obj.SetMarkerTexture(texture)
## \endcode
## @param fname texture file name
## @return sequence of tree values: texture's width, height in pixels and its byte stream
2013-04-04 07:06:43 +00:00
## @ingroup l1_geomBuilder_auxiliary
2012-08-09 07:58:02 +00:00
def ReadTexture ( fname ) :
"""
Read bitmap texture from the text file .
In that file , any non - zero symbol represents ' 1 ' opaque pixel of the bitmap .
A zero symbol ( ' 0 ' ) represents transparent pixel of the texture bitmap .
The function returns width and height of the pixmap in pixels and byte stream representing
texture bitmap itself .
This function can be used to read the texture to the byte stream in order to pass it to
2013-04-04 07:06:43 +00:00
the AddTexture ( ) function of geomBuilder class .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
fname texture file name
Returns :
sequence of tree values : texture ' s width, height in pixels and its byte stream
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Example of usage :
2013-04-04 07:06:43 +00:00
from salome . geom import geomBuilder
geompy = geomBuilder . New ( salome . myStudy )
2012-08-09 07:58:02 +00:00
texture = geompy . readtexture ( ' mytexture.dat ' )
texture = geompy . AddTexture ( * texture )
obj . SetMarkerTexture ( texture )
"""
try :
f = open ( fname )
lines = [ l . strip ( ) for l in f . readlines ( ) ]
f . close ( )
maxlen = 0
if lines : maxlen = max ( [ len ( x ) for x in lines ] )
lenbytes = maxlen / 8
if maxlen % 8 : lenbytes + = 1
bytedata = " "
for line in lines :
if len ( line ) % 8 :
lenline = ( len ( line ) / 8 + 1 ) * 8
pass
else :
lenline = ( len ( line ) / 8 ) * 8
pass
for i in range ( lenline / 8 ) :
byte = " "
for j in range ( 8 ) :
if i * 8 + j < len ( line ) and line [ i * 8 + j ] != " 0 " : byte + = " 1 "
else : byte + = " 0 "
pass
bytedata + = PackData ( byte )
pass
for i in range ( lenline / 8 , lenbytes ) :
bytedata + = PackData ( " 0 " )
pass
return lenbytes * 8 , len ( lines ) , bytedata
except :
pass
return 0 , 0 , " "
## Returns a long value from enumeration type
# Can be used for CORBA enumerator types like GEOM.shape_type
# @param theItem enumeration type
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2012-08-09 07:58:02 +00:00
def EnumToLong ( theItem ) :
"""
Returns a long value from enumeration type
2013-04-04 07:06:43 +00:00
Can be used for CORBA enumerator types like geomBuilder . ShapeType
2012-08-09 07:58:02 +00:00
Parameters :
theItem enumeration type
"""
ret = theItem
if hasattr ( theItem , " _v " ) : ret = theItem . _v
return ret
2014-10-09 18:34:57 +04:00
## Pack an argument into a list
def ToList ( arg ) :
if isinstance ( arg , list ) :
return arg
if hasattr ( arg , " __getitem__ " ) :
return list ( arg )
return [ arg ]
2009-02-13 12:16:39 +00:00
## Information about closed/unclosed state of shell or wire
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2008-03-07 07:45:34 +00:00
class info :
2012-08-09 07:58:02 +00:00
"""
Information about closed / unclosed state of shell or wire
"""
2008-03-07 07:45:34 +00:00
UNKNOWN = 0
CLOSED = 1
UNCLOSED = 2
2014-03-13 16:50:55 +04:00
## Private class used to bind calls of plugin operations to geomBuilder
2013-09-04 13:49:39 +00:00
class PluginOperation :
def __init__ ( self , operation , function ) :
self . operation = operation
self . function = function
pass
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " operation " )
2013-09-04 13:49:39 +00:00
def __call__ ( self , * args ) :
res = self . function ( self . operation , * args )
RaiseIfFailed ( self . function . __name__ , self . operation )
return res
2013-04-04 07:06:43 +00:00
# Warning: geom is a singleton
geom = None
engine = None
doLcc = False
created = False
class geomBuilder ( object , GEOM . _objref_GEOM_Gen ) :
## Enumeration ShapeType as a dictionary. \n
## Topological types of shapes (like Open Cascade types). See GEOM::shape_type for details.
# @ingroup l1_geomBuilder_auxiliary
2014-10-14 12:22:46 +04:00
ShapeType = { " AUTO " : - 1 , " COMPOUND " : 0 , " COMPSOLID " : 1 , " SOLID " : 2 , " SHELL " : 3 , " FACE " : 4 , " WIRE " : 5 , " EDGE " : 6 , " VERTEX " : 7 , " SHAPE " : 8 , " FLAT " : 9 }
2013-04-04 07:06:43 +00:00
## Kinds of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
# and a list of parameters, describing the shape.
# List of parameters, describing the shape:
# - COMPOUND: [nb_solids nb_faces nb_edges nb_vertices]
# - COMPSOLID: [nb_solids nb_faces nb_edges nb_vertices]
#
# - SHELL: [info.CLOSED / info.UNCLOSED nb_faces nb_edges nb_vertices]
#
# - WIRE: [info.CLOSED / info.UNCLOSED nb_edges nb_vertices]
#
# - SPHERE: [xc yc zc R]
# - CYLINDER: [xb yb zb dx dy dz R H]
# - BOX: [xc yc zc ax ay az]
# - ROTATED_BOX: [xc yc zc zx zy zz xx xy xz ax ay az]
# - TORUS: [xc yc zc dx dy dz R_1 R_2]
# - CONE: [xb yb zb dx dy dz R_1 R_2 H]
# - POLYHEDRON: [nb_faces nb_edges nb_vertices]
# - SOLID: [nb_faces nb_edges nb_vertices]
#
# - SPHERE2D: [xc yc zc R]
# - CYLINDER2D: [xb yb zb dx dy dz R H]
# - TORUS2D: [xc yc zc dx dy dz R_1 R_2]
# - CONE2D: [xc yc zc dx dy dz R_1 R_2 H]
# - DISK_CIRCLE: [xc yc zc dx dy dz R]
# - DISK_ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
# - POLYGON: [xo yo zo dx dy dz nb_edges nb_vertices]
# - PLANE: [xo yo zo dx dy dz]
# - PLANAR: [xo yo zo dx dy dz nb_edges nb_vertices]
# - FACE: [nb_edges nb_vertices]
#
# - CIRCLE: [xc yc zc dx dy dz R]
# - ARC_CIRCLE: [xc yc zc dx dy dz R x1 y1 z1 x2 y2 z2]
# - ELLIPSE: [xc yc zc dx dy dz R_1 R_2]
# - ARC_ELLIPSE: [xc yc zc dx dy dz R_1 R_2 x1 y1 z1 x2 y2 z2]
# - LINE: [xo yo zo dx dy dz]
# - SEGMENT: [x1 y1 z1 x2 y2 z2]
# - EDGE: [nb_vertices]
#
# - VERTEX: [x y z]
# @ingroup l1_geomBuilder_auxiliary
kind = GEOM . GEOM_IKindOfShape
def __new__ ( cls ) :
global engine
global geom
global doLcc
global created
2013-04-10 14:06:25 +00:00
#print "==== __new__ ", engine, geom, doLcc, created
2013-04-04 07:06:43 +00:00
if geom is None :
# geom engine is either retrieved from engine, or created
geom = engine
# Following test avoids a recursive loop
if doLcc :
if geom is not None :
# geom engine not created: existing engine found
doLcc = False
if doLcc and not created :
doLcc = False
# FindOrLoadComponent called:
# 1. CORBA resolution of server
# 2. the __new__ method is called again
2013-04-10 14:06:25 +00:00
#print "==== FindOrLoadComponent ", engine, geom, doLcc, created
2013-04-04 07:06:43 +00:00
geom = lcc . FindOrLoadComponent ( " FactoryServer " , " GEOM " )
2013-04-10 14:06:25 +00:00
#print "====1 ",geom
2013-04-04 07:06:43 +00:00
else :
# FindOrLoadComponent not called
if geom is None :
# geomBuilder instance is created from lcc.FindOrLoadComponent
2013-04-10 14:06:25 +00:00
#print "==== super ", engine, geom, doLcc, created
2013-04-04 07:06:43 +00:00
geom = super ( geomBuilder , cls ) . __new__ ( cls )
2013-04-10 14:06:25 +00:00
#print "====2 ",geom
2013-04-04 07:06:43 +00:00
else :
# geom engine not created: existing engine found
2013-04-10 14:06:25 +00:00
#print "==== existing ", engine, geom, doLcc, created
2013-04-04 07:06:43 +00:00
pass
2013-04-10 14:06:25 +00:00
#print "return geom 1 ", geom
2013-04-04 07:06:43 +00:00
return geom
2013-04-10 14:06:25 +00:00
#print "return geom 2 ", geom
2013-04-04 07:06:43 +00:00
return geom
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
def __init__ ( self ) :
2013-04-10 14:06:25 +00:00
global created
2013-04-04 07:06:43 +00:00
#print "-------- geomBuilder __init__ --- ", created, self
2013-04-10 14:06:25 +00:00
if not created :
created = True
GEOM . _objref_GEOM_Gen . __init__ ( self )
self . myMaxNbSubShapesAllowed = 0 # auto-publishing is disabled by default
self . myBuilder = None
self . myStudyId = 0
self . father = None
self . BasicOp = None
self . CurvesOp = None
self . PrimOp = None
self . ShapesOp = None
self . HealOp = None
self . InsertOp = None
self . BoolOp = None
self . TrsfOp = None
self . LocalOp = None
self . MeasuOp = None
self . BlocksOp = None
self . GroupOp = None
2013-09-30 11:45:32 +00:00
self . FieldOp = None
2008-03-07 07:45:34 +00:00
pass
2013-02-12 11:35:16 +00:00
## Process object publication in the study, as follows:
# - if @a theName is specified (not None), the object is published in the study
# with this name, not taking into account "auto-publishing" option;
# - if @a theName is NOT specified, the object is published in the study
# (using default name, which can be customized using @a theDefaultName parameter)
# only if auto-publishing is switched on.
#
# @param theObj object, a subject for publishing
# @param theName object name for study
# @param theDefaultName default name for the auto-publishing
#
# @sa addToStudyAuto()
def _autoPublish ( self , theObj , theName , theDefaultName = " noname " ) :
# ---
def _item_name ( _names , _defname , _idx = - 1 ) :
if not _names : _names = _defname
if type ( _names ) in [ types . ListType , types . TupleType ] :
if _idx > = 0 :
if _idx > = len ( _names ) or not _names [ _idx ] :
if type ( _defname ) not in [ types . ListType , types . TupleType ] :
_name = " %s _ %d " % ( _defname , _idx + 1 )
elif len ( _defname ) > 0 and _idx > = 0 and _idx < len ( _defname ) :
_name = _defname [ _idx ]
else :
_name = " % noname_ %d " % ( dn , _idx + 1 )
pass
else :
_name = _names [ _idx ]
pass
else :
# must be wrong usage
_name = _names [ 0 ]
pass
else :
if _idx > = 0 :
_name = " %s _ %d " % ( _names , _idx + 1 )
else :
_name = _names
pass
return _name
# ---
2013-09-30 11:45:32 +00:00
def _publish ( _name , _obj ) :
fatherObj = None
if isinstance ( _obj , GEOM . _objref_GEOM_Field ) :
fatherObj = _obj . GetShape ( )
elif isinstance ( _obj , GEOM . _objref_GEOM_FieldStep ) :
fatherObj = _obj . GetField ( )
elif not _obj . IsMainShape ( ) :
fatherObj = _obj . GetMainShape ( )
pass
if fatherObj and fatherObj . GetStudyEntry ( ) :
self . addToStudyInFather ( fatherObj , _obj , _name )
else :
self . addToStudy ( _obj , _name )
pass
return
# ---
2013-02-12 11:35:16 +00:00
if not theObj :
return # null object
if not theName and not self . myMaxNbSubShapesAllowed :
return # nothing to do: auto-publishing is disabled
if not theName and not theDefaultName :
return # neither theName nor theDefaultName is given
import types
if type ( theObj ) in [ types . ListType , types . TupleType ] :
# list of objects is being published
idx = 0
for obj in theObj :
if not obj : continue # bad object
name = _item_name ( theName , theDefaultName , idx )
2013-09-30 11:45:32 +00:00
_publish ( name , obj )
2013-02-12 11:35:16 +00:00
idx = idx + 1
if not theName and idx == self . myMaxNbSubShapesAllowed : break
pass
pass
else :
# single object is published
name = _item_name ( theName , theDefaultName )
2013-09-30 11:45:32 +00:00
_publish ( name , theObj )
2013-02-12 11:35:16 +00:00
pass
2013-04-17 10:43:10 +00:00
## @addtogroup l1_geomBuilder_auxiliary
2009-02-13 12:16:39 +00:00
## @{
2008-03-07 07:45:34 +00:00
def init_geom ( self , theStudy ) :
self . myStudy = theStudy
self . myStudyId = self . myStudy . _get_StudyId ( )
self . myBuilder = self . myStudy . NewBuilder ( )
self . father = self . myStudy . FindComponent ( " GEOM " )
2014-04-29 16:12:10 +04:00
notebook . myStudy = theStudy
2008-03-07 07:45:34 +00:00
if self . father is None :
self . father = self . myBuilder . NewComponent ( " GEOM " )
A1 = self . myBuilder . FindOrCreateAttribute ( self . father , " AttributeName " )
FName = A1 . _narrow ( SALOMEDS . AttributeName )
FName . SetValue ( " Geometry " )
A2 = self . myBuilder . FindOrCreateAttribute ( self . father , " AttributePixMap " )
aPixmap = A2 . _narrow ( SALOMEDS . AttributePixMap )
aPixmap . SetPixMap ( " ICON_OBJBROWSER_Geometry " )
self . myBuilder . DefineComponentInstance ( self . father , self )
pass
self . BasicOp = self . GetIBasicOperations ( self . myStudyId )
self . CurvesOp = self . GetICurvesOperations ( self . myStudyId )
self . PrimOp = self . GetI3DPrimOperations ( self . myStudyId )
self . ShapesOp = self . GetIShapesOperations ( self . myStudyId )
self . HealOp = self . GetIHealingOperations ( self . myStudyId )
self . InsertOp = self . GetIInsertOperations ( self . myStudyId )
self . BoolOp = self . GetIBooleanOperations ( self . myStudyId )
self . TrsfOp = self . GetITransformOperations ( self . myStudyId )
self . LocalOp = self . GetILocalOperations ( self . myStudyId )
self . MeasuOp = self . GetIMeasureOperations ( self . myStudyId )
self . BlocksOp = self . GetIBlocksOperations ( self . myStudyId )
self . GroupOp = self . GetIGroupOperations ( self . myStudyId )
2013-09-30 11:45:32 +00:00
self . FieldOp = self . GetIFieldOperations ( self . myStudyId )
2013-09-27 09:01:59 +00:00
2013-06-28 08:18:20 +00:00
# set GEOM as root in the use case tree
self . myUseCaseBuilder = self . myStudy . GetUseCaseBuilder ( )
self . myUseCaseBuilder . SetRootCurrent ( )
self . myUseCaseBuilder . Append ( self . father )
2015-02-06 15:38:24 +03:00
# load data from the study file, if necessary
self . myBuilder . LoadWith ( self . father , self )
2008-03-07 07:45:34 +00:00
pass
2009-02-13 12:16:39 +00:00
2013-09-04 13:49:39 +00:00
def GetPluginOperations ( self , studyID , libraryName ) :
op = GEOM . _objref_GEOM_Gen . GetPluginOperations ( self , studyID , libraryName )
return op
2013-02-12 11:35:16 +00:00
## Enable / disable results auto-publishing
2014-06-25 18:28:02 +04:00
#
2013-02-12 11:35:16 +00:00
# The automatic publishing is managed in the following way:
# - if @a maxNbSubShapes = 0, automatic publishing is disabled.
# - if @a maxNbSubShapes = -1 (default), automatic publishing is enabled and
# maximum number of sub-shapes allowed for publishing is unlimited; any negative
# value passed as parameter has the same effect.
# - if @a maxNbSubShapes is any positive value, automatic publishing is enabled and
# maximum number of sub-shapes allowed for publishing is set to specified value.
#
# @param maxNbSubShapes maximum number of sub-shapes allowed for publishing.
# @ingroup l1_publish_data
def addToStudyAuto ( self , maxNbSubShapes = - 1 ) :
"""
Enable / disable results auto - publishing
The automatic publishing is managed in the following way :
- if @a maxNbSubShapes = 0 , automatic publishing is disabled ;
- if @a maxNbSubShapes = - 1 ( default ) , automatic publishing is enabled and
maximum number of sub - shapes allowed for publishing is unlimited ; any negative
value passed as parameter has the same effect .
- if @a maxNbSubShapes is any positive value , automatic publishing is enabled and
maximum number of sub - shapes allowed for publishing is set to this value .
Parameters :
maxNbSubShapes maximum number of sub - shapes allowed for publishing .
Example of usage :
geompy . addToStudyAuto ( ) # enable auto-publishing
geompy . MakeBoxDXDYDZ ( 100 ) # box is created and published with default name
geompy . addToStudyAuto ( 0 ) # disable auto-publishing
"""
self . myMaxNbSubShapesAllowed = max ( - 1 , maxNbSubShapes )
pass
2012-08-09 07:58:02 +00:00
## Dump component to the Python script
# This method overrides IDL function to allow default values for the parameters.
def DumpPython ( self , theStudy , theIsPublished = True , theIsMultiFile = True ) :
"""
Dump component to the Python script
This method overrides IDL function to allow default values for the parameters .
"""
return GEOM . _objref_GEOM_Gen . DumpPython ( self , theStudy , theIsPublished , theIsMultiFile )
2008-03-07 07:45:34 +00:00
## Get name for sub-shape aSubObj of shape aMainObj
#
2012-08-09 07:58:02 +00:00
# @ref swig_SubShapeName "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2008-03-07 07:45:34 +00:00
def SubShapeName ( self , aSubObj , aMainObj ) :
2012-08-09 07:58:02 +00:00
"""
Get name for sub - shape aSubObj of shape aMainObj
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
#aSubId = orb.object_to_string(aSubObj)
#aMainId = orb.object_to_string(aMainObj)
#index = gg.getIndexTopology(aSubId, aMainId)
#name = gg.getShapeTypeString(aSubId) + "_%d"%(index)
index = self . ShapesOp . GetTopologyIndex ( aMainObj , aSubObj )
name = self . ShapesOp . GetShapeTypeString ( aSubObj ) + " _ %d " % ( index )
return name
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Publish in study aShape with name aName
#
2009-02-13 12:16:39 +00:00
# \param aShape the shape to be published
# \param aName the name for the shape
# \param doRestoreSubShapes if True, finds and publishes also
# sub-shapes of <VAR>aShape</VAR>, corresponding to its arguments
# and published sub-shapes of arguments
2012-08-09 07:58:02 +00:00
# \param theArgs,theFindMethod,theInheritFirstArg see RestoreSubShapes() for
2009-02-13 12:16:39 +00:00
# these arguments description
# \return study entry of the published shape in form of string
#
2013-02-12 11:35:16 +00:00
# @ingroup l1_publish_data
2012-08-09 07:58:02 +00:00
# @ref swig_all_addtostudy "Example"
2009-02-13 12:16:39 +00:00
def addToStudy ( self , aShape , aName , doRestoreSubShapes = False ,
theArgs = [ ] , theFindMethod = GEOM . FSM_GetInPlace , theInheritFirstArg = False ) :
2012-08-09 07:58:02 +00:00
"""
Publish in study aShape with name aName
Parameters :
aShape the shape to be published
aName the name for the shape
doRestoreSubShapes if True , finds and publishes also
sub - shapes of aShape , corresponding to its arguments
and published sub - shapes of arguments
theArgs , theFindMethod , theInheritFirstArg see geompy . RestoreSubShapes ( ) for
these arguments description
Returns :
study entry of the published shape in form of string
Example of usage :
id_block1 = geompy . addToStudy ( Block1 , " Block 1 " )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
try :
aSObject = self . AddInStudy ( self . myStudy , aShape , aName , None )
2012-10-08 11:16:36 +00:00
if aSObject and aName : aSObject . SetAttrString ( " AttributeName " , aName )
2009-02-13 12:16:39 +00:00
if doRestoreSubShapes :
self . RestoreSubShapesSO ( self . myStudy , aSObject , theArgs ,
2012-08-09 07:58:02 +00:00
theFindMethod , theInheritFirstArg , True )
2008-03-07 07:45:34 +00:00
except :
print " addToStudy() failed "
return " "
return aShape . GetStudyEntry ( )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Publish in study aShape with name aName as sub-object of previously published aFather
2012-08-09 07:58:02 +00:00
# \param aFather previously published object
# \param aShape the shape to be published as sub-object of <VAR>aFather</VAR>
# \param aName the name for the shape
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# \return study entry of the published shape in form of string
2013-02-12 11:35:16 +00:00
#
# @ingroup l1_publish_data
2012-08-09 07:58:02 +00:00
# @ref swig_all_addtostudyInFather "Example"
2009-02-13 12:16:39 +00:00
def addToStudyInFather ( self , aFather , aShape , aName ) :
2012-08-09 07:58:02 +00:00
"""
Publish in study aShape with name aName as sub - object of previously published aFather
Parameters :
aFather previously published object
aShape the shape to be published as sub - object of aFather
aName the name for the shape
Returns :
study entry of the published shape in form of string
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
try :
2012-08-09 07:58:02 +00:00
aSObject = self . AddInStudy ( self . myStudy , aShape , aName , aFather )
2012-10-08 11:16:36 +00:00
if aSObject and aName : aSObject . SetAttrString ( " AttributeName " , aName )
2008-03-07 07:45:34 +00:00
except :
print " addToStudyInFather() failed "
return " "
return aShape . GetStudyEntry ( )
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Unpublish object in study
#
# \param obj the object to be unpublished
def hideInStudy ( self , obj ) :
"""
Unpublish object in study
Parameters :
obj the object to be unpublished
"""
ior = salome . orb . object_to_string ( obj )
aSObject = self . myStudy . FindObjectIOR ( ior )
if aSObject is not None :
genericAttribute = self . myBuilder . FindOrCreateAttribute ( aSObject , " AttributeDrawable " )
drwAttribute = genericAttribute . _narrow ( SALOMEDS . AttributeDrawable )
drwAttribute . SetDrawable ( False )
2014-07-23 12:51:21 +04:00
# hide references if any
vso = self . myStudy . FindDependances ( aSObject ) ;
for refObj in vso :
genericAttribute = self . myBuilder . FindOrCreateAttribute ( refObj , " AttributeDrawable " )
drwAttribute = genericAttribute . _narrow ( SALOMEDS . AttributeDrawable )
drwAttribute . SetDrawable ( False )
pass
2012-08-09 07:58:02 +00:00
pass
2013-04-17 10:43:10 +00:00
# end of l1_geomBuilder_auxiliary
2009-02-13 12:16:39 +00:00
## @}
## @addtogroup l3_restore_ss
## @{
## Publish sub-shapes, standing for arguments and sub-shapes of arguments
2012-08-09 07:58:02 +00:00
# To be used from python scripts out of addToStudy() (non-default usage)
# \param theObject published GEOM.GEOM_Object, arguments of which will be published
# \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
2009-02-13 12:16:39 +00:00
# If this list is empty, all operation arguments will be published
2012-08-09 07:58:02 +00:00
# \param theFindMethod method to search sub-shapes, corresponding to arguments and
# their sub-shapes. Value from enumeration GEOM.find_shape_method.
2009-02-13 12:16:39 +00:00
# \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
2012-08-09 07:58:02 +00:00
# Do not publish sub-shapes in place of arguments, but only
# in place of sub-shapes of the first argument,
2009-02-13 12:16:39 +00:00
# because the whole shape corresponds to the first argument.
# Mainly to be used after transformations, but it also can be
# usefull after partition with one object shape, and some other
# operations, where only the first argument has to be considered.
# If theObject has only one argument shape, this flag is automatically
# considered as True, not regarding really passed value.
2012-08-09 07:58:02 +00:00
# \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
# and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
# \return list of published sub-shapes
2009-02-13 12:16:39 +00:00
#
# @ref tui_restore_prs_params "Example"
2012-08-09 07:58:02 +00:00
def RestoreSubShapes ( self , theObject , theArgs = [ ] , theFindMethod = GEOM . FSM_GetInPlace ,
theInheritFirstArg = False , theAddPrefix = True ) :
"""
Publish sub - shapes , standing for arguments and sub - shapes of arguments
To be used from python scripts out of geompy . addToStudy ( non - default usage )
Parameters :
theObject published GEOM . GEOM_Object , arguments of which will be published
theArgs list of GEOM . GEOM_Object , operation arguments to be published .
If this list is empty , all operation arguments will be published
theFindMethod method to search sub - shapes , corresponding to arguments and
their sub - shapes . Value from enumeration GEOM . find_shape_method .
theInheritFirstArg set properties of the first argument for theObject .
Do not publish sub - shapes in place of arguments , but only
in place of sub - shapes of the first argument ,
because the whole shape corresponds to the first argument .
Mainly to be used after transformations , but it also can be
usefull after partition with one object shape , and some other
operations , where only the first argument has to be considered .
If theObject has only one argument shape , this flag is automatically
considered as True , not regarding really passed value .
theAddPrefix add prefix " from_ " to names of restored sub - shapes ,
and prefix " from_subshapes_of_ " to names of partially restored sub - shapes .
Returns :
list of published sub - shapes
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
return self . RestoreSubShapesO ( self . myStudy , theObject , theArgs ,
2012-08-09 07:58:02 +00:00
theFindMethod , theInheritFirstArg , theAddPrefix )
## Publish sub-shapes, standing for arguments and sub-shapes of arguments
# To be used from python scripts out of addToStudy() (non-default usage)
# \param theObject published GEOM.GEOM_Object, arguments of which will be published
# \param theArgs list of GEOM.GEOM_Object, operation arguments to be published.
# If this list is empty, all operation arguments will be published
# \param theFindMethod method to search sub-shapes, corresponding to arguments and
# their sub-shapes. Value from enumeration GEOM::find_shape_method.
# \param theInheritFirstArg set properties of the first argument for <VAR>theObject</VAR>.
# Do not publish sub-shapes in place of arguments, but only
# in place of sub-shapes of the first argument,
# because the whole shape corresponds to the first argument.
# Mainly to be used after transformations, but it also can be
# usefull after partition with one object shape, and some other
# operations, where only the first argument has to be considered.
# If theObject has only one argument shape, this flag is automatically
# considered as True, not regarding really passed value.
# \param theAddPrefix add prefix "from_" to names of restored sub-shapes,
# and prefix "from_subshapes_of_" to names of partially restored sub-shapes.
# \return list of published sub-shapes
#
# @ref tui_restore_prs_params "Example"
def RestoreGivenSubShapes ( self , theObject , theArgs = [ ] , theFindMethod = GEOM . FSM_GetInPlace ,
theInheritFirstArg = False , theAddPrefix = True ) :
"""
Publish sub - shapes , standing for arguments and sub - shapes of arguments
To be used from python scripts out of geompy . addToStudy ( ) ( non - default usage )
Parameters :
theObject published GEOM . GEOM_Object , arguments of which will be published
theArgs list of GEOM . GEOM_Object , operation arguments to be published .
If this list is empty , all operation arguments will be published
theFindMethod method to search sub - shapes , corresponding to arguments and
their sub - shapes . Value from enumeration GEOM : : find_shape_method .
theInheritFirstArg set properties of the first argument for theObject .
Do not publish sub - shapes in place of arguments , but only
in place of sub - shapes of the first argument ,
because the whole shape corresponds to the first argument .
Mainly to be used after transformations , but it also can be
usefull after partition with one object shape , and some other
operations , where only the first argument has to be considered .
If theObject has only one argument shape , this flag is automatically
considered as True , not regarding really passed value .
theAddPrefix add prefix " from_ " to names of restored sub - shapes ,
and prefix " from_subshapes_of_ " to names of partially restored sub - shapes .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
list of published sub - shapes
"""
# Example: see GEOM_TestAll.py
return self . RestoreGivenSubShapesO ( self . myStudy , theObject , theArgs ,
theFindMethod , theInheritFirstArg , theAddPrefix )
2009-02-13 12:16:39 +00:00
# end of l3_restore_ss
## @}
## @addtogroup l3_basic_go
## @{
2008-03-07 07:45:34 +00:00
## Create point by three coordinates.
# @param theX The X coordinate of the point.
# @param theY The Y coordinate of the point.
# @param theZ The Z coordinate of the point.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_point "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertex ( self , theX , theY , theZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create point by three coordinates .
Parameters :
theX The X coordinate of the point .
theY The Y coordinate of the point .
theZ The Z coordinate of the point .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created point .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theX , theY , theZ , Parameters = ParseParameters ( theX , theY , theZ )
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePointXYZ ( theX , theY , theZ )
RaiseIfFailed ( " MakePointXYZ " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a point, distant from the referenced point
# on the given distances along the coordinate axes.
# @param theReference The referenced point.
# @param theX Displacement from the referenced point along OX axis.
# @param theY Displacement from the referenced point along OY axis.
# @param theZ Displacement from the referenced point along OZ axis.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_point "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexWithRef ( self , theReference , theX , theY , theZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point , distant from the referenced point
on the given distances along the coordinate axes .
Parameters :
theReference The referenced point .
theX Displacement from the referenced point along OX axis .
theY Displacement from the referenced point along OY axis .
theZ Displacement from the referenced point along OZ axis .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theX , theY , theZ , Parameters = ParseParameters ( theX , theY , theZ )
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePointWithReference ( theReference , theX , theY , theZ )
RaiseIfFailed ( " MakePointWithReference " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a point, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_point "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnCurve ( self , theRefCurve , theParameter , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point , corresponding to the given parameter on the given curve .
Parameters :
theRefCurve The referenced curve .
theParameter Value of parameter on the referenced curve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
Example of usage :
p_on_arc = geompy . MakeVertexOnCurve ( Arc , 0.25 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theParameter , Parameters = ParseParameters ( theParameter )
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePointOnCurve ( theRefCurve , theParameter )
RaiseIfFailed ( " MakePointOnCurve " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2009-02-13 12:16:39 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Create a point by projection give coordinates on the given curve
# @param theRefCurve The referenced curve.
# @param theX X-coordinate in 3D space
# @param theY Y-coordinate in 3D space
# @param theZ Z-coordinate in 3D space
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnCurveByCoord ( self , theRefCurve , theX , theY , theZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point by projection give coordinates on the given curve
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
theRefCurve The referenced curve .
theX X - coordinate in 3 D space
theY Y - coordinate in 3 D space
theZ Z - coordinate in 3 D space
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
Example of usage :
p_on_arc3 = geompy . MakeVertexOnCurveByCoord ( Arc , 100 , - 10 , 10 )
"""
# Example: see GEOM_TestAll.py
theX , theY , theZ , Parameters = ParseParameters ( theX , theY , theZ )
anObj = self . BasicOp . MakePointOnCurveByCoord ( theRefCurve , theX , theY , theZ )
RaiseIfFailed ( " MakeVertexOnCurveByCoord " , self . BasicOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-08-09 07:58:02 +00:00
return anObj
## Create a point, corresponding to the given length on the given curve.
# @param theRefCurve The referenced curve.
# @param theLength Length on the referenced curve. It can be negative.
# @param theStartPoint Point allowing to choose the direction for the calculation
# of the length. If None, start from the first point of theRefCurve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnCurveByLength ( self , theRefCurve , theLength , theStartPoint = None , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point , corresponding to the given length on the given curve .
Parameters :
theRefCurve The referenced curve .
theLength Length on the referenced curve . It can be negative .
theStartPoint Point allowing to choose the direction for the calculation
of the length . If None , start from the first point of theRefCurve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
"""
# Example: see GEOM_TestAll.py
theLength , Parameters = ParseParameters ( theLength )
anObj = self . BasicOp . MakePointOnCurveByLength ( theRefCurve , theLength , theStartPoint )
RaiseIfFailed ( " MakePointOnCurveByLength " , self . BasicOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-08-09 07:58:02 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a point, corresponding to the given parameters on the
# given surface.
# @param theRefSurf The referenced surface.
# @param theUParameter Value of U-parameter on the referenced surface.
# @param theVParameter Value of V-parameter on the referenced surface.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2009-02-13 12:16:39 +00:00
#
# @ref swig_MakeVertexOnSurface "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnSurface ( self , theRefSurf , theUParameter , theVParameter , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point , corresponding to the given parameters on the
given surface .
Parameters :
theRefSurf The referenced surface .
theUParameter Value of U - parameter on the referenced surface .
theVParameter Value of V - parameter on the referenced surface .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
Example of usage :
2012-10-08 11:16:36 +00:00
p_on_face = geompy . MakeVertexOnSurface ( Face , 0.1 , 0.8 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
theUParameter , theVParameter , Parameters = ParseParameters ( theUParameter , theVParameter )
# Example: see GEOM_TestAll.py
anObj = self . BasicOp . MakePointOnSurface ( theRefSurf , theUParameter , theVParameter )
RaiseIfFailed ( " MakePointOnSurface " , self . BasicOp )
anObj . SetParameters ( Parameters ) ;
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Create a point by projection give coordinates on the given surface
# @param theRefSurf The referenced surface.
# @param theX X-coordinate in 3D space
# @param theY Y-coordinate in 3D space
# @param theZ Z-coordinate in 3D space
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexOnSurfaceByCoord "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnSurfaceByCoord ( self , theRefSurf , theX , theY , theZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point by projection give coordinates on the given surface
Parameters :
theRefSurf The referenced surface .
theX X - coordinate in 3 D space
theY Y - coordinate in 3 D space
theZ Z - coordinate in 3 D space
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
Example of usage :
2012-10-08 11:16:36 +00:00
p_on_face2 = geompy . MakeVertexOnSurfaceByCoord ( Face , 0. , 0. , 0. )
2012-08-09 07:58:02 +00:00
"""
theX , theY , theZ , Parameters = ParseParameters ( theX , theY , theZ )
# Example: see GEOM_TestAll.py
anObj = self . BasicOp . MakePointOnSurfaceByCoord ( theRefSurf , theX , theY , theZ )
RaiseIfFailed ( " MakeVertexOnSurfaceByCoord " , self . BasicOp )
anObj . SetParameters ( Parameters ) ;
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-08-09 07:58:02 +00:00
return anObj
2012-10-08 11:16:36 +00:00
## Create a point, which lays on the given face.
# The point will lay in arbitrary place of the face.
# The only condition on it is a non-zero distance to the face boundary.
# Such point can be used to uniquely identify the face inside any
# shape in case, when the shape does not contain overlapped faces.
# @param theFace The referenced face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
#
# @ref swig_MakeVertexInsideFace "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexInsideFace ( self , theFace , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Create a point , which lays on the given face .
The point will lay in arbitrary place of the face .
The only condition on it is a non - zero distance to the face boundary .
Such point can be used to uniquely identify the face inside any
shape in case , when the shape does not contain overlapped faces .
Parameters :
theFace The referenced face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
Example of usage :
p_on_face = geompy . MakeVertexInsideFace ( Face )
"""
# Example: see GEOM_TestAll.py
anObj = self . BasicOp . MakePointOnFace ( theFace )
RaiseIfFailed ( " MakeVertexInsideFace " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-10-08 11:16:36 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a point on intersection of two lines.
# @param theRefLine1, theRefLine2 The referenced lines.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeVertexOnLinesIntersection "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVertexOnLinesIntersection ( self , theRefLine1 , theRefLine2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a point on intersection of two lines .
Parameters :
theRefLine1 , theRefLine2 The referenced lines .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePointOnLinesIntersection ( theRefLine1 , theRefLine2 )
RaiseIfFailed ( " MakePointOnLinesIntersection " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a tangent, corresponding to the given parameter on the given curve.
# @param theRefCurve The referenced curve.
# @param theParameter Value of parameter on the referenced curve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created tangent.
2009-02-13 12:16:39 +00:00
#
# @ref swig_MakeTangentOnCurve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeTangentOnCurve ( self , theRefCurve , theParameter , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a tangent , corresponding to the given parameter on the given curve .
Parameters :
theRefCurve The referenced curve .
theParameter Value of parameter on the referenced curve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created tangent .
Example of usage :
2012-10-08 11:16:36 +00:00
tan_on_arc = geompy . MakeTangentOnCurve ( Arc , 0.7 )
2012-08-09 07:58:02 +00:00
"""
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeTangentOnCurve ( theRefCurve , theParameter )
RaiseIfFailed ( " MakeTangentOnCurve " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " tangent " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Create a tangent plane, corresponding to the given parameter on the given face.
# @param theFace The face for which tangent plane should be built.
# @param theParameterV vertical value of the center point (0.0 - 1.0).
# @param theParameterU horisontal value of the center point (0.0 - 1.0).
# @param theTrimSize the size of plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created tangent.
#
# @ref swig_MakeTangentPlaneOnFace "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeTangentPlaneOnFace ( self , theFace , theParameterU , theParameterV , theTrimSize , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a tangent plane , corresponding to the given parameter on the given face .
Parameters :
theFace The face for which tangent plane should be built .
theParameterV vertical value of the center point ( 0.0 - 1.0 ) .
theParameterU horisontal value of the center point ( 0.0 - 1.0 ) .
theTrimSize the size of plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created tangent .
Example of usage :
an_on_face = geompy . MakeTangentPlaneOnFace ( tan_extrusion , 0.7 , 0.5 , 150 )
"""
anObj = self . BasicOp . MakeTangentPlaneOnFace ( theFace , theParameterU , theParameterV , theTrimSize )
RaiseIfFailed ( " MakeTangentPlaneOnFace " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " tangent " )
2012-08-09 07:58:02 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a vector with the given components.
# @param theDX X component of the vector.
# @param theDY Y component of the vector.
# @param theDZ Z component of the vector.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vector.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_vector "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVectorDXDYDZ ( self , theDX , theDY , theDZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a vector with the given components .
Parameters :
theDX X component of the vector .
theDY Y component of the vector .
theDZ Z component of the vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created vector .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeVectorDXDYDZ ( theDX , theDY , theDZ )
RaiseIfFailed ( " MakeVectorDXDYDZ " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vector " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a vector between two points.
# @param thePnt1 Start point for the vector.
# @param thePnt2 End point for the vector.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vector.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_vector "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeVector ( self , thePnt1 , thePnt2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a vector between two points .
Parameters :
thePnt1 Start point for the vector .
thePnt2 End point for the vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created vector .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeVectorTwoPnt ( thePnt1 , thePnt2 )
RaiseIfFailed ( " MakeVectorTwoPnt " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vector " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a line, passing through the given point
# and parrallel to the given direction
# @param thePnt Point. The resulting line will pass through it.
# @param theDir Direction. The resulting line will be parallel to it.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created line.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_line "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeLine ( self , thePnt , theDir , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a line , passing through the given point
and parrallel to the given direction
Parameters :
thePnt Point . The resulting line will pass through it .
theDir Direction . The resulting line will be parallel to it .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created line .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeLine ( thePnt , theDir )
RaiseIfFailed ( " MakeLine " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " line " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a line, passing through the given points
# @param thePnt1 First of two points, defining the line.
# @param thePnt2 Second of two points, defining the line.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created line.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_line "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeLineTwoPnt ( self , thePnt1 , thePnt2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a line , passing through the given points
Parameters :
thePnt1 First of two points , defining the line .
thePnt2 Second of two points , defining the line .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created line .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeLineTwoPnt ( thePnt1 , thePnt2 )
RaiseIfFailed ( " MakeLineTwoPnt " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " line " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a line on two faces intersection.
2008-03-07 07:45:34 +00:00
# @param theFace1 First of two faces, defining the line.
# @param theFace2 Second of two faces, defining the line.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created line.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeLineTwoFaces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeLineTwoFaces ( self , theFace1 , theFace2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a line on two faces intersection .
Parameters :
theFace1 First of two faces , defining the line .
theFace2 Second of two faces , defining the line .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created line .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeLineTwoFaces ( theFace1 , theFace2 )
RaiseIfFailed ( " MakeLineTwoFaces " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " line " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a plane, passing through the given point
# and normal to the given vector.
# @param thePnt Point, the plane has to pass through.
# @param theVec Vector, defining the plane normal direction.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created plane.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_plane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakePlane ( self , thePnt , theVec , theTrimSize , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a plane , passing through the given point
and normal to the given vector .
Parameters :
thePnt Point , the plane has to pass through .
theVec Vector , defining the plane normal direction .
theTrimSize Half size of a side of quadrangle face , representing the plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created plane .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theTrimSize , Parameters = ParseParameters ( theTrimSize ) ;
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePlanePntVec ( thePnt , theVec , theTrimSize )
RaiseIfFailed ( " MakePlanePntVec " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " plane " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a plane, passing through the three given points
# @param thePnt1 First of three points, defining the plane.
# @param thePnt2 Second of three points, defining the plane.
# @param thePnt3 Fird of three points, defining the plane.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created plane.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_plane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakePlaneThreePnt ( self , thePnt1 , thePnt2 , thePnt3 , theTrimSize , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a plane , passing through the three given points
Parameters :
thePnt1 First of three points , defining the plane .
thePnt2 Second of three points , defining the plane .
thePnt3 Fird of three points , defining the plane .
theTrimSize Half size of a side of quadrangle face , representing the plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created plane .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theTrimSize , Parameters = ParseParameters ( theTrimSize ) ;
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePlaneThreePnt ( thePnt1 , thePnt2 , thePnt3 , theTrimSize )
RaiseIfFailed ( " MakePlaneThreePnt " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " plane " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a plane, similar to the existing one, but with another size of representing face.
# @param theFace Referenced plane or LCS(Marker).
# @param theTrimSize New half size of a side of quadrangle face, representing the plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created plane.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_plane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakePlaneFace ( self , theFace , theTrimSize , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a plane , similar to the existing one , but with another size of representing face .
Parameters :
theFace Referenced plane or LCS ( Marker ) .
theTrimSize New half size of a side of quadrangle face , representing the plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created plane .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theTrimSize , Parameters = ParseParameters ( theTrimSize ) ;
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakePlaneFace ( theFace , theTrimSize )
RaiseIfFailed ( " MakePlaneFace " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " plane " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Create a plane, passing through the 2 vectors
# with center in a start point of the first vector.
# @param theVec1 Vector, defining center point and plane direction.
# @param theVec2 Vector, defining the plane normal direction.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakePlane2Vec ( self , theVec1 , theVec2 , theTrimSize , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a plane , passing through the 2 vectors
with center in a start point of the first vector .
Parameters :
theVec1 Vector , defining center point and plane direction .
theVec2 Vector , defining the plane normal direction .
theTrimSize Half size of a side of quadrangle face , representing the plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created plane .
"""
# Example: see GEOM_TestAll.py
theTrimSize , Parameters = ParseParameters ( theTrimSize ) ;
anObj = self . BasicOp . MakePlane2Vec ( theVec1 , theVec2 , theTrimSize )
RaiseIfFailed ( " MakePlane2Vec " , self . BasicOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " plane " )
2012-08-09 07:58:02 +00:00
return anObj
## Create a plane, based on a Local coordinate system.
# @param theLCS coordinate system, defining plane.
# @param theTrimSize Half size of a side of quadrangle face, representing the plane.
# @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created plane.
#
# @ref tui_creation_plane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakePlaneLCS ( self , theLCS , theTrimSize , theOrientation , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a plane , based on a Local coordinate system .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theLCS coordinate system , defining plane .
theTrimSize Half size of a side of quadrangle face , representing the plane .
theOrientation OXY , OYZ or OZX orientation - ( 1 , 2 or 3 )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created plane .
"""
# Example: see GEOM_TestAll.py
theTrimSize , Parameters = ParseParameters ( theTrimSize ) ;
anObj = self . BasicOp . MakePlaneLCS ( theLCS , theTrimSize , theOrientation )
RaiseIfFailed ( " MakePlaneLCS " , self . BasicOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " plane " )
2012-08-09 07:58:02 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a local coordinate system.
# @param OX,OY,OZ Three coordinates of coordinate system origin.
# @param XDX,XDY,XDZ Three components of OX direction
# @param YDX,YDY,YDZ Three components of OY direction
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created coordinate system.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeMarker "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeMarker ( self , OX , OY , OZ , XDX , XDY , XDZ , YDX , YDY , YDZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a local coordinate system .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
OX , OY , OZ Three coordinates of coordinate system origin .
XDX , XDY , XDZ Three components of OX direction
YDX , YDY , YDZ Three components of OY direction
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created coordinate system .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
OX , OY , OZ , XDX , XDY , XDZ , YDX , YDY , YDZ , Parameters = ParseParameters ( OX , OY , OZ , XDX , XDY , XDZ , YDX , YDY , YDZ ) ;
2008-03-07 07:45:34 +00:00
anObj = self . BasicOp . MakeMarker ( OX , OY , OZ , XDX , XDY , XDZ , YDX , YDY , YDZ )
RaiseIfFailed ( " MakeMarker " , self . BasicOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " lcs " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Create a local coordinate system from shape.
# @param theShape The initial shape to detect the coordinate system.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created coordinate system.
#
# @ref tui_creation_lcs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeMarkerFromShape ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a local coordinate system from shape .
Parameters :
theShape The initial shape to detect the coordinate system .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created coordinate system .
"""
anObj = self . BasicOp . MakeMarkerFromShape ( theShape )
RaiseIfFailed ( " MakeMarkerFromShape " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " lcs " )
2012-08-09 07:58:02 +00:00
return anObj
## Create a local coordinate system from point and two vectors.
2008-03-07 07:45:34 +00:00
# @param theOrigin Point of coordinate system origin.
# @param theXVec Vector of X direction
# @param theYVec Vector of Y direction
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created coordinate system.
2009-02-13 12:16:39 +00:00
#
2012-08-09 07:58:02 +00:00
# @ref tui_creation_lcs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BasicOp " )
2013-02-12 11:35:16 +00:00
def MakeMarkerPntTwoVec ( self , theOrigin , theXVec , theYVec , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a local coordinate system from point and two vectors .
Parameters :
theOrigin Point of coordinate system origin .
theXVec Vector of X direction
theYVec Vector of Y direction
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created coordinate system .
"""
anObj = self . BasicOp . MakeMarkerPntTwoVec ( theOrigin , theXVec , theYVec )
RaiseIfFailed ( " MakeMarkerPntTwoVec " , self . BasicOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " lcs " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_basic_go
## @}
## @addtogroup l4_curves
## @{
2008-03-07 07:45:34 +00:00
## Create an arc of circle, passing through three given points.
# @param thePnt1 Start point of the arc.
# @param thePnt2 Middle point of the arc.
# @param thePnt3 End point of the arc.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created arc.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeArc "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeArc ( self , thePnt1 , thePnt2 , thePnt3 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an arc of circle , passing through three given points .
Parameters :
thePnt1 Start point of the arc .
thePnt2 Middle point of the arc .
thePnt3 End point of the arc .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created arc .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeArc ( thePnt1 , thePnt2 , thePnt3 )
RaiseIfFailed ( " MakeArc " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " arc " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create an arc of circle from a center and 2 points.
# @param thePnt1 Center of the arc
# @param thePnt2 Start point of the arc. (Gives also the radius of the arc)
# @param thePnt3 End point of the arc (Gives also a direction)
2009-02-13 12:16:39 +00:00
# @param theSense Orientation of the arc
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created arc.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeArc "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeArcCenter ( self , thePnt1 , thePnt2 , thePnt3 , theSense = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an arc of circle from a center and 2 points .
Parameters :
thePnt1 Center of the arc
thePnt2 Start point of the arc . ( Gives also the radius of the arc )
thePnt3 End point of the arc ( Gives also a direction )
theSense Orientation of the arc
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created arc .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . CurvesOp . MakeArcCenter ( thePnt1 , thePnt2 , thePnt3 , theSense )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeArcCenter " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " arc " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
## Create an arc of ellipse, of center and two points.
# @param theCenter Center of the arc.
# @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
# @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created arc.
2009-02-13 12:16:39 +00:00
#
# @ref swig_MakeArc "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeArcOfEllipse ( self , theCenter , thePnt1 , thePnt2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an arc of ellipse , of center and two points .
Parameters :
theCenter Center of the arc .
thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2 .
thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2 .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created arc .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . CurvesOp . MakeArcOfEllipse ( theCenter , thePnt1 , thePnt2 )
RaiseIfFailed ( " MakeArcOfEllipse " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " arc " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a circle with given center, normal vector and radius.
# @param thePnt Circle center.
# @param theVec Vector, normal to the plane of the circle.
# @param theR Circle radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created circle.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_circle "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeCircle ( self , thePnt , theVec , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a circle with given center , normal vector and radius .
Parameters :
thePnt Circle center .
theVec Vector , normal to the plane of the circle .
theR Circle radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created circle .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeCirclePntVecR ( thePnt , theVec , theR )
RaiseIfFailed ( " MakeCirclePntVecR " , self . CurvesOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " circle " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a circle with given radius.
# Center of the circle will be in the origin of global
# coordinate system and normal vector will be codirected with Z axis
# @param theR Circle radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created circle.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeCircleR ( self , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a circle with given radius .
Center of the circle will be in the origin of global
coordinate system and normal vector will be codirected with Z axis
Parameters :
theR Circle radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created circle .
"""
2009-02-13 12:16:39 +00:00
anObj = self . CurvesOp . MakeCirclePntVecR ( None , None , theR )
RaiseIfFailed ( " MakeCirclePntVecR " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " circle " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a circle, passing through three given points
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created circle.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_circle "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeCircleThreePnt ( self , thePnt1 , thePnt2 , thePnt3 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a circle , passing through three given points
Parameters :
thePnt1 , thePnt2 , thePnt3 Points , defining the circle .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created circle .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeCircleThreePnt ( thePnt1 , thePnt2 , thePnt3 )
RaiseIfFailed ( " MakeCircleThreePnt " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " circle " )
2008-03-07 07:45:34 +00:00
return anObj
## Create a circle, with given point1 as center,
# passing through the point2 as radius and laying in the plane,
# defined by all three given points.
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created circle.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeCircle "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeCircleCenter2Pnt ( self , thePnt1 , thePnt2 , thePnt3 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a circle , with given point1 as center ,
passing through the point2 as radius and laying in the plane ,
defined by all three given points .
Parameters :
thePnt1 , thePnt2 , thePnt3 Points , defining the circle .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created circle .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_example6.py
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeCircleCenter2Pnt ( thePnt1 , thePnt2 , thePnt3 )
RaiseIfFailed ( " MakeCircleCenter2Pnt " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " circle " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create an ellipse with given center, normal vector and radiuses.
# @param thePnt Ellipse center.
# @param theVec Vector, normal to the plane of the ellipse.
# @param theRMajor Major ellipse radius.
# @param theRMinor Minor ellipse radius.
2012-08-09 07:58:02 +00:00
# @param theVecMaj Vector, direction of the ellipse's main axis.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created ellipse.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_ellipse "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeEllipse ( self , thePnt , theVec , theRMajor , theRMinor , theVecMaj = None , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an ellipse with given center , normal vector and radiuses .
Parameters :
thePnt Ellipse center .
theVec Vector , normal to the plane of the ellipse .
theRMajor Major ellipse radius .
theRMinor Minor ellipse radius .
theVecMaj Vector , direction of the ellipse ' s main axis.
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created ellipse .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theRMajor , theRMinor , Parameters = ParseParameters ( theRMajor , theRMinor )
2012-08-09 07:58:02 +00:00
if theVecMaj is not None :
anObj = self . CurvesOp . MakeEllipseVec ( thePnt , theVec , theRMajor , theRMinor , theVecMaj )
else :
anObj = self . CurvesOp . MakeEllipse ( thePnt , theVec , theRMajor , theRMinor )
pass
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeEllipse " , self . CurvesOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " ellipse " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create an ellipse with given radiuses.
# Center of the ellipse will be in the origin of global
# coordinate system and normal vector will be codirected with Z axis
# @param theRMajor Major ellipse radius.
# @param theRMinor Minor ellipse radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created ellipse.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeEllipseRR ( self , theRMajor , theRMinor , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an ellipse with given radiuses .
Center of the ellipse will be in the origin of global
coordinate system and normal vector will be codirected with Z axis
Parameters :
theRMajor Major ellipse radius .
theRMinor Minor ellipse radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM . GEOM_Object , containing the created ellipse .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
anObj = self . CurvesOp . MakeEllipse ( None , None , theRMajor , theRMinor )
RaiseIfFailed ( " MakeEllipse " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " ellipse " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a polyline on the set of points.
# @param thePoints Sequence of points for the polyline.
2012-08-09 07:58:02 +00:00
# @param theIsClosed If True, build a closed wire.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created polyline.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakePolyline ( self , thePoints , theIsClosed = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a polyline on the set of points .
Parameters :
thePoints Sequence of points for the polyline .
theIsClosed If True , build a closed wire .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created polyline .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = self . CurvesOp . MakePolyline ( thePoints , theIsClosed )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakePolyline " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " polyline " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create bezier curve on the set of points.
# @param thePoints Sequence of points for the bezier curve.
2012-08-09 07:58:02 +00:00
# @param theIsClosed If True, build a closed curve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created bezier curve.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeBezier ( self , thePoints , theIsClosed = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create bezier curve on the set of points .
Parameters :
thePoints Sequence of points for the bezier curve .
theIsClosed If True , build a closed curve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created bezier curve .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = self . CurvesOp . MakeSplineBezier ( thePoints , theIsClosed )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeSplineBezier " , self . CurvesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " bezier " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create B-Spline curve on the set of points.
# @param thePoints Sequence of points for the B-Spline curve.
2012-08-09 07:58:02 +00:00
# @param theIsClosed If True, build a closed curve.
# @param theDoReordering If TRUE, the algo does not follow the order of
# \a thePoints but searches for the closest vertex.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created B-Spline curve.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeInterpol ( self , thePoints , theIsClosed = False , theDoReordering = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create B - Spline curve on the set of points .
Parameters :
thePoints Sequence of points for the B - Spline curve .
theIsClosed If True , build a closed curve .
theDoReordering If True , the algo does not follow the order of
thePoints but searches for the closest vertex .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created B - Spline curve .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = self . CurvesOp . MakeSplineInterpolation ( thePoints , theIsClosed , theDoReordering )
2013-02-12 11:35:16 +00:00
RaiseIfFailed ( " MakeInterpol " , self . CurvesOp )
self . _autoPublish ( anObj , theName , " bspline " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## Create B-Spline curve on the set of points.
# @param thePoints Sequence of points for the B-Spline curve.
# @param theFirstVec Vector object, defining the curve direction at its first point.
# @param theLastVec Vector object, defining the curve direction at its last point.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created B-Spline curve.
#
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeInterpolWithTangents ( self , thePoints , theFirstVec , theLastVec , theName = None ) :
"""
Create B - Spline curve on the set of points .
Parameters :
thePoints Sequence of points for the B - Spline curve .
theFirstVec Vector object , defining the curve direction at its first point .
theLastVec Vector object , defining the curve direction at its last point .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM . GEOM_Object , containing the created B - Spline curve .
"""
# Example: see GEOM_TestAll.py
anObj = self . CurvesOp . MakeSplineInterpolWithTangents ( thePoints , theFirstVec , theLastVec )
RaiseIfFailed ( " MakeInterpolWithTangents " , self . CurvesOp )
self . _autoPublish ( anObj , theName , " bspline " )
return anObj
2012-08-09 07:58:02 +00:00
## Creates a curve using the parametric definition of the basic points.
# @param thexExpr parametric equation of the coordinates X.
# @param theyExpr parametric equation of the coordinates Y.
# @param thezExpr parametric equation of the coordinates Z.
# @param theParamMin the minimal value of the parameter.
# @param theParamMax the maximum value of the parameter.
# @param theParamStep the number of steps if theNewMethod = True, else step value of the parameter.
2013-09-30 11:45:32 +00:00
# @param theCurveType the type of the curve,
# one of GEOM.Polyline, GEOM.Bezier, GEOM.Interpolation.
2012-08-09 07:58:02 +00:00
# @param theNewMethod flag for switching to the new method if the flag is set to false a deprecated method is used which can lead to a bug.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created curve.
#
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2012-08-09 07:58:02 +00:00
def MakeCurveParametric ( self , thexExpr , theyExpr , thezExpr ,
2013-02-12 11:35:16 +00:00
theParamMin , theParamMax , theParamStep , theCurveType , theNewMethod = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Creates a curve using the parametric definition of the basic points .
Parameters :
thexExpr parametric equation of the coordinates X .
theyExpr parametric equation of the coordinates Y .
thezExpr parametric equation of the coordinates Z .
theParamMin the minimal value of the parameter .
theParamMax the maximum value of the parameter .
theParamStep the number of steps if theNewMethod = True , else step value of the parameter .
2013-09-30 11:45:32 +00:00
theCurveType the type of the curve ,
one of GEOM . Polyline , GEOM . Bezier , GEOM . Interpolation .
2012-08-09 07:58:02 +00:00
theNewMethod flag for switching to the new method if the flag is set to false a deprecated
method is used which can lead to a bug .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created curve .
"""
theParamMin , theParamMax , theParamStep , Parameters = ParseParameters ( theParamMin , theParamMax , theParamStep )
if theNewMethod :
anObj = self . CurvesOp . MakeCurveParametricNew ( thexExpr , theyExpr , thezExpr , theParamMin , theParamMax , theParamStep , theCurveType )
else :
2014-06-25 18:28:02 +04:00
anObj = self . CurvesOp . MakeCurveParametric ( thexExpr , theyExpr , thezExpr , theParamMin , theParamMax , theParamStep , theCurveType )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " MakeSplineInterpolation " , self . CurvesOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " curve " )
2012-08-09 07:58:02 +00:00
return anObj
2013-11-19 11:55:25 +00:00
## Create an isoline curve on a face.
# @param theFace the face for which an isoline is created.
# @param IsUIsoline True for U-isoline creation; False for V-isoline
# creation.
# @param theParameter the U parameter for U-isoline or V parameter
# for V-isoline.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created isoline edge or
# a compound of edges.
#
# @ref tui_creation_curve "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-11-19 11:55:25 +00:00
def MakeIsoline ( self , theFace , IsUIsoline , theParameter , theName = None ) :
"""
Create an isoline curve on a face .
Parameters :
theFace the face for which an isoline is created .
IsUIsoline True for U - isoline creation ; False for V - isoline
creation .
theParameter the U parameter for U - isoline or V parameter
for V - isoline .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created isoline edge or a
compound of edges .
"""
# Example: see GEOM_TestAll.py
anObj = self . CurvesOp . MakeIsoline ( theFace , IsUIsoline , theParameter )
RaiseIfFailed ( " MakeIsoline " , self . CurvesOp )
if IsUIsoline :
self . _autoPublish ( anObj , theName , " U-Isoline " )
else :
self . _autoPublish ( anObj , theName , " V-Isoline " )
return anObj
2009-02-13 12:16:39 +00:00
# end of l4_curves
## @}
## @addtogroup l3_sketcher
## @{
2008-03-07 07:45:34 +00:00
## Create a sketcher (wire or face), following the textual description,
2009-02-13 12:16:39 +00:00
# passed through <VAR>theCommand</VAR> argument. \n
2008-03-07 07:45:34 +00:00
# Edges of the resulting wire or face will be arcs of circles and/or linear segments. \n
# Format of the description string have to be the following:
#
# "Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]]"
#
# Where:
# - x1, y1 are coordinates of the first sketcher point (zero by default),
# - CMD is one of
# - "R angle" : Set the direction by angle
# - "D dx dy" : Set the direction by DX & DY
# .
# \n
# - "TT x y" : Create segment by point at X & Y
# - "T dx dy" : Create segment by point with DX & DY
# - "L length" : Create segment by direction & Length
# - "IX x" : Create segment by direction & Intersect. X
# - "IY y" : Create segment by direction & Intersect. Y
# .
# \n
# - "C radius length" : Create arc by direction, radius and length(in degree)
2012-08-09 07:58:02 +00:00
# - "AA x y": Create arc by point at X & Y
# - "A dx dy" : Create arc by point with DX & DY
# - "UU x y radius flag1": Create arc by point at X & Y with given radiUs
# - "U dx dy radius flag1" : Create arc by point with DX & DY with given radiUs
# - "EE x y xc yc flag1 flag2": Create arc by point at X & Y with given cEnter coordinates
# - "E dx dy dxc dyc radius flag1 flag2" : Create arc by point with DX & DY with given cEnter coordinates
2008-03-07 07:45:34 +00:00
# .
# \n
# - "WW" : Close Wire (to finish)
# - "WF" : Close Wire and build face (to finish)
2012-08-09 07:58:02 +00:00
# .
# \n
# - Flag1 (= reverse) is 0 or 2 ...
# - if 0 the drawn arc is the one of lower angle (< Pi)
# - if 2 the drawn arc ius the one of greater angle (> Pi)
# .
# \n
# - Flag2 (= control tolerance) is 0 or 1 ...
# - if 0 the specified end point can be at a distance of the arc greater than the tolerance (10^-7)
# - if 1 the wire is built only if the end point is on the arc
# with a tolerance of 10^-7 on the distance else the creation fails
2008-03-07 07:45:34 +00:00
#
# @param theCommand String, defining the sketcher in local
# coordinates of the working plane.
# @param theWorkingPlane Nine double values, defining origin,
# OZ and OX directions of the working plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created wire.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_sketcher_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeSketcher ( self , theCommand , theWorkingPlane = [ 0 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 ] , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sketcher ( wire or face ) , following the textual description , passed
through theCommand argument .
Edges of the resulting wire or face will be arcs of circles and / or linear segments .
Format of the description string have to be the following :
" Sketcher[:F x1 y1]:CMD[:CMD[:CMD...]] "
Where :
- x1 , y1 are coordinates of the first sketcher point ( zero by default ) ,
- CMD is one of
- " R angle " : Set the direction by angle
- " D dx dy " : Set the direction by DX & DY
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
- " TT x y " : Create segment by point at X & Y
- " T dx dy " : Create segment by point with DX & DY
- " L length " : Create segment by direction & Length
- " IX x " : Create segment by direction & Intersect . X
- " IY y " : Create segment by direction & Intersect . Y
- " C radius length " : Create arc by direction , radius and length ( in degree )
- " AA x y " : Create arc by point at X & Y
- " A dx dy " : Create arc by point with DX & DY
- " UU x y radius flag1 " : Create arc by point at X & Y with given radiUs
- " U dx dy radius flag1 " : Create arc by point with DX & DY with given radiUs
- " EE x y xc yc flag1 flag2 " : Create arc by point at X & Y with given cEnter coordinates
- " E dx dy dxc dyc radius flag1 flag2 " : Create arc by point with DX & DY with given cEnter coordinates
- " WW " : Close Wire ( to finish )
- " WF " : Close Wire and build face ( to finish )
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
- Flag1 ( = reverse ) is 0 or 2 . . .
- if 0 the drawn arc is the one of lower angle ( < Pi )
- if 2 the drawn arc ius the one of greater angle ( > Pi )
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
- Flag2 ( = control tolerance ) is 0 or 1 . . .
- if 0 the specified end point can be at a distance of the arc greater than the tolerance ( 10 ^ - 7 )
- if 1 the wire is built only if the end point is on the arc
with a tolerance of 10 ^ - 7 on the distance else the creation fails
Parameters :
theCommand String , defining the sketcher in local
coordinates of the working plane .
theWorkingPlane Nine double values , defining origin ,
OZ and OX directions of the working plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created wire .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theCommand , Parameters = ParseSketcherCommand ( theCommand )
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeSketcher ( theCommand , theWorkingPlane )
RaiseIfFailed ( " MakeSketcher " , self . CurvesOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " wire " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a sketcher (wire or face), following the textual description,
2009-02-13 12:16:39 +00:00
# passed through <VAR>theCommand</VAR> argument. \n
2012-08-09 07:58:02 +00:00
# For format of the description string see MakeSketcher() method.\n
2008-03-07 07:45:34 +00:00
# @param theCommand String, defining the sketcher in local
# coordinates of the working plane.
# @param theWorkingPlane Planar Face or LCS(Marker) of the working plane.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created wire.
2009-02-13 12:16:39 +00:00
#
# @ref tui_sketcher_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def MakeSketcherOnPlane ( self , theCommand , theWorkingPlane , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sketcher ( wire or face ) , following the textual description ,
passed through theCommand argument .
For format of the description string see geompy . MakeSketcher ( ) method .
Parameters :
theCommand String , defining the sketcher in local
coordinates of the working plane .
theWorkingPlane Planar Face or LCS ( Marker ) of the working plane .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created wire .
"""
2012-10-08 11:16:36 +00:00
theCommand , Parameters = ParseSketcherCommand ( theCommand )
2008-03-07 07:45:34 +00:00
anObj = self . CurvesOp . MakeSketcherOnPlane ( theCommand , theWorkingPlane )
RaiseIfFailed ( " MakeSketcherOnPlane " , self . CurvesOp )
2012-10-08 11:16:36 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " wire " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
2013-05-29 16:27:24 +00:00
## Obtain a 2D sketcher interface
2014-06-25 18:28:02 +04:00
# @return An instance of @ref gsketcher.Sketcher2D "Sketcher2D" interface
2013-05-29 16:27:24 +00:00
def Sketcher2D ( self ) :
"""
Obtain a 2 D sketcher interface .
Example of usage :
sk = geompy . Sketcher2D ( )
sk . addPoint ( 20 , 20 )
sk . addSegmentRelative ( 15 , 70 )
sk . addSegmentPerpY ( 50 )
sk . addArcRadiusRelative ( 25 , 15 , 14.5 , 0 )
sk . addArcCenterAbsolute ( 1 , 1 , 50 , 50 , 0 , 0 )
sk . addArcDirectionRadiusLength ( 20 , 20 , 101 , 162.13 )
sk . close ( )
Sketch_1 = sk . wire ( geomObj_1 )
"""
sk = Sketcher2D ( self )
return sk
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
## Create a sketcher wire, following the numerical description,
2009-02-13 12:16:39 +00:00
# passed through <VAR>theCoordinates</VAR> argument. \n
2012-08-09 07:58:02 +00:00
# @param theCoordinates double values, defining points to create a wire,
2009-02-13 12:16:39 +00:00
# passing from it.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created wire.
2009-02-13 12:16:39 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_3dsketcher_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " CurvesOp " )
2013-02-12 11:35:16 +00:00
def Make3DSketcher ( self , theCoordinates , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sketcher wire , following the numerical description ,
passed through theCoordinates argument .
Parameters :
theCoordinates double values , defining points to create a wire ,
passing from it .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM_Object , containing the created wire .
"""
theCoordinates , Parameters = ParseParameters ( theCoordinates )
2009-02-13 12:16:39 +00:00
anObj = self . CurvesOp . Make3DSketcher ( theCoordinates )
RaiseIfFailed ( " Make3DSketcher " , self . CurvesOp )
2012-08-09 07:58:02 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " wire " )
2009-02-13 12:16:39 +00:00
return anObj
2012-10-08 11:16:36 +00:00
## Obtain a 3D sketcher interface
# @return An instance of @ref gsketcher.Sketcher3D "Sketcher3D" interface
#
# @ref tui_3dsketcher_page "Example"
def Sketcher3D ( self ) :
"""
Obtain a 3 D sketcher interface .
Example of usage :
sk = geompy . Sketcher3D ( )
sk . addPointsAbsolute ( 0 , 0 , 0 , 70 , 0 , 0 )
sk . addPointsRelative ( 0 , 0 , 130 )
sk . addPointAnglesLength ( " OXY " , 50 , 0 , 100 )
sk . addPointAnglesLength ( " OXZ " , 30 , 80 , 130 )
sk . close ( )
a3D_Sketcher_1 = sk . wire ( )
"""
sk = Sketcher3D ( self )
return sk
2014-09-08 16:07:16 +04:00
## Obtain a 2D polyline creation interface
# @return An instance of @ref gsketcher.Polyline2D "Polyline2D" interface
#
# @ref tui_3dsketcher_page "Example"
def Polyline2D ( self ) :
"""
Obtain a 2 D polyline creation interface .
Example of usage :
pl = geompy . Polyline2D ( )
pl . addSection ( " section 1 " , GEOM . Polyline , True )
pl . addPoints ( 0 , 0 , 10 , 0 , 10 , 10 )
pl . addSection ( " section 2 " , GEOM . Interpolation , False )
pl . addPoints ( 20 , 0 , 30 , 0 , 30 , 10 )
resultObj = pl . result ( WorkingPlane )
"""
pl = Polyline2D ( self )
return pl
2009-02-13 12:16:39 +00:00
# end of l3_sketcher
## @}
## @addtogroup l3_3d_primitives
## @{
2008-03-07 07:45:34 +00:00
## Create a box by coordinates of two opposite vertices.
#
2012-08-09 07:58:02 +00:00
# @param x1,y1,z1 double values, defining first point it.
# @param x2,y2,z2 double values, defining first point it.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
2012-08-09 07:58:02 +00:00
#
# @return New GEOM.GEOM_Object, containing the created box.
2013-02-12 11:35:16 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_box "Example"
2013-02-12 11:35:16 +00:00
def MakeBox ( self , x1 , y1 , z1 , x2 , y2 , z2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a box by coordinates of two opposite vertices .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
x1 , y1 , z1 double values , defining first point .
x2 , y2 , z2 double values , defining second point .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created box .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
pnt1 = self . MakeVertex ( x1 , y1 , z1 )
pnt2 = self . MakeVertex ( x2 , y2 , z2 )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeBoxTwoPnt()
return self . MakeBoxTwoPnt ( pnt1 , pnt2 , theName )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a box with specified dimensions along the coordinate axes
# and with edges, parallel to the coordinate axes.
# Center of the box will be at point (DX/2, DY/2, DZ/2).
# @param theDX Length of Box edges, parallel to OX axis.
# @param theDY Length of Box edges, parallel to OY axis.
# @param theDZ Length of Box edges, parallel to OZ axis.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created box.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_box "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeBoxDXDYDZ ( self , theDX , theDY , theDZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a box with specified dimensions along the coordinate axes
and with edges , parallel to the coordinate axes .
Center of the box will be at point ( DX / 2 , DY / 2 , DZ / 2 ) .
Parameters :
theDX Length of Box edges , parallel to OX axis .
theDY Length of Box edges , parallel to OY axis .
theDZ Length of Box edges , parallel to OZ axis .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created box .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeBoxDXDYDZ ( theDX , theDY , theDZ )
RaiseIfFailed ( " MakeBoxDXDYDZ " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " box " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a box with two specified opposite vertices,
# and with edges, parallel to the coordinate axes
# @param thePnt1 First of two opposite vertices.
# @param thePnt2 Second of two opposite vertices.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created box.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_box "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeBoxTwoPnt ( self , thePnt1 , thePnt2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a box with two specified opposite vertices ,
and with edges , parallel to the coordinate axes
Parameters :
thePnt1 First of two opposite vertices .
thePnt2 Second of two opposite vertices .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created box .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeBoxTwoPnt ( thePnt1 , thePnt2 )
RaiseIfFailed ( " MakeBoxTwoPnt " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " box " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Create a face with specified dimensions with edges parallel to coordinate axes.
2009-02-13 12:16:39 +00:00
# @param theH height of Face.
# @param theW width of Face.
2012-08-09 07:58:02 +00:00
# @param theOrientation face orientation: 1-OXY, 2-OYZ, 3-OZX
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_face "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeFaceHW ( self , theH , theW , theOrientation , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a face with specified dimensions with edges parallel to coordinate axes .
Parameters :
theH height of Face .
theW width of Face .
theOrientation face orientation : 1 - OXY , 2 - OYZ , 3 - OZX
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theH , theW , Parameters = ParseParameters ( theH , theW )
anObj = self . PrimOp . MakeFaceHW ( theH , theW , theOrientation )
RaiseIfFailed ( " MakeFaceHW " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " rectangle " )
2009-02-13 12:16:39 +00:00
return anObj
## Create a face from another plane and two sizes,
# vertical size and horisontal size.
# @param theObj Normale vector to the creating face or
2012-08-09 07:58:02 +00:00
# the face object.
2009-02-13 12:16:39 +00:00
# @param theH Height (vertical size).
# @param theW Width (horisontal size).
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_face "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeFaceObjHW ( self , theObj , theH , theW , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a face from another plane and two sizes ,
vertical size and horisontal size .
Parameters :
theObj Normale vector to the creating face or
the face object .
theH Height ( vertical size ) .
theW Width ( horisontal size ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM_Object , containing the created face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theH , theW , Parameters = ParseParameters ( theH , theW )
anObj = self . PrimOp . MakeFaceObjHW ( theObj , theH , theW )
RaiseIfFailed ( " MakeFaceObjHW " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " rectangle " )
2009-02-13 12:16:39 +00:00
return anObj
## Create a disk with given center, normal vector and radius.
# @param thePnt Disk center.
# @param theVec Vector, normal to the plane of the disk.
# @param theR Disk radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created disk.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_disk "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeDiskPntVecR ( self , thePnt , theVec , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a disk with given center , normal vector and radius .
Parameters :
thePnt Disk center .
theVec Vector , normal to the plane of the disk .
theR Disk radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created disk .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
anObj = self . PrimOp . MakeDiskPntVecR ( thePnt , theVec , theR )
RaiseIfFailed ( " MakeDiskPntVecR " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " disk " )
2009-02-13 12:16:39 +00:00
return anObj
## Create a disk, passing through three given points
# @param thePnt1,thePnt2,thePnt3 Points, defining the disk.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created disk.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_disk "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeDiskThreePnt ( self , thePnt1 , thePnt2 , thePnt3 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a disk , passing through three given points
Parameters :
thePnt1 , thePnt2 , thePnt3 Points , defining the disk .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created disk .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakeDiskThreePnt ( thePnt1 , thePnt2 , thePnt3 )
RaiseIfFailed ( " MakeDiskThreePnt " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " disk " )
2009-02-13 12:16:39 +00:00
return anObj
## Create a disk with specified dimensions along OX-OY coordinate axes.
# @param theR Radius of Face.
2012-08-09 07:58:02 +00:00
# @param theOrientation set the orientation belong axis OXY or OYZ or OZX
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created disk.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_face "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeDiskR ( self , theR , theOrientation , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a disk with specified dimensions along OX - OY coordinate axes .
Parameters :
theR Radius of Face .
theOrientation set the orientation belong axis OXY or OYZ or OZX
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created disk .
Example of usage :
2012-10-08 11:16:36 +00:00
Disk3 = geompy . MakeDiskR ( 100. , 1 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
anObj = self . PrimOp . MakeDiskR ( theR , theOrientation )
RaiseIfFailed ( " MakeDiskR " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " disk " )
2009-02-13 12:16:39 +00:00
return anObj
2014-08-11 11:54:38 +02:00
## Create a cylinder with given base point, axis, radius and height.
2008-03-07 07:45:34 +00:00
# @param thePnt Central point of cylinder base.
# @param theAxis Cylinder axis.
# @param theR Cylinder radius.
# @param theH Cylinder height.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created cylinder.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_cylinder "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2014-08-11 11:54:38 +02:00
def MakeCylinder ( self , thePnt , theAxis , theR , theH , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-08-11 11:54:38 +02:00
Create a cylinder with given base point , axis , radius and height .
2012-08-09 07:58:02 +00:00
Parameters :
thePnt Central point of cylinder base .
theAxis Cylinder axis .
theR Cylinder radius .
theH Cylinder height .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created cylinder .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-08-11 11:54:38 +02:00
theR , theH , Parameters = ParseParameters ( theR , theH )
anObj = self . PrimOp . MakeCylinderPntVecRH ( thePnt , theAxis , theR , theH )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeCylinderPntVecRH " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " cylinder " )
2008-03-07 07:45:34 +00:00
return anObj
2014-08-11 11:54:38 +02:00
## Create a portion of cylinder with given base point, axis, radius, height and angle.
# @param thePnt Central point of cylinder base.
# @param theAxis Cylinder axis.
# @param theR Cylinder radius.
# @param theH Cylinder height.
# @param theA Cylinder angle in radians.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created cylinder.
#
# @ref tui_creation_cylinder "Example"
@ManageTransactions ( " PrimOp " )
def MakeCylinderA ( self , thePnt , theAxis , theR , theH , theA , theName = None ) :
"""
2014-11-12 20:06:47 +03:00
Create a portion of cylinder with given base point , axis , radius , height and angle .
2014-08-11 11:54:38 +02:00
Parameters :
thePnt Central point of cylinder base .
theAxis Cylinder axis .
theR Cylinder radius .
theH Cylinder height .
theA Cylinder angle in radians .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2009-02-13 12:16:39 +00:00
2014-08-11 11:54:38 +02:00
Returns :
New GEOM . GEOM_Object , containing the created cylinder .
"""
# Example: see GEOM_TestAll.py
flag = False
if isinstance ( theA , str ) :
flag = True
theR , theH , theA , Parameters = ParseParameters ( theR , theH , theA )
if flag :
theA = theA * math . pi / 180.
anObj = self . PrimOp . MakeCylinderPntVecRHA ( thePnt , theAxis , theR , theH , theA )
RaiseIfFailed ( " MakeCylinderPntVecRHA " , self . PrimOp )
anObj . SetParameters ( Parameters )
self . _autoPublish ( anObj , theName , " cylinder " )
return anObj
## Create a cylinder with given radius and height at
2008-03-07 07:45:34 +00:00
# the origin of coordinate system. Axis of the cylinder
# will be collinear to the OZ axis of the coordinate system.
# @param theR Cylinder radius.
# @param theH Cylinder height.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created cylinder.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_cylinder "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2014-08-11 11:54:38 +02:00
def MakeCylinderRH ( self , theR , theH , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-08-11 11:54:38 +02:00
Create a cylinder with given radius and height at
2012-08-09 07:58:02 +00:00
the origin of coordinate system . Axis of the cylinder
will be collinear to the OZ axis of the coordinate system .
Parameters :
theR Cylinder radius .
theH Cylinder height .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created cylinder .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-08-11 11:54:38 +02:00
theR , theH , Parameters = ParseParameters ( theR , theH )
anObj = self . PrimOp . MakeCylinderRH ( theR , theH )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeCylinderRH " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " cylinder " )
2008-03-07 07:45:34 +00:00
return anObj
2014-08-11 11:54:38 +02:00
## Create a portion of cylinder with given radius, height and angle at
# the origin of coordinate system. Axis of the cylinder
# will be collinear to the OZ axis of the coordinate system.
# @param theR Cylinder radius.
# @param theH Cylinder height.
# @param theA Cylinder angle in radians.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created cylinder.
#
# @ref tui_creation_cylinder "Example"
@ManageTransactions ( " PrimOp " )
def MakeCylinderRHA ( self , theR , theH , theA , theName = None ) :
"""
Create a portion of cylinder with given radius , height and angle at
the origin of coordinate system . Axis of the cylinder
will be collinear to the OZ axis of the coordinate system .
Parameters :
theR Cylinder radius .
theH Cylinder height .
theA Cylinder angle in radians .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created cylinder .
"""
# Example: see GEOM_TestAll.py
flag = False
if isinstance ( theA , str ) :
flag = True
theR , theH , theA , Parameters = ParseParameters ( theR , theH , theA )
if flag :
theA = theA * math . pi / 180.
anObj = self . PrimOp . MakeCylinderRHA ( theR , theH , theA )
RaiseIfFailed ( " MakeCylinderRHA " , self . PrimOp )
anObj . SetParameters ( Parameters )
self . _autoPublish ( anObj , theName , " cylinder " )
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a sphere with given center and radius.
# @param thePnt Sphere center.
# @param theR Sphere radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created sphere.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_sphere "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeSpherePntR ( self , thePnt , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sphere with given center and radius .
Parameters :
thePnt Sphere center .
theR Sphere radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
New GEOM . GEOM_Object , containing the created sphere .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeSpherePntR ( thePnt , theR )
RaiseIfFailed ( " MakeSpherePntR " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " sphere " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a sphere with given center and radius.
# @param x,y,z Coordinates of sphere center.
# @param theR Sphere radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created sphere.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_sphere "Example"
2013-02-12 11:35:16 +00:00
def MakeSphere ( self , x , y , z , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sphere with given center and radius .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
x , y , z Coordinates of sphere center .
theR Sphere radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created sphere .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
point = self . MakeVertex ( x , y , z )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeSpherePntR()
anObj = self . MakeSpherePntR ( point , theR , theName )
2008-03-07 07:45:34 +00:00
return anObj
## Create a sphere with given radius at the origin of coordinate system.
# @param theR Sphere radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created sphere.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_sphere "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeSphereR ( self , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a sphere with given radius at the origin of coordinate system .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theR Sphere radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-06-25 18:28:02 +04:00
New GEOM . GEOM_Object , containing the created sphere .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeSphereR ( theR )
RaiseIfFailed ( " MakeSphereR " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " sphere " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a cone with given base point, axis, height and radiuses.
# @param thePnt Central point of the first cone base.
# @param theAxis Cone axis.
# @param theR1 Radius of the first cone base.
# @param theR2 Radius of the second cone base.
# \note If both radiuses are non-zero, the cone will be truncated.
# \note If the radiuses are equal, a cylinder will be created instead.
# @param theH Cone height.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created cone.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_cone "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeCone ( self , thePnt , theAxis , theR1 , theR2 , theH , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a cone with given base point , axis , height and radiuses .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
thePnt Central point of the first cone base .
theAxis Cone axis .
theR1 Radius of the first cone base .
theR2 Radius of the second cone base .
theH Cone height .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2012-10-08 11:16:36 +00:00
Note :
2012-08-09 07:58:02 +00:00
If both radiuses are non - zero , the cone will be truncated .
If the radiuses are equal , a cylinder will be created instead .
2012-10-08 11:16:36 +00:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created cone .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR1 , theR2 , theH , Parameters = ParseParameters ( theR1 , theR2 , theH )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeConePntVecR1R2H ( thePnt , theAxis , theR1 , theR2 , theH )
RaiseIfFailed ( " MakeConePntVecR1R2H " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " cone " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a cone with given height and radiuses at
# the origin of coordinate system. Axis of the cone will
# be collinear to the OZ axis of the coordinate system.
# @param theR1 Radius of the first cone base.
# @param theR2 Radius of the second cone base.
# \note If both radiuses are non-zero, the cone will be truncated.
# \note If the radiuses are equal, a cylinder will be created instead.
# @param theH Cone height.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created cone.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_cone "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeConeR1R2H ( self , theR1 , theR2 , theH , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a cone with given height and radiuses at
the origin of coordinate system . Axis of the cone will
be collinear to the OZ axis of the coordinate system .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theR1 Radius of the first cone base .
theR2 Radius of the second cone base .
theH Cone height .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
If both radiuses are non - zero , the cone will be truncated .
If the radiuses are equal , a cylinder will be created instead .
2012-10-08 11:16:36 +00:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created cone .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR1 , theR2 , theH , Parameters = ParseParameters ( theR1 , theR2 , theH )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeConeR1R2H ( theR1 , theR2 , theH )
RaiseIfFailed ( " MakeConeR1R2H " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " cone " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a torus with given center, normal vector and radiuses.
# @param thePnt Torus central point.
# @param theVec Torus axis of symmetry.
# @param theRMajor Torus major radius.
# @param theRMinor Torus minor radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created torus.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_torus "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeTorus ( self , thePnt , theVec , theRMajor , theRMinor , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a torus with given center , normal vector and radiuses .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
thePnt Torus central point .
theVec Torus axis of symmetry .
theRMajor Torus major radius .
theRMinor Torus minor radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created torus .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theRMajor , theRMinor , Parameters = ParseParameters ( theRMajor , theRMinor )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeTorusPntVecRR ( thePnt , theVec , theRMajor , theRMinor )
RaiseIfFailed ( " MakeTorusPntVecRR " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " torus " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a torus with given radiuses at the origin of coordinate system.
# @param theRMajor Torus major radius.
# @param theRMinor Torus minor radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created torus.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_torus "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeTorusRR ( self , theRMajor , theRMinor , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a torus with given radiuses at the origin of coordinate system .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theRMajor Torus major radius .
theRMinor Torus minor radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-06-25 18:28:02 +04:00
New GEOM . GEOM_Object , containing the created torus .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theRMajor , theRMinor , Parameters = ParseParameters ( theRMajor , theRMinor )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeTorusRR ( theRMajor , theRMinor )
RaiseIfFailed ( " MakeTorusRR " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " torus " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_3d_primitives
## @}
## @addtogroup l3_complex
## @{
2008-03-07 07:45:34 +00:00
## Create a shape by extrusion of the base shape along a vector, defined by two points.
# @param theBase Base shape to be extruded.
# @param thePoint1 First end of extrusion vector.
# @param thePoint2 Second end of extrusion vector.
2012-08-09 07:58:02 +00:00
# @param theScaleFactor Use it to make prism with scaled second base.
# Nagative value means not scaled second base.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrism ( self , theBase , thePoint1 , thePoint2 , theScaleFactor = - 1.0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along a vector , defined by two points .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theBase Base shape to be extruded .
thePoint1 First end of extrusion vector .
thePoint2 Second end of extrusion vector .
theScaleFactor Use it to make prism with scaled second base .
Nagative value means not scaled second base .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created prism .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = None
Parameters = " "
if theScaleFactor > 0 :
theScaleFactor , Parameters = ParseParameters ( theScaleFactor )
anObj = self . PrimOp . MakePrismTwoPntWithScaling ( theBase , thePoint1 , thePoint2 , theScaleFactor )
else :
anObj = self . PrimOp . MakePrismTwoPnt ( theBase , thePoint1 , thePoint2 )
RaiseIfFailed ( " MakePrismTwoPnt " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2012-08-09 07:58:02 +00:00
return anObj
## Create a shape by extrusion of the base shape along a
# vector, defined by two points, in 2 Ways (forward/backward).
# @param theBase Base shape to be extruded.
# @param thePoint1 First end of extrusion vector.
# @param thePoint2 Second end of extrusion vector.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
#
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrism2Ways ( self , theBase , thePoint1 , thePoint2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along a
vector , defined by two points , in 2 Ways ( forward / backward ) .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theBase Base shape to be extruded .
thePoint1 First end of extrusion vector .
thePoint2 Second end of extrusion vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created prism .
"""
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakePrismTwoPnt2Ways ( theBase , thePoint1 , thePoint2 )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakePrismTwoPnt " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a shape by extrusion of the base shape along the vector,
# i.e. all the space, transfixed by the base shape during its translation
# along the vector on the given distance.
# @param theBase Base shape to be extruded.
# @param theVec Direction of extrusion.
# @param theH Prism dimension along theVec.
2012-08-09 07:58:02 +00:00
# @param theScaleFactor Use it to make prism with scaled second base.
# Negative value means not scaled second base.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrismVecH ( self , theBase , theVec , theH , theScaleFactor = - 1.0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along the vector ,
i . e . all the space , transfixed by the base shape during its translation
along the vector on the given distance .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theBase Base shape to be extruded .
theVec Direction of extrusion .
theH Prism dimension along theVec .
theScaleFactor Use it to make prism with scaled second base .
Negative value means not scaled second base .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created prism .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = None
Parameters = " "
if theScaleFactor > 0 :
theH , theScaleFactor , Parameters = ParseParameters ( theH , theScaleFactor )
anObj = self . PrimOp . MakePrismVecHWithScaling ( theBase , theVec , theH , theScaleFactor )
else :
theH , Parameters = ParseParameters ( theH )
anObj = self . PrimOp . MakePrismVecH ( theBase , theVec , theH )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakePrismVecH " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2008-03-07 07:45:34 +00:00
return anObj
## Create a shape by extrusion of the base shape along the vector,
# i.e. all the space, transfixed by the base shape during its translation
2012-08-09 07:58:02 +00:00
# along the vector on the given distance in 2 Ways (forward/backward).
2008-03-07 07:45:34 +00:00
# @param theBase Base shape to be extruded.
# @param theVec Direction of extrusion.
# @param theH Prism dimension along theVec in forward direction.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrismVecH2Ways ( self , theBase , theVec , theH , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along the vector ,
i . e . all the space , transfixed by the base shape during its translation
along the vector on the given distance in 2 Ways ( forward / backward ) .
Parameters :
theBase Base shape to be extruded .
theVec Direction of extrusion .
theH Prism dimension along theVec in forward direction .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created prism .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theH , Parameters = ParseParameters ( theH )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakePrismVecH2Ways ( theBase , theVec , theH )
RaiseIfFailed ( " MakePrismVecH2Ways " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
2008-03-07 07:45:34 +00:00
# @param theBase Base shape to be extruded.
2009-02-13 12:16:39 +00:00
# @param theDX, theDY, theDZ Directions of extrusion.
2012-08-09 07:58:02 +00:00
# @param theScaleFactor Use it to make prism with scaled second base.
# Nagative value means not scaled second base.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrismDXDYDZ ( self , theBase , theDX , theDY , theDZ , theScaleFactor = - 1.0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along the dx , dy , dz direction
Parameters :
theBase Base shape to be extruded .
theDX , theDY , theDZ Directions of extrusion .
theScaleFactor Use it to make prism with scaled second base .
Nagative value means not scaled second base .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created prism .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = None
Parameters = " "
if theScaleFactor > 0 :
theDX , theDY , theDZ , theScaleFactor , Parameters = ParseParameters ( theDX , theDY , theDZ , theScaleFactor )
anObj = self . PrimOp . MakePrismDXDYDZWithScaling ( theBase , theDX , theDY , theDZ , theScaleFactor )
else :
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
anObj = self . PrimOp . MakePrismDXDYDZ ( theBase , theDX , theDY , theDZ )
2009-02-13 12:16:39 +00:00
RaiseIfFailed ( " MakePrismDXDYDZ " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Create a shape by extrusion of the base shape along the dx, dy, dz direction
2009-02-13 12:16:39 +00:00
# i.e. all the space, transfixed by the base shape during its translation
2012-08-09 07:58:02 +00:00
# along the vector on the given distance in 2 Ways (forward/backward).
2009-02-13 12:16:39 +00:00
# @param theBase Base shape to be extruded.
# @param theDX, theDY, theDZ Directions of extrusion.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created prism.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePrismDXDYDZ2Ways ( self , theBase , theDX , theDY , theDZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along the dx , dy , dz direction
i . e . all the space , transfixed by the base shape during its translation
along the vector on the given distance in 2 Ways ( forward / backward ) .
Parameters :
theBase Base shape to be extruded .
theDX , theDY , theDZ Directions of extrusion .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created prism .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
anObj = self . PrimOp . MakePrismDXDYDZ2Ways ( theBase , theDX , theDY , theDZ )
RaiseIfFailed ( " MakePrismDXDYDZ2Ways " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " prism " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a shape by revolution of the base shape around the axis
# on the given angle, i.e. all the space, transfixed by the base
# shape during its rotation around the axis on the given angle.
# @param theBase Base shape to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created revolution.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_revolution "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeRevolution ( self , theBase , theAxis , theAngle , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by revolution of the base shape around the axis
on the given angle , i . e . all the space , transfixed by the base
shape during its rotation around the axis on the given angle .
Parameters :
theBase Base shape to be rotated .
theAxis Rotation axis .
theAngle Rotation angle in radians .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created revolution .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theAngle , Parameters = ParseParameters ( theAngle )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeRevolutionAxisAngle ( theBase , theAxis , theAngle )
RaiseIfFailed ( " MakeRevolutionAxisAngle " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " revolution " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Create a shape by revolution of the base shape around the axis
# on the given angle, i.e. all the space, transfixed by the base
# shape during its rotation around the axis on the given angle in
# both directions (forward/backward)
# @param theBase Base shape to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created revolution.
#
# @ref tui_creation_revolution "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeRevolution2Ways ( self , theBase , theAxis , theAngle , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by revolution of the base shape around the axis
on the given angle , i . e . all the space , transfixed by the base
shape during its rotation around the axis on the given angle in
both directions ( forward / backward ) .
Parameters :
theBase Base shape to be rotated .
theAxis Rotation axis .
theAngle Rotation angle in radians .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created revolution .
"""
2009-02-13 12:16:39 +00:00
theAngle , Parameters = ParseParameters ( theAngle )
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeRevolutionAxisAngle2Ways ( theBase , theAxis , theAngle )
RaiseIfFailed ( " MakeRevolutionAxisAngle2Ways " , self . PrimOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " revolution " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-15 17:00:48 +04:00
## Create a face from a given set of contours.
# @param theContours either a list or a compound of edges/wires.
# @param theMinDeg a minimal degree of BSpline surface to create.
# @param theMaxDeg a maximal degree of BSpline surface to create.
# @param theTol2D a 2d tolerance to be reached.
# @param theTol3D a 3d tolerance to be reached.
# @param theNbIter a number of iteration of approximation algorithm.
# @param theMethod Kind of method to perform filling operation
# (see GEOM.filling_oper_method enum).
2009-02-13 12:16:39 +00:00
# @param isApprox if True, BSpline curves are generated in the process
# of surface construction. By default it is False, that means
2012-08-09 07:58:02 +00:00
# the surface is created using given curves. The usage of
2009-02-13 12:16:39 +00:00
# Approximation makes the algorithm work slower, but allows
2012-08-09 07:58:02 +00:00
# building the surface for rather complex cases.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-15 17:00:48 +04:00
# @return New GEOM.GEOM_Object (face), containing the created filling surface.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_filling "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2014-10-15 17:00:48 +04:00
def MakeFilling ( self , theContours , theMinDeg = 2 , theMaxDeg = 5 , theTol2D = 0.0001 ,
2013-02-12 11:35:16 +00:00
theTol3D = 0.0001 , theNbIter = 0 , theMethod = GEOM . FOM_Default , isApprox = 0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-15 17:00:48 +04:00
Create a face from a given set of contours .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-15 17:00:48 +04:00
theContours either a list or a compound of edges / wires .
theMinDeg a minimal degree of BSpline surface to create .
theMaxDeg a maximal degree of BSpline surface to create .
theTol2D a 2 d tolerance to be reached .
theTol3D a 3 d tolerance to be reached .
theNbIter a number of iteration of approximation algorithm .
theMethod Kind of method to perform filling operation
( see GEOM . filling_oper_method enum ) .
2012-08-09 07:58:02 +00:00
isApprox if True , BSpline curves are generated in the process
of surface construction . By default it is False , that means
the surface is created using given curves . The usage of
Approximation makes the algorithm work slower , but allows
2014-10-15 17:00:48 +04:00
building the surface for rather complex cases .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2014-10-15 17:00:48 +04:00
New GEOM . GEOM_Object ( face ) , containing the created filling surface .
2012-08-09 07:58:02 +00:00
Example of usage :
filling = geompy . MakeFilling ( compound , 2 , 5 , 0.0001 , 0.0001 , 5 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
theMinDeg , theMaxDeg , theTol2D , theTol3D , theNbIter , Parameters = ParseParameters ( theMinDeg , theMaxDeg , theTol2D , theTol3D , theNbIter )
2014-10-15 17:00:48 +04:00
anObj = self . PrimOp . MakeFilling ( ToList ( theContours ) , theMinDeg , theMaxDeg ,
2012-08-09 07:58:02 +00:00
theTol2D , theTol3D , theNbIter ,
theMethod , isApprox )
2009-02-13 12:16:39 +00:00
RaiseIfFailed ( " MakeFilling " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " filling " )
2009-02-13 12:16:39 +00:00
return anObj
2012-08-09 07:58:02 +00:00
2014-10-15 17:00:48 +04:00
## Create a face from a given set of contours.
# This method corresponds to MakeFilling() with isApprox=True.
# @param theContours either a list or a compound of edges/wires.
# @param theMinDeg a minimal degree of BSpline surface to create.
# @param theMaxDeg a maximal degree of BSpline surface to create.
# @param theTol3D a 3d tolerance to be reached.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-15 17:00:48 +04:00
# @return New GEOM.GEOM_Object (face), containing the created filling surface.
2012-08-09 07:58:02 +00:00
#
# @ref tui_creation_filling "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2014-10-15 17:00:48 +04:00
def MakeFillingNew ( self , theContours , theMinDeg = 2 , theMaxDeg = 5 , theTol3D = 0.0001 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a filling from the given compound of contours .
2014-10-15 17:00:48 +04:00
This method corresponds to MakeFilling ( ) with isApprox = True .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-15 17:00:48 +04:00
theContours either a list or a compound of edges / wires .
theMinDeg a minimal degree of BSpline surface to create .
theMaxDeg a maximal degree of BSpline surface to create .
theTol3D a 3 d tolerance to be reached .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2014-10-15 17:00:48 +04:00
New GEOM . GEOM_Object ( face ) , containing the created filling surface .
2012-08-09 07:58:02 +00:00
Example of usage :
filling = geompy . MakeFillingNew ( compound , 2 , 5 , 0.0001 )
"""
# Example: see GEOM_TestAll.py
theMinDeg , theMaxDeg , theTol3D , Parameters = ParseParameters ( theMinDeg , theMaxDeg , theTol3D )
2014-10-15 17:00:48 +04:00
anObj = self . PrimOp . MakeFilling ( theContours , theMinDeg , theMaxDeg ,
2012-08-09 07:58:02 +00:00
0 , theTol3D , 0 , GEOM . FOM_Default , True )
RaiseIfFailed ( " MakeFillingNew " , self . PrimOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " filling " )
2012-08-09 07:58:02 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a shell or solid passing through set of sections.Sections should be wires,edges or vertices.
# @param theSeqSections - set of specified sections.
# @param theModeSolid - mode defining building solid or shell
2012-08-09 07:58:02 +00:00
# @param thePreci - precision 3D used for smoothing
2008-03-07 07:45:34 +00:00
# @param theRuled - mode defining type of the result surfaces (ruled or smoothed).
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created shell or solid.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeThruSections ( self , theSeqSections , theModeSolid , thePreci , theRuled , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shell or solid passing through set of sections . Sections should be wires , edges or vertices .
Parameters :
theSeqSections - set of specified sections .
theModeSolid - mode defining building solid or shell
thePreci - precision 3 D used for smoothing
theRuled - mode defining type of the result surfaces ( ruled or smoothed ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created shell or solid .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakeThruSections ( theSeqSections , theModeSolid , thePreci , theRuled )
RaiseIfFailed ( " MakeThruSections " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " filling " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a shape by extrusion of the base shape along
# the path shape. The path shape can be a wire or an edge.
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created pipe.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_pipe "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePipe ( self , theBase , thePath , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along
the path shape . The path shape can be a wire or an edge .
Parameters :
theBase Base shape to be extruded .
thePath Path shape to extrude the base shape along it .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created pipe .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakePipe ( theBase , thePath )
RaiseIfFailed ( " MakePipe " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " pipe " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a shape by extrusion of the profile shape along
# the path shape. The path shape can be a wire or an edge.
2012-08-09 07:58:02 +00:00
# the several profiles can be specified in the several locations of path.
2008-03-07 07:45:34 +00:00
# @param theSeqBases - list of Bases shape to be extruded.
# @param theLocations - list of locations on the path corresponding
# specified list of the Bases shapes. Number of locations
# should be equal to number of bases or list of locations can be empty.
# @param thePath - Path shape to extrude the base shape along it.
# @param theWithContact - the mode defining that the section is translated to be in
# contact with the spine.
2009-02-13 12:16:39 +00:00
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created pipe.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_pipe_with_diff_sec "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2008-03-07 07:45:34 +00:00
def MakePipeWithDifferentSections ( self , theSeqBases ,
theLocations , thePath ,
2013-02-12 11:35:16 +00:00
theWithContact , theWithCorrection , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the profile shape along
the path shape . The path shape can be a wire or an edge .
the several profiles can be specified in the several locations of path .
Parameters :
theSeqBases - list of Bases shape to be extruded .
theLocations - list of locations on the path corresponding
specified list of the Bases shapes . Number of locations
should be equal to number of bases or list of locations can be empty .
thePath - Path shape to extrude the base shape along it .
theWithContact - the mode defining that the section is translated to be in
contact with the spine ( 0 / 1 )
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point ( 0 / 1 )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created pipe .
"""
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakePipeWithDifferentSections ( theSeqBases ,
theLocations , thePath ,
theWithContact , theWithCorrection )
RaiseIfFailed ( " MakePipeWithDifferentSections " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " pipe " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a shape by extrusion of the profile shape along
2009-02-13 12:16:39 +00:00
# the path shape. The path shape can be a wire or a edge.
2012-08-09 07:58:02 +00:00
# the several profiles can be specified in the several locations of path.
2009-02-13 12:16:39 +00:00
# @param theSeqBases - list of Bases shape to be extruded. Base shape must be
# shell or face. If number of faces in neighbour sections
# aren't coincided result solid between such sections will
# be created using external boundaries of this shells.
2012-08-09 07:58:02 +00:00
# @param theSeqSubBases - list of corresponding sub-shapes of section shapes.
2009-02-13 12:16:39 +00:00
# This list is used for searching correspondences between
# faces in the sections. Size of this list must be equal
# to size of list of base shapes.
2008-03-07 07:45:34 +00:00
# @param theLocations - list of locations on the path corresponding
# specified list of the Bases shapes. Number of locations
# should be equal to number of bases. First and last
# locations must be coincided with first and last vertexes
# of path correspondingly.
# @param thePath - Path shape to extrude the base shape along it.
# @param theWithContact - the mode defining that the section is translated to be in
# contact with the spine.
2009-02-13 12:16:39 +00:00
# @param theWithCorrection - defining that the section is rotated to be
# orthogonal to the spine tangent in the correspondent point
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created solids.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_pipe_with_shell_sec "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePipeWithShellSections ( self , theSeqBases , theSeqSubBases ,
2008-03-07 07:45:34 +00:00
theLocations , thePath ,
2013-02-12 11:35:16 +00:00
theWithContact , theWithCorrection , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the profile shape along
the path shape . The path shape can be a wire or a edge .
the several profiles can be specified in the several locations of path .
Parameters :
theSeqBases - list of Bases shape to be extruded . Base shape must be
shell or face . If number of faces in neighbour sections
aren ' t coincided result solid between such sections will
be created using external boundaries of this shells .
theSeqSubBases - list of corresponding sub - shapes of section shapes .
This list is used for searching correspondences between
faces in the sections . Size of this list must be equal
to size of list of base shapes .
theLocations - list of locations on the path corresponding
specified list of the Bases shapes . Number of locations
should be equal to number of bases . First and last
locations must be coincided with first and last vertexes
of path correspondingly .
thePath - Path shape to extrude the base shape along it .
theWithContact - the mode defining that the section is translated to be in
contact with the spine ( 0 / 1 )
theWithCorrection - defining that the section is rotated to be
orthogonal to the spine tangent in the correspondent point ( 0 / 1 )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created solids .
"""
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakePipeWithShellSections ( theSeqBases , theSeqSubBases ,
theLocations , thePath ,
theWithContact , theWithCorrection )
RaiseIfFailed ( " MakePipeWithShellSections " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " pipe " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a shape by extrusion of the profile shape along
# the path shape. This function is used only for debug pipe
2012-08-09 07:58:02 +00:00
# functionality - it is a version of function MakePipeWithShellSections()
# which give a possibility to recieve information about
# creating pipe between each pair of sections step by step.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2008-03-07 07:45:34 +00:00
def MakePipeWithShellSectionsBySteps ( self , theSeqBases , theSeqSubBases ,
theLocations , thePath ,
2013-02-12 11:35:16 +00:00
theWithContact , theWithCorrection , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the profile shape along
the path shape . This function is used only for debug pipe
functionality - it is a version of previous function
geompy . MakePipeWithShellSections ( ) which give a possibility to
recieve information about creating pipe between each pair of
sections step by step .
"""
2008-03-07 07:45:34 +00:00
res = [ ]
nbsect = len ( theSeqBases )
nbsubsect = len ( theSeqSubBases )
#print "nbsect = ",nbsect
for i in range ( 1 , nbsect ) :
#print " i = ",i
tmpSeqBases = [ theSeqBases [ i - 1 ] , theSeqBases [ i ] ]
tmpLocations = [ theLocations [ i - 1 ] , theLocations [ i ] ]
tmpSeqSubBases = [ ]
if nbsubsect > 0 : tmpSeqSubBases = [ theSeqSubBases [ i - 1 ] , theSeqSubBases [ i ] ]
anObj = self . PrimOp . MakePipeWithShellSections ( tmpSeqBases , tmpSeqSubBases ,
tmpLocations , thePath ,
theWithContact , theWithCorrection )
if self . PrimOp . IsDone ( ) == 0 :
print " Problems with pipe creation between " , i , " and " , i + 1 , " sections "
RaiseIfFailed ( " MakePipeWithShellSections " , self . PrimOp )
break
else :
print " Pipe between " , i , " and " , i + 1 , " sections is OK "
res . append ( anObj )
pass
pass
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
resc = self . MakeCompound ( res )
#resc = self.MakeSewing(res, 0.001)
#print "resc: ",resc
2013-02-12 11:35:16 +00:00
self . _autoPublish ( resc , theName , " pipe " )
2008-03-07 07:45:34 +00:00
return resc
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create solids between given sections
# @param theSeqBases - list of sections (shell or face).
# @param theLocations - list of corresponding vertexes
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created solids.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_pipe_without_path "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePipeShellsWithoutPath ( self , theSeqBases , theLocations , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create solids between given sections
Parameters :
theSeqBases - list of sections ( shell or face ) .
theLocations - list of corresponding vertexes
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created solids .
"""
2008-03-07 07:45:34 +00:00
anObj = self . PrimOp . MakePipeShellsWithoutPath ( theSeqBases , theLocations )
RaiseIfFailed ( " MakePipeShellsWithoutPath " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " pipe " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Create a shape by extrusion of the base shape along
# the path shape with constant bi-normal direction along the given vector.
# The path shape can be a wire or an edge.
# @param theBase Base shape to be extruded.
# @param thePath Path shape to extrude the base shape along it.
# @param theVec Vector defines a constant binormal direction to keep the
# same angle beetween the direction and the sections
# along the sweep surface.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created pipe.
2009-02-13 12:16:39 +00:00
#
# @ref tui_creation_pipe "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakePipeBiNormalAlongVector ( self , theBase , thePath , theVec , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shape by extrusion of the base shape along
the path shape with constant bi - normal direction along the given vector .
The path shape can be a wire or an edge .
Parameters :
theBase Base shape to be extruded .
thePath Path shape to extrude the base shape along it .
theVec Vector defines a constant binormal direction to keep the
same angle beetween the direction and the sections
along the sweep surface .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created pipe .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakePipeBiNormalAlongVector ( theBase , thePath , theVec )
RaiseIfFailed ( " MakePipeBiNormalAlongVector " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " pipe " )
2009-02-13 12:16:39 +00:00
return anObj
2014-06-25 18:28:02 +04:00
2013-02-28 14:00:05 +00:00
## Makes a thick solid from a face or a shell
# @param theShape Face or Shell to be thicken
# @param theThickness Thickness of the resulting solid
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created solid
#
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-28 14:00:05 +00:00
def MakeThickSolid ( self , theShape , theThickness , theName = None ) :
"""
Make a thick solid from a face or a shell
Parameters :
theShape Face or Shell to be thicken
theThickness Thickness of the resulting solid
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
2013-02-28 14:00:05 +00:00
Returns :
New GEOM . GEOM_Object , containing the created solid
"""
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakeThickening ( theShape , theThickness , True )
RaiseIfFailed ( " MakeThickening " , self . PrimOp )
self . _autoPublish ( anObj , theName , " pipe " )
return anObj
2014-06-25 18:28:02 +04:00
2013-02-28 14:00:05 +00:00
## Modifies a face or a shell to make it a thick solid
# @param theShape Face or Shell to be thicken
# @param theThickness Thickness of the resulting solid
#
# @return The modified shape
#
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-28 14:00:05 +00:00
def Thicken ( self , theShape , theThickness ) :
"""
Modifies a face or a shell to make it a thick solid
Parameters :
theBase Base shape to be extruded .
thePath Path shape to extrude the base shape along it .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
The modified shape
"""
# Example: see GEOM_TestAll.py
anObj = self . PrimOp . MakeThickening ( theShape , theThickness , False )
RaiseIfFailed ( " MakeThickening " , self . PrimOp )
return anObj
2009-02-13 12:16:39 +00:00
2012-12-13 08:40:36 +00:00
## Build a middle path of a pipe-like shape.
# The path shape can be a wire or an edge.
# @param theShape It can be closed or unclosed pipe-like shell
# or a pipe-like solid.
# @param theBase1, theBase2 Two bases of the supposed pipe. This
# should be wires or faces of theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-12-13 08:40:36 +00:00
# @note It is not assumed that exact or approximate copy of theShape
# can be obtained by applying existing Pipe operation on the
# resulting "Path" wire taking theBase1 as the base - it is not
# always possible; though in some particular cases it might work
# it is not guaranteed. Thus, RestorePath function should not be
# considered as an exact reverse operation of the Pipe.
2013-02-12 11:35:16 +00:00
#
2012-12-13 08:40:36 +00:00
# @return New GEOM.GEOM_Object, containing an edge or wire that represent
# source pipe's "path".
#
# @ref tui_creation_pipe_path "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def RestorePath ( self , theShape , theBase1 , theBase2 , theName = None ) :
2012-12-13 08:40:36 +00:00
"""
Build a middle path of a pipe - like shape .
The path shape can be a wire or an edge .
Parameters :
theShape It can be closed or unclosed pipe - like shell
or a pipe - like solid .
theBase1 , theBase2 Two bases of the supposed pipe . This
should be wires or faces of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-12-13 08:40:36 +00:00
Returns :
New GEOM_Object , containing an edge or wire that represent
source pipe ' s path.
"""
anObj = self . PrimOp . RestorePath ( theShape , theBase1 , theBase2 )
RaiseIfFailed ( " RestorePath " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " path " )
2012-12-13 08:40:36 +00:00
return anObj
## Build a middle path of a pipe-like shape.
# The path shape can be a wire or an edge.
# @param theShape It can be closed or unclosed pipe-like shell
# or a pipe-like solid.
# @param listEdges1, listEdges2 Two bases of the supposed pipe. This
# should be lists of edges of theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-12-13 08:40:36 +00:00
# @note It is not assumed that exact or approximate copy of theShape
# can be obtained by applying existing Pipe operation on the
# resulting "Path" wire taking theBase1 as the base - it is not
# always possible; though in some particular cases it might work
# it is not guaranteed. Thus, RestorePath function should not be
# considered as an exact reverse operation of the Pipe.
2013-02-12 11:35:16 +00:00
#
2012-12-13 08:40:36 +00:00
# @return New GEOM.GEOM_Object, containing an edge or wire that represent
# source pipe's "path".
#
# @ref tui_creation_pipe_path "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def RestorePathEdges ( self , theShape , listEdges1 , listEdges2 , theName = None ) :
2012-12-13 08:40:36 +00:00
"""
Build a middle path of a pipe - like shape .
The path shape can be a wire or an edge .
Parameters :
theShape It can be closed or unclosed pipe - like shell
or a pipe - like solid .
listEdges1 , listEdges2 Two bases of the supposed pipe . This
should be lists of edges of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-12-13 08:40:36 +00:00
Returns :
New GEOM_Object , containing an edge or wire that represent
source pipe ' s path.
"""
anObj = self . PrimOp . RestorePathEdges ( theShape , listEdges1 , listEdges2 )
RaiseIfFailed ( " RestorePath " , self . PrimOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " path " )
2012-12-13 08:40:36 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_complex
## @}
## @addtogroup l3_advanced
## @{
2008-03-07 07:45:34 +00:00
## Create a linear edge with specified ends.
# @param thePnt1 Point for the first end of edge.
# @param thePnt2 Point for the second end of edge.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created edge.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_edge "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeEdge ( self , thePnt1 , thePnt2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a linear edge with specified ends .
Parameters :
thePnt1 Point for the first end of edge .
thePnt2 Point for the second end of edge .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created edge .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . MakeEdge ( thePnt1 , thePnt2 )
RaiseIfFailed ( " MakeEdge " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edge " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Create a new edge, corresponding to the given length on the given curve.
# @param theRefCurve The referenced curve (edge).
# @param theLength Length on the referenced curve. It can be negative.
# @param theStartPoint Any point can be selected for it, the new edge will begin
# at the end of \a theRefCurve, close to the selected point.
# If None, start from the first point of \a theRefCurve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_creation_edge "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeEdgeOnCurveByLength ( self , theRefCurve , theLength , theStartPoint = None , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a new edge , corresponding to the given length on the given curve .
Parameters :
theRefCurve The referenced curve ( edge ) .
theLength Length on the referenced curve . It can be negative .
theStartPoint Any point can be selected for it , the new edge will begin
at the end of theRefCurve , close to the selected point .
If None , start from the first point of theRefCurve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created edge .
"""
# Example: see GEOM_TestAll.py
theLength , Parameters = ParseParameters ( theLength )
anObj = self . ShapesOp . MakeEdgeOnCurveByLength ( theRefCurve , theLength , theStartPoint )
RaiseIfFailed ( " MakeEdgeOnCurveByLength " , self . ShapesOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edge " )
2012-08-09 07:58:02 +00:00
return anObj
## Create an edge from specified wire.
# @param theWire source Wire
# @param theLinearTolerance linear tolerance value (default = 1e-07)
# @param theAngularTolerance angular tolerance value (default = 1e-12)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_creation_edge "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeEdgeWire ( self , theWire , theLinearTolerance = 1e-07 , theAngularTolerance = 1e-12 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an edge from specified wire .
Parameters :
theWire source Wire
theLinearTolerance linear tolerance value ( default = 1e-07 )
theAngularTolerance angular tolerance value ( default = 1e-12 )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created edge .
"""
# Example: see GEOM_TestAll.py
anObj = self . ShapesOp . MakeEdgeWire ( theWire , theLinearTolerance , theAngularTolerance )
RaiseIfFailed ( " MakeEdgeWire " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edge " )
2012-08-09 07:58:02 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create a wire from the set of edges and wires.
# @param theEdgesAndWires List of edges and/or wires.
2012-08-09 07:58:02 +00:00
# @param theTolerance Maximum distance between vertices, that will be merged.
# Values less than 1e-07 are equivalent to 1e-07 (Precision::Confusion())
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created wire.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_wire "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeWire ( self , theEdgesAndWires , theTolerance = 1e-07 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a wire from the set of edges and wires .
Parameters :
theEdgesAndWires List of edges and / or wires .
theTolerance Maximum distance between vertices , that will be merged .
Values less than 1e-07 are equivalent to 1e-07 ( Precision : : Confusion ( ) ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created wire .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
anObj = self . ShapesOp . MakeWire ( theEdgesAndWires , theTolerance )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeWire " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " wire " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a face on the given wire.
# @param theWire closed Wire or Edge to build the face on.
2012-08-09 07:58:02 +00:00
# @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
# If the tolerance of the obtained planar face is less
# than 1e-06, this face will be returned, otherwise the
# algorithm tries to build any suitable face on the given
# wire and prints a warning message.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_face "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeFace ( self , theWire , isPlanarWanted , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a face on the given wire .
Parameters :
theWire closed Wire or Edge to build the face on .
isPlanarWanted If TRUE , the algorithm tries to build a planar face .
If the tolerance of the obtained planar face is less
than 1e-06 , this face will be returned , otherwise the
algorithm tries to build any suitable face on the given
wire and prints a warning message .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . MakeFace ( theWire , isPlanarWanted )
2012-08-09 07:58:02 +00:00
if isPlanarWanted and anObj is not None and self . ShapesOp . GetErrorCode ( ) == " MAKE_FACE_TOLERANCE_TOO_BIG " :
print " WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built. "
else :
RaiseIfFailed ( " MakeFace " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a face on the given wires set.
# @param theWires List of closed wires or edges to build the face on.
2012-08-09 07:58:02 +00:00
# @param isPlanarWanted If TRUE, the algorithm tries to build a planar face.
# If the tolerance of the obtained planar face is less
# than 1e-06, this face will be returned, otherwise the
# algorithm tries to build any suitable face on the given
# wire and prints a warning message.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_face "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeFaceWires ( self , theWires , isPlanarWanted , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a face on the given wires set .
Parameters :
theWires List of closed wires or edges to build the face on .
isPlanarWanted If TRUE , the algorithm tries to build a planar face .
If the tolerance of the obtained planar face is less
than 1e-06 , this face will be returned , otherwise the
algorithm tries to build any suitable face on the given
wire and prints a warning message .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-10-15 17:00:48 +04:00
anObj = self . ShapesOp . MakeFaceWires ( ToList ( theWires ) , isPlanarWanted )
2012-08-09 07:58:02 +00:00
if isPlanarWanted and anObj is not None and self . ShapesOp . GetErrorCode ( ) == " MAKE_FACE_TOLERANCE_TOO_BIG " :
print " WARNING: Cannot build a planar face: required tolerance is too big. Non-planar face is built. "
else :
RaiseIfFailed ( " MakeFaceWires " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## See MakeFaceWires() method for details.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_face "Example 1"
# \n @ref swig_MakeFaces "Example 2"
2013-02-12 11:35:16 +00:00
def MakeFaces ( self , theWires , isPlanarWanted , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
See geompy . MakeFaceWires ( ) method for details .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeFaceWires()
anObj = self . MakeFaceWires ( theWires , isPlanarWanted , theName )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-16 18:31:50 +04:00
## Create a face based on a surface from given face bounded
# by given wire.
# @param theFace the face whose surface is used to create a new face.
# @param theWire the wire that will bound a new face.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
@ManageTransactions ( " ShapesOp " )
def MakeFaceFromSurface ( self , theFace , theWire , theName = None ) :
"""
Create a face based on a surface from given face bounded
by given wire .
Parameters :
theFace the face whose surface is used to create a new face .
theWire the wire that will bound a new face .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
# Example: see GEOM_TestAll.py
anObj = self . ShapesOp . MakeFaceFromSurface ( theFace , theWire )
RaiseIfFailed ( " MakeFaceFromSurface " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " face " )
return anObj
2014-12-08 18:14:18 +03:00
## Create a face from a set of edges with the given constraints.
# @param theConstraints List of edges and constraint faces (as a sequence of a Edge + Face couples):
# - edges should form a closed wire;
# - for each edge, constraint face is optional: if a constraint face is missing
# for some edge, this means that there no constraint associated with this edge.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_face "Example"
@ManageTransactions ( " ShapesOp " )
def MakeFaceWithConstraints ( self , theConstraints , theName = None ) :
"""
Create a face from a set of edges with the given constraints .
Parameters :
theConstraints List of edges and constraint faces ( as a sequence of a Edge + Face couples ) :
- edges should form a closed wire ;
- for each edge , constraint face is optional : if a constraint face is missing
for some edge , this means that there no constraint associated with this edge .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
# Example: see GEOM_TestAll.py
anObj = self . ShapesOp . MakeFaceWithConstraints ( theConstraints )
if anObj is None :
RaiseIfFailed ( " MakeFaceWithConstraints " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " face " )
return anObj
2014-10-16 18:31:50 +04:00
2008-03-07 07:45:34 +00:00
## Create a shell from the set of faces and shells.
# @param theFacesAndShells List of faces and/or shells.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created shell.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_shell "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeShell ( self , theFacesAndShells , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a shell from the set of faces and shells .
Parameters :
theFacesAndShells List of faces and / or shells .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created shell .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-10-09 18:34:57 +04:00
anObj = self . ShapesOp . MakeShell ( ToList ( theFacesAndShells ) )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeShell " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " shell " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a solid, bounded by the given shells.
# @param theShells Sequence of bounding shells.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created solid.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_solid "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeSolid ( self , theShells , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a solid , bounded by the given shells .
Parameters :
theShells Sequence of bounding shells .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created solid .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-10-15 17:00:48 +04:00
theShells = ToList ( theShells )
2012-08-09 07:58:02 +00:00
if len ( theShells ) == 1 :
2014-06-25 18:28:02 +04:00
descr = self . _IsGoodForSolid ( theShells [ 0 ] )
2012-08-09 07:58:02 +00:00
#if len(descr) > 0:
# raise RuntimeError, "MakeSolidShells : " + descr
if descr == " WRN_SHAPE_UNCLOSED " :
raise RuntimeError , " MakeSolidShells : Unable to create solid from unclosed shape "
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . MakeSolidShells ( theShells )
RaiseIfFailed ( " MakeSolidShells " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " solid " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a compound of the given shapes.
# @param theShapes List of shapes to put in compound.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created compound.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_creation_compound "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def MakeCompound ( self , theShapes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a compound of the given shapes .
Parameters :
theShapes List of shapes to put in compound .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created compound .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-10-15 17:00:48 +04:00
anObj = self . ShapesOp . MakeCompound ( ToList ( theShapes ) )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeCompound " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " compound " )
2008-03-07 07:45:34 +00:00
return anObj
2014-11-13 18:53:32 +03:00
## Create a solid (or solids) from the set of faces and/or shells.
# @param theFacesOrShells List of faces and/or shells.
# @param isIntersect If TRUE, forces performing intersections
# between arguments; otherwise (default) intersection is not performed.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
#
# @ref tui_creation_solid_from_faces "Example"
@ManageTransactions ( " ShapesOp " )
def MakeSolidFromConnectedFaces ( self , theFacesOrShells , isIntersect = False , theName = None ) :
"""
Create a solid ( or solids ) from the set of connected faces and / or shells .
Parameters :
theFacesOrShells List of faces and / or shells .
isIntersect If TRUE , forces performing intersections
between arguments ; otherwise ( default ) intersection is not performed
theName Object name ; when specified , this parameter is used .
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created solid ( or compound of solids ) .
"""
# Example: see GEOM_TestAll.py
anObj = self . ShapesOp . MakeSolidFromConnectedFaces ( theFacesOrShells , isIntersect )
RaiseIfFailed ( " MakeSolidFromConnectedFaces " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " solid " )
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_advanced
## @}
## @addtogroup l2_measure
## @{
2008-03-07 07:45:34 +00:00
## Gives quantity of faces in the given shape.
# @param theShape Shape to count faces of.
# @return Quantity of faces.
#
2012-08-09 07:58:02 +00:00
# @ref swig_NumberOf "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def NumberOfFaces ( self , theShape ) :
"""
Gives quantity of faces in the given shape .
Parameters :
theShape Shape to count faces of .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Quantity of faces .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
nb_faces = self . ShapesOp . NumberOfFaces ( theShape )
RaiseIfFailed ( " NumberOfFaces " , self . ShapesOp )
return nb_faces
## Gives quantity of edges in the given shape.
# @param theShape Shape to count edges of.
# @return Quantity of edges.
#
2012-08-09 07:58:02 +00:00
# @ref swig_NumberOf "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def NumberOfEdges ( self , theShape ) :
"""
Gives quantity of edges in the given shape .
Parameters :
theShape Shape to count edges of .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Quantity of edges .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
nb_edges = self . ShapesOp . NumberOfEdges ( theShape )
RaiseIfFailed ( " NumberOfEdges " , self . ShapesOp )
return nb_edges
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Gives quantity of sub-shapes of type theShapeType in the given shape.
# @param theShape Shape to count sub-shapes of.
# @param theShapeType Type of sub-shapes to count (see ShapeType())
# @return Quantity of sub-shapes of given type.
#
# @ref swig_NumberOf "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def NumberOfSubShapes ( self , theShape , theShapeType ) :
"""
Gives quantity of sub - shapes of type theShapeType in the given shape .
Parameters :
theShape Shape to count sub - shapes of .
theShapeType Type of sub - shapes to count ( see geompy . ShapeType )
Returns :
Quantity of sub - shapes of given type .
"""
# Example: see GEOM_TestOthers.py
nb_ss = self . ShapesOp . NumberOfSubShapes ( theShape , theShapeType )
RaiseIfFailed ( " NumberOfSubShapes " , self . ShapesOp )
return nb_ss
## Gives quantity of solids in the given shape.
# @param theShape Shape to count solids in.
# @return Quantity of solids.
#
# @ref swig_NumberOf "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def NumberOfSolids ( self , theShape ) :
"""
Gives quantity of solids in the given shape .
Parameters :
theShape Shape to count solids in .
Returns :
Quantity of solids .
"""
# Example: see GEOM_TestOthers.py
2013-04-04 07:06:43 +00:00
nb_solids = self . ShapesOp . NumberOfSubShapes ( theShape , self . ShapeType [ " SOLID " ] )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " NumberOfSolids " , self . ShapesOp )
return nb_solids
2009-02-13 12:16:39 +00:00
# end of l2_measure
## @}
## @addtogroup l3_healing
## @{
2008-03-07 07:45:34 +00:00
## Reverses an orientation the given shape.
# @param theShape Shape to be reversed.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return The reversed copy of theShape.
#
2009-02-13 12:16:39 +00:00
# @ref swig_ChangeOrientation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def ChangeOrientation ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Reverses an orientation the given shape .
Parameters :
theShape Shape to be reversed .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
The reversed copy of theShape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . ChangeOrientation ( theShape )
RaiseIfFailed ( " ChangeOrientation " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " reversed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## See ChangeOrientation() method for details.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_OrientationChange "Example"
2013-02-12 11:35:16 +00:00
def OrientationChange ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
See geompy . ChangeOrientation method for details .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.ChangeOrientation()
anObj = self . ChangeOrientation ( theShape , theName )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_healing
## @}
## @addtogroup l4_obtain
## @{
2008-03-07 07:45:34 +00:00
## Retrieve all free faces from the given shape.
# Free face is a face, which is not shared between two shells of the shape.
# @param theShape Shape to find free faces in.
# @return List of IDs of all free faces, contained in theShape.
#
2014-12-16 19:27:28 +03:00
# @ref tui_free_faces_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2008-03-07 07:45:34 +00:00
def GetFreeFacesIDs ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Retrieve all free faces from the given shape .
Free face is a face , which is not shared between two shells of the shape .
Parameters :
theShape Shape to find free faces in .
Returns :
List of IDs of all free faces , contained in theShape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anIDs = self . ShapesOp . GetFreeFacesIDs ( theShape )
RaiseIfFailed ( " GetFreeFacesIDs " , self . ShapesOp )
return anIDs
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get all sub-shapes of theShape1 of the given type, shared with theShape2.
# @param theShape1 Shape to find sub-shapes in.
# @param theShape2 Shape to find shared sub-shapes with.
# @param theShapeType Type of sub-shapes to be retrieved.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of sub-shapes of theShape1, shared with theShape2.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetSharedShapes "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetSharedShapes ( self , theShape1 , theShape2 , theShapeType , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get all sub - shapes of theShape1 of the given type , shared with theShape2 .
Parameters :
theShape1 Shape to find sub - shapes in .
theShape2 Shape to find shared sub - shapes with .
theShapeType Type of sub - shapes to be retrieved .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of sub - shapes of theShape1 , shared with theShape2 .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetSharedShapes ( theShape1 , theShape2 , theShapeType )
RaiseIfFailed ( " GetSharedShapes " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shared " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2014-12-26 11:52:00 +03:00
## Get sub-shapes, shared by input shapes.
2014-10-15 19:26:27 +04:00
# @param theShapes Either a list or compound of shapes to find common sub-shapes of.
2014-12-26 11:52:00 +03:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()).
# @param theMultiShare Specifies what type of shares should be checked:
# - @c True (default): search sub-shapes from 1st input shape shared with all other input shapes;
# - @c False: causes to search sub-shapes shared between couples of input shapes.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-12-26 11:52:00 +03:00
# @note If @a theShapes contains single compound, the shares between all possible couples of
# its top-level shapes are returned; otherwise, only shares between 1st input shape
# and all rest input shapes are returned.
2012-08-09 07:58:02 +00:00
#
2014-12-26 11:52:00 +03:00
# @return List of all found sub-shapes.
#
# Examples:
# - @ref tui_shared_shapes "Example 1"
# - @ref swig_GetSharedShapes "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-12-26 11:52:00 +03:00
def GetSharedShapesMulti ( self , theShapes , theShapeType , theMultiShare = True , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-12-26 11:52:00 +03:00
Get sub - shapes , shared by input shapes .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-15 19:26:27 +04:00
theShapes Either a list or compound of shapes to find common sub - shapes of .
2014-12-26 11:52:00 +03:00
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType ) .
theMultiShare Specifies what type of shares should be checked :
- True ( default ) : search sub - shapes from 1 st input shape shared with all other input shapes ;
- False : causes to search sub - shapes shared between couples of input shapes .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-12-26 11:52:00 +03:00
Note : if theShapes contains single compound , the shares between all possible couples of
its top - level shapes are returned ; otherwise , only shares between 1 st input shape
and all rest input shapes are returned .
2014-06-25 18:28:02 +04:00
Returns :
2014-12-26 11:52:00 +03:00
List of all found sub - shapes .
2012-08-09 07:58:02 +00:00
"""
# Example: see GEOM_TestOthers.py
2014-12-26 11:52:00 +03:00
aList = self . ShapesOp . GetSharedShapesMulti ( ToList ( theShapes ) , theShapeType , theMultiShare )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " GetSharedShapesMulti " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shared " )
2012-08-09 07:58:02 +00:00
return aList
2009-02-13 12:16:39 +00:00
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
2008-03-07 07:45:34 +00:00
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction and location of the plane to find shapes on.
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnPlane "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnPlane ( self , theShape , theShapeType , theAx1 , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified plane by the certain way ,
defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAx1 Vector ( or line , or linear edge ) , specifying normal
direction and location of the plane to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnPlane ( theShape , theShapeType , theAx1 , theState )
RaiseIfFailed ( " GetShapesOnPlane " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnPlane " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction and location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnPlaneIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnPlaneIDs ( self , theShape , theShapeType , theAx1 , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified plane by the certain way ,
defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAx1 Vector ( or line , or linear edge ) , specifying normal
direction and location of the plane to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnPlaneIDs ( theShape , theShapeType , theAx1 , theState )
RaiseIfFailed ( " GetShapesOnPlaneIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
2008-03-07 07:45:34 +00:00
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction of the plane to find shapes on.
# @param thePnt Point specifying location of the plane to find shapes on.
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnPlaneWithLocation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnPlaneWithLocation ( self , theShape , theShapeType , theAx1 , thePnt , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified plane by the certain way ,
defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAx1 Vector ( or line , or linear edge ) , specifying normal
direction and location of the plane to find shapes on .
thePnt Point specifying location of the plane to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnPlaneWithLocation ( theShape , theShapeType ,
theAx1 , thePnt , theState )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetShapesOnPlaneWithLocation " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnPlane " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in <VAR>theShape</VAR> all sub-shapes of type <VAR>theShapeType</VAR>,
# situated relatively the specified plane by the certain way,
# defined through <VAR>theState</VAR> parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theAx1 Vector (or line, or linear edge), specifying normal
# direction of the plane to find shapes on.
# @param thePnt Point specifying location of the plane to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnPlaneWithLocationIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnPlaneWithLocationIDs ( self , theShape , theShapeType , theAx1 , thePnt , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified plane by the certain way ,
defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAx1 Vector ( or line , or linear edge ) , specifying normal
direction and location of the plane to find shapes on .
thePnt Point specifying location of the plane to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnPlaneWithLocationIDs ( theShape , theShapeType ,
theAx1 , thePnt , theState )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetShapesOnPlaneWithLocationIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified cylinder by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theAxis Vector (or line, or linear edge), specifying
# axis of the cylinder to find shapes on.
# @param theRadius Radius of the cylinder to find shapes on.
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnCylinder "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnCylinder ( self , theShape , theShapeType , theAxis , theRadius , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified cylinder by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAxis Vector ( or line , or linear edge ) , specifying
axis of the cylinder to find shapes on .
theRadius Radius of the cylinder to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnCylinder ( theShape , theShapeType , theAxis , theRadius , theState )
RaiseIfFailed ( " GetShapesOnCylinder " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnCylinder " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified cylinder by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theAxis Vector (or line, or linear edge), specifying
# axis of the cylinder to find shapes on.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnCylinderIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnCylinderIDs ( self , theShape , theShapeType , theAxis , theRadius , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified cylinder by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAxis Vector ( or line , or linear edge ) , specifying
axis of the cylinder to find shapes on .
theRadius Radius of the cylinder to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnCylinderIDs ( theShape , theShapeType , theAxis , theRadius , theState )
RaiseIfFailed ( " GetShapesOnCylinderIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified cylinder by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theAxis Vector (or line, or linear edge), specifying
# axis of the cylinder to find shapes on.
# @param thePnt Point specifying location of the bottom of the cylinder.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnCylinderWithLocation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnCylinderWithLocation ( self , theShape , theShapeType , theAxis , thePnt , theRadius , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified cylinder by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAxis Vector ( or line , or linear edge ) , specifying
axis of the cylinder to find shapes on .
theRadius Radius of the cylinder to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnCylinderWithLocation ( theShape , theShapeType , theAxis , thePnt , theRadius , theState )
RaiseIfFailed ( " GetShapesOnCylinderWithLocation " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnCylinder " )
2012-08-09 07:58:02 +00:00
return aList
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified cylinder by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theAxis Vector (or line, or linear edge), specifying
# axis of the cylinder to find shapes on.
# @param thePnt Point specifying location of the bottom of the cylinder.
# @param theRadius Radius of the cylinder to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices
#
# @ref swig_GetShapesOnCylinderWithLocationIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def GetShapesOnCylinderWithLocationIDs ( self , theShape , theShapeType , theAxis , thePnt , theRadius , theState ) :
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified cylinder by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theAxis Vector ( or line , or linear edge ) , specifying
axis of the cylinder to find shapes on .
theRadius Radius of the cylinder to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
2014-06-25 18:28:02 +04:00
List of all found sub - shapes indices .
2012-08-09 07:58:02 +00:00
"""
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnCylinderWithLocationIDs ( theShape , theShapeType , theAxis , thePnt , theRadius , theState )
RaiseIfFailed ( " GetShapesOnCylinderWithLocationIDs " , self . ShapesOp )
return aList
2008-03-07 07:45:34 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified sphere by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theCenter Point, specifying center of the sphere to find shapes on.
# @param theRadius Radius of the sphere to find shapes on.
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnSphere "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnSphere ( self , theShape , theShapeType , theCenter , theRadius , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified sphere by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theCenter Point , specifying center of the sphere to find shapes on .
theRadius Radius of the sphere to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnSphere ( theShape , theShapeType , theCenter , theRadius , theState )
RaiseIfFailed ( " GetShapesOnSphere " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnSphere " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified sphere by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theCenter Point, specifying center of the sphere to find shapes on.
# @param theRadius Radius of the sphere to find shapes on.
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnSphereIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnSphereIDs ( self , theShape , theShapeType , theCenter , theRadius , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified sphere by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theCenter Point , specifying center of the sphere to find shapes on .
theRadius Radius of the sphere to find shapes on .
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnSphereIDs ( theShape , theShapeType , theCenter , theRadius , theState )
RaiseIfFailed ( " GetShapesOnSphereIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified quadrangle by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theTopLeftPoint Point, specifying top left corner of a quadrangle
# @param theTopRigthPoint Point, specifying top right corner of a quadrangle
# @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
# @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnQuadrangle "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnQuadrangle ( self , theShape , theShapeType ,
theTopLeftPoint , theTopRigthPoint ,
2013-02-12 11:35:16 +00:00
theBottomLeftPoint , theBottomRigthPoint , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified quadrangle by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theTopLeftPoint Point , specifying top left corner of a quadrangle
theTopRigthPoint Point , specifying top right corner of a quadrangle
theBottomLeftPoint Point , specifying bottom left corner of a quadrangle
theBottomRigthPoint Point , specifying bottom right corner of a quadrangle
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnQuadrangle ( theShape , theShapeType ,
theTopLeftPoint , theTopRigthPoint ,
theBottomLeftPoint , theBottomRigthPoint , theState )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetShapesOnQuadrangle " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnQuadrangle " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified quadrangle by the certain way, defined through \a theState parameter.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theTopLeftPoint Point, specifying top left corner of a quadrangle
# @param theTopRigthPoint Point, specifying top right corner of a quadrangle
# @param theBottomLeftPoint Point, specifying bottom left corner of a quadrangle
# @param theBottomRigthPoint Point, specifying bottom right corner of a quadrangle
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnQuadrangleIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnQuadrangleIDs ( self , theShape , theShapeType ,
theTopLeftPoint , theTopRigthPoint ,
theBottomLeftPoint , theBottomRigthPoint , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified quadrangle by the certain way , defined through theState parameter .
Parameters :
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theTopLeftPoint Point , specifying top left corner of a quadrangle
theTopRigthPoint Point , specifying top right corner of a quadrangle
theBottomLeftPoint Point , specifying bottom left corner of a quadrangle
theBottomRigthPoint Point , specifying bottom right corner of a quadrangle
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnQuadrangleIDs ( theShape , theShapeType ,
theTopLeftPoint , theTopRigthPoint ,
theBottomLeftPoint , theBottomRigthPoint , theState )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetShapesOnQuadrangleIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified \a theBox by the certain way, defined through \a theState parameter.
# @param theBox Shape for relative comparing.
# @param theShape Shape to find sub-shapes of.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of all found sub-shapes.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnBox "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnBox ( self , theBox , theShape , theShapeType , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified theBox by the certain way , defined through theState parameter .
Parameters :
theBox Shape for relative comparing .
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnBox ( theBox , theShape , theShapeType , theState )
RaiseIfFailed ( " GetShapesOnBox " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnBox " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType, situated relatively
# the specified \a theBox by the certain way, defined through \a theState parameter.
# @param theBox Shape for relative comparing.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetShapesOnBoxIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnBoxIDs ( self , theBox , theShape , theShapeType , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType , situated relatively
the specified theBox by the certain way , defined through theState parameter .
Parameters :
theBox Shape for relative comparing .
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aList = self . ShapesOp . GetShapesOnBoxIDs ( theBox , theShape , theShapeType , theState )
RaiseIfFailed ( " GetShapesOnBoxIDs " , self . ShapesOp )
return aList
2009-02-13 12:16:39 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType,
# situated relatively the specified \a theCheckShape by the
# certain way, defined through \a theState parameter.
2012-08-09 07:58:02 +00:00
# @param theCheckShape Shape for relative comparing. It must be a solid.
2009-02-13 12:16:39 +00:00
# @param theShape Shape to find sub-shapes of.
2014-06-25 18:28:02 +04:00
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
2012-08-09 07:58:02 +00:00
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2009-02-13 12:16:39 +00:00
# @return List of all found sub-shapes.
#
# @ref swig_GetShapesOnShape "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnShape ( self , theCheckShape , theShape , theShapeType , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified theCheckShape by the
certain way , defined through theState parameter .
Parameters :
theCheckShape Shape for relative comparing . It must be a solid .
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of all found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnShape ( theCheckShape , theShape ,
theShapeType , theState )
RaiseIfFailed ( " GetShapesOnShape " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " shapeOnShape " )
2009-02-13 12:16:39 +00:00
return aList
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType,
# situated relatively the specified \a theCheckShape by the
# certain way, defined through \a theState parameter.
# @param theCheckShape Shape for relative comparing. It must be a solid.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return All found sub-shapes as compound.
2009-02-13 12:16:39 +00:00
#
# @ref swig_GetShapesOnShapeAsCompound "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetShapesOnShapeAsCompound ( self , theCheckShape , theShape , theShapeType , theState , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified theCheckShape by the
certain way , defined through theState parameter .
Parameters :
theCheckShape Shape for relative comparing . It must be a solid .
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
All found sub - shapes as compound .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
anObj = self . ShapesOp . GetShapesOnShapeAsCompound ( theCheckShape , theShape ,
theShapeType , theState )
RaiseIfFailed ( " GetShapesOnShapeAsCompound " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " shapeOnShape " )
2009-02-13 12:16:39 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Find in \a theShape all sub-shapes of type \a theShapeType,
# situated relatively the specified \a theCheckShape by the
# certain way, defined through \a theState parameter.
# @param theCheckShape Shape for relative comparing. It must be a solid.
# @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state)
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @return List of all found sub-shapes indices.
2009-02-13 12:16:39 +00:00
#
# @ref swig_GetShapesOnShapeIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def GetShapesOnShapeIDs ( self , theCheckShape , theShape , theShapeType , theState ) :
2012-08-09 07:58:02 +00:00
"""
Find in theShape all sub - shapes of type theShapeType ,
situated relatively the specified theCheckShape by the
certain way , defined through theState parameter .
Parameters :
theCheckShape Shape for relative comparing . It must be a solid .
theShape Shape to find sub - shapes of .
theShapeType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
theState The state of the sub - shapes to find ( see GEOM : : shape_state )
Returns :
List of all found sub - shapes indices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
aList = self . ShapesOp . GetShapesOnShapeIDs ( theCheckShape , theShape ,
theShapeType , theState )
RaiseIfFailed ( " GetShapesOnShapeIDs " , self . ShapesOp )
return aList
2008-03-07 07:45:34 +00:00
## Get sub-shape(s) of theShapeWhere, which are
# coincident with \a theShapeWhat or could be a part of it.
# @param theShapeWhere Shape to find sub-shapes of.
# @param theShapeWhat Shape, specifying what to find.
2012-08-09 07:58:02 +00:00
# @param isNewImplementation implementation of GetInPlace functionality
# (default = False, old alghorithm based on shape properties)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return Group of all found sub-shapes or a single found sub-shape.
#
2012-08-09 07:58:02 +00:00
# @note This function has a restriction on argument shapes.
# If \a theShapeWhere has curved parts with significantly
# outstanding centres (i.e. the mass centre of a part is closer to
# \a theShapeWhat than to the part), such parts will not be found.
# @image html get_in_place_lost_part.png
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetInPlace "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetInPlace ( self , theShapeWhere , theShapeWhat , isNewImplementation = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get sub - shape ( s ) of theShapeWhere , which are
coincident with theShapeWhat or could be a part of it .
Parameters :
theShapeWhere Shape to find sub - shapes of .
theShapeWhat Shape , specifying what to find .
isNewImplementation Implementation of GetInPlace functionality
( default = False , old alghorithm based on shape properties )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
Group of all found sub - shapes or a single found sub - shape .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Note :
This function has a restriction on argument shapes .
If theShapeWhere has curved parts with significantly
outstanding centres ( i . e . the mass centre of a part is closer to
theShapeWhat than to the part ) , such parts will not be found .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2012-08-09 07:58:02 +00:00
anObj = None
if isNewImplementation :
anObj = self . ShapesOp . GetInPlace ( theShapeWhere , theShapeWhat )
else :
anObj = self . ShapesOp . GetInPlaceOld ( theShapeWhere , theShapeWhat )
pass
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetInPlace " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " inplace " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get sub-shape(s) of \a theShapeWhere, which are
# coincident with \a theShapeWhat or could be a part of it.
#
# Implementation of this method is based on a saved history of an operation,
# produced \a theShapeWhere. The \a theShapeWhat must be among this operation's
# arguments (an argument shape or a sub-shape of an argument shape).
# The operation could be the Partition or one of boolean operations,
# performed on simple shapes (not on compounds).
#
# @param theShapeWhere Shape to find sub-shapes of.
# @param theShapeWhat Shape, specifying what to find (must be in the
# building history of the ShapeWhere).
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return Group of all found sub-shapes or a single found sub-shape.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetInPlace "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetInPlaceByHistory ( self , theShapeWhere , theShapeWhat , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Implementation of this method is based on a saved history of an operation ,
produced theShapeWhere . The theShapeWhat must be among this operation ' s
arguments ( an argument shape or a sub - shape of an argument shape ) .
The operation could be the Partition or one of boolean operations ,
performed on simple shapes ( not on compounds ) .
Parameters :
theShapeWhere Shape to find sub - shapes of .
theShapeWhat Shape , specifying what to find ( must be in the
building history of the ShapeWhere ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
Group of all found sub - shapes or a single found sub - shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . GetInPlaceByHistory ( theShapeWhere , theShapeWhat )
RaiseIfFailed ( " GetInPlaceByHistory " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " inplace " )
2008-03-07 07:45:34 +00:00
return anObj
## Get sub-shape of theShapeWhere, which is
# equal to \a theShapeWhat.
# @param theShapeWhere Shape to find sub-shape of.
# @param theShapeWhat Shape, specifying what to find.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object for found sub-shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetSame "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetSame ( self , theShapeWhere , theShapeWhat , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get sub - shape of theShapeWhere , which is
equal to theShapeWhat .
Parameters :
theShapeWhere Shape to find sub - shape of .
theShapeWhat Shape , specifying what to find .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object for found sub - shape .
"""
2008-03-07 07:45:34 +00:00
anObj = self . ShapesOp . GetSame ( theShapeWhere , theShapeWhat )
RaiseIfFailed ( " GetSame " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " sameShape " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Get sub-shape indices of theShapeWhere, which is
# equal to \a theShapeWhat.
# @param theShapeWhere Shape to find sub-shape of.
# @param theShapeWhat Shape, specifying what to find.
2014-06-25 18:28:02 +04:00
# @return List of all found sub-shapes indices.
2012-08-09 07:58:02 +00:00
#
# @ref swig_GetSame "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetSameIDs ( self , theShapeWhere , theShapeWhat ) :
2012-08-09 07:58:02 +00:00
"""
Get sub - shape indices of theShapeWhere , which is
equal to theShapeWhat .
Parameters :
theShapeWhere Shape to find sub - shape of .
theShapeWhat Shape , specifying what to find .
Returns :
List of all found sub - shapes indices .
"""
anObj = self . ShapesOp . GetSameIDs ( theShapeWhere , theShapeWhat )
RaiseIfFailed ( " GetSameIDs " , self . ShapesOp )
return anObj
2014-10-22 14:33:19 +04:00
## Resize the input edge with the new Min and Max parameters.
# The input edge parameters range is [0, 1]. If theMin parameter is
# negative, the input edge is extended, otherwise it is shrinked by
# theMin parameter. If theMax is greater than 1, the edge is extended,
# otherwise it is shrinked by theMax parameter.
# @param theEdge the input edge to be resized.
# @param theMin the minimal parameter value.
# @param theMax the maximal parameter value.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return New GEOM.GEOM_Object, containing the created edge.
#
# @ref tui_extend "Example"
@ManageTransactions ( " ShapesOp " )
def ExtendEdge ( self , theEdge , theMin , theMax , theName = None ) :
"""
Resize the input edge with the new Min and Max parameters .
The input edge parameters range is [ 0 , 1 ] . If theMin parameter is
negative , the input edge is extended , otherwise it is shrinked by
theMin parameter . If theMax is greater than 1 , the edge is extended ,
otherwise it is shrinked by theMax parameter .
Parameters :
theEdge the input edge to be resized .
theMin the minimal parameter value .
theMax the maximal parameter value .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created edge .
"""
anObj = self . ShapesOp . ExtendEdge ( theEdge , theMin , theMax )
RaiseIfFailed ( " ExtendEdge " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " edge " )
return anObj
## Resize the input face with the new UMin, UMax, VMin and VMax
# parameters. The input face U and V parameters range is [0, 1]. If
# theUMin parameter is negative, the input face is extended, otherwise
# it is shrinked along U direction by theUMin parameter. If theUMax is
# greater than 1, the face is extended, otherwise it is shrinked along
# U direction by theUMax parameter. So as for theVMin, theVMax and
# V direction of the input face.
# @param theFace the input face to be resized.
# @param theUMin the minimal U parameter value.
# @param theUMax the maximal U parameter value.
# @param theVMin the minimal V parameter value.
# @param theVMax the maximal V parameter value.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_extend "Example"
@ManageTransactions ( " ShapesOp " )
def ExtendFace ( self , theFace , theUMin , theUMax ,
theVMin , theVMax , theName = None ) :
"""
Resize the input face with the new UMin , UMax , VMin and VMax
parameters . The input face U and V parameters range is [ 0 , 1 ] . If
theUMin parameter is negative , the input face is extended , otherwise
it is shrinked along U direction by theUMin parameter . If theUMax is
greater than 1 , the face is extended , otherwise it is shrinked along
U direction by theUMax parameter . So as for theVMin , theVMax and
V direction of the input face .
Parameters :
theFace the input face to be resized .
theUMin the minimal U parameter value .
theUMax the maximal U parameter value .
theVMin the minimal V parameter value .
theVMax the maximal V parameter value .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
anObj = self . ShapesOp . ExtendFace ( theFace , theUMin , theUMax ,
theVMin , theVMax )
RaiseIfFailed ( " ExtendFace " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " face " )
return anObj
2012-08-09 07:58:02 +00:00
2014-10-28 13:19:15 +03:00
## This function takes some face as input parameter and creates new
# GEOM_Object, i.e. topological shape by extracting underlying surface
# of the source face and limiting it by the Umin, Umax, Vmin, Vmax
# parameters of the source face (in the parametrical space).
# @param theFace the input face.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return New GEOM.GEOM_Object, containing the created face.
#
# @ref tui_creation_surface "Example"
@ManageTransactions ( " ShapesOp " )
def MakeSurfaceFromFace ( self , theFace , theName = None ) :
"""
This function takes some face as input parameter and creates new
GEOM_Object , i . e . topological shape by extracting underlying surface
of the source face and limiting it by the Umin , Umax , Vmin , Vmax
parameters of the source face ( in the parametrical space ) .
Parameters :
theFace the input face .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created face .
"""
anObj = self . ShapesOp . MakeSurfaceFromFace ( theFace )
RaiseIfFailed ( " MakeSurfaceFromFace " , self . ShapesOp )
self . _autoPublish ( anObj , theName , " surface " )
return anObj
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
# end of l4_obtain
## @}
## @addtogroup l4_access
## @{
## Obtain a composite sub-shape of <VAR>aShape</VAR>, composed from sub-shapes
# of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
2012-08-09 07:58:02 +00:00
# @param aShape Shape to get sub-shape of.
# @param ListOfID List of sub-shapes indices.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return Found sub-shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_all_decompose "Example"
2013-02-12 11:35:16 +00:00
def GetSubShape ( self , aShape , ListOfID , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Obtain a composite sub - shape of aShape , composed from sub - shapes
of aShape , selected by their unique IDs inside aShape
Parameters :
2013-02-12 11:35:16 +00:00
aShape Shape to get sub - shape of .
ListOfID List of sub - shapes indices .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
Found sub - shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . AddSubShape ( aShape , ListOfID )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " subshape " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Obtain unique ID of sub-shape <VAR>aSubShape</VAR> inside <VAR>aShape</VAR>
2012-08-09 07:58:02 +00:00
# of aShape, selected by their unique IDs inside <VAR>aShape</VAR>
# @param aShape Shape to get sub-shape of.
# @param aSubShape Sub-shapes of aShape.
# @return ID of found sub-shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2009-02-13 12:16:39 +00:00
def GetSubShapeID ( self , aShape , aSubShape ) :
2012-08-09 07:58:02 +00:00
"""
Obtain unique ID of sub - shape aSubShape inside aShape
of aShape , selected by their unique IDs inside aShape
Parameters :
aShape Shape to get sub - shape of .
aSubShape Sub - shapes of aShape .
Returns :
ID of found sub - shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anID = self . LocalOp . GetSubShapeIndex ( aShape , aSubShape )
RaiseIfFailed ( " GetSubShapeIndex " , self . LocalOp )
return anID
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
## Obtain unique IDs of sub-shapes <VAR>aSubShapes</VAR> inside <VAR>aShape</VAR>
# This function is provided for performance purpose. The complexity is O(n) with n
# the number of subobjects of aShape
# @param aShape Shape to get sub-shape of.
# @param aSubShapes Sub-shapes of aShape.
# @return list of IDs of found sub-shapes.
#
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def GetSubShapesIDs ( self , aShape , aSubShapes ) :
"""
Obtain a list of IDs of sub - shapes aSubShapes inside aShape
This function is provided for performance purpose . The complexity is O ( n ) with n
the number of subobjects of aShape
Parameters :
aShape Shape to get sub - shape of .
aSubShapes Sub - shapes of aShape .
Returns :
List of IDs of found sub - shape .
"""
# Example: see GEOM_TestAll.py
anIDs = self . ShapesOp . GetSubShapesIndices ( aShape , aSubShapes )
RaiseIfFailed ( " GetSubShapesIndices " , self . ShapesOp )
return anIDs
2009-02-13 12:16:39 +00:00
# end of l4_access
## @}
## @addtogroup l4_decompose
## @{
2012-08-09 07:58:02 +00:00
## Get all sub-shapes and groups of \a theShape,
# that were created already by any other methods.
# @param theShape Any shape.
# @param theGroupsOnly If this parameter is TRUE, only groups will be
# returned, else all found sub-shapes and groups.
# @return List of existing sub-objects of \a theShape.
#
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def GetExistingSubObjects ( self , theShape , theGroupsOnly = False ) :
"""
Get all sub - shapes and groups of theShape ,
that were created already by any other methods .
Parameters :
theShape Any shape .
theGroupsOnly If this parameter is TRUE , only groups will be
returned , else all found sub - shapes and groups .
Returns :
List of existing sub - objects of theShape .
"""
# Example: see GEOM_TestAll.py
ListObj = self . ShapesOp . GetExistingSubObjects ( theShape , theGroupsOnly )
RaiseIfFailed ( " GetExistingSubObjects " , self . ShapesOp )
return ListObj
## Get all groups of \a theShape,
# that were created already by any other methods.
# @param theShape Any shape.
# @return List of existing groups of \a theShape.
#
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def GetGroups ( self , theShape ) :
"""
Get all groups of theShape ,
that were created already by any other methods .
Parameters :
theShape Any shape .
Returns :
List of existing groups of theShape .
"""
# Example: see GEOM_TestAll.py
ListObj = self . ShapesOp . GetExistingSubObjects ( theShape , True )
RaiseIfFailed ( " GetExistingSubObjects " , self . ShapesOp )
return ListObj
## Explode a shape on sub-shapes of a given type.
# If the shape itself matches the type, it is also returned.
2009-02-13 12:16:39 +00:00
# @param aShape Shape to be exploded.
2014-06-25 18:28:02 +04:00
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
2009-02-13 12:16:39 +00:00
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def SubShapeAll ( self , aShape , aType , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Explode a shape on sub - shapes of a given type .
If the shape itself matches the type , it is also returned .
Parameters :
aShape Shape to be exploded .
2014-06-25 18:28:02 +04:00
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of sub - shapes of type theShapeType , contained in theShape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-10-08 11:16:36 +00:00
ListObj = self . ShapesOp . MakeAllSubShapes ( aShape , EnumToLong ( aType ) , False )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " SubShapeAll " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( ListObj , theName , " subshape " )
2008-03-07 07:45:34 +00:00
return ListObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Explode a shape on sub-shapes of a given type.
2009-02-13 12:16:39 +00:00
# @param aShape Shape to be exploded.
2012-08-09 07:58:02 +00:00
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @return List of IDs of sub-shapes.
2009-02-13 12:16:39 +00:00
#
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2009-02-13 12:16:39 +00:00
def SubShapeAllIDs ( self , aShape , aType ) :
2012-08-09 07:58:02 +00:00
"""
Explode a shape on sub - shapes of a given type .
Parameters :
2013-04-04 07:06:43 +00:00
aShape Shape to be exploded ( see geompy . ShapeType )
2012-08-09 07:58:02 +00:00
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
Returns :
List of IDs of sub - shapes .
"""
2012-10-08 11:16:36 +00:00
ListObj = self . ShapesOp . GetAllSubShapesIDs ( aShape , EnumToLong ( aType ) , False )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " SubShapeAllIDs " , self . ShapesOp )
return ListObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2013-08-15 13:05:10 +00:00
# selected by their indices in list of all sub-shapes of type <VAR>aType</VAR>.
2012-08-09 07:58:02 +00:00
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
# @param aShape Shape to get sub-shape of.
# @param ListOfInd List of sub-shapes indices.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return A compound of sub-shapes of aShape.
#
# @ref swig_all_decompose "Example"
2013-02-12 11:35:16 +00:00
def SubShape ( self , aShape , aType , ListOfInd , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Obtain a compound of sub - shapes of aShape ,
2013-08-15 13:05:10 +00:00
selected by their indices in list of all sub - shapes of type aType .
2012-08-09 07:58:02 +00:00
Each index is in range [ 1 , Nb_Sub - Shapes_Of_Given_Type ]
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
aShape Shape to get sub - shape of .
ListOfID List of sub - shapes indices .
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
A compound of sub - shapes of aShape .
"""
# Example: see GEOM_TestAll.py
ListOfIDs = [ ]
2012-10-08 11:16:36 +00:00
AllShapeIDsList = self . SubShapeAllIDs ( aShape , EnumToLong ( aType ) )
2012-08-09 07:58:02 +00:00
for ind in ListOfInd :
ListOfIDs . append ( AllShapeIDsList [ ind - 1 ] )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.GetSubShape()
anObj = self . GetSubShape ( aShape , ListOfIDs , theName )
2012-08-09 07:58:02 +00:00
return anObj
## Explode a shape on sub-shapes of a given type.
2014-07-16 19:17:01 +04:00
# Sub-shapes will be sorted taking into account their gravity centers,
# to provide stable order of sub-shapes.
2012-08-09 07:58:02 +00:00
# If the shape itself matches the type, it is also returned.
2009-02-13 12:16:39 +00:00
# @param aShape Shape to be exploded.
2012-08-09 07:58:02 +00:00
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return List of sub-shapes of type theShapeType, contained in theShape.
#
2009-02-13 12:16:39 +00:00
# @ref swig_SubShapeAllSorted "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def SubShapeAllSortedCentres ( self , aShape , aType , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Explode a shape on sub - shapes of a given type .
2014-07-16 19:17:01 +04:00
Sub - shapes will be sorted taking into account their gravity centers ,
to provide stable order of sub - shapes .
2012-08-09 07:58:02 +00:00
If the shape itself matches the type , it is also returned .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
aShape Shape to be exploded .
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
List of sub - shapes of type theShapeType , contained in theShape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-10-08 11:16:36 +00:00
ListObj = self . ShapesOp . MakeAllSubShapes ( aShape , EnumToLong ( aType ) , True )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " SubShapeAllSortedCentres " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( ListObj , theName , " subshape " )
2008-03-07 07:45:34 +00:00
return ListObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Explode a shape on sub-shapes of a given type.
2014-07-16 19:17:01 +04:00
# Sub-shapes will be sorted taking into account their gravity centers,
# to provide stable order of sub-shapes.
2009-02-13 12:16:39 +00:00
# @param aShape Shape to be exploded.
2012-08-09 07:58:02 +00:00
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2008-03-07 07:45:34 +00:00
# @return List of IDs of sub-shapes.
2009-02-13 12:16:39 +00:00
#
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def SubShapeAllSortedCentresIDs ( self , aShape , aType ) :
"""
Explode a shape on sub - shapes of a given type .
2014-07-16 19:17:01 +04:00
Sub - shapes will be sorted taking into account their gravity centers ,
to provide stable order of sub - shapes .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
aShape Shape to be exploded .
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
List of IDs of sub - shapes .
"""
2012-10-08 11:16:36 +00:00
ListIDs = self . ShapesOp . GetAllSubShapesIDs ( aShape , EnumToLong ( aType ) , True )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " SubShapeAllIDs " , self . ShapesOp )
return ListIDs
2009-02-13 12:16:39 +00:00
## Obtain a compound of sub-shapes of <VAR>aShape</VAR>,
2012-08-09 07:58:02 +00:00
# selected by they indices in sorted list of all sub-shapes of type <VAR>aType</VAR>.
2008-03-07 07:45:34 +00:00
# Each index is in range [1, Nb_Sub-Shapes_Of_Given_Type]
2012-08-09 07:58:02 +00:00
# @param aShape Shape to get sub-shape of.
# @param ListOfInd List of sub-shapes indices.
# @param aType Type of sub-shapes to be retrieved (see ShapeType())
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return A compound of sub-shapes of aShape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_all_decompose "Example"
2013-02-12 11:35:16 +00:00
def SubShapeSortedCentres ( self , aShape , aType , ListOfInd , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Obtain a compound of sub - shapes of aShape ,
selected by they indices in sorted list of all sub - shapes of type aType .
Each index is in range [ 1 , Nb_Sub - Shapes_Of_Given_Type ]
Parameters :
aShape Shape to get sub - shape of .
ListOfID List of sub - shapes indices .
aType Type of sub - shapes to be retrieved ( see geompy . ShapeType )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
A compound of sub - shapes of aShape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
ListOfIDs = [ ]
2012-10-08 11:16:36 +00:00
AllShapeIDsList = self . SubShapeAllSortedCentresIDs ( aShape , EnumToLong ( aType ) )
2008-03-07 07:45:34 +00:00
for ind in ListOfInd :
2012-08-09 07:58:02 +00:00
ListOfIDs . append ( AllShapeIDsList [ ind - 1 ] )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.GetSubShape()
anObj = self . GetSubShape ( aShape , ListOfIDs , theName )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Extract shapes (excluding the main shape) of given type.
# @param aShape The shape.
# @param aType The shape type (see ShapeType())
# @param isSorted Boolean flag to switch sorting on/off.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return List of sub-shapes of type aType, contained in aShape.
#
# @ref swig_FilletChamfer "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def ExtractShapes ( self , aShape , aType , isSorted = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Extract shapes ( excluding the main shape ) of given type .
Parameters :
aShape The shape .
aType The shape type ( see geompy . ShapeType )
isSorted Boolean flag to switch sorting on / off .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
List of sub - shapes of type aType , contained in aShape .
"""
# Example: see GEOM_TestAll.py
2012-10-08 11:16:36 +00:00
ListObj = self . ShapesOp . ExtractSubShapes ( aShape , EnumToLong ( aType ) , isSorted )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " ExtractSubShapes " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( ListObj , theName , " subshape " )
2012-08-09 07:58:02 +00:00
return ListObj
## Get a set of sub-shapes defined by their unique IDs inside <VAR>aShape</VAR>
# @param aShape Main shape.
# @param anIDs List of unique IDs of sub-shapes inside <VAR>aShape</VAR>.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
2012-08-09 07:58:02 +00:00
# @return List of GEOM.GEOM_Object, corresponding to found sub-shapes.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_all_decompose "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def SubShapes ( self , aShape , anIDs , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a set of sub - shapes defined by their unique IDs inside theMainShape
Parameters :
aShape Main shape .
anIDs List of unique IDs of sub - shapes inside theMainShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
List of GEOM . GEOM_Object , corresponding to found sub - shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
ListObj = self . ShapesOp . MakeSubShapes ( aShape , anIDs )
RaiseIfFailed ( " SubShapes " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( ListObj , theName , " subshape " )
2012-08-09 07:58:02 +00:00
return ListObj
2015-01-14 16:43:10 +03:00
## Explode a shape into edges sorted in a row from a starting point.
# @param theShape the shape to be exploded on edges.
# @param theStartPoint the starting point.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return List of GEOM.GEOM_Object that is actually an ordered list
# of edges sorted in a row from a starting point.
#
# @ref swig_GetSubShapeEdgeSorted "Example"
@ManageTransactions ( " ShapesOp " )
def GetSubShapeEdgeSorted ( self , theShape , theStartPoint , theName = None ) :
"""
Explode a shape into edges sorted in a row from a starting point .
Parameters :
theShape the shape to be exploded on edges .
theStartPoint the starting point .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
List of GEOM . GEOM_Object that is actually an ordered list
of edges sorted in a row from a starting point .
"""
# Example: see GEOM_TestAll.py
ListObj = self . ShapesOp . GetSubShapeEdgeSorted ( theShape , theStartPoint )
RaiseIfFailed ( " GetSubShapeEdgeSorted " , self . ShapesOp )
self . _autoPublish ( ListObj , theName , " SortedEdges " )
return ListObj
2014-12-08 18:14:18 +03:00
## Check if the object is a sub-object of another GEOM object.
# @param aSubObject Checked sub-object (or its parent object, in case if
# \a theSubObjectIndex is non-zero).
# @param anObject An object that is checked for ownership (or its parent object,
# in case if \a theObjectIndex is non-zero).
# @param aSubObjectIndex When non-zero, specifies a sub-shape index that
# identifies a sub-object within its parent specified via \a theSubObject.
# @param anObjectIndex When non-zero, specifies a sub-shape index that
# identifies an object within its parent specified via \a theObject.
# @return TRUE, if the given object contains sub-object.
@ManageTransactions ( " ShapesOp " )
def IsSubShapeBelongsTo ( self , aSubObject , anObject , aSubObjectIndex = 0 , anObjectIndex = 0 ) :
"""
Check if the object is a sub - object of another GEOM object .
Parameters :
aSubObject Checked sub - object ( or its parent object , in case if
\a theSubObjectIndex is non - zero ) .
anObject An object that is checked for ownership ( or its parent object ,
in case if \a theObjectIndex is non - zero ) .
aSubObjectIndex When non - zero , specifies a sub - shape index that
identifies a sub - object within its parent specified via \a theSubObject .
anObjectIndex When non - zero , specifies a sub - shape index that
identifies an object within its parent specified via \a theObject .
Returns
TRUE , if the given object contains sub - object .
"""
IsOk = self . ShapesOp . IsSubShapeBelongsTo ( aSubObject , aSubObjectIndex , anObject , anObjectIndex )
RaiseIfFailed ( " IsSubShapeBelongsTo " , self . ShapesOp )
return IsOk
2012-08-09 07:58:02 +00:00
# end of l4_decompose
## @}
## @addtogroup l4_decompose_d
## @{
## Deprecated method
# It works like SubShapeAllSortedCentres(), but wrongly
# defines centres of faces, shells and solids.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2013-02-12 11:35:16 +00:00
def SubShapeAllSorted ( self , aShape , aType , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Deprecated method
It works like geompy . SubShapeAllSortedCentres , but wrongly
defines centres of faces , shells and solids .
"""
2012-10-08 11:16:36 +00:00
ListObj = self . ShapesOp . MakeExplode ( aShape , EnumToLong ( aType ) , True )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " MakeExplode " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( ListObj , theName , " subshape " )
2012-08-09 07:58:02 +00:00
return ListObj
## Deprecated method
# It works like SubShapeAllSortedCentresIDs(), but wrongly
# defines centres of faces, shells and solids.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2012-08-09 07:58:02 +00:00
def SubShapeAllSortedIDs ( self , aShape , aType ) :
"""
Deprecated method
It works like geompy . SubShapeAllSortedCentresIDs , but wrongly
defines centres of faces , shells and solids .
"""
2012-10-08 11:16:36 +00:00
ListIDs = self . ShapesOp . SubShapeAllIDs ( aShape , EnumToLong ( aType ) , True )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " SubShapeAllIDs " , self . ShapesOp )
return ListIDs
## Deprecated method
# It works like SubShapeSortedCentres(), but has a bug
# (wrongly defines centres of faces, shells and solids).
2013-02-12 11:35:16 +00:00
def SubShapeSorted ( self , aShape , aType , ListOfInd , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Deprecated method
It works like geompy . SubShapeSortedCentres , but has a bug
( wrongly defines centres of faces , shells and solids ) .
"""
2008-03-07 07:45:34 +00:00
ListOfIDs = [ ]
2012-10-08 11:16:36 +00:00
AllShapeIDsList = self . SubShapeAllSortedIDs ( aShape , EnumToLong ( aType ) )
2008-03-07 07:45:34 +00:00
for ind in ListOfInd :
2012-08-09 07:58:02 +00:00
ListOfIDs . append ( AllShapeIDsList [ ind - 1 ] )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.GetSubShape()
anObj = self . GetSubShape ( aShape , ListOfIDs , theName )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
# end of l4_decompose_d
2009-02-13 12:16:39 +00:00
## @}
## @addtogroup l3_healing
## @{
2008-03-07 07:45:34 +00:00
## Apply a sequence of Shape Healing operators to the given object.
# @param theShape Shape to be processed.
# @param theOperators List of names of operators ("FixShape", "SplitClosedFaces", etc.).
# @param theParameters List of names of parameters
# ("FixShape.Tolerance3d", "SplitClosedFaces.NbSplitPoints", etc.).
# @param theValues List of values of parameters, in the same order
2009-02-13 12:16:39 +00:00
# as parameters are listed in <VAR>theParameters</VAR> list.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
2012-08-09 07:58:02 +00:00
#
# <b> Operators and Parameters: </b> \n
#
# * \b FixShape - corrects invalid shapes. \n
# - \b FixShape.Tolerance3d - work tolerance for detection of the problems and correction of them. \n
# - \b FixShape.MaxTolerance3d - maximal possible tolerance of the shape after correction. \n
#
# * \b FixFaceSize - removes small faces, such as spots and strips.\n
# - \b FixFaceSize.Tolerance - defines minimum possible face size. \n
# - \b DropSmallEdges - removes edges, which merge with neighbouring edges. \n
# - \b DropSmallEdges.Tolerance3d - defines minimum possible distance between two parallel edges.\n
2014-12-11 21:29:03 +03:00
# - \b DropSmallSolids - either removes small solids or merges them with neighboring ones. \n
# - \b DropSmallSolids.WidthFactorThreshold - defines maximum value of <em>2V/S</em> of a solid which is considered small, where \a V is volume and \a S is surface area of the solid. \n
# - \b DropSmallSolids.VolumeThreshold - defines maximum volume of a solid which is considered small. If the both tolerances are privided a solid is considered small if it meets the both criteria. \n
# - \b DropSmallSolids.MergeSolids - if "1", small solids are removed; if "0" small solids are merged to adjacent non-small solids or left untouched if cannot be merged. \n
2012-08-09 07:58:02 +00:00
#
# * \b SplitAngle - splits faces based on conical surfaces, surfaces of revolution and cylindrical
# surfaces in segments using a certain angle. \n
# - \b SplitAngle.Angle - the central angle of the resulting segments (i.e. we obtain two segments
# if Angle=180, four if Angle=90, etc). \n
# - \b SplitAngle.MaxTolerance - maximum possible tolerance among the resulting segments.\n
#
# * \b SplitClosedFaces - splits closed faces in segments.
# The number of segments depends on the number of splitting points.\n
# - \b SplitClosedFaces.NbSplitPoints - the number of splitting points.\n
#
# * \b SplitContinuity - splits shapes to reduce continuities of curves and surfaces.\n
# - \b SplitContinuity.Tolerance3d - 3D tolerance for correction of geometry.\n
# - \b SplitContinuity.SurfaceContinuity - required continuity for surfaces.\n
# - \b SplitContinuity.CurveContinuity - required continuity for curves.\n
# This and the previous parameters can take the following values:\n
# \b Parametric \b Continuity \n
# \b C0 (Positional Continuity): curves are joined (the end positions of curves or surfaces
# are coincidental. The curves or surfaces may still meet at an angle, giving rise to a sharp corner or edge).\n
# \b C1 (Tangential Continuity): first derivatives are equal (the end vectors of curves or surfaces are parallel,
# ruling out sharp edges).\n
2014-06-25 18:28:02 +04:00
# \b C2 (Curvature Continuity): first and second derivatives are equal (the end vectors of curves or surfaces
2012-08-09 07:58:02 +00:00
# are of the same magnitude).\n
# \b CN N-th derivatives are equal (both the direction and the magnitude of the Nth derivatives of curves
# or surfaces (d/du C(u)) are the same at junction. \n
# \b Geometric \b Continuity \n
# \b G1: first derivatives are proportional at junction.\n
# The curve tangents thus have the same direction, but not necessarily the same magnitude.
# i.e., C1'(1) = (a,b,c) and C2'(0) = (k*a, k*b, k*c).\n
# \b G2: first and second derivatives are proportional at junction.
# As the names imply, geometric continuity requires the geometry to be continuous, while parametric
# continuity requires that the underlying parameterization was continuous as well.
# Parametric continuity of order n implies geometric continuity of order n, but not vice-versa.\n
#
# * \b BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters:\n
# - \b BSplineRestriction.SurfaceMode - approximation of surfaces if restriction is necessary.\n
# - \b BSplineRestriction.Curve3dMode - conversion of any 3D curve to BSpline and approximation.\n
# - \b BSplineRestriction.Curve2dMode - conversion of any 2D curve to BSpline and approximation.\n
# - \b BSplineRestriction.Tolerance3d - defines the possibility of surfaces and 3D curves approximation
# with the specified parameters.\n
# - \b BSplineRestriction.Tolerance2d - defines the possibility of surfaces and 2D curves approximation
# with the specified parameters.\n
# - \b BSplineRestriction.RequiredDegree - required degree of the resulting BSplines.\n
# - \b BSplineRestriction.RequiredNbSegments - required maximum number of segments of resultant BSplines.\n
# - \b BSplineRestriction.Continuity3d - continuity of the resulting surfaces and 3D curves.\n
# - \b BSplineRestriction.Continuity2d - continuity of the resulting 2D curves.\n
#
# * \b ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces.\n
# - \b ToBezier.SurfaceMode - if checked in, allows conversion of surfaces.\n
# - \b ToBezier.Curve3dMode - if checked in, allows conversion of 3D curves.\n
# - \b ToBezier.Curve2dMode - if checked in, allows conversion of 2D curves.\n
# - \b ToBezier.MaxTolerance - defines tolerance for detection and correction of problems.\n
#
# * \b SameParameter - fixes edges of 2D and 3D curves not having the same parameter.\n
# - \b SameParameter.Tolerance3d - defines tolerance for fixing of edges.\n
#
#
# @return New GEOM.GEOM_Object, containing processed shape.
#
# \n @ref tui_shape_processing "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def ProcessShape ( self , theShape , theOperators , theParameters , theValues , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Apply a sequence of Shape Healing operators to the given object .
Parameters :
theShape Shape to be processed .
theValues List of values of parameters , in the same order
as parameters are listed in theParameters list .
2014-12-11 21:29:03 +03:00
theOperators List of names of operators ( ' FixShape ' , ' SplitClosedFaces ' , etc . ) .
2012-08-09 07:58:02 +00:00
theParameters List of names of parameters
2014-12-11 21:29:03 +03:00
( ' FixShape.Tolerance3d ' , ' SplitClosedFaces.NbSplitPoints ' , etc . ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Operators and Parameters :
2012-08-09 07:58:02 +00:00
* FixShape - corrects invalid shapes .
* FixShape . Tolerance3d - work tolerance for detection of the problems and correction of them .
* FixShape . MaxTolerance3d - maximal possible tolerance of the shape after correction .
* FixFaceSize - removes small faces , such as spots and strips .
* FixFaceSize . Tolerance - defines minimum possible face size .
2014-12-11 21:29:03 +03:00
* DropSmallEdges - removes edges , which merge with neighbouring edges .
2012-08-09 07:58:02 +00:00
* DropSmallEdges . Tolerance3d - defines minimum possible distance between two parallel edges .
2014-12-11 21:29:03 +03:00
* DropSmallSolids - either removes small solids or merges them with neighboring ones .
* DropSmallSolids . WidthFactorThreshold - defines maximum value of 2 V / S of a solid which is considered small , where V is volume and S is surface area of the solid .
* DropSmallSolids . VolumeThreshold - defines maximum volume of a solid which is considered small . If the both tolerances are privided a solid is considered small if it meets the both criteria .
* DropSmallSolids . MergeSolids - if ' 1 ' , small solids are removed ; if ' 0 ' small solids are merged to adjacent non - small solids or left untouched if cannot be merged .
2012-08-09 07:58:02 +00:00
* SplitAngle - splits faces based on conical surfaces , surfaces of revolution and cylindrical surfaces
in segments using a certain angle .
* SplitAngle . Angle - the central angle of the resulting segments ( i . e . we obtain two segments
if Angle = 180 , four if Angle = 90 , etc ) .
* SplitAngle . MaxTolerance - maximum possible tolerance among the resulting segments .
* SplitClosedFaces - splits closed faces in segments . The number of segments depends on the number of
splitting points .
* SplitClosedFaces . NbSplitPoints - the number of splitting points .
* SplitContinuity - splits shapes to reduce continuities of curves and surfaces .
* SplitContinuity . Tolerance3d - 3 D tolerance for correction of geometry .
* SplitContinuity . SurfaceContinuity - required continuity for surfaces .
* SplitContinuity . CurveContinuity - required continuity for curves .
This and the previous parameters can take the following values :
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parametric Continuity :
C0 ( Positional Continuity ) : curves are joined ( the end positions of curves or surfaces are
coincidental . The curves or surfaces may still meet at an angle ,
giving rise to a sharp corner or edge ) .
C1 ( Tangential Continuity ) : first derivatives are equal ( the end vectors of curves or surfaces
are parallel , ruling out sharp edges ) .
C2 ( Curvature Continuity ) : first and second derivatives are equal ( the end vectors of curves
or surfaces are of the same magnitude ) .
CN N - th derivatives are equal ( both the direction and the magnitude of the Nth derivatives of
curves or surfaces ( d / du C ( u ) ) are the same at junction .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Geometric Continuity :
G1 : first derivatives are proportional at junction .
The curve tangents thus have the same direction , but not necessarily the same magnitude .
i . e . , C1 ' (1) = (a,b,c) and C2 ' ( 0 ) = ( k * a , k * b , k * c ) .
G2 : first and second derivatives are proportional at junction . As the names imply ,
geometric continuity requires the geometry to be continuous , while parametric continuity requires
that the underlying parameterization was continuous as well . Parametric continuity of order n implies
geometric continuity of order n , but not vice - versa .
* BsplineRestriction - converts curves and surfaces to Bsplines and processes them with the following parameters :
* BSplineRestriction . SurfaceMode - approximation of surfaces if restriction is necessary .
* BSplineRestriction . Curve3dMode - conversion of any 3 D curve to BSpline and approximation .
* BSplineRestriction . Curve2dMode - conversion of any 2 D curve to BSpline and approximation .
* BSplineRestriction . Tolerance3d - defines the possibility of surfaces and 3 D curves approximation with
the specified parameters .
* BSplineRestriction . Tolerance2d - defines the possibility of surfaces and 2 D curves approximation with
the specified parameters .
* BSplineRestriction . RequiredDegree - required degree of the resulting BSplines .
* BSplineRestriction . RequiredNbSegments - required maximum number of segments of resultant BSplines .
* BSplineRestriction . Continuity3d - continuity of the resulting surfaces and 3 D curves .
* BSplineRestriction . Continuity2d - continuity of the resulting 2 D curves .
* ToBezier - converts curves and surfaces of any type to Bezier curves and surfaces .
* ToBezier . SurfaceMode - if checked in , allows conversion of surfaces .
* ToBezier . Curve3dMode - if checked in , allows conversion of 3 D curves .
* ToBezier . Curve2dMode - if checked in , allows conversion of 2 D curves .
* ToBezier . MaxTolerance - defines tolerance for detection and correction of problems .
* SameParameter - fixes edges of 2 D and 3 D curves not having the same parameter .
* SameParameter . Tolerance3d - defines tolerance for fixing of edges .
Returns :
New GEOM . GEOM_Object , containing processed shape .
Note : For more information look through SALOME Geometry User ' s Guide->
- > Introduction to Geometry - > Repairing Operations - > Shape Processing
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
theValues , Parameters = ParseList ( theValues )
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . ProcessShape ( theShape , theOperators , theParameters , theValues )
2012-08-09 07:58:02 +00:00
# To avoid script failure in case of good argument shape
if self . HealOp . GetErrorCode ( ) == " ShHealOper_NotError_msg " :
return theShape
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " ProcessShape " , self . HealOp )
2009-02-13 12:16:39 +00:00
for string in ( theOperators + theParameters ) :
Parameters = " : " + Parameters
pass
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " healed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Remove faces from the given object (shape).
# @param theObject Shape to be processed.
# @param theFaces Indices of faces to be removed, if EMPTY then the method
# removes ALL faces of the given object.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_suppress_faces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def SuppressFaces ( self , theObject , theFaces , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Remove faces from the given object ( shape ) .
Parameters :
theObject Shape to be processed .
theFaces Indices of faces to be removed , if EMPTY then the method
removes ALL faces of the given object .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing processed shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . SuppressFaces ( theObject , theFaces )
RaiseIfFailed ( " SuppressFaces " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " suppressFaces " )
2008-03-07 07:45:34 +00:00
return anObj
2014-10-09 18:34:57 +04:00
## Sewing of faces into a single shell.
2012-08-09 07:58:02 +00:00
# @param ListShape Shapes to be processed.
# @param theTolerance Required tolerance value.
2013-05-24 10:40:50 +00:00
# @param AllowNonManifold Flag that allows non-manifold sewing.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-09 18:34:57 +04:00
# @return New GEOM.GEOM_Object, containing a result shell.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_sewing "Example"
2013-05-24 10:40:50 +00:00
def MakeSewing ( self , ListShape , theTolerance , AllowNonManifold = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-09 18:34:57 +04:00
Sewing of faces into a single shell .
2012-08-09 07:58:02 +00:00
Parameters :
ListShape Shapes to be processed .
theTolerance Required tolerance value .
2013-05-24 10:40:50 +00:00
AllowNonManifold Flag that allows non - manifold sewing .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-10-09 18:34:57 +04:00
New GEOM . GEOM_Object , containing containing a result shell .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.Sew()
2014-10-09 18:34:57 +04:00
anObj = self . Sew ( ListShape , theTolerance , AllowNonManifold , theName )
2008-03-07 07:45:34 +00:00
return anObj
2014-10-09 18:34:57 +04:00
## Sewing of faces into a single shell.
# @param ListShape Shapes to be processed.
2008-03-07 07:45:34 +00:00
# @param theTolerance Required tolerance value.
2013-05-24 10:40:50 +00:00
# @param AllowNonManifold Flag that allows non-manifold sewing.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-09 18:34:57 +04:00
# @return New GEOM.GEOM_Object, containing a result shell.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2014-10-09 18:34:57 +04:00
def Sew ( self , ListShape , theTolerance , AllowNonManifold = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-09 18:34:57 +04:00
Sewing of faces into a single shell .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-09 18:34:57 +04:00
ListShape Shapes to be processed .
2012-08-09 07:58:02 +00:00
theTolerance Required tolerance value .
2013-05-24 10:40:50 +00:00
AllowNonManifold Flag that allows non - manifold sewing .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-10-09 18:34:57 +04:00
New GEOM . GEOM_Object , containing a result shell .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see MakeSewing() above
theTolerance , Parameters = ParseParameters ( theTolerance )
2013-05-24 10:40:50 +00:00
if AllowNonManifold :
2014-10-09 18:34:57 +04:00
anObj = self . HealOp . SewAllowNonManifold ( ToList ( ListShape ) , theTolerance )
2013-05-24 10:40:50 +00:00
else :
2014-10-09 18:34:57 +04:00
anObj = self . HealOp . Sew ( ToList ( ListShape ) , theTolerance )
2013-09-16 13:59:50 +00:00
# To avoid script failure in case of good argument shape
2014-10-09 18:34:57 +04:00
# (Fix of test cases geom/bugs11/L7,L8)
2013-09-16 13:59:50 +00:00
if self . HealOp . GetErrorCode ( ) == " ShHealOper_NotError_msg " :
2014-10-09 18:34:57 +04:00
return anObj
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " Sew " , self . HealOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " sewed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-16 14:36:46 +04:00
## Rebuild the topology of theSolids by removing
# the faces that are shared by several solids.
# @param theSolids A compound or a list of solids to be processed.
2013-06-14 12:20:21 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_remove_webs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2014-10-16 14:36:46 +04:00
def RemoveInternalFaces ( self , theSolids , theName = None ) :
2013-06-14 12:20:21 +00:00
"""
2014-10-16 14:36:46 +04:00
Rebuild the topology of theSolids by removing
the faces that are shared by several solids .
2013-06-14 12:20:21 +00:00
Parameters :
2014-10-16 14:36:46 +04:00
theSolids A compound or a list of solids to be processed .
2013-06-14 12:20:21 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing processed shape .
"""
# Example: see GEOM_TestHealing.py
2014-10-16 14:36:46 +04:00
anObj = self . HealOp . RemoveInternalFaces ( ToList ( theSolids ) )
2013-06-14 12:20:21 +00:00
RaiseIfFailed ( " RemoveInternalFaces " , self . HealOp )
self . _autoPublish ( anObj , theName , " removeWebs " )
return anObj
2008-03-07 07:45:34 +00:00
## Remove internal wires and edges from the given object (face).
# @param theObject Shape to be processed.
# @param theWires Indices of wires to be removed, if EMPTY then the method
# removes ALL internal wires of the given object.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_suppress_internal_wires "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def SuppressInternalWires ( self , theObject , theWires , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Remove internal wires and edges from the given object ( face ) .
Parameters :
theObject Shape to be processed .
theWires Indices of wires to be removed , if EMPTY then the method
removes ALL internal wires of the given object .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing processed shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . RemoveIntWires ( theObject , theWires )
RaiseIfFailed ( " RemoveIntWires " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " suppressWires " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Remove internal closed contours (holes) from the given object.
# @param theObject Shape to be processed.
# @param theWires Indices of wires to be removed, if EMPTY then the method
# removes ALL internal holes of the given object
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_suppress_holes "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def SuppressHoles ( self , theObject , theWires , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Remove internal closed contours ( holes ) from the given object .
Parameters :
theObject Shape to be processed .
theWires Indices of wires to be removed , if EMPTY then the method
removes ALL internal holes of the given object
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing processed shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . FillHoles ( theObject , theWires )
RaiseIfFailed ( " FillHoles " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " suppressHoles " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Close an open wire.
# @param theObject Shape to be processed.
# @param theWires Indexes of edge(s) and wire(s) to be closed within <VAR>theObject</VAR>'s shape,
2012-08-09 07:58:02 +00:00
# if [ ], then <VAR>theObject</VAR> itself is a wire.
# @param isCommonVertex If True : closure by creation of a common vertex,
# If False : closure by creation of an edge between ends.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_close_contour "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def CloseContour ( self , theObject , theWires , isCommonVertex , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Close an open wire .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject Shape to be processed .
theWires Indexes of edge ( s ) and wire ( s ) to be closed within theObject ' s shape,
if [ ] , then theObject itself is a wire .
isCommonVertex If True : closure by creation of a common vertex ,
If False : closure by creation of an edge between ends .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
New GEOM . GEOM_Object , containing processed shape .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . CloseContour ( theObject , theWires , isCommonVertex )
RaiseIfFailed ( " CloseContour " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " closeContour " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Addition of a point to a given edge object.
# @param theObject Shape to be processed.
# @param theEdgeIndex Index of edge to be divided within theObject's shape,
# if -1, then theObject itself is the edge.
# @param theValue Value of parameter on edge or length parameter,
# depending on \a isByParameter.
2012-08-09 07:58:02 +00:00
# @param isByParameter If TRUE : \a theValue is treated as a curve parameter [0..1], \n
2008-03-07 07:45:34 +00:00
# if FALSE : \a theValue is treated as a length parameter [0..1]
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_add_point_on_edge "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def DivideEdge ( self , theObject , theEdgeIndex , theValue , isByParameter , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Addition of a point to a given edge object .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject Shape to be processed .
theEdgeIndex Index of edge to be divided within theObject ' s shape,
if - 1 , then theObject itself is the edge .
theValue Value of parameter on edge or length parameter ,
depending on isByParameter .
isByParameter If TRUE : theValue is treated as a curve parameter [ 0. .1 ] ,
if FALSE : theValue is treated as a length parameter [ 0. .1 ]
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing processed shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
theEdgeIndex , theValue , isByParameter , Parameters = ParseParameters ( theEdgeIndex , theValue , isByParameter )
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . DivideEdge ( theObject , theEdgeIndex , theValue , isByParameter )
RaiseIfFailed ( " DivideEdge " , self . HealOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " divideEdge " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-12-10 19:07:28 +03:00
## Addition of points to a given edge of \a theObject by projecting
# other points to the given edge.
2014-10-21 20:06:51 +04:00
# @param theObject Shape to be processed.
# @param theEdgeIndex Index of edge to be divided within theObject's shape,
# if -1, then theObject itself is the edge.
2014-12-10 19:07:28 +03:00
# @param thePoints List of points to project to theEdgeIndex-th edge.
2014-10-21 20:06:51 +04:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_add_point_on_edge "Example"
@ManageTransactions ( " HealOp " )
2014-12-10 19:07:28 +03:00
def DivideEdgeByPoint ( self , theObject , theEdgeIndex , thePoints , theName = None ) :
2014-10-21 20:06:51 +04:00
"""
2014-12-10 19:07:28 +03:00
Addition of points to a given edge of \a theObject by projecting
other points to the given edge .
2014-10-21 20:06:51 +04:00
Parameters :
theObject Shape to be processed .
theEdgeIndex The edge or its index to be divided within theObject ' s shape,
if - 1 , then theObject itself is the edge .
2014-12-10 19:07:28 +03:00
thePoints List of points to project to theEdgeIndex - th edge .
2014-10-21 20:06:51 +04:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing processed shape .
"""
# Example: see GEOM_TestHealing.py
if isinstance ( theEdgeIndex , GEOM . _objref_GEOM_Object ) :
theEdgeIndex = self . GetSubShapeID ( theObject , theEdgeIndex )
2014-12-10 19:07:28 +03:00
anObj = self . HealOp . DivideEdgeByPoint ( theObject , theEdgeIndex , ToList ( thePoints ) )
2014-10-21 20:06:51 +04:00
RaiseIfFailed ( " DivideEdgeByPoint " , self . HealOp )
self . _autoPublish ( anObj , theName , " divideEdge " )
return anObj
2012-08-09 07:58:02 +00:00
## Suppress the vertices in the wire in case if adjacent edges are C1 continuous.
# @param theWire Wire to minimize the number of C1 continuous edges in.
# @param theVertices A list of vertices to suppress. If the list
# is empty, all vertices in a wire will be assumed.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object with modified wire.
#
# @ref tui_fuse_collinear_edges "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def FuseCollinearEdgesWithinWire ( self , theWire , theVertices = [ ] , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Suppress the vertices in the wire in case if adjacent edges are C1 continuous .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theWire Wire to minimize the number of C1 continuous edges in .
theVertices A list of vertices to suppress . If the list
is empty , all vertices in a wire will be assumed .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object with modified wire .
"""
anObj = self . HealOp . FuseCollinearEdgesWithinWire ( theWire , theVertices )
RaiseIfFailed ( " FuseCollinearEdgesWithinWire " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fuseEdges " )
2012-08-09 07:58:02 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Change orientation of the given object. Updates given shape.
2008-03-07 07:45:34 +00:00
# @param theObject Shape to be processed.
2012-08-09 07:58:02 +00:00
# @return Updated <var>theObject</var>
2009-02-13 12:16:39 +00:00
#
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2008-03-07 07:45:34 +00:00
def ChangeOrientationShell ( self , theObject ) :
2012-08-09 07:58:02 +00:00
"""
Change orientation of the given object . Updates given shape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject Shape to be processed .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Updated theObject
"""
2008-03-07 07:45:34 +00:00
theObject = self . HealOp . ChangeOrientation ( theObject )
RaiseIfFailed ( " ChangeOrientation " , self . HealOp )
pass
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Change orientation of the given object.
# @param theObject Shape to be processed.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
2009-02-13 12:16:39 +00:00
#
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def ChangeOrientationShellCopy ( self , theObject , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Change orientation of the given object .
Parameters :
theObject Shape to be processed .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing processed shape .
"""
2008-03-07 07:45:34 +00:00
anObj = self . HealOp . ChangeOrientationCopy ( theObject )
RaiseIfFailed ( " ChangeOrientationCopy " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " reversed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Try to limit tolerance of the given object by value \a theTolerance.
# @param theObject Shape to be processed.
# @param theTolerance Required tolerance value.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing processed shape.
#
# @ref tui_limit_tolerance "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def LimitTolerance ( self , theObject , theTolerance = 1e-07 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Try to limit tolerance of the given object by value theTolerance .
Parameters :
theObject Shape to be processed .
theTolerance Required tolerance value .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing processed shape .
"""
anObj = self . HealOp . LimitTolerance ( theObject , theTolerance )
RaiseIfFailed ( " LimitTolerance " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " limitTolerance " )
2012-08-09 07:58:02 +00:00
return anObj
## Get a list of wires (wrapped in GEOM.GEOM_Object-s),
2008-03-07 07:45:34 +00:00
# that constitute a free boundary of the given shape.
# @param theObject Shape to get free boundary of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return [\a status, \a theClosedWires, \a theOpenWires]
# \n \a status: FALSE, if an error(s) occured during the method execution.
# \n \a theClosedWires: Closed wires on the free boundary of the given shape.
# \n \a theOpenWires: Open wires on the free boundary of the given shape.
2008-03-07 07:45:34 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_free_boundaries_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " HealOp " )
2013-02-12 11:35:16 +00:00
def GetFreeBoundary ( self , theObject , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a list of wires ( wrapped in GEOM . GEOM_Object - s ) ,
that constitute a free boundary of the given shape .
Parameters :
theObject Shape to get free boundary of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
[ status , theClosedWires , theOpenWires ]
status : FALSE , if an error ( s ) occured during the method execution .
theClosedWires : Closed wires on the free boundary of the given shape .
theOpenWires : Open wires on the free boundary of the given shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestHealing.py
2014-10-09 18:34:57 +04:00
anObj = self . HealOp . GetFreeBoundary ( ToList ( theObject ) )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetFreeBoundary " , self . HealOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj [ 1 ] , theName , " closedWire " )
self . _autoPublish ( anObj [ 2 ] , theName , " openWire " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-14 20:45:17 +04:00
## Replace coincident faces in \a theShapes by one face.
# @param theShapes Initial shapes, either a list or compound of shapes.
2008-03-07 07:45:34 +00:00
# @param theTolerance Maximum distance between faces, which can be considered as coincident.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-14 20:45:17 +04:00
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_glue_faces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def MakeGlueFaces ( self , theShapes , theTolerance , doKeepNonSolids = True , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Replace coincident faces in theShapes by one face .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-14 20:45:17 +04:00
theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between faces , which can be considered as coincident .
doKeepNonSolids If FALSE , only solids will present in the result ,
otherwise all initial shapes .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-10-14 20:45:17 +04:00
New GEOM . GEOM_Object , containing copies of theShapes without coincident faces .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
theTolerance , Parameters = ParseParameters ( theTolerance )
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . MakeGlueFaces ( ToList ( theShapes ) , theTolerance , doKeepNonSolids )
2008-03-07 07:45:34 +00:00
if anObj is None :
raise RuntimeError , " MakeGlueFaces : " + self . ShapesOp . GetErrorCode ( )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " glueFaces " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-14 20:45:17 +04:00
## Find coincident faces in \a theShapes for possible gluing.
# @param theShapes Initial shapes, either a list or compound of shapes.
2008-03-07 07:45:34 +00:00
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return GEOM.ListOfGO
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# @ref tui_glue_faces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def GetGlueFaces ( self , theShapes , theTolerance , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Find coincident faces in theShapes for possible gluing .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-14 20:45:17 +04:00
theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between faces ,
which can be considered as coincident .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
GEOM . ListOfGO
"""
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . GetGlueFaces ( ToList ( theShapes ) , theTolerance )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetGlueFaces " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " facesToGlue " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-10-14 20:45:17 +04:00
## Replace coincident faces in \a theShapes by one face
2008-03-07 07:45:34 +00:00
# in compliance with given list of faces
2014-10-14 20:45:17 +04:00
# @param theShapes Initial shapes, either a list or compound of shapes.
2008-03-07 07:45:34 +00:00
# @param theTolerance Maximum distance between faces,
# which can be considered as coincident.
# @param theFaces List of faces for gluing.
# @param doKeepNonSolids If FALSE, only solids will present in the result,
# otherwise all initial shapes.
2012-08-09 07:58:02 +00:00
# @param doGlueAllEdges If TRUE, all coincident edges of <VAR>theShape</VAR>
# will be glued, otherwise only the edges,
# belonging to <VAR>theFaces</VAR>.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-14 20:45:17 +04:00
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident faces.
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# @ref tui_glue_faces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def MakeGlueFacesByList ( self , theShapes , theTolerance , theFaces ,
2013-02-12 11:35:16 +00:00
doKeepNonSolids = True , doGlueAllEdges = True , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Replace coincident faces in theShapes by one face
2012-08-09 07:58:02 +00:00
in compliance with given list of faces
Parameters :
2014-10-14 20:45:17 +04:00
theShapes theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between faces ,
which can be considered as coincident .
theFaces List of faces for gluing .
doKeepNonSolids If FALSE , only solids will present in the result ,
otherwise all initial shapes .
doGlueAllEdges If TRUE , all coincident edges of theShape
will be glued , otherwise only the edges ,
belonging to theFaces .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2014-10-14 20:45:17 +04:00
New GEOM . GEOM_Object , containing copies of theShapes without coincident faces .
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . MakeGlueFacesByList ( ToList ( theShapes ) , theTolerance , theFaces ,
2012-08-09 07:58:02 +00:00
doKeepNonSolids , doGlueAllEdges )
if anObj is None :
raise RuntimeError , " MakeGlueFacesByList : " + self . ShapesOp . GetErrorCode ( )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " glueFaces " )
2012-08-09 07:58:02 +00:00
return anObj
2014-10-14 20:45:17 +04:00
## Replace coincident edges in \a theShapes by one edge.
# @param theShapes Initial shapes, either a list or compound of shapes.
2012-08-09 07:58:02 +00:00
# @param theTolerance Maximum distance between edges, which can be considered as coincident.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-14 20:45:17 +04:00
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
2012-08-09 07:58:02 +00:00
#
# @ref tui_glue_edges "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def MakeGlueEdges ( self , theShapes , theTolerance , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Replace coincident edges in theShapes by one edge .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-14 20:45:17 +04:00
theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between edges , which can be considered as coincident .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2014-10-14 20:45:17 +04:00
New GEOM . GEOM_Object , containing copies of theShapes without coincident edges .
2012-08-09 07:58:02 +00:00
"""
theTolerance , Parameters = ParseParameters ( theTolerance )
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . MakeGlueEdges ( ToList ( theShapes ) , theTolerance )
2012-08-09 07:58:02 +00:00
if anObj is None :
raise RuntimeError , " MakeGlueEdges : " + self . ShapesOp . GetErrorCode ( )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " glueEdges " )
2012-08-09 07:58:02 +00:00
return anObj
2014-10-14 20:45:17 +04:00
## Find coincident edges in \a theShapes for possible gluing.
# @param theShapes Initial shapes, either a list or compound of shapes.
2012-08-09 07:58:02 +00:00
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return GEOM.ListOfGO
#
# @ref tui_glue_edges "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def GetGlueEdges ( self , theShapes , theTolerance , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Find coincident edges in theShapes for possible gluing .
2012-08-09 07:58:02 +00:00
Parameters :
2014-10-14 20:45:17 +04:00
theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between edges ,
which can be considered as coincident .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
GEOM . ListOfGO
"""
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . GetGlueEdges ( ToList ( theShapes ) , theTolerance )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " GetGlueEdges " , self . ShapesOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edgesToGlue " )
2012-08-09 07:58:02 +00:00
return anObj
2014-10-14 20:45:17 +04:00
## Replace coincident edges in theShapes by one edge
2012-08-09 07:58:02 +00:00
# in compliance with given list of edges.
2014-10-14 20:45:17 +04:00
# @param theShapes Initial shapes, either a list or compound of shapes.
2012-08-09 07:58:02 +00:00
# @param theTolerance Maximum distance between edges,
# which can be considered as coincident.
# @param theEdges List of edges for gluing.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-10-14 20:45:17 +04:00
# @return New GEOM.GEOM_Object, containing copies of theShapes without coincident edges.
2012-08-09 07:58:02 +00:00
#
# @ref tui_glue_edges "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " ShapesOp " )
2014-10-14 20:45:17 +04:00
def MakeGlueEdgesByList ( self , theShapes , theTolerance , theEdges , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
Replace coincident edges in theShapes by one edge
2012-08-09 07:58:02 +00:00
in compliance with given list of edges .
Parameters :
2014-10-14 20:45:17 +04:00
theShapes Initial shapes , either a list or compound of shapes .
2012-08-09 07:58:02 +00:00
theTolerance Maximum distance between edges ,
which can be considered as coincident .
theEdges List of edges for gluing .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2014-10-14 20:45:17 +04:00
New GEOM . GEOM_Object , containing copies of theShapes without coincident edges .
2012-08-09 07:58:02 +00:00
"""
2014-10-14 20:45:17 +04:00
anObj = self . ShapesOp . MakeGlueEdgesByList ( ToList ( theShapes ) , theTolerance , theEdges )
2008-03-07 07:45:34 +00:00
if anObj is None :
2012-08-09 07:58:02 +00:00
raise RuntimeError , " MakeGlueEdgesByList : " + self . ShapesOp . GetErrorCode ( )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " glueEdges " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_healing
## @}
## @addtogroup l3_boolean Boolean Operations
## @{
2008-03-07 07:45:34 +00:00
# -----------------------------------------------------------------------------
# Boolean (Common, Cut, Fuse, Section)
# -----------------------------------------------------------------------------
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform one of boolean operations on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
2012-08-09 07:58:02 +00:00
# @param theOperation Indicates the operation to be done:\n
2008-03-07 07:45:34 +00:00
# 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_fuse "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2013-10-16 11:22:29 +00:00
def MakeBoolean ( self , theShape1 , theShape2 , theOperation , checkSelfInte = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform one of boolean operations on two given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 First argument for boolean operation .
theShape2 Second argument for boolean operation .
theOperation Indicates the operation to be done :
1 - Common , 2 - Cut , 3 - Fuse , 4 - Section .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2013-10-16 11:22:29 +00:00
anObj = self . BoolOp . MakeBoolean ( theShape1 , theShape2 , theOperation , checkSelfInte )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeBoolean " , self . BoolOp )
2013-02-12 11:35:16 +00:00
def_names = { 1 : " common " , 2 : " cut " , 3 : " fuse " , 4 : " section " }
self . _autoPublish ( anObj , theName , def_names [ theOperation ] )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Perform Common boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2013-10-16 11:22:29 +00:00
def MakeCommon ( self , theShape1 , theShape2 , checkSelfInte = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform Common boolean operation on two given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 First argument for boolean operation .
theShape2 Second argument for boolean operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeBoolean()
2013-10-16 11:22:29 +00:00
return self . MakeBoolean ( theShape1 , theShape2 , 1 , checkSelfInte , theName )
2008-03-07 07:45:34 +00:00
2012-08-09 07:58:02 +00:00
## Perform Cut boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2013-10-16 11:22:29 +00:00
def MakeCut ( self , theShape1 , theShape2 , checkSelfInte = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform Cut boolean operation on two given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 First argument for boolean operation .
theShape2 Second argument for boolean operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeBoolean()
2013-10-16 11:22:29 +00:00
return self . MakeBoolean ( theShape1 , theShape2 , 2 , checkSelfInte , theName )
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Perform Fuse boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2014-03-27 11:59:05 +04:00
# @param rmExtraEdges The flag that tells if Remove Extra Edges
# operation should be performed during the operation.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2014-03-27 11:59:05 +04:00
def MakeFuse ( self , theShape1 , theShape2 , checkSelfInte = False ,
rmExtraEdges = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform Fuse boolean operation on two given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 First argument for boolean operation .
theShape2 Second argument for boolean operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2014-03-27 11:59:05 +04:00
rmExtraEdges The flag that tells if Remove Extra Edges
operation should be performed during the operation .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2014-03-27 11:59:05 +04:00
anObj = self . BoolOp . MakeFuse ( theShape1 , theShape2 ,
checkSelfInte , rmExtraEdges )
RaiseIfFailed ( " MakeFuse " , self . BoolOp )
self . _autoPublish ( anObj , theName , " fuse " )
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Perform Section boolean operation on two given shapes.
# @param theShape1 First argument for boolean operation.
# @param theShape2 Second argument for boolean operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2014-11-20 18:11:55 +03:00
# If a self-intersection detected the operation fails.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_section "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2013-10-16 11:22:29 +00:00
def MakeSection ( self , theShape1 , theShape2 , checkSelfInte = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform Section boolean operation on two given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 First argument for boolean operation .
theShape2 Second argument for boolean operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
2014-11-20 18:11:55 +03:00
be checked for self - intersection prior to the operation .
If a self - intersection detected the operation fails .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeBoolean()
2013-10-16 11:22:29 +00:00
return self . MakeBoolean ( theShape1 , theShape2 , 4 , checkSelfInte , theName )
2009-02-13 12:16:39 +00:00
2013-05-23 06:42:48 +00:00
## Perform Fuse boolean operation on the list of shapes.
# @param theShapesList Shapes to be fused.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2014-03-27 11:59:05 +04:00
# @param rmExtraEdges The flag that tells if Remove Extra Edges
# operation should be performed during the operation.
2013-05-23 06:42:48 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2013-05-23 06:42:48 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fuse "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2014-03-27 11:59:05 +04:00
def MakeFuseList ( self , theShapesList , checkSelfInte = False ,
rmExtraEdges = False , theName = None ) :
2013-05-23 06:42:48 +00:00
"""
Perform Fuse boolean operation on the list of shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2013-05-23 06:42:48 +00:00
theShapesList Shapes to be fused .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2014-03-27 11:59:05 +04:00
rmExtraEdges The flag that tells if Remove Extra Edges
operation should be performed during the operation .
2013-05-23 06:42:48 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2013-05-23 06:42:48 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2013-05-23 06:42:48 +00:00
"""
# Example: see GEOM_TestOthers.py
2014-03-27 11:59:05 +04:00
anObj = self . BoolOp . MakeFuseList ( theShapesList , checkSelfInte ,
rmExtraEdges )
2013-05-23 06:42:48 +00:00
RaiseIfFailed ( " MakeFuseList " , self . BoolOp )
self . _autoPublish ( anObj , theName , " fuse " )
return anObj
## Perform Common boolean operation on the list of shapes.
# @param theShapesList Shapes for Common operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2013-05-23 06:42:48 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2013-05-23 06:42:48 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_common "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2013-10-16 11:22:29 +00:00
def MakeCommonList ( self , theShapesList , checkSelfInte = False , theName = None ) :
2013-05-23 06:42:48 +00:00
"""
Perform Common boolean operation on the list of shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2013-05-23 06:42:48 +00:00
theShapesList Shapes for Common operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2013-05-23 06:42:48 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2013-05-23 06:42:48 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2013-05-23 06:42:48 +00:00
"""
# Example: see GEOM_TestOthers.py
2013-10-16 11:22:29 +00:00
anObj = self . BoolOp . MakeCommonList ( theShapesList , checkSelfInte )
2013-05-23 06:42:48 +00:00
RaiseIfFailed ( " MakeCommonList " , self . BoolOp )
self . _autoPublish ( anObj , theName , " common " )
return anObj
## Perform Cut boolean operation on one object and the list of tools.
# @param theMainShape The object of the operation.
# @param theShapesList The list of tools of the operation.
2013-10-16 11:22:29 +00:00
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
2013-05-23 06:42:48 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2013-11-27 08:27:46 +00:00
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
#
2013-05-23 06:42:48 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_cut "Example 1"
# \n @ref swig_MakeCommon "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2013-10-16 11:22:29 +00:00
def MakeCutList ( self , theMainShape , theShapesList , checkSelfInte = False , theName = None ) :
2013-05-23 06:42:48 +00:00
"""
Perform Cut boolean operation on one object and the list of tools .
2014-06-25 18:28:02 +04:00
Parameters :
2013-05-23 06:42:48 +00:00
theMainShape The object of the operation .
theShapesList The list of tools of the operation .
2013-10-16 11:22:29 +00:00
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
2013-05-23 06:42:48 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2013-11-27 08:27:46 +00:00
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
Returns :
2013-05-23 06:42:48 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
2013-05-23 06:42:48 +00:00
"""
# Example: see GEOM_TestOthers.py
2013-10-16 11:22:29 +00:00
anObj = self . BoolOp . MakeCutList ( theMainShape , theShapesList , checkSelfInte )
2013-05-23 06:42:48 +00:00
RaiseIfFailed ( " MakeCutList " , self . BoolOp )
self . _autoPublish ( anObj , theName , " cut " )
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_boolean
## @}
## @addtogroup l3_basic_op
## @{
2008-03-07 07:45:34 +00:00
## Perform partition operation.
# @param ListShapes Shapes to be intersected.
# @param ListTools Shapes to intersect theShapes.
2012-08-09 07:58:02 +00:00
# @param Limit Type of resulting shapes (see ShapeType()).\n
# If this parameter is set to -1 ("Auto"), most appropriate shape limit
# type will be detected automatically.
# @param KeepNonlimitShapes if this parameter == 0, then only shapes of
# target type (equal to Limit) are kept in the result,
# else standalone shapes of lower dimension
# are kept also (if they exist).
2013-11-27 08:27:46 +00:00
#
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @note Each compound from ListShapes and ListTools will be exploded
# in order to avoid possible intersection between shapes from this compound.
2008-03-07 07:45:34 +00:00
#
# After implementation new version of PartitionAlgo (October 2006)
# other parameters are ignored by current functionality. They are kept
# in this function only for support old versions.
# @param ListKeepInside Shapes, outside which the results will be deleted.
# Each shape from theKeepInside must belong to theShapes also.
# @param ListRemoveInside Shapes, inside which the results will be deleted.
# Each shape from theRemoveInside must belong to theShapes also.
# @param RemoveWebs If TRUE, perform Glue 3D algorithm.
# @param ListMaterials Material indices for each shape. Make sence,
# only if theRemoveWebs is TRUE.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shapes.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_partition "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2008-03-07 07:45:34 +00:00
def MakePartition ( self , ListShapes , ListTools = [ ] , ListKeepInside = [ ] , ListRemoveInside = [ ] ,
2012-08-09 07:58:02 +00:00
Limit = ShapeType [ " AUTO " ] , RemoveWebs = 0 , ListMaterials = [ ] ,
2014-02-26 13:13:55 +04:00
KeepNonlimitShapes = 0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform partition operation .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
ListShapes Shapes to be intersected .
ListTools Shapes to intersect theShapes .
Limit Type of resulting shapes ( see geompy . ShapeType )
If this parameter is set to - 1 ( " Auto " ) , most appropriate shape limit
type will be detected automatically .
KeepNonlimitShapes if this parameter == 0 , then only shapes of
target type ( equal to Limit ) are kept in the result ,
else standalone shapes of lower dimension
are kept also ( if they exist ) .
2013-11-27 08:27:46 +00:00
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Each compound from ListShapes and ListTools will be exploded
in order to avoid possible intersection between shapes from
this compound .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
After implementation new version of PartitionAlgo ( October 2006 ) other
parameters are ignored by current functionality . They are kept in this
function only for support old versions .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Ignored parameters :
ListKeepInside Shapes , outside which the results will be deleted .
Each shape from theKeepInside must belong to theShapes also .
ListRemoveInside Shapes , inside which the results will be deleted .
Each shape from theRemoveInside must belong to theShapes also .
RemoveWebs If TRUE , perform Glue 3 D algorithm .
ListMaterials Material indices for each shape . Make sence , only if theRemoveWebs is TRUE .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2013-04-04 07:06:43 +00:00
if Limit == self . ShapeType [ " AUTO " ] :
2012-08-09 07:58:02 +00:00
# automatic detection of the most appropriate shape limit type
lim = GEOM . SHAPE
for s in ListShapes : lim = min ( lim , s . GetMaxShapeType ( ) )
Limit = EnumToLong ( lim )
pass
2008-03-07 07:45:34 +00:00
anObj = self . BoolOp . MakePartition ( ListShapes , ListTools ,
ListKeepInside , ListRemoveInside ,
Limit , RemoveWebs , ListMaterials ,
2014-02-26 13:13:55 +04:00
KeepNonlimitShapes ) ;
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakePartition " , self . BoolOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " partition " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform partition operation.
# This method may be useful if it is needed to make a partition for
# compound contains nonintersected shapes. Performance will be better
# since intersection between shapes from compound is not performed.
#
2014-02-26 13:13:55 +04:00
# Description of all parameters as in previous method MakePartition().
# One additional parameter is provided:
# @param checkSelfInte The flag that tells if the arguments should
# be checked for self-intersection prior to the operation.
#
# @note This algorithm doesn't find all types of self-intersections.
# It is tuned to detect vertex/vertex, vertex/edge, edge/edge,
# vertex/face and edge/face intersections. Face/face
# intersections detection is switched off as it is a
# time-consuming operation that gives an impact on performance.
# To find all self-intersections please use
# CheckSelfIntersections() method.
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# @note Passed compounds (via ListShapes or via ListTools)
2008-03-07 07:45:34 +00:00
# have to consist of nonintersecting shapes.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shapes.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2008-03-07 07:45:34 +00:00
def MakePartitionNonSelfIntersectedShape ( self , ListShapes , ListTools = [ ] ,
ListKeepInside = [ ] , ListRemoveInside = [ ] ,
2012-08-09 07:58:02 +00:00
Limit = ShapeType [ " AUTO " ] , RemoveWebs = 0 ,
2013-02-12 11:35:16 +00:00
ListMaterials = [ ] , KeepNonlimitShapes = 0 ,
2013-11-26 07:06:56 +00:00
checkSelfInte = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform partition operation .
This method may be useful if it is needed to make a partition for
compound contains nonintersected shapes . Performance will be better
since intersection between shapes from compound is not performed .
2014-06-25 18:28:02 +04:00
Parameters :
2014-02-26 13:13:55 +04:00
Description of all parameters as in method geompy . MakePartition .
One additional parameter is provided :
checkSelfInte The flag that tells if the arguments should
be checked for self - intersection prior to
the operation .
Note :
This algorithm doesn ' t find all types of self-intersections.
It is tuned to detect vertex / vertex , vertex / edge , edge / edge ,
vertex / face and edge / face intersections . Face / face
intersections detection is switched off as it is a
time - consuming operation that gives an impact on performance .
To find all self - intersections please use
CheckSelfIntersections ( ) method .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
NOTE :
Passed compounds ( via ListShapes or via ListTools )
have to consist of nonintersecting shapes .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shapes .
"""
2013-04-04 07:06:43 +00:00
if Limit == self . ShapeType [ " AUTO " ] :
2012-08-09 07:58:02 +00:00
# automatic detection of the most appropriate shape limit type
lim = GEOM . SHAPE
for s in ListShapes : lim = min ( lim , s . GetMaxShapeType ( ) )
Limit = EnumToLong ( lim )
pass
2008-03-07 07:45:34 +00:00
anObj = self . BoolOp . MakePartitionNonSelfIntersectedShape ( ListShapes , ListTools ,
ListKeepInside , ListRemoveInside ,
Limit , RemoveWebs , ListMaterials ,
2013-11-26 07:06:56 +00:00
KeepNonlimitShapes , checkSelfInte ) ;
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakePartitionNonSelfIntersectedShape " , self . BoolOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " partition " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## See method MakePartition() for more information.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_partition "Example 1"
# \n @ref swig_Partition "Example 2"
2008-03-07 07:45:34 +00:00
def Partition ( self , ListShapes , ListTools = [ ] , ListKeepInside = [ ] , ListRemoveInside = [ ] ,
2012-08-09 07:58:02 +00:00
Limit = ShapeType [ " AUTO " ] , RemoveWebs = 0 , ListMaterials = [ ] ,
2014-02-26 13:13:55 +04:00
KeepNonlimitShapes = 0 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
See method geompy . MakePartition for more information .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakePartition()
2008-03-07 07:45:34 +00:00
anObj = self . MakePartition ( ListShapes , ListTools ,
ListKeepInside , ListRemoveInside ,
Limit , RemoveWebs , ListMaterials ,
2014-02-26 13:13:55 +04:00
KeepNonlimitShapes , theName ) ;
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform partition of the Shape with the Plane
# @param theShape Shape to be intersected.
# @param thePlane Tool shape, to intersect theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_partition "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BoolOp " )
2014-02-26 13:13:55 +04:00
def MakeHalfPartition ( self , theShape , thePlane , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform partition of the Shape with the Plane
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to be intersected .
thePlane Tool shape , to intersect theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2014-02-26 13:13:55 +04:00
anObj = self . BoolOp . MakeHalfPartition ( theShape , thePlane )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " MakeHalfPartition " , self . BoolOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " partition " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_basic_op
## @}
## @addtogroup l3_transform
## @{
2013-02-12 11:35:16 +00:00
## Translate the given object along the vector, specified
# by its end points.
# @param theObject The object to be translated.
# @param thePoint1 Start point of translation vector.
# @param thePoint2 End point of translation vector.
# @param theCopy Flag used to translate object itself or create a copy.
# @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def TranslateTwoPoints ( self , theObject , thePoint1 , thePoint2 , theCopy = False ) :
"""
Translate the given object along the vector , specified by its end points .
2014-06-25 18:28:02 +04:00
Parameters :
2013-02-12 11:35:16 +00:00
theObject The object to be translated .
thePoint1 Start point of translation vector .
thePoint2 End point of translation vector .
theCopy Flag used to translate object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Translated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the translated object if theCopy flag is True .
"""
if theCopy :
anObj = self . TrsfOp . TranslateTwoPointsCopy ( theObject , thePoint1 , thePoint2 )
else :
anObj = self . TrsfOp . TranslateTwoPoints ( theObject , thePoint1 , thePoint2 )
RaiseIfFailed ( " TranslateTwoPoints " , self . TrsfOp )
return anObj
2008-03-07 07:45:34 +00:00
## Translate the given object along the vector, specified
# by its end points, creating its copy before the translation.
# @param theObject The object to be translated.
# @param thePoint1 Start point of translation vector.
# @param thePoint2 End point of translation vector.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the translated object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_translation "Example 1"
# \n @ref swig_MakeTranslationTwoPoints "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeTranslationTwoPoints ( self , theObject , thePoint1 , thePoint2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the vector , specified
by its end points , creating its copy before the translation .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject The object to be translated .
thePoint1 Start point of translation vector .
thePoint2 End point of translation vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the translated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . TranslateTwoPointsCopy ( theObject , thePoint1 , thePoint2 )
RaiseIfFailed ( " TranslateTwoPointsCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " translated " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Translate the given object along the vector, specified by its components.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
2013-02-12 11:35:16 +00:00
# @param theCopy Flag used to translate object itself or create a copy.
# @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
2009-02-13 12:16:39 +00:00
#
# @ref tui_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def TranslateDXDYDZ ( self , theObject , theDX , theDY , theDZ , theCopy = False ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the vector , specified by its components .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject The object to be translated .
theDX , theDY , theDZ Components of translation vector .
2013-02-12 11:35:16 +00:00
theCopy Flag used to translate object itself or create a copy .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Translated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the translated object if theCopy flag is True .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
2013-02-12 11:35:16 +00:00
if theCopy :
anObj = self . TrsfOp . TranslateDXDYDZCopy ( theObject , theDX , theDY , theDZ )
else :
anObj = self . TrsfOp . TranslateDXDYDZ ( theObject , theDX , theDY , theDZ )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
RaiseIfFailed ( " TranslateDXDYDZ " , self . TrsfOp )
return anObj
2008-03-07 07:45:34 +00:00
## Translate the given object along the vector, specified
# by its components, creating its copy before the translation.
# @param theObject The object to be translated.
# @param theDX,theDY,theDZ Components of translation vector.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the translated object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeTranslation ( self , theObject , theDX , theDY , theDZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the vector , specified
by its components , creating its copy before the translation .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject The object to be translated .
theDX , theDY , theDZ Components of translation vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the translated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDX , theDY , theDZ , Parameters = ParseParameters ( theDX , theDY , theDZ )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . TranslateDXDYDZCopy ( theObject , theDX , theDY , theDZ )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " TranslateDXDYDZ " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " translated " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## Translate the given object along the given vector.
2009-02-13 12:16:39 +00:00
# @param theObject The object to be translated.
# @param theVector The translation vector.
2013-02-12 11:35:16 +00:00
# @param theCopy Flag used to translate object itself or create a copy.
# @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def TranslateVector ( self , theObject , theVector , theCopy = False ) :
"""
Translate the given object along the given vector .
2014-06-25 18:28:02 +04:00
Parameters :
2013-02-12 11:35:16 +00:00
theObject The object to be translated .
theVector The translation vector .
theCopy Flag used to translate object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Translated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the translated object if theCopy flag is True .
"""
if theCopy :
anObj = self . TrsfOp . TranslateVectorCopy ( theObject , theVector )
else :
anObj = self . TrsfOp . TranslateVector ( theObject , theVector )
RaiseIfFailed ( " TranslateVector " , self . TrsfOp )
return anObj
## Translate the given object along the given vector,
# creating its copy before the translation.
# @param theObject The object to be translated.
# @param theVector The translation vector.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the translated object.
#
2009-02-13 12:16:39 +00:00
# @ref tui_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeTranslationVector ( self , theObject , theVector , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the given vector ,
creating its copy before the translation .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject The object to be translated .
theVector The translation vector .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the translated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . TrsfOp . TranslateVectorCopy ( theObject , theVector )
RaiseIfFailed ( " TranslateVectorCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " translated " )
2009-02-13 12:16:39 +00:00
return anObj
## Translate the given object along the given vector on given distance.
# @param theObject The object to be translated.
# @param theVector The translation vector.
# @param theDistance The translation distance.
# @param theCopy Flag used to translate object itself or create a copy.
2013-02-12 11:35:16 +00:00
# @return Translated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the translated object if @a theCopy flag is @c True.
2009-02-13 12:16:39 +00:00
#
# @ref tui_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def TranslateVectorDistance ( self , theObject , theVector , theDistance , theCopy = False ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the given vector on given distance .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theObject The object to be translated .
theVector The translation vector .
theDistance The translation distance .
theCopy Flag used to translate object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Translated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the translated object if theCopy flag is True .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDistance , Parameters = ParseParameters ( theDistance )
anObj = self . TrsfOp . TranslateVectorDistance ( theObject , theVector , theDistance , theCopy )
RaiseIfFailed ( " TranslateVectorDistance " , self . TrsfOp )
anObj . SetParameters ( Parameters )
return anObj
## Translate the given object along the given vector on given distance,
2008-03-07 07:45:34 +00:00
# creating its copy before the translation.
# @param theObject The object to be translated.
# @param theVector The translation vector.
2009-02-13 12:16:39 +00:00
# @param theDistance The translation distance.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the translated object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeTranslationVectorDistance ( self , theObject , theVector , theDistance , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the given vector on given distance ,
creating its copy before the translation .
Parameters :
theObject The object to be translated .
theVector The translation vector .
theDistance The translation distance .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the translated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theDistance , Parameters = ParseParameters ( theDistance )
anObj = self . TrsfOp . TranslateVectorDistance ( theObject , theVector , theDistance , 1 )
RaiseIfFailed ( " TranslateVectorDistance " , self . TrsfOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " translated " )
2009-02-13 12:16:39 +00:00
return anObj
## Rotate the given object around the given axis on the given angle.
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
2013-02-12 11:35:16 +00:00
# @param theCopy Flag used to rotate object itself or create a copy.
#
# @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
2009-02-13 12:16:39 +00:00
#
# @ref tui_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def Rotate ( self , theObject , theAxis , theAngle , theCopy = False ) :
2012-08-09 07:58:02 +00:00
"""
Rotate the given object around the given axis on the given angle .
Parameters :
theObject The object to be rotated .
theAxis Rotation axis .
theAngle Rotation angle in radians .
2013-02-12 11:35:16 +00:00
theCopy Flag used to rotate object itself or create a copy .
2012-08-09 07:58:02 +00:00
2013-02-12 11:35:16 +00:00
Returns :
Rotated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the rotated object if theCopy flag is True .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
flag = False
if isinstance ( theAngle , str ) :
flag = True
theAngle , Parameters = ParseParameters ( theAngle )
if flag :
theAngle = theAngle * math . pi / 180.0
2013-02-12 11:35:16 +00:00
if theCopy :
anObj = self . TrsfOp . RotateCopy ( theObject , theAxis , theAngle )
else :
anObj = self . TrsfOp . Rotate ( theObject , theAxis , theAngle )
RaiseIfFailed ( " Rotate " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2008-03-07 07:45:34 +00:00
return anObj
## Rotate the given object around the given axis
2014-08-11 11:54:38 +02:00
# on the given angle, creating its copy before the rotation.
2008-03-07 07:45:34 +00:00
# @param theObject The object to be rotated.
# @param theAxis Rotation axis.
# @param theAngle Rotation angle in radians.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the rotated object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeRotation ( self , theObject , theAxis , theAngle , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Rotate the given object around the given axis
on the given angle , creating its copy before the rotatation .
Parameters :
theObject The object to be rotated .
theAxis Rotation axis .
theAngle Rotation angle in radians .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the rotated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
flag = False
if isinstance ( theAngle , str ) :
flag = True
theAngle , Parameters = ParseParameters ( theAngle )
if flag :
theAngle = theAngle * math . pi / 180.0
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . RotateCopy ( theObject , theAxis , theAngle )
RaiseIfFailed ( " RotateCopy " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " rotated " )
return anObj
## Rotate given object around vector perpendicular to plane
# containing three points.
# @param theObject The object to be rotated.
# @param theCentPoint central point the axis is the vector perpendicular to the plane
# containing the three points.
# @param thePoint1,thePoint2 points in a perpendicular plane of the axis.
# @param theCopy Flag used to rotate object itself or create a copy.
# @return Rotated @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the rotated object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def RotateThreePoints ( self , theObject , theCentPoint , thePoint1 , thePoint2 , theCopy = False ) :
"""
Rotate given object around vector perpendicular to plane
containing three points .
Parameters :
theObject The object to be rotated .
theCentPoint central point the axis is the vector perpendicular to the plane
containing the three points .
thePoint1 , thePoint2 points in a perpendicular plane of the axis .
theCopy Flag used to rotate object itself or create a copy .
Returns :
Rotated theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the rotated object if theCopy flag is True .
"""
if theCopy :
anObj = self . TrsfOp . RotateThreePointsCopy ( theObject , theCentPoint , thePoint1 , thePoint2 )
else :
anObj = self . TrsfOp . RotateThreePoints ( theObject , theCentPoint , thePoint1 , thePoint2 )
RaiseIfFailed ( " RotateThreePoints " , self . TrsfOp )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Rotate given object around vector perpendicular to plane
# containing three points, creating its copy before the rotatation.
# @param theObject The object to be rotated.
2012-08-09 07:58:02 +00:00
# @param theCentPoint central point the axis is the vector perpendicular to the plane
2008-03-07 07:45:34 +00:00
# containing the three points.
2012-08-09 07:58:02 +00:00
# @param thePoint1,thePoint2 in a perpendicular plane of the axis.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the rotated object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeRotationThreePoints ( self , theObject , theCentPoint , thePoint1 , thePoint2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Rotate given object around vector perpendicular to plane
containing three points , creating its copy before the rotatation .
Parameters :
theObject The object to be rotated .
theCentPoint central point the axis is the vector perpendicular to the plane
containing the three points .
thePoint1 , thePoint2 in a perpendicular plane of the axis .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the rotated object .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . RotateThreePointsCopy ( theObject , theCentPoint , thePoint1 , thePoint2 )
RaiseIfFailed ( " RotateThreePointsCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " rotated " )
return anObj
## Scale the given object by the specified factor.
# @param theObject The object to be scaled.
# @param thePoint Center point for scaling.
# Passing None for it means scaling relatively the origin of global CS.
# @param theFactor Scaling factor value.
# @param theCopy Flag used to scale object itself or create a copy.
# @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def Scale ( self , theObject , thePoint , theFactor , theCopy = False ) :
"""
Scale the given object by the specified factor .
Parameters :
theObject The object to be scaled .
thePoint Center point for scaling .
Passing None for it means scaling relatively the origin of global CS .
theFactor Scaling factor value .
theCopy Flag used to scale object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Scaled theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the scaled object if theCopy flag is True .
"""
# Example: see GEOM_TestAll.py
theFactor , Parameters = ParseParameters ( theFactor )
if theCopy :
anObj = self . TrsfOp . ScaleShapeCopy ( theObject , thePoint , theFactor )
else :
anObj = self . TrsfOp . ScaleShape ( theObject , thePoint , theFactor )
RaiseIfFailed ( " Scale " , self . TrsfOp )
anObj . SetParameters ( Parameters )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Scale the given object by the factor, creating its copy before the scaling.
# @param theObject The object to be scaled.
# @param thePoint Center point for scaling.
2009-02-13 12:16:39 +00:00
# Passing None for it means scaling relatively the origin of global CS.
2008-03-07 07:45:34 +00:00
# @param theFactor Scaling factor value.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the scaled shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_scale "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeScaleTransform ( self , theObject , thePoint , theFactor , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Scale the given object by the factor , creating its copy before the scaling .
Parameters :
theObject The object to be scaled .
thePoint Center point for scaling .
Passing None for it means scaling relatively the origin of global CS .
theFactor Scaling factor value .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the scaled shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theFactor , Parameters = ParseParameters ( theFactor )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . ScaleShapeCopy ( theObject , thePoint , theFactor )
RaiseIfFailed ( " ScaleShapeCopy " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " scaled " )
return anObj
## Scale the given object by different factors along coordinate axes.
# @param theObject The object to be scaled.
# @param thePoint Center point for scaling.
# Passing None for it means scaling relatively the origin of global CS.
# @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
# @param theCopy Flag used to scale object itself or create a copy.
# @return Scaled @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the scaled object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def ScaleAlongAxes ( self , theObject , thePoint , theFactorX , theFactorY , theFactorZ , theCopy = False ) :
"""
Scale the given object by different factors along coordinate axes .
Parameters :
theObject The object to be scaled .
thePoint Center point for scaling .
Passing None for it means scaling relatively the origin of global CS .
theFactorX , theFactorY , theFactorZ Scaling factors along each axis .
theCopy Flag used to scale object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Scaled theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the scaled object if theCopy flag is True .
"""
# Example: see GEOM_TestAll.py
theFactorX , theFactorY , theFactorZ , Parameters = ParseParameters ( theFactorX , theFactorY , theFactorZ )
if theCopy :
anObj = self . TrsfOp . ScaleShapeAlongAxesCopy ( theObject , thePoint ,
theFactorX , theFactorY , theFactorZ )
else :
anObj = self . TrsfOp . ScaleShapeAlongAxes ( theObject , thePoint ,
theFactorX , theFactorY , theFactorZ )
RaiseIfFailed ( " ScaleAlongAxes " , self . TrsfOp )
anObj . SetParameters ( Parameters )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
## Scale the given object by different factors along coordinate axes,
# creating its copy before the scaling.
# @param theObject The object to be scaled.
# @param thePoint Center point for scaling.
# Passing None for it means scaling relatively the origin of global CS.
# @param theFactorX,theFactorY,theFactorZ Scaling factors along each axis.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the scaled shape.
2009-02-13 12:16:39 +00:00
#
# @ref swig_scale "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeScaleAlongAxes ( self , theObject , thePoint , theFactorX , theFactorY , theFactorZ , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Scale the given object by different factors along coordinate axes ,
creating its copy before the scaling .
Parameters :
theObject The object to be scaled .
thePoint Center point for scaling .
Passing None for it means scaling relatively the origin of global CS .
theFactorX , theFactorY , theFactorZ Scaling factors along each axis .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the scaled shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theFactorX , theFactorY , theFactorZ , Parameters = ParseParameters ( theFactorX , theFactorY , theFactorZ )
anObj = self . TrsfOp . ScaleShapeAlongAxesCopy ( theObject , thePoint ,
theFactorX , theFactorY , theFactorZ )
RaiseIfFailed ( " MakeScaleAlongAxes " , self . TrsfOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " scaled " )
return anObj
## Mirror an object relatively the given plane.
# @param theObject The object to be mirrored.
# @param thePlane Plane of symmetry.
# @param theCopy Flag used to mirror object itself or create a copy.
# @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MirrorByPlane ( self , theObject , thePlane , theCopy = False ) :
"""
Mirror an object relatively the given plane .
Parameters :
theObject The object to be mirrored .
thePlane Plane of symmetry .
theCopy Flag used to mirror object itself or create a copy .
Returns :
Mirrored theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the mirrored object if theCopy flag is True .
"""
if theCopy :
anObj = self . TrsfOp . MirrorPlaneCopy ( theObject , thePlane )
else :
anObj = self . TrsfOp . MirrorPlane ( theObject , thePlane )
RaiseIfFailed ( " MirrorByPlane " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Create an object, symmetrical
# to the given one relatively the given plane.
# @param theObject The object to be mirrored.
# @param thePlane Plane of symmetry.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the mirrored shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_mirror "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeMirrorByPlane ( self , theObject , thePlane , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an object , symmetrical to the given one relatively the given plane .
Parameters :
theObject The object to be mirrored .
thePlane Plane of symmetry .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the mirrored shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MirrorPlaneCopy ( theObject , thePlane )
RaiseIfFailed ( " MirrorPlaneCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " mirrored " )
return anObj
## Mirror an object relatively the given axis.
# @param theObject The object to be mirrored.
# @param theAxis Axis of symmetry.
# @param theCopy Flag used to mirror object itself or create a copy.
# @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MirrorByAxis ( self , theObject , theAxis , theCopy = False ) :
"""
Mirror an object relatively the given axis .
Parameters :
theObject The object to be mirrored .
theAxis Axis of symmetry .
theCopy Flag used to mirror object itself or create a copy .
Returns :
Mirrored theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the mirrored object if theCopy flag is True .
"""
if theCopy :
anObj = self . TrsfOp . MirrorAxisCopy ( theObject , theAxis )
else :
anObj = self . TrsfOp . MirrorAxis ( theObject , theAxis )
RaiseIfFailed ( " MirrorByAxis " , self . TrsfOp )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create an object, symmetrical
# to the given one relatively the given axis.
# @param theObject The object to be mirrored.
# @param theAxis Axis of symmetry.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the mirrored shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_mirror "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeMirrorByAxis ( self , theObject , theAxis , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an object , symmetrical to the given one relatively the given axis .
Parameters :
theObject The object to be mirrored .
theAxis Axis of symmetry .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the mirrored shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MirrorAxisCopy ( theObject , theAxis )
RaiseIfFailed ( " MirrorAxisCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " mirrored " )
return anObj
## Mirror an object relatively the given point.
# @param theObject The object to be mirrored.
# @param thePoint Point of symmetry.
# @param theCopy Flag used to mirror object itself or create a copy.
# @return Mirrored @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the mirrored object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MirrorByPoint ( self , theObject , thePoint , theCopy = False ) :
"""
Mirror an object relatively the given point .
Parameters :
theObject The object to be mirrored .
thePoint Point of symmetry .
theCopy Flag used to mirror object itself or create a copy .
Returns :
Mirrored theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the mirrored object if theCopy flag is True .
"""
# Example: see GEOM_TestAll.py
if theCopy :
anObj = self . TrsfOp . MirrorPointCopy ( theObject , thePoint )
else :
anObj = self . TrsfOp . MirrorPoint ( theObject , thePoint )
RaiseIfFailed ( " MirrorByPoint " , self . TrsfOp )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create an object, symmetrical
# to the given one relatively the given point.
# @param theObject The object to be mirrored.
# @param thePoint Point of symmetry.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the mirrored shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_mirror "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeMirrorByPoint ( self , theObject , thePoint , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create an object , symmetrical
to the given one relatively the given point .
Parameters :
theObject The object to be mirrored .
thePoint Point of symmetry .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the mirrored shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MirrorPointCopy ( theObject , thePoint )
RaiseIfFailed ( " MirrorPointCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " mirrored " )
return anObj
## Modify the location of the given object.
# @param theObject The object to be displaced.
# @param theStartLCS Coordinate system to perform displacement from it.\n
# If \a theStartLCS is NULL, displacement
# will be performed from global CS.\n
# If \a theObject itself is used as \a theStartLCS,
# its location will be changed to \a theEndLCS.
# @param theEndLCS Coordinate system to perform displacement to it.
# @param theCopy Flag used to displace object itself or create a copy.
# @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the displaced object if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def Position ( self , theObject , theStartLCS , theEndLCS , theCopy = False ) :
"""
Modify the Location of the given object by LCS , creating its copy before the setting .
Parameters :
theObject The object to be displaced .
theStartLCS Coordinate system to perform displacement from it .
If theStartLCS is NULL , displacement
will be performed from global CS .
If theObject itself is used as theStartLCS ,
its location will be changed to theEndLCS .
theEndLCS Coordinate system to perform displacement to it .
theCopy Flag used to displace object itself or create a copy .
Returns :
Displaced theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the displaced object if theCopy flag is True .
"""
# Example: see GEOM_TestAll.py
if theCopy :
anObj = self . TrsfOp . PositionShapeCopy ( theObject , theStartLCS , theEndLCS )
else :
anObj = self . TrsfOp . PositionShape ( theObject , theStartLCS , theEndLCS )
RaiseIfFailed ( " Displace " , self . TrsfOp )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Modify the Location of the given object by LCS,
# creating its copy before the setting.
# @param theObject The object to be displaced.
2012-08-09 07:58:02 +00:00
# @param theStartLCS Coordinate system to perform displacement from it.\n
2008-03-07 07:45:34 +00:00
# If \a theStartLCS is NULL, displacement
2012-08-09 07:58:02 +00:00
# will be performed from global CS.\n
2008-03-07 07:45:34 +00:00
# If \a theObject itself is used as \a theStartLCS,
# its location will be changed to \a theEndLCS.
# @param theEndLCS Coordinate system to perform displacement to it.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the displaced shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_modify_location "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakePosition ( self , theObject , theStartLCS , theEndLCS , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Modify the Location of the given object by LCS , creating its copy before the setting .
Parameters :
theObject The object to be displaced .
theStartLCS Coordinate system to perform displacement from it .
If theStartLCS is NULL , displacement
will be performed from global CS .
If theObject itself is used as theStartLCS ,
its location will be changed to theEndLCS .
theEndLCS Coordinate system to perform displacement to it .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the displaced shape .
Example of usage :
# create local coordinate systems
cs1 = geompy . MakeMarker ( 0 , 0 , 0 , 1 , 0 , 0 , 0 , 1 , 0 )
cs2 = geompy . MakeMarker ( 30 , 40 , 40 , 1 , 0 , 0 , 0 , 1 , 0 )
# modify the location of the given object
position = geompy . MakePosition ( cylinder , cs1 , cs2 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . PositionShapeCopy ( theObject , theStartLCS , theEndLCS )
RaiseIfFailed ( " PositionShapeCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " displaced " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## Modify the Location of the given object by Path.
2009-02-13 12:16:39 +00:00
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
2012-08-09 07:58:02 +00:00
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
# @param theCopy is to create a copy objects if true.
# @param theReverse 0 - for usual direction, 1 - to reverse path direction.
2013-02-12 11:35:16 +00:00
# @return Displaced @a theObject (GEOM.GEOM_Object) if @a theCopy is @c False or
# new GEOM.GEOM_Object, containing the displaced shape if @a theCopy is @c True.
2009-02-13 12:16:39 +00:00
#
# @ref tui_modify_location "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2009-02-13 12:16:39 +00:00
def PositionAlongPath ( self , theObject , thePath , theDistance , theCopy , theReverse ) :
2012-08-09 07:58:02 +00:00
"""
2013-02-12 11:35:16 +00:00
Modify the Location of the given object by Path .
2012-08-09 07:58:02 +00:00
Parameters :
theObject The object to be displaced .
thePath Wire or Edge along that the object will be translated .
theDistance progress of Path ( 0 = start location , 1 = end of path location ) .
theCopy is to create a copy objects if true .
theReverse 0 - for usual direction , 1 - to reverse path direction .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Displaced theObject ( GEOM . GEOM_Object ) if theCopy is False or
new GEOM . GEOM_Object , containing the displaced shape if theCopy is True .
2012-08-09 07:58:02 +00:00
Example of usage :
position = geompy . PositionAlongPath ( cylinder , circle , 0.75 , 1 , 1 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . TrsfOp . PositionAlongPath ( theObject , thePath , theDistance , theCopy , theReverse )
RaiseIfFailed ( " PositionAlongPath " , self . TrsfOp )
return anObj
2013-02-12 11:35:16 +00:00
## Modify the Location of the given object by Path, creating its copy before the operation.
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
# @param theReverse 0 - for usual direction, 1 - to reverse path direction.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the displaced shape.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakePositionAlongPath ( self , theObject , thePath , theDistance , theReverse , theName = None ) :
"""
Modify the Location of the given object by Path , creating its copy before the operation .
Parameters :
theObject The object to be displaced .
thePath Wire or Edge along that the object will be translated .
theDistance progress of Path ( 0 = start location , 1 = end of path location ) .
theReverse 0 - for usual direction , 1 - to reverse path direction .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM . GEOM_Object , containing the displaced shape .
"""
# Example: see GEOM_TestAll.py
anObj = self . TrsfOp . PositionAlongPath ( theObject , thePath , theDistance , 1 , theReverse )
RaiseIfFailed ( " PositionAlongPath " , self . TrsfOp )
self . _autoPublish ( anObj , theName , " displaced " )
return anObj
## Offset given shape.
# @param theObject The base object for the offset.
# @param theOffset Offset value.
# @param theCopy Flag used to offset object itself or create a copy.
# @return Modified @a theObject (GEOM.GEOM_Object) if @a theCopy flag is @c False (default) or
# new GEOM.GEOM_Object, containing the result of offset operation if @a theCopy flag is @c True.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def Offset ( self , theObject , theOffset , theCopy = False ) :
"""
Offset given shape .
Parameters :
theObject The base object for the offset .
theOffset Offset value .
theCopy Flag used to offset object itself or create a copy .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Modified theObject ( GEOM . GEOM_Object ) if theCopy flag is False ( default ) or
new GEOM . GEOM_Object , containing the result of offset operation if theCopy flag is True .
"""
theOffset , Parameters = ParseParameters ( theOffset )
if theCopy :
anObj = self . TrsfOp . OffsetShapeCopy ( theObject , theOffset )
else :
anObj = self . TrsfOp . OffsetShape ( theObject , theOffset )
RaiseIfFailed ( " Offset " , self . TrsfOp )
anObj . SetParameters ( Parameters )
return anObj
2008-03-07 07:45:34 +00:00
## Create new object as offset of the given one.
# @param theObject The base object for the offset.
# @param theOffset Offset value.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the offset object.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_offset "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeOffset ( self , theObject , theOffset , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create new object as offset of the given one .
Parameters :
theObject The base object for the offset .
theOffset Offset value .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the offset object .
Example of usage :
box = geompy . MakeBox ( 20 , 20 , 20 , 200 , 200 , 200 )
# create a new object as offset of the given object
offset = geompy . MakeOffset ( box , 70. )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theOffset , Parameters = ParseParameters ( theOffset )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . OffsetShapeCopy ( theObject , theOffset )
RaiseIfFailed ( " OffsetShapeCopy " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " offset " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-11-21 20:25:48 +03:00
## Create new object as projection of the given one on another.
2012-08-09 07:58:02 +00:00
# @param theSource The source object for the projection. It can be a point, edge or wire.
2014-11-21 20:25:48 +03:00
# Edge and wire are acceptable if @a theTarget is a face.
# @param theTarget The target object. It can be planar or cylindrical face, edge or wire.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the projection.
#
# @ref tui_projection "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeProjection ( self , theSource , theTarget , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-11-21 20:25:48 +03:00
Create new object as projection of the given one on another .
2012-08-09 07:58:02 +00:00
Parameters :
theSource The source object for the projection . It can be a point , edge or wire .
2014-11-21 20:25:48 +03:00
Edge and wire are acceptable if theTarget is a face .
theTarget The target object . It can be planar or cylindrical face , edge or wire .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the projection .
"""
# Example: see GEOM_TestAll.py
anObj = self . TrsfOp . ProjectShapeCopy ( theSource , theTarget )
RaiseIfFailed ( " ProjectShapeCopy " , self . TrsfOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " projection " )
2012-08-09 07:58:02 +00:00
return anObj
2014-06-25 18:28:02 +04:00
2013-10-21 09:02:19 +00:00
## Create a projection projection of the given point on a wire or an edge.
# If there are no solutions or there are 2 or more solutions It throws an
# exception.
# @param thePoint the point to be projected.
# @param theWire the wire. The edge is accepted as well.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return [\a u, \a PointOnEdge, \a EdgeInWireIndex]
# \n \a u: The parameter of projection point on edge.
# \n \a PointOnEdge: The projection point.
# \n \a EdgeInWireIndex: The index of an edge in a wire.
#
# @ref tui_projection "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-10-21 09:02:19 +00:00
def MakeProjectionOnWire ( self , thePoint , theWire , theName = None ) :
"""
Create a projection projection of the given point on a wire or an edge .
If there are no solutions or there are 2 or more solutions It throws an
exception .
2014-06-25 18:28:02 +04:00
2013-10-21 09:02:19 +00:00
Parameters :
thePoint the point to be projected .
theWire the wire . The edge is accepted as well .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
2013-10-21 09:02:19 +00:00
Returns :
[ u , PointOnEdge , EdgeInWireIndex ]
u : The parameter of projection point on edge .
PointOnEdge : The projection point .
EdgeInWireIndex : The index of an edge in a wire .
"""
# Example: see GEOM_TestAll.py
anObj = self . TrsfOp . ProjectPointOnWire ( thePoint , theWire )
RaiseIfFailed ( " ProjectPointOnWire " , self . TrsfOp )
self . _autoPublish ( anObj [ 1 ] , theName , " projection " )
return anObj
2012-08-09 07:58:02 +00:00
2008-03-07 07:45:34 +00:00
# -----------------------------------------------------------------------------
# Patterns
# -----------------------------------------------------------------------------
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Translate the given object along the given vector a given number times
# @param theObject The object to be translated.
2013-02-12 11:35:16 +00:00
# @param theVector Direction of the translation. DX if None.
2008-03-07 07:45:34 +00:00
# @param theStep Distance to translate on.
# @param theNbTimes Quantity of translations to be done.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing compound of all
2008-03-07 07:45:34 +00:00
# the shapes, obtained after each translation.
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeMultiTranslation1D ( self , theObject , theVector , theStep , theNbTimes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Translate the given object along the given vector a given number times
Parameters :
theObject The object to be translated .
2013-02-12 11:35:16 +00:00
theVector Direction of the translation . DX if None .
2012-08-09 07:58:02 +00:00
theStep Distance to translate on .
theNbTimes Quantity of translations to be done .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing compound of all
the shapes , obtained after each translation .
Example of usage :
r1d = geompy . MakeMultiTranslation1D ( prism , vect , 20 , 4 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theStep , theNbTimes , Parameters = ParseParameters ( theStep , theNbTimes )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MultiTranslate1D ( theObject , theVector , theStep , theNbTimes )
RaiseIfFailed ( " MultiTranslate1D " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " multitranslation " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Conseqently apply two specified translations to theObject specified number of times.
# @param theObject The object to be translated.
2013-02-12 11:35:16 +00:00
# @param theVector1 Direction of the first translation. DX if None.
2008-03-07 07:45:34 +00:00
# @param theStep1 Step of the first translation.
# @param theNbTimes1 Quantity of translations to be done along theVector1.
2013-02-12 11:35:16 +00:00
# @param theVector2 Direction of the second translation. DY if None.
2008-03-07 07:45:34 +00:00
# @param theStep2 Step of the second translation.
# @param theNbTimes2 Quantity of translations to be done along theVector2.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing compound of all
2008-03-07 07:45:34 +00:00
# the shapes, obtained after each translation.
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_translation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MakeMultiTranslation2D ( self , theObject , theVector1 , theStep1 , theNbTimes1 ,
theVector2 , theStep2 , theNbTimes2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Conseqently apply two specified translations to theObject specified number of times .
Parameters :
theObject The object to be translated .
2013-02-12 11:35:16 +00:00
theVector1 Direction of the first translation . DX if None .
2012-08-09 07:58:02 +00:00
theStep1 Step of the first translation .
theNbTimes1 Quantity of translations to be done along theVector1 .
2013-02-12 11:35:16 +00:00
theVector2 Direction of the second translation . DY if None .
2012-08-09 07:58:02 +00:00
theStep2 Step of the second translation .
theNbTimes2 Quantity of translations to be done along theVector2 .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing compound of all
the shapes , obtained after each translation .
Example of usage :
tr2d = geompy . MakeMultiTranslation2D ( prism , vect1 , 20 , 4 , vect2 , 80 , 3 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theStep1 , theNbTimes1 , theStep2 , theNbTimes2 , Parameters = ParseParameters ( theStep1 , theNbTimes1 , theStep2 , theNbTimes2 )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MultiTranslate2D ( theObject , theVector1 , theStep1 , theNbTimes1 ,
theVector2 , theStep2 , theNbTimes2 )
RaiseIfFailed ( " MultiTranslate2D " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " multitranslation " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Rotate the given object around the given axis a given number times.
# Rotation angle will be 2*PI/theNbTimes.
# @param theObject The object to be rotated.
2013-02-12 11:35:16 +00:00
# @param theAxis The rotation axis. DZ if None.
2008-03-07 07:45:34 +00:00
# @param theNbTimes Quantity of rotations to be done.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing compound of all the
2008-03-07 07:45:34 +00:00
# shapes, obtained after each rotation.
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MultiRotate1DNbTimes ( self , theObject , theAxis , theNbTimes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Rotate the given object around the given axis a given number times .
Rotation angle will be 2 * PI / theNbTimes .
Parameters :
theObject The object to be rotated .
2013-02-12 11:35:16 +00:00
theAxis The rotation axis . DZ if None .
2012-08-09 07:58:02 +00:00
theNbTimes Quantity of rotations to be done .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing compound of all the
shapes , obtained after each rotation .
Example of usage :
2013-02-12 11:35:16 +00:00
rot1d = geompy . MultiRotate1DNbTimes ( prism , vect , 4 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2013-02-12 11:35:16 +00:00
theNbTimes , Parameters = ParseParameters ( theNbTimes )
2008-03-07 07:45:34 +00:00
anObj = self . TrsfOp . MultiRotate1D ( theObject , theAxis , theNbTimes )
2013-02-12 11:35:16 +00:00
RaiseIfFailed ( " MultiRotate1DNbTimes " , self . TrsfOp )
anObj . SetParameters ( Parameters )
self . _autoPublish ( anObj , theName , " multirotation " )
return anObj
## Rotate the given object around the given axis
# a given number times on the given angle.
# @param theObject The object to be rotated.
# @param theAxis The rotation axis. DZ if None.
# @param theAngleStep Rotation angle in radians.
# @param theNbTimes Quantity of rotations to be done.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing compound of all the
# shapes, obtained after each rotation.
#
# @ref tui_multi_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MultiRotate1DByStep ( self , theObject , theAxis , theAngleStep , theNbTimes , theName = None ) :
"""
Rotate the given object around the given axis
a given number times on the given angle .
Parameters :
theObject The object to be rotated .
theAxis The rotation axis . DZ if None .
theAngleStep Rotation angle in radians .
theNbTimes Quantity of rotations to be done .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM . GEOM_Object , containing compound of all the
shapes , obtained after each rotation .
Example of usage :
rot1d = geompy . MultiRotate1DByStep ( prism , vect , math . pi / 4 , 4 )
"""
# Example: see GEOM_TestAll.py
theAngleStep , theNbTimes , Parameters = ParseParameters ( theAngleStep , theNbTimes )
anObj = self . TrsfOp . MultiRotate1DByStep ( theObject , theAxis , theAngleStep , theNbTimes )
RaiseIfFailed ( " MultiRotate1DByStep " , self . TrsfOp )
anObj . SetParameters ( Parameters )
self . _autoPublish ( anObj , theName , " multirotation " )
return anObj
## Rotate the given object around the given axis a given
# number times and multi-translate each rotation result.
# Rotation angle will be 2*PI/theNbTimes1.
# Translation direction passes through center of gravity
# of rotated shape and its projection on the rotation axis.
# @param theObject The object to be rotated.
# @param theAxis Rotation axis. DZ if None.
# @param theNbTimes1 Quantity of rotations to be done.
# @param theRadialStep Translation distance.
# @param theNbTimes2 Quantity of translations to be done.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing compound of all the
# shapes, obtained after each transformation.
#
# @ref tui_multi_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MultiRotate2DNbTimes ( self , theObject , theAxis , theNbTimes1 , theRadialStep , theNbTimes2 , theName = None ) :
"""
Rotate the given object around the
given axis on the given angle a given number
times and multi - translate each rotation result .
Translation direction passes through center of gravity
of rotated shape and its projection on the rotation axis .
Parameters :
theObject The object to be rotated .
theAxis Rotation axis . DZ if None .
theNbTimes1 Quantity of rotations to be done .
theRadialStep Translation distance .
theNbTimes2 Quantity of translations to be done .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM . GEOM_Object , containing compound of all the
shapes , obtained after each transformation .
Example of usage :
rot2d = geompy . MultiRotate2D ( prism , vect , 60 , 4 , 50 , 5 )
"""
# Example: see GEOM_TestAll.py
theNbTimes1 , theRadialStep , theNbTimes2 , Parameters = ParseParameters ( theNbTimes1 , theRadialStep , theNbTimes2 )
anObj = self . TrsfOp . MultiRotate2DNbTimes ( theObject , theAxis , theNbTimes1 , theRadialStep , theNbTimes2 )
RaiseIfFailed ( " MultiRotate2DNbTimes " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " multirotation " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Rotate the given object around the
# given axis on the given angle a given number
# times and multi-translate each rotation result.
# Translation direction passes through center of gravity
# of rotated shape and its projection on the rotation axis.
# @param theObject The object to be rotated.
2013-02-12 11:35:16 +00:00
# @param theAxis Rotation axis. DZ if None.
# @param theAngleStep Rotation angle in radians.
2008-03-07 07:45:34 +00:00
# @param theNbTimes1 Quantity of rotations to be done.
2013-02-12 11:35:16 +00:00
# @param theRadialStep Translation distance.
2008-03-07 07:45:34 +00:00
# @param theNbTimes2 Quantity of translations to be done.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing compound of all the
2008-03-07 07:45:34 +00:00
# shapes, obtained after each transformation.
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_rotation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MultiRotate2DByStep ( self , theObject , theAxis , theAngleStep , theNbTimes1 , theRadialStep , theNbTimes2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Rotate the given object around the
given axis on the given angle a given number
times and multi - translate each rotation result .
Translation direction passes through center of gravity
of rotated shape and its projection on the rotation axis .
Parameters :
theObject The object to be rotated .
2013-02-12 11:35:16 +00:00
theAxis Rotation axis . DZ if None .
theAngleStep Rotation angle in radians .
2012-08-09 07:58:02 +00:00
theNbTimes1 Quantity of rotations to be done .
2013-02-12 11:35:16 +00:00
theRadialStep Translation distance .
2012-08-09 07:58:02 +00:00
theNbTimes2 Quantity of translations to be done .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing compound of all the
shapes , obtained after each transformation .
Example of usage :
2013-02-12 11:35:16 +00:00
rot2d = geompy . MultiRotate2D ( prism , vect , math . pi / 3 , 4 , 50 , 5 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2013-02-12 11:35:16 +00:00
theAngleStep , theNbTimes1 , theRadialStep , theNbTimes2 , Parameters = ParseParameters ( theAngleStep , theNbTimes1 , theRadialStep , theNbTimes2 )
anObj = self . TrsfOp . MultiRotate2DByStep ( theObject , theAxis , theAngleStep , theNbTimes1 , theRadialStep , theNbTimes2 )
RaiseIfFailed ( " MultiRotate2DByStep " , self . TrsfOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " multirotation " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## The same, as MultiRotate1DNbTimes(), but axis is given by direction and point
#
# @ref swig_MakeMultiRotation "Example"
def MakeMultiRotation1DNbTimes ( self , aShape , aDir , aPoint , aNbTimes , theName = None ) :
"""
The same , as geompy . MultiRotate1DNbTimes , but axis is given by direction and point
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
MultiRot1D = geompy . MakeMultiRotation1DNbTimes ( prism , vy , pz , 6 )
"""
# Example: see GEOM_TestOthers.py
aVec = self . MakeLine ( aPoint , aDir )
# note: auto-publishing is done in self.MultiRotate1D()
anObj = self . MultiRotate1DNbTimes ( aShape , aVec , aNbTimes , theName )
return anObj
## The same, as MultiRotate1DByStep(), but axis is given by direction and point
2012-08-09 07:58:02 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeMultiRotation "Example"
2013-02-12 11:35:16 +00:00
def MakeMultiRotation1DByStep ( self , aShape , aDir , aPoint , anAngle , aNbTimes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
The same , as geompy . MultiRotate1D , but axis is given by direction and point
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
2013-02-12 11:35:16 +00:00
MultiRot1D = geompy . MakeMultiRotation1DByStep ( prism , vy , pz , math . pi / 3 , 6 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aVec = self . MakeLine ( aPoint , aDir )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MultiRotate1D()
anObj = self . MultiRotate1DByStep ( aShape , aVec , anAngle , aNbTimes , theName )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## The same, as MultiRotate2DNbTimes(), but axis is given by direction and point
2012-08-09 07:58:02 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeMultiRotation "Example"
2013-02-12 11:35:16 +00:00
def MakeMultiRotation2DNbTimes ( self , aShape , aDir , aPoint , nbtimes1 , aStep , nbtimes2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2013-02-12 11:35:16 +00:00
The same , as MultiRotate2DNbTimes ( ) , but axis is given by direction and point
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
2013-02-12 11:35:16 +00:00
MultiRot2D = geompy . MakeMultiRotation2DNbTimes ( f12 , vy , pz , 6 , 30 , 3 )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aVec = self . MakeLine ( aPoint , aDir )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MultiRotate2DNbTimes()
anObj = self . MultiRotate2DNbTimes ( aShape , aVec , nbtimes1 , aStep , nbtimes2 , theName )
return anObj
## The same, as MultiRotate2DByStep(), but axis is given by direction and point
#
# @ref swig_MakeMultiRotation "Example"
def MakeMultiRotation2DByStep ( self , aShape , aDir , aPoint , anAngle , nbtimes1 , aStep , nbtimes2 , theName = None ) :
"""
The same , as MultiRotate2DByStep ( ) , but axis is given by direction and point
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
MultiRot2D = geompy . MakeMultiRotation2DByStep ( f12 , vy , pz , math . pi / 4 , 6 , 30 , 3 )
"""
# Example: see GEOM_TestOthers.py
aVec = self . MakeLine ( aPoint , aDir )
# note: auto-publishing is done in self.MultiRotate2D()
anObj = self . MultiRotate2DByStep ( aShape , aVec , anAngle , nbtimes1 , aStep , nbtimes2 , theName )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_transform
## @}
2013-02-12 11:35:16 +00:00
## @addtogroup l3_transform_d
## @{
## Deprecated method. Use MultiRotate1DNbTimes instead.
def MultiRotate1D ( self , theObject , theAxis , theNbTimes , theName = None ) :
"""
Deprecated method . Use MultiRotate1DNbTimes instead .
"""
print " The method MultiRotate1D is DEPRECATED. Use MultiRotate1DNbTimes instead. "
return self . MultiRotate1DNbTimes ( theObject , theAxis , theNbTimes , theName )
## The same, as MultiRotate2DByStep(), but theAngle is in degrees.
# This method is DEPRECATED. Use MultiRotate2DByStep() instead.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " TrsfOp " )
2013-02-12 11:35:16 +00:00
def MultiRotate2D ( self , theObject , theAxis , theAngle , theNbTimes1 , theStep , theNbTimes2 , theName = None ) :
"""
The same , as MultiRotate2DByStep ( ) , but theAngle is in degrees .
This method is DEPRECATED . Use MultiRotate2DByStep ( ) instead .
Example of usage :
rot2d = geompy . MultiRotate2D ( prism , vect , 60 , 4 , 50 , 5 )
"""
print " The method MultiRotate2D is DEPRECATED. Use MultiRotate2DByStep instead. "
theAngle , theNbTimes1 , theStep , theNbTimes2 , Parameters = ParseParameters ( theAngle , theNbTimes1 , theStep , theNbTimes2 )
anObj = self . TrsfOp . MultiRotate2D ( theObject , theAxis , theAngle , theNbTimes1 , theStep , theNbTimes2 )
RaiseIfFailed ( " MultiRotate2D " , self . TrsfOp )
anObj . SetParameters ( Parameters )
self . _autoPublish ( anObj , theName , " multirotation " )
return anObj
## The same, as MultiRotate1D(), but axis is given by direction and point
# This method is DEPRECATED. Use MakeMultiRotation1DNbTimes instead.
def MakeMultiRotation1D ( self , aShape , aDir , aPoint , aNbTimes , theName = None ) :
"""
The same , as geompy . MultiRotate1D , but axis is given by direction and point .
This method is DEPRECATED . Use MakeMultiRotation1DNbTimes instead .
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
MultiRot1D = geompy . MakeMultiRotation1D ( prism , vy , pz , 6 )
"""
print " The method MakeMultiRotation1D is DEPRECATED. Use MakeMultiRotation1DNbTimes instead. "
aVec = self . MakeLine ( aPoint , aDir )
# note: auto-publishing is done in self.MultiRotate1D()
anObj = self . MultiRotate1D ( aShape , aVec , aNbTimes , theName )
return anObj
## The same, as MultiRotate2D(), but axis is given by direction and point
# This method is DEPRECATED. Use MakeMultiRotation2DByStep instead.
def MakeMultiRotation2D ( self , aShape , aDir , aPoint , anAngle , nbtimes1 , aStep , nbtimes2 , theName = None ) :
"""
The same , as MultiRotate2D ( ) , but axis is given by direction and point
This method is DEPRECATED . Use MakeMultiRotation2DByStep instead .
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
Example of usage :
pz = geompy . MakeVertex ( 0 , 0 , 100 )
vy = geompy . MakeVectorDXDYDZ ( 0 , 100 , 0 )
MultiRot2D = geompy . MakeMultiRotation2D ( f12 , vy , pz , 45 , 6 , 30 , 3 )
"""
print " The method MakeMultiRotation2D is DEPRECATED. Use MakeMultiRotation2DByStep instead. "
aVec = self . MakeLine ( aPoint , aDir )
# note: auto-publishing is done in self.MultiRotate2D()
anObj = self . MultiRotate2D ( aShape , aVec , anAngle , nbtimes1 , aStep , nbtimes2 , theName )
return anObj
# end of l3_transform_d
## @}
2009-02-13 12:16:39 +00:00
## @addtogroup l3_local
## @{
2008-03-07 07:45:34 +00:00
## Perform a fillet on all edges of the given shape.
# @param theShape Shape, to perform fillet on.
# @param theR Fillet radius.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_fillet "Example 1"
# \n @ref swig_MakeFilletAll "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeFilletAll ( self , theShape , theR , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a fillet on all edges of the given shape .
Parameters :
theShape Shape , to perform fillet on .
theR Fillet radius .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
Example of usage :
2013-04-04 07:06:43 +00:00
filletall = geompy . MakeFilletAll ( prism , 10. )
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
theR , Parameters = ParseParameters ( theR )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeFilletAll ( theShape , theR )
RaiseIfFailed ( " MakeFilletAll " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fillet " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform a fillet on the specified edges/faces of the given shape
# @param theShape Shape, to perform fillet on.
# @param theR Fillet radius.
2012-08-09 07:58:02 +00:00
# @param theShapeType Type of shapes in <VAR>theListShapes</VAR> (see ShapeType())
2008-03-07 07:45:34 +00:00
# @param theListShapes Global indices of edges/faces to perform fillet on.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Global index of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_fillet "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeFillet ( self , theShape , theR , theShapeType , theListShapes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a fillet on the specified edges / faces of the given shape
Parameters :
theShape Shape , to perform fillet on .
theR Fillet radius .
theShapeType Type of shapes in theListShapes ( see geompy . ShapeTypes )
theListShapes Global indices of edges / faces to perform fillet on .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Global index of sub - shape can be obtained , using method geompy . GetSubShapeID
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
Example of usage :
# get the list of IDs (IDList) for the fillet
prism_edges = geompy . SubShapeAllSortedCentres ( prism , geompy . ShapeType [ " EDGE " ] )
IDlist_e = [ ]
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 0 ] ) )
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 1 ] ) )
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 2 ] ) )
# make a fillet on the specified edges of the given shape
fillet = geompy . MakeFillet ( prism , 10. , geompy . ShapeType [ " EDGE " ] , IDlist_e )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theR , Parameters = ParseParameters ( theR )
2008-03-07 07:45:34 +00:00
anObj = None
2013-04-04 07:06:43 +00:00
if theShapeType == self . ShapeType [ " EDGE " ] :
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeFilletEdges ( theShape , theR , theListShapes )
RaiseIfFailed ( " MakeFilletEdges " , self . LocalOp )
else :
anObj = self . LocalOp . MakeFilletFaces ( theShape , theR , theListShapes )
RaiseIfFailed ( " MakeFilletFaces " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fillet " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## The same that MakeFillet() but with two Fillet Radius R1 and R2
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeFilletR1R2 ( self , theShape , theR1 , theR2 , theShapeType , theListShapes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
The same that geompy . MakeFillet but with two Fillet Radius R1 and R2
Example of usage :
# get the list of IDs (IDList) for the fillet
prism_edges = geompy . SubShapeAllSortedCentres ( prism , geompy . ShapeType [ " EDGE " ] )
IDlist_e = [ ]
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 0 ] ) )
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 1 ] ) )
IDlist_e . append ( geompy . GetSubShapeID ( prism , prism_edges [ 2 ] ) )
# make a fillet on the specified edges of the given shape
fillet = geompy . MakeFillet ( prism , 10. , 15. , geompy . ShapeType [ " EDGE " ] , IDlist_e )
"""
2009-02-13 12:16:39 +00:00
theR1 , theR2 , Parameters = ParseParameters ( theR1 , theR2 )
2008-03-07 07:45:34 +00:00
anObj = None
2013-04-04 07:06:43 +00:00
if theShapeType == self . ShapeType [ " EDGE " ] :
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeFilletEdgesR1R2 ( theShape , theR1 , theR2 , theListShapes )
RaiseIfFailed ( " MakeFilletEdgesR1R2 " , self . LocalOp )
else :
anObj = self . LocalOp . MakeFilletFacesR1R2 ( theShape , theR1 , theR2 , theListShapes )
RaiseIfFailed ( " MakeFilletFacesR1R2 " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fillet " )
2008-03-07 07:45:34 +00:00
return anObj
2012-08-09 07:58:02 +00:00
## Perform a fillet on the specified edges of the given shape
# @param theShape Wire Shape to perform fillet on.
# @param theR Fillet radius.
# @param theListOfVertexes Global indices of vertexes to perform fillet on.
# \note Global index of sub-shape can be obtained, using method GetSubShapeID()
# \note The list of vertices could be empty,
# in this case fillet will done done at all vertices in wire
# @param doIgnoreSecantVertices If FALSE, fillet radius is always limited
# by the length of the edges, nearest to the fillet vertex.
# But sometimes the next edge is C1 continuous with the one, nearest to
# the fillet point, and such two (or more) edges can be united to allow
# bigger radius. Set this flag to TRUE to allow collinear edges union,
# thus ignoring the secant vertex (vertices).
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
#
# @ref tui_fillet2d "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeFillet1D ( self , theShape , theR , theListOfVertexes , doIgnoreSecantVertices = True , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a fillet on the specified edges of the given shape
Parameters :
theShape Wire Shape to perform fillet on .
theR Fillet radius .
theListOfVertexes Global indices of vertexes to perform fillet on .
doIgnoreSecantVertices If FALSE , fillet radius is always limited
by the length of the edges , nearest to the fillet vertex .
But sometimes the next edge is C1 continuous with the one , nearest to
the fillet point , and such two ( or more ) edges can be united to allow
bigger radius . Set this flag to TRUE to allow collinear edges union ,
thus ignoring the secant vertex ( vertices ) .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Global index of sub - shape can be obtained , using method geompy . GetSubShapeID
The list of vertices could be empty , in this case fillet will done done at all vertices in wire
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
2014-06-25 18:28:02 +04:00
Example of usage :
2012-08-09 07:58:02 +00:00
# create wire
Wire_1 = geompy . MakeWire ( [ Edge_12 , Edge_7 , Edge_11 , Edge_6 , Edge_1 , Edge_4 ] )
# make fillet at given wire vertices with giver radius
Fillet_1D_1 = geompy . MakeFillet1D ( Wire_1 , 55 , [ 3 , 4 , 6 , 8 , 10 ] )
"""
# Example: see GEOM_TestAll.py
theR , doIgnoreSecantVertices , Parameters = ParseParameters ( theR , doIgnoreSecantVertices )
anObj = self . LocalOp . MakeFillet1D ( theShape , theR , theListOfVertexes , doIgnoreSecantVertices )
RaiseIfFailed ( " MakeFillet1D " , self . LocalOp )
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fillet " )
2012-08-09 07:58:02 +00:00
return anObj
## Perform a fillet at the specified vertices of the given face/shell.
# @param theShape Face or Shell shape to perform fillet on.
# @param theR Fillet radius.
2009-02-13 12:16:39 +00:00
# @param theListOfVertexes Global indices of vertexes to perform fillet on.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Global index of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2009-02-13 12:16:39 +00:00
#
# @ref tui_fillet2d "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeFillet2D ( self , theShape , theR , theListOfVertexes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a fillet at the specified vertices of the given face / shell .
Parameters :
theShape Face or Shell shape to perform fillet on .
theR Fillet radius .
theListOfVertexes Global indices of vertexes to perform fillet on .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Global index of sub - shape can be obtained , using method geompy . GetSubShapeID
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
Example of usage :
face = geompy . MakeFaceHW ( 100 , 100 , 1 )
fillet2d = geompy . MakeFillet2D ( face , 30 , [ 7 , 9 ] )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
2012-08-09 07:58:02 +00:00
theR , Parameters = ParseParameters ( theR )
2009-02-13 12:16:39 +00:00
anObj = self . LocalOp . MakeFillet2D ( theShape , theR , theListOfVertexes )
RaiseIfFailed ( " MakeFillet2D " , self . LocalOp )
2012-08-09 07:58:02 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " fillet " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Perform a symmetric chamfer on all edges of the given shape.
# @param theShape Shape, to perform chamfer on.
# @param theD Chamfer size along each face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_chamfer "Example 1"
# \n @ref swig_MakeChamferAll "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferAll ( self , theShape , theD , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a symmetric chamfer on all edges of the given shape .
Parameters :
theShape Shape , to perform chamfer on .
theD Chamfer size along each face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
Example of usage :
chamfer_all = geompy . MakeChamferAll ( prism , 10. )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
theD , Parameters = ParseParameters ( theD )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferAll ( theShape , theD )
RaiseIfFailed ( " MakeChamferAll " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform a chamfer on edges, common to the specified faces,
# with distance D1 on the Face1
# @param theShape Shape, to perform chamfer on.
# @param theD1 Chamfer size along \a theFace1.
# @param theD2 Chamfer size along \a theFace2.
# @param theFace1,theFace2 Global indices of two faces of \a theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Global index of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_chamfer "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferEdge ( self , theShape , theD1 , theD2 , theFace1 , theFace2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a chamfer on edges , common to the specified faces ,
with distance D1 on the Face1
Parameters :
theShape Shape , to perform chamfer on .
theD1 Chamfer size along theFace1 .
theD2 Chamfer size along theFace2 .
theFace1 , theFace2 Global indices of two faces of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Global index of sub - shape can be obtained , using method geompy . GetSubShapeID
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
Example of usage :
prism_faces = geompy . SubShapeAllSortedCentres ( prism , geompy . ShapeType [ " FACE " ] )
f_ind_1 = geompy . GetSubShapeID ( prism , prism_faces [ 0 ] )
f_ind_2 = geompy . GetSubShapeID ( prism , prism_faces [ 1 ] )
chamfer_e = geompy . MakeChamferEdge ( prism , 10. , 10. , f_ind_1 , f_ind_2 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theD1 , theD2 , Parameters = ParseParameters ( theD1 , theD2 )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferEdge ( theShape , theD1 , theD2 , theFace1 , theFace2 )
RaiseIfFailed ( " MakeChamferEdge " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Perform a chamfer on edges
# @param theShape Shape, to perform chamfer on.
# @param theD Chamfer length
# @param theAngle Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
# @param theFace1,theFace2 Global indices of two faces of \a theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Global index of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferEdgeAD ( self , theShape , theD , theAngle , theFace1 , theFace2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a chamfer on edges
Parameters :
theShape Shape , to perform chamfer on .
theD1 Chamfer size along theFace1 .
theAngle Angle of chamfer ( angle in radians or a name of variable which defines angle in degrees ) .
theFace1 , theFace2 Global indices of two faces of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Global index of sub - shape can be obtained , using method geompy . GetSubShapeID
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
Example of usage :
prism_faces = geompy . SubShapeAllSortedCentres ( prism , geompy . ShapeType [ " FACE " ] )
f_ind_1 = geompy . GetSubShapeID ( prism , prism_faces [ 0 ] )
f_ind_2 = geompy . GetSubShapeID ( prism , prism_faces [ 1 ] )
ang = 30
chamfer_e = geompy . MakeChamferEdge ( prism , 10. , ang , f_ind_1 , f_ind_2 )
"""
2009-02-13 12:16:39 +00:00
flag = False
if isinstance ( theAngle , str ) :
flag = True
theD , theAngle , Parameters = ParseParameters ( theD , theAngle )
if flag :
theAngle = theAngle * math . pi / 180.0
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferEdgeAD ( theShape , theD , theAngle , theFace1 , theFace2 )
RaiseIfFailed ( " MakeChamferEdgeAD " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform a chamfer on all edges of the specified faces,
# with distance D1 on the first specified face (if several for one edge)
# @param theShape Shape, to perform chamfer on.
# @param theD1 Chamfer size along face from \a theFaces. If both faces,
# connected to the edge, are in \a theFaces, \a theD1
# will be get along face, which is nearer to \a theFaces beginning.
# @param theD2 Chamfer size along another of two faces, connected to the edge.
# @param theFaces Sequence of global indices of faces of \a theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Global index of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_chamfer "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferFaces ( self , theShape , theD1 , theD2 , theFaces , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a chamfer on all edges of the specified faces ,
with distance D1 on the first specified face ( if several for one edge )
Parameters :
theShape Shape , to perform chamfer on .
theD1 Chamfer size along face from theFaces . If both faces ,
connected to the edge , are in theFaces , theD1
will be get along face , which is nearer to theFaces beginning .
theD2 Chamfer size along another of two faces , connected to the edge .
theFaces Sequence of global indices of faces of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Note : Global index of sub - shape can be obtained , using method geompy . GetSubShapeID ( ) .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theD1 , theD2 , Parameters = ParseParameters ( theD1 , theD2 )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferFaces ( theShape , theD1 , theD2 , theFaces )
RaiseIfFailed ( " MakeChamferFaces " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## The Same that MakeChamferFaces() but with params theD is chamfer lenght and
2009-02-13 12:16:39 +00:00
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
#
# @ref swig_FilletChamfer "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferFacesAD ( self , theShape , theD , theAngle , theFaces , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
The Same that geompy . MakeChamferFaces but with params theD is chamfer lenght and
theAngle is Angle of chamfer ( angle in radians or a name of variable which defines angle in degrees )
"""
2009-02-13 12:16:39 +00:00
flag = False
if isinstance ( theAngle , str ) :
flag = True
theD , theAngle , Parameters = ParseParameters ( theD , theAngle )
if flag :
theAngle = theAngle * math . pi / 180.0
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferFacesAD ( theShape , theD , theAngle , theFaces )
RaiseIfFailed ( " MakeChamferFacesAD " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Perform a chamfer on edges,
# with distance D1 on the first specified face (if several for one edge)
# @param theShape Shape, to perform chamfer on.
2009-02-13 12:16:39 +00:00
# @param theD1,theD2 Chamfer size
2008-03-07 07:45:34 +00:00
# @param theEdges Sequence of edges of \a theShape.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_FilletChamfer "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferEdges ( self , theShape , theD1 , theD2 , theEdges , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform a chamfer on edges ,
with distance D1 on the first specified face ( if several for one edge )
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
theShape Shape , to perform chamfer on .
theD1 , theD2 Chamfer size
theEdges Sequence of edges of theShape .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
theD1 , theD2 , Parameters = ParseParameters ( theD1 , theD2 )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferEdges ( theShape , theD1 , theD2 , theEdges )
RaiseIfFailed ( " MakeChamferEdges " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## The Same that MakeChamferEdges() but with params theD is chamfer lenght and
2009-02-13 12:16:39 +00:00
# theAngle is Angle of chamfer (angle in radians or a name of variable which defines angle in degrees)
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def MakeChamferEdgesAD ( self , theShape , theD , theAngle , theEdges , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
The Same that geompy . MakeChamferEdges but with params theD is chamfer lenght and
theAngle is Angle of chamfer ( angle in radians or a name of variable which defines angle in degrees )
"""
2009-02-13 12:16:39 +00:00
flag = False
if isinstance ( theAngle , str ) :
flag = True
theD , theAngle , Parameters = ParseParameters ( theD , theAngle )
if flag :
theAngle = theAngle * math . pi / 180.0
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeChamferEdgesAD ( theShape , theD , theAngle , theEdges )
RaiseIfFailed ( " MakeChamferEdgesAD " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " chamfer " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## @sa MakeChamferEdge(), MakeChamferFaces()
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_MakeChamfer "Example"
2013-02-12 11:35:16 +00:00
def MakeChamfer ( self , aShape , d1 , d2 , aShapeType , ListShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
See geompy . MakeChamferEdge ( ) and geompy . MakeChamferFaces ( ) functions for more information .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = None
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.MakeChamferEdge() or self.MakeChamferFaces()
2013-04-04 07:06:43 +00:00
if aShapeType == self . ShapeType [ " EDGE " ] :
2013-02-12 11:35:16 +00:00
anObj = self . MakeChamferEdge ( aShape , d1 , d2 , ListShape [ 0 ] , ListShape [ 1 ] , theName )
2008-03-07 07:45:34 +00:00
else :
2013-02-12 11:35:16 +00:00
anObj = self . MakeChamferFaces ( aShape , d1 , d2 , ListShape , theName )
2008-03-07 07:45:34 +00:00
return anObj
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
## Remove material from a solid by extrusion of the base shape on the given distance.
2014-06-25 18:28:02 +04:00
# @param theInit Shape to remove material from. It must be a solid or
2012-08-09 07:58:02 +00:00
# a compound made of a single solid.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-06-25 18:28:02 +04:00
# @return New GEOM.GEOM_Object, containing the initial shape with removed material
2012-08-09 07:58:02 +00:00
#
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeExtrudedCut ( self , theInit , theBase , theH , theAngle , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Add material to a solid by extrusion of the base shape on the given distance .
Parameters :
theInit Shape to remove material from . It must be a solid or a compound made of a single solid .
theBase Closed edge or wire defining the base shape to be extruded .
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the initial shape with removed material .
"""
# Example: see GEOM_TestAll.py
#theH,Parameters = ParseParameters(theH)
anObj = self . PrimOp . MakeDraftPrism ( theInit , theBase , theH , theAngle , False )
RaiseIfFailed ( " MakeExtrudedBoss " , self . PrimOp )
#anObj.SetParameters(Parameters)
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " extrudedCut " )
2014-06-25 18:28:02 +04:00
return anObj
2012-08-09 07:58:02 +00:00
## Add material to a solid by extrusion of the base shape on the given distance.
2014-06-25 18:28:02 +04:00
# @param theInit Shape to add material to. It must be a solid or
2012-08-09 07:58:02 +00:00
# a compound made of a single solid.
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2014-06-25 18:28:02 +04:00
# @return New GEOM.GEOM_Object, containing the initial shape with added material
2012-08-09 07:58:02 +00:00
#
# @ref tui_creation_prism "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " PrimOp " )
2013-02-12 11:35:16 +00:00
def MakeExtrudedBoss ( self , theInit , theBase , theH , theAngle , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Add material to a solid by extrusion of the base shape on the given distance .
Parameters :
theInit Shape to add material to . It must be a solid or a compound made of a single solid .
theBase Closed edge or wire defining the base shape to be extruded .
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the initial shape with added material .
"""
# Example: see GEOM_TestAll.py
#theH,Parameters = ParseParameters(theH)
anObj = self . PrimOp . MakeDraftPrism ( theInit , theBase , theH , theAngle , True )
RaiseIfFailed ( " MakeExtrudedBoss " , self . PrimOp )
#anObj.SetParameters(Parameters)
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " extrudedBoss " )
2014-06-25 18:28:02 +04:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_local
## @}
## @addtogroup l3_basic_op
## @{
2008-03-07 07:45:34 +00:00
## Perform an Archimde operation on the given shape with given parameters.
# The object presenting the resulting face is returned.
# @param theShape Shape to be put in water.
2014-10-21 20:06:51 +04:00
# @param theWeight Weight of the shape.
2008-03-07 07:45:34 +00:00
# @param theWaterDensity Density of the water.
# @param theMeshDeflection Deflection of the mesh, using to compute the section.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing a section of \a theShape
2008-03-07 07:45:34 +00:00
# by a plane, corresponding to water level.
#
2009-02-13 12:16:39 +00:00
# @ref tui_archimede "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " LocalOp " )
2013-02-12 11:35:16 +00:00
def Archimede ( self , theShape , theWeight , theWaterDensity , theMeshDeflection , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Perform an Archimde operation on the given shape with given parameters .
The object presenting the resulting face is returned .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to be put in water .
2014-10-21 20:06:51 +04:00
theWeight Weight of the shape .
2012-08-09 07:58:02 +00:00
theWaterDensity Density of the water .
theMeshDeflection Deflection of the mesh , using to compute the section .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing a section of theShape
by a plane , corresponding to water level .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
theWeight , theWaterDensity , theMeshDeflection , Parameters = ParseParameters (
theWeight , theWaterDensity , theMeshDeflection )
2008-03-07 07:45:34 +00:00
anObj = self . LocalOp . MakeArchimede ( theShape , theWeight , theWaterDensity , theMeshDeflection )
RaiseIfFailed ( " MakeArchimede " , self . LocalOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " archimede " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_basic_op
## @}
## @addtogroup l2_measure
## @{
2008-03-07 07:45:34 +00:00
## Get point coordinates
# @return [x, y, z]
#
2014-12-16 19:27:28 +03:00
# @ref tui_point_coordinates_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def PointCoordinates ( self , Point ) :
2012-08-09 07:58:02 +00:00
"""
Get point coordinates
Returns :
[ x , y , z ]
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . PointCoordinates ( Point )
RaiseIfFailed ( " PointCoordinates " , self . MeasuOp )
2014-06-25 18:28:02 +04:00
return aTuple
2013-02-12 11:35:16 +00:00
## Get vector coordinates
# @return [x, y, z]
#
# @ref tui_measurement_tools_page "Example"
def VectorCoordinates ( self , Vector ) :
"""
Get vector coordinates
Returns :
[ x , y , z ]
"""
p1 = self . GetFirstVertex ( Vector )
p2 = self . GetLastVertex ( Vector )
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
X1 = self . PointCoordinates ( p1 )
X2 = self . PointCoordinates ( p2 )
return ( X2 [ 0 ] - X1 [ 0 ] , X2 [ 1 ] - X1 [ 1 ] , X2 [ 2 ] - X1 [ 2 ] )
## Compute cross product
# @return vector w=u^v
#
# @ref tui_measurement_tools_page "Example"
def CrossProduct ( self , Vector1 , Vector2 ) :
2014-06-25 18:28:02 +04:00
"""
2013-02-12 11:35:16 +00:00
Compute cross product
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
Returns : vector w = u ^ v
"""
u = self . VectorCoordinates ( Vector1 )
v = self . VectorCoordinates ( Vector2 )
w = self . MakeVectorDXDYDZ ( u [ 1 ] * v [ 2 ] - u [ 2 ] * v [ 1 ] , u [ 2 ] * v [ 0 ] - u [ 0 ] * v [ 2 ] , u [ 0 ] * v [ 1 ] - u [ 1 ] * v [ 0 ] )
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
return w
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
## Compute cross product
# @return dot product p=u.v
#
# @ref tui_measurement_tools_page "Example"
def DotProduct ( self , Vector1 , Vector2 ) :
2014-06-25 18:28:02 +04:00
"""
2013-02-12 11:35:16 +00:00
Compute cross product
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
Returns : dot product p = u . v
"""
u = self . VectorCoordinates ( Vector1 )
v = self . VectorCoordinates ( Vector2 )
p = u [ 0 ] * v [ 0 ] + u [ 1 ] * v [ 1 ] + u [ 2 ] * v [ 2 ]
2014-06-25 18:28:02 +04:00
2013-02-12 11:35:16 +00:00
return p
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get summarized length of all wires,
# area of surface and volume of the given shape.
# @param theShape Shape to define properties of.
2012-08-09 07:58:02 +00:00
# @return [theLength, theSurfArea, theVolume]\n
# theLength: Summarized length of all wires of the given shape.\n
# theSurfArea: Area of surface of the given shape.\n
2008-03-07 07:45:34 +00:00
# theVolume: Volume of the given shape.
#
2014-12-16 19:27:28 +03:00
# @ref tui_basic_properties_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def BasicProperties ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Get summarized length of all wires ,
area of surface and volume of the given shape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to define properties of .
Returns :
[ theLength , theSurfArea , theVolume ]
theLength : Summarized length of all wires of the given shape .
theSurfArea : Area of surface of the given shape .
theVolume : Volume of the given shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetBasicProperties ( theShape )
RaiseIfFailed ( " GetBasicProperties " , self . MeasuOp )
return aTuple
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get parameters of bounding box of the given shape
# @param theShape Shape to obtain bounding box of.
2013-05-23 12:53:40 +00:00
# @param precise TRUE for precise computation; FALSE for fast one.
2008-03-07 07:45:34 +00:00
# @return [Xmin,Xmax, Ymin,Ymax, Zmin,Zmax]
# Xmin,Xmax: Limits of shape along OX axis.
# Ymin,Ymax: Limits of shape along OY axis.
# Zmin,Zmax: Limits of shape along OZ axis.
#
2014-12-16 19:27:28 +03:00
# @ref tui_bounding_box_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-05-23 12:53:40 +00:00
def BoundingBox ( self , theShape , precise = False ) :
2012-08-09 07:58:02 +00:00
"""
Get parameters of bounding box of the given shape
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to obtain bounding box of .
2013-05-23 12:53:40 +00:00
precise TRUE for precise computation ; FALSE for fast one .
2012-08-09 07:58:02 +00:00
Returns :
[ Xmin , Xmax , Ymin , Ymax , Zmin , Zmax ]
Xmin , Xmax : Limits of shape along OX axis .
Ymin , Ymax : Limits of shape along OY axis .
Zmin , Zmax : Limits of shape along OZ axis .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2013-05-23 12:53:40 +00:00
aTuple = self . MeasuOp . GetBoundingBox ( theShape , precise )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " GetBoundingBox " , self . MeasuOp )
return aTuple
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
## Get bounding box of the given shape
# @param theShape Shape to obtain bounding box of.
2013-05-23 12:53:40 +00:00
# @param precise TRUE for precise computation; FALSE for fast one.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created box.
#
2014-12-16 19:27:28 +03:00
# @ref tui_bounding_box_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-05-23 12:53:40 +00:00
def MakeBoundingBox ( self , theShape , precise = False , theName = None ) :
2013-02-12 11:35:16 +00:00
"""
Get bounding box of the given shape
2014-06-25 18:28:02 +04:00
Parameters :
2013-02-12 11:35:16 +00:00
theShape Shape to obtain bounding box of .
2013-05-23 12:53:40 +00:00
precise TRUE for precise computation ; FALSE for fast one .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
Returns :
New GEOM . GEOM_Object , containing the created box .
"""
# Example: see GEOM_TestMeasures.py
2013-05-23 12:53:40 +00:00
anObj = self . MeasuOp . MakeBoundingBox ( theShape , precise )
2013-02-12 11:35:16 +00:00
RaiseIfFailed ( " MakeBoundingBox " , self . MeasuOp )
self . _autoPublish ( anObj , theName , " bndbox " )
return anObj
2008-03-07 07:45:34 +00:00
## Get inertia matrix and moments of inertia of theShape.
# @param theShape Shape to calculate inertia of.
# @return [I11,I12,I13, I21,I22,I23, I31,I32,I33, Ix,Iy,Iz]
# I(1-3)(1-3): Components of the inertia matrix of the given shape.
# Ix,Iy,Iz: Moments of inertia of the given shape.
#
2014-12-16 19:27:28 +03:00
# @ref tui_inertia_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def Inertia ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Get inertia matrix and moments of inertia of theShape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to calculate inertia of .
Returns :
[ I11 , I12 , I13 , I21 , I22 , I23 , I31 , I32 , I33 , Ix , Iy , Iz ]
I ( 1 - 3 ) ( 1 - 3 ) : Components of the inertia matrix of the given shape .
Ix , Iy , Iz : Moments of inertia of the given shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetInertia ( theShape )
RaiseIfFailed ( " GetInertia " , self . MeasuOp )
return aTuple
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Get if coords are included in the shape (ST_IN or ST_ON)
# @param theShape Shape
# @param coords list of points coordinates [x1, y1, z1, x2, y2, z2, ...]
# @param tolerance to be used (default is 1.0e-7)
# @return list_of_boolean = [res1, res2, ...]
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2012-08-09 07:58:02 +00:00
def AreCoordsInside ( self , theShape , coords , tolerance = 1.e-7 ) :
"""
Get if coords are included in the shape ( ST_IN or ST_ON )
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape
coords list of points coordinates [ x1 , y1 , z1 , x2 , y2 , z2 , . . . ]
tolerance to be used ( default is 1.0e-7 )
Returns :
list_of_boolean = [ res1 , res2 , . . . ]
"""
return self . MeasuOp . AreCoordsInside ( theShape , coords , tolerance )
2008-03-07 07:45:34 +00:00
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
# @return Value of the minimal distance between the given shapes.
#
2014-12-16 19:27:28 +03:00
# @ref tui_min_distance_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def MinDistance ( self , theShape1 , theShape2 ) :
2012-08-09 07:58:02 +00:00
"""
Get minimal distance between the given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Shapes to find minimal distance between .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Value of the minimal distance between the given shapes .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetMinDistance ( theShape1 , theShape2 )
RaiseIfFailed ( " GetMinDistance " , self . MeasuOp )
return aTuple [ 0 ]
## Get minimal distance between the given shapes.
# @param theShape1,theShape2 Shapes to find minimal distance between.
2013-02-12 11:35:16 +00:00
# @return Value of the minimal distance between the given shapes, in form of list
# [Distance, DX, DY, DZ].
2008-03-07 07:45:34 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_min_distance_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def MinDistanceComponents ( self , theShape1 , theShape2 ) :
2012-08-09 07:58:02 +00:00
"""
Get minimal distance between the given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Shapes to find minimal distance between .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
Value of the minimal distance between the given shapes , in form of list
[ Distance , DX , DY , DZ ]
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetMinDistance ( theShape1 , theShape2 )
RaiseIfFailed ( " GetMinDistance " , self . MeasuOp )
aRes = [ aTuple [ 0 ] , aTuple [ 4 ] - aTuple [ 1 ] , aTuple [ 5 ] - aTuple [ 2 ] , aTuple [ 6 ] - aTuple [ 3 ] ]
return aRes
2013-02-12 11:35:16 +00:00
## Get closest points of the given shapes.
# @param theShape1,theShape2 Shapes to find closest points of.
# @return The number of found solutions (-1 in case of infinite number of
# solutions) and a list of (X, Y, Z) coordinates for all couples of points.
#
2014-12-16 19:27:28 +03:00
# @ref tui_min_distance_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-02-12 11:35:16 +00:00
def ClosestPoints ( self , theShape1 , theShape2 ) :
"""
Get closest points of the given shapes .
2014-06-25 18:28:02 +04:00
Parameters :
2013-02-12 11:35:16 +00:00
theShape1 , theShape2 Shapes to find closest points of .
2014-06-25 18:28:02 +04:00
Returns :
2013-02-12 11:35:16 +00:00
The number of found solutions ( - 1 in case of infinite number of
solutions ) and a list of ( X , Y , Z ) coordinates for all couples of points .
"""
# Example: see GEOM_TestMeasures.py
aTuple = self . MeasuOp . ClosestPoints ( theShape1 , theShape2 )
RaiseIfFailed ( " ClosestPoints " , self . MeasuOp )
return aTuple
2009-02-13 12:16:39 +00:00
## Get angle between the given shapes in degrees.
2008-03-07 07:45:34 +00:00
# @param theShape1,theShape2 Lines or linear edges to find angle between.
2012-08-09 07:58:02 +00:00
# @note If both arguments are vectors, the angle is computed in accordance
# with their orientations, otherwise the minimum angle is computed.
2009-02-13 12:16:39 +00:00
# @return Value of the angle between the given shapes in degrees.
2008-03-07 07:45:34 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_angle_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def GetAngle ( self , theShape1 , theShape2 ) :
2012-08-09 07:58:02 +00:00
"""
Get angle between the given shapes in degrees .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Lines or linear edges to find angle between .
Note :
If both arguments are vectors , the angle is computed in accordance
with their orientations , otherwise the minimum angle is computed .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Value of the angle between the given shapes in degrees .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
anAngle = self . MeasuOp . GetAngle ( theShape1 , theShape2 )
RaiseIfFailed ( " GetAngle " , self . MeasuOp )
return anAngle
2012-08-09 07:58:02 +00:00
2009-02-13 12:16:39 +00:00
## Get angle between the given shapes in radians.
# @param theShape1,theShape2 Lines or linear edges to find angle between.
2012-08-09 07:58:02 +00:00
# @note If both arguments are vectors, the angle is computed in accordance
# with their orientations, otherwise the minimum angle is computed.
2009-02-13 12:16:39 +00:00
# @return Value of the angle between the given shapes in radians.
#
2014-12-16 19:27:28 +03:00
# @ref tui_angle_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def GetAngleRadians ( self , theShape1 , theShape2 ) :
2012-08-09 07:58:02 +00:00
"""
Get angle between the given shapes in radians .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Lines or linear edges to find angle between .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Note :
If both arguments are vectors , the angle is computed in accordance
with their orientations , otherwise the minimum angle is computed .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Value of the angle between the given shapes in radians .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
anAngle = self . MeasuOp . GetAngle ( theShape1 , theShape2 ) * math . pi / 180.
RaiseIfFailed ( " GetAngle " , self . MeasuOp )
return anAngle
2012-08-09 07:58:02 +00:00
## Get angle between the given vectors in degrees.
# @param theShape1,theShape2 Vectors to find angle between.
# @param theFlag If True, the normal vector is defined by the two vectors cross,
# if False, the opposite vector to the normal vector is used.
# @return Value of the angle between the given vectors in degrees.
#
2014-12-16 19:27:28 +03:00
# @ref tui_angle_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2012-08-09 07:58:02 +00:00
def GetAngleVectors ( self , theShape1 , theShape2 , theFlag = True ) :
"""
Get angle between the given vectors in degrees .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Vectors to find angle between .
theFlag If True , the normal vector is defined by the two vectors cross ,
if False , the opposite vector to the normal vector is used .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Value of the angle between the given vectors in degrees .
"""
anAngle = self . MeasuOp . GetAngleBtwVectors ( theShape1 , theShape2 )
if not theFlag :
anAngle = 360. - anAngle
RaiseIfFailed ( " GetAngleVectors " , self . MeasuOp )
return anAngle
## The same as GetAngleVectors, but the result is in radians.
def GetAngleRadiansVectors ( self , theShape1 , theShape2 , theFlag = True ) :
"""
Get angle between the given vectors in radians .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape1 , theShape2 Vectors to find angle between .
theFlag If True , the normal vector is defined by the two vectors cross ,
if False , the opposite vector to the normal vector is used .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Value of the angle between the given vectors in radians .
"""
anAngle = self . GetAngleVectors ( theShape1 , theShape2 , theFlag ) * math . pi / 180.
return anAngle
2009-02-13 12:16:39 +00:00
## @name Curve Curvature Measurement
# Methods for receiving radius of curvature of curves
# in the given point
## @{
## Measure curvature of a curve at a point, set by parameter.
2012-08-09 07:58:02 +00:00
# @param theCurve a curve.
# @param theParam parameter.
# @return radius of curvature of \a theCurve.
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def CurveCurvatureByParam ( self , theCurve , theParam ) :
2012-08-09 07:58:02 +00:00
"""
Measure curvature of a curve at a point , set by parameter .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theCurve a curve .
theParam parameter .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
radius of curvature of theCurve .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
aCurv = self . MeasuOp . CurveCurvatureByParam ( theCurve , theParam )
RaiseIfFailed ( " CurveCurvatureByParam " , self . MeasuOp )
return aCurv
2012-08-09 07:58:02 +00:00
## Measure curvature of a curve at a point.
# @param theCurve a curve.
# @param thePoint given point.
# @return radius of curvature of \a theCurve.
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def CurveCurvatureByPoint ( self , theCurve , thePoint ) :
2012-08-09 07:58:02 +00:00
"""
Measure curvature of a curve at a point .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theCurve a curve .
thePoint given point .
2014-06-25 18:28:02 +04:00
Returns :
radius of curvature of theCurve .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
aCurv = self . MeasuOp . CurveCurvatureByPoint ( theCurve , thePoint )
RaiseIfFailed ( " CurveCurvatureByPoint " , self . MeasuOp )
return aCurv
## @}
## @name Surface Curvature Measurement
# Methods for receiving max and min radius of curvature of surfaces
# in the given point
## @{
2012-08-09 07:58:02 +00:00
## Measure max radius of curvature of surface.
# @param theSurf the given surface.
# @param theUParam Value of U-parameter on the referenced surface.
# @param theVParam Value of V-parameter on the referenced surface.
# @return max radius of curvature of theSurf.
#
2009-02-13 12:16:39 +00:00
## @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def MaxSurfaceCurvatureByParam ( self , theSurf , theUParam , theVParam ) :
2012-08-09 07:58:02 +00:00
"""
Measure max radius of curvature of surface .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theSurf the given surface .
theUParam Value of U - parameter on the referenced surface .
theVParam Value of V - parameter on the referenced surface .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
max radius of curvature of theSurf .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
aSurf = self . MeasuOp . MaxSurfaceCurvatureByParam ( theSurf , theUParam , theVParam )
RaiseIfFailed ( " MaxSurfaceCurvatureByParam " , self . MeasuOp )
return aSurf
2012-08-09 07:58:02 +00:00
## Measure max radius of curvature of surface in the given point
# @param theSurf the given surface.
# @param thePoint given point.
# @return max radius of curvature of theSurf.
#
2009-02-13 12:16:39 +00:00
## @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def MaxSurfaceCurvatureByPoint ( self , theSurf , thePoint ) :
2012-08-09 07:58:02 +00:00
"""
Measure max radius of curvature of surface in the given point .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theSurf the given surface .
thePoint given point .
2014-06-25 18:28:02 +04:00
Returns :
max radius of curvature of theSurf .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
aSurf = self . MeasuOp . MaxSurfaceCurvatureByPoint ( theSurf , thePoint )
RaiseIfFailed ( " MaxSurfaceCurvatureByPoint " , self . MeasuOp )
return aSurf
2012-08-09 07:58:02 +00:00
## Measure min radius of curvature of surface.
# @param theSurf the given surface.
# @param theUParam Value of U-parameter on the referenced surface.
# @param theVParam Value of V-parameter on the referenced surface.
# @return min radius of curvature of theSurf.
2014-06-25 18:28:02 +04:00
#
2009-02-13 12:16:39 +00:00
## @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def MinSurfaceCurvatureByParam ( self , theSurf , theUParam , theVParam ) :
2012-08-09 07:58:02 +00:00
"""
Measure min radius of curvature of surface .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theSurf the given surface .
theUParam Value of U - parameter on the referenced surface .
theVParam Value of V - parameter on the referenced surface .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Min radius of curvature of theSurf .
"""
2009-02-13 12:16:39 +00:00
aSurf = self . MeasuOp . MinSurfaceCurvatureByParam ( theSurf , theUParam , theVParam )
RaiseIfFailed ( " MinSurfaceCurvatureByParam " , self . MeasuOp )
return aSurf
2012-08-09 07:58:02 +00:00
## Measure min radius of curvature of surface in the given point
# @param theSurf the given surface.
# @param thePoint given point.
# @return min radius of curvature of theSurf.
#
2009-02-13 12:16:39 +00:00
## @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2009-02-13 12:16:39 +00:00
def MinSurfaceCurvatureByPoint ( self , theSurf , thePoint ) :
2012-08-09 07:58:02 +00:00
"""
Measure min radius of curvature of surface in the given point .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theSurf the given surface .
thePoint given point .
2014-06-25 18:28:02 +04:00
Returns :
Min radius of curvature of theSurf .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
aSurf = self . MeasuOp . MinSurfaceCurvatureByPoint ( theSurf , thePoint )
RaiseIfFailed ( " MinSurfaceCurvatureByPoint " , self . MeasuOp )
return aSurf
## @}
2008-03-07 07:45:34 +00:00
## Get min and max tolerances of sub-shapes of theShape
# @param theShape Shape, to get tolerances of.
2012-08-09 07:58:02 +00:00
# @return [FaceMin,FaceMax, EdgeMin,EdgeMax, VertMin,VertMax]\n
# FaceMin,FaceMax: Min and max tolerances of the faces.\n
# EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
2008-03-07 07:45:34 +00:00
# VertMin,VertMax: Min and max tolerances of the vertices.
#
2014-12-16 19:27:28 +03:00
# @ref tui_tolerance_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def Tolerance ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Get min and max tolerances of sub - shapes of theShape
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape , to get tolerances of .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
[ FaceMin , FaceMax , EdgeMin , EdgeMax , VertMin , VertMax ]
FaceMin , FaceMax : Min and max tolerances of the faces .
EdgeMin , EdgeMax : Min and max tolerances of the edges .
VertMin , VertMax : Min and max tolerances of the vertices .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetTolerance ( theShape )
RaiseIfFailed ( " GetTolerance " , self . MeasuOp )
return aTuple
## Obtain description of the given shape (number of sub-shapes of each type)
# @param theShape Shape to be described.
# @return Description of the given shape.
#
2014-12-16 19:27:28 +03:00
# @ref tui_whatis_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def WhatIs ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Obtain description of the given shape ( number of sub - shapes of each type )
Parameters :
theShape Shape to be described .
Returns :
Description of the given shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aDescr = self . MeasuOp . WhatIs ( theShape )
RaiseIfFailed ( " WhatIs " , self . MeasuOp )
return aDescr
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Obtain quantity of shapes of the given type in \a theShape.
# If \a theShape is of type \a theType, it is also counted.
# @param theShape Shape to be described.
# @param theType the given ShapeType().
# @return Quantity of shapes of type \a theType in \a theShape.
#
# @ref tui_measurement_tools_page "Example"
def NbShapes ( self , theShape , theType ) :
"""
Obtain quantity of shapes of the given type in theShape .
If theShape is of type theType , it is also counted .
Parameters :
theShape Shape to be described .
theType the given geompy . ShapeType
Returns :
Quantity of shapes of type theType in theShape .
"""
# Example: see GEOM_TestMeasures.py
listSh = self . SubShapeAllIDs ( theShape , theType )
Nb = len ( listSh )
return Nb
## Obtain quantity of shapes of each type in \a theShape.
# The \a theShape is also counted.
# @param theShape Shape to be described.
# @return Dictionary of ShapeType() with bound quantities of shapes.
#
# @ref tui_measurement_tools_page "Example"
def ShapeInfo ( self , theShape ) :
"""
Obtain quantity of shapes of each type in theShape .
The theShape is also counted .
Parameters :
theShape Shape to be described .
Returns :
Dictionary of geompy . ShapeType with bound quantities of shapes .
"""
# Example: see GEOM_TestMeasures.py
aDict = { }
2013-04-04 07:06:43 +00:00
for typeSh in self . ShapeType :
2012-08-09 07:58:02 +00:00
if typeSh in ( " AUTO " , " SHAPE " ) : continue
2013-04-04 07:06:43 +00:00
listSh = self . SubShapeAllIDs ( theShape , self . ShapeType [ typeSh ] )
2012-08-09 07:58:02 +00:00
Nb = len ( listSh )
aDict [ typeSh ] = Nb
pass
return aDict
2013-06-17 12:42:48 +00:00
def GetCreationInformation ( self , theShape ) :
info = theShape . GetCreationInformation ( )
# operationName
opName = info . operationName
if not opName : opName = " no info available "
res = " Operation: " + opName
# parameters
for parVal in info . params :
res + = " \n %s = %s " % ( parVal . name , parVal . value )
return res
2008-03-07 07:45:34 +00:00
## Get a point, situated at the centre of mass of theShape.
# @param theShape Shape to define centre of mass of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created point.
2008-03-07 07:45:34 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_center_of_mass_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-02-12 11:35:16 +00:00
def MakeCDG ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a point , situated at the centre of mass of theShape .
Parameters :
theShape Shape to define centre of mass of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created point .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
anObj = self . MeasuOp . GetCentreOfMass ( theShape )
RaiseIfFailed ( " GetCentreOfMass " , self . MeasuOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " centerOfMass " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Get a vertex sub-shape by index depended with orientation.
# @param theShape Shape to find sub-shape.
# @param theIndex Index to find vertex by this index (starting from zero)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-02-12 11:35:16 +00:00
def GetVertexByIndex ( self , theShape , theIndex , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a vertex sub - shape by index depended with orientation .
Parameters :
theShape Shape to find sub - shape .
theIndex Index to find vertex by this index ( starting from zero )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created vertex .
"""
# Example: see GEOM_TestMeasures.py
anObj = self . MeasuOp . GetVertexByIndex ( theShape , theIndex )
RaiseIfFailed ( " GetVertexByIndex " , self . MeasuOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-08-09 07:58:02 +00:00
return anObj
## Get the first vertex of wire/edge depended orientation.
# @param theShape Shape to find first vertex.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
2013-02-12 11:35:16 +00:00
def GetFirstVertex ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get the first vertex of wire / edge depended orientation .
Parameters :
theShape Shape to find first vertex .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created vertex .
"""
# Example: see GEOM_TestMeasures.py
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.GetVertexByIndex()
2014-06-25 18:28:02 +04:00
return self . GetVertexByIndex ( theShape , 0 , theName )
2012-08-09 07:58:02 +00:00
## Get the last vertex of wire/edge depended orientation.
# @param theShape Shape to find last vertex.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vertex.
#
# @ref tui_measurement_tools_page "Example"
2013-02-12 11:35:16 +00:00
def GetLastVertex ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get the last vertex of wire / edge depended orientation .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to find last vertex .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created vertex .
"""
# Example: see GEOM_TestMeasures.py
2014-06-25 18:28:02 +04:00
nb_vert = self . NumberOfSubShapes ( theShape , self . ShapeType [ " VERTEX " ] )
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.GetVertexByIndex()
2014-06-25 18:28:02 +04:00
return self . GetVertexByIndex ( theShape , ( nb_vert - 1 ) , theName )
2012-08-09 07:58:02 +00:00
2008-03-07 07:45:34 +00:00
## Get a normale to the given face. If the point is not given,
# the normale is calculated at the center of mass.
# @param theFace Face to define normale of.
# @param theOptionalPoint Point to compute the normale at.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created vector.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2013-02-12 11:35:16 +00:00
def GetNormal ( self , theFace , theOptionalPoint = None , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a normale to the given face . If the point is not given ,
the normale is calculated at the center of mass .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theFace Face to define normale of .
theOptionalPoint Point to compute the normale at .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created vector .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
anObj = self . MeasuOp . GetNormal ( theFace , theOptionalPoint )
RaiseIfFailed ( " GetNormal " , self . MeasuOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " normal " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2014-04-04 10:44:39 +04:00
## Print shape errors obtained from CheckShape.
# @param theShape Shape that was checked.
# @param theShapeErrors the shape errors obtained by CheckShape.
# @param theReturnStatus If 0 the description of problem is printed.
# If 1 the description of problem is returned.
# @return If theReturnStatus is equal to 1 the description is returned.
# Otherwise doesn't return anything.
#
2014-12-16 19:27:28 +03:00
# @ref tui_check_shape_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2014-04-04 10:44:39 +04:00
def PrintShapeErrors ( self , theShape , theShapeErrors , theReturnStatus = 0 ) :
"""
Print shape errors obtained from CheckShape .
Parameters :
theShape Shape that was checked .
theShapeErrors the shape errors obtained by CheckShape .
theReturnStatus If 0 the description of problem is printed .
If 1 the description of problem is returned .
Returns :
If theReturnStatus is equal to 1 the description is returned .
Otherwise doesn ' t return anything.
"""
# Example: see GEOM_TestMeasures.py
Descr = self . MeasuOp . PrintShapeErrors ( theShape , theShapeErrors )
if theReturnStatus == 1 :
return Descr
print Descr
pass
2008-03-07 07:45:34 +00:00
## Check a topology of the given shape.
# @param theShape Shape to check validity of.
2012-08-09 07:58:02 +00:00
# @param theIsCheckGeom If FALSE, only the shape's topology will be checked, \n
2008-03-07 07:45:34 +00:00
# if TRUE, the shape's geometry will be checked also.
2014-04-04 10:44:39 +04:00
# @param theReturnStatus If 0 and if theShape is invalid, a description
# of problem is printed.
# If 1 isValid flag and the description of
# problem is returned.
# If 2 isValid flag and the list of error data
# is returned.
2008-03-07 07:45:34 +00:00
# @return TRUE, if the shape "seems to be valid".
2014-04-04 10:44:39 +04:00
# If theShape is invalid, prints a description of problem.
# If theReturnStatus is equal to 1 the description is returned
# along with IsValid flag.
# If theReturnStatus is equal to 2 the list of error data is
# returned along with IsValid flag.
2008-03-07 07:45:34 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_check_shape_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2012-08-09 07:58:02 +00:00
def CheckShape ( self , theShape , theIsCheckGeom = 0 , theReturnStatus = 0 ) :
"""
Check a topology of the given shape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to check validity of .
theIsCheckGeom If FALSE , only the shape ' s topology will be checked,
if TRUE , the shape ' s geometry will be checked also.
2014-04-04 10:44:39 +04:00
theReturnStatus If 0 and if theShape is invalid , a description
2012-08-09 07:58:02 +00:00
of problem is printed .
2014-04-04 10:44:39 +04:00
If 1 IsValid flag and the description of
problem is returned .
If 2 IsValid flag and the list of error data
is returned .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
TRUE , if the shape " seems to be valid " .
If theShape is invalid , prints a description of problem .
2014-04-04 10:44:39 +04:00
If theReturnStatus is equal to 1 the description is returned
along with IsValid flag .
If theReturnStatus is equal to 2 the list of error data is
returned along with IsValid flag .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
if theIsCheckGeom :
2014-04-04 10:44:39 +04:00
( IsValid , ShapeErrors ) = self . MeasuOp . CheckShapeWithGeometry ( theShape )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " CheckShapeWithGeometry " , self . MeasuOp )
else :
2014-04-04 10:44:39 +04:00
( IsValid , ShapeErrors ) = self . MeasuOp . CheckShape ( theShape )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " CheckShape " , self . MeasuOp )
if IsValid == 0 :
2012-08-09 07:58:02 +00:00
if theReturnStatus == 0 :
2014-04-04 10:44:39 +04:00
Descr = self . MeasuOp . PrintShapeErrors ( theShape , ShapeErrors )
print Descr
2012-08-09 07:58:02 +00:00
if theReturnStatus == 1 :
2014-04-04 10:44:39 +04:00
Descr = self . MeasuOp . PrintShapeErrors ( theShape , ShapeErrors )
return ( IsValid , Descr )
elif theReturnStatus == 2 :
return ( IsValid , ShapeErrors )
2012-08-09 07:58:02 +00:00
return IsValid
## Detect self-intersections in the given shape.
# @param theShape Shape to check.
2014-10-13 12:14:17 +04:00
# @param theCheckLevel is the level of self-intersection check.
# Possible input values are:
# - GEOM.SI_V_V(0) - only V/V interferences
# - GEOM.SI_V_E(1) - V/V and V/E interferences
# - GEOM.SI_E_E(2) - V/V, V/E and E/E interferences
# - GEOM.SI_V_F(3) - V/V, V/E, E/E and V/F interferences
# - GEOM.SI_E_F(4) - V/V, V/E, E/E, V/F and E/F interferences
# - GEOM.SI_ALL(5) - all interferences.
2012-08-09 07:58:02 +00:00
# @return TRUE, if the shape contains no self-intersections.
#
2014-12-16 19:27:28 +03:00
# @ref tui_check_self_intersections_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2014-10-13 12:14:17 +04:00
def CheckSelfIntersections ( self , theShape , theCheckLevel = GEOM . SI_ALL ) :
2012-08-09 07:58:02 +00:00
"""
Detect self - intersections in the given shape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to check .
2014-10-13 12:14:17 +04:00
theCheckLevel is the level of self - intersection check .
Possible input values are :
- GEOM . SI_V_V ( 0 ) - only V / V interferences
- GEOM . SI_V_E ( 1 ) - V / V and V / E interferences
- GEOM . SI_E_E ( 2 ) - V / V , V / E and E / E interferences
- GEOM . SI_V_F ( 3 ) - V / V , V / E , E / E and V / F interferences
- GEOM . SI_E_F ( 4 ) - V / V , V / E , E / E , V / F and E / F interferences
- GEOM . SI_ALL ( 5 ) - all interferences .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
TRUE , if the shape contains no self - intersections .
"""
# Example: see GEOM_TestMeasures.py
2014-10-13 12:14:17 +04:00
( IsValid , Pairs ) = self . MeasuOp . CheckSelfIntersections ( theShape , EnumToLong ( theCheckLevel ) )
2012-08-09 07:58:02 +00:00
RaiseIfFailed ( " CheckSelfIntersections " , self . MeasuOp )
2008-03-07 07:45:34 +00:00
return IsValid
2009-02-13 12:16:39 +00:00
2014-12-16 19:27:28 +03:00
## Detect intersections of the given shapes with algorithm based on mesh intersections.
# @param theShape1 First source object
# @param theShape2 Second source object
# @param theTolerance Specifies a distance between shapes used for detecting gaps:
# - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
# - if \a theTolerance > 0, algorithm detects gaps
# @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
# - if \a theDeflection <= 0, default deflection 0.001 is used
# @return TRUE, if there are intersections (gaps) between source shapes
# @return List of sub-shapes IDs from 1st shape that localize intersection.
# @return List of sub-shapes IDs from 2nd shape that localize intersection.
#
# @ref tui_fast_intersection_page "Example"
@ManageTransactions ( " MeasuOp " )
def FastIntersect ( self , theShape1 , theShape2 , theTolerance = 0.0 , theDeflection = 0.001 ) :
"""
Detect intersections of the given shapes with algorithm based on mesh intersections .
Parameters :
theShape1 First source object
theShape2 Second source object
theTolerance Specifies a distance between shapes used for detecting gaps :
- if theTolerance < = 0 , algorithm detects intersections ( default behavior )
- if theTolerance > 0 , algorithm detects gaps
theDeflection Linear deflection coefficient that specifies quality of tesselation :
- if theDeflection < = 0 , default deflection 0.001 is used
Returns :
TRUE , if there are intersections ( gaps ) between source shapes
List of sub - shapes IDs from 1 st shape that localize intersection .
List of sub - shapes IDs from 2 nd shape that localize intersection .
"""
# Example: see GEOM_TestMeasures.py
IsOk , Res1 , Res2 = self . MeasuOp . FastIntersect ( theShape1 , theShape2 , theTolerance , theDeflection )
RaiseIfFailed ( " FastIntersect " , self . MeasuOp )
return IsOk , Res1 , Res2
2008-03-07 07:45:34 +00:00
## Get position (LCS) of theShape.
#
# Origin of the LCS is situated at the shape's center of mass.
# Axes of the LCS are obtained from shape's location or,
# if the shape is a planar face, from position of its plane.
#
# @param theShape Shape to calculate position of.
# @return [Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz].
# Ox,Oy,Oz: Coordinates of shape's LCS origin.
# Zx,Zy,Zz: Coordinates of shape's LCS normal(main) direction.
# Xx,Xy,Xz: Coordinates of shape's LCS X direction.
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def GetPosition ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Get position ( LCS ) of theShape .
Origin of the LCS is situated at the shape ' s center of mass.
Axes of the LCS are obtained from shape ' s location or,
if the shape is a planar face , from position of its plane .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to calculate position of .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
[ Ox , Oy , Oz , Zx , Zy , Zz , Xx , Xy , Xz ] .
Ox , Oy , Oz : Coordinates of shape ' s LCS origin.
Zx , Zy , Zz : Coordinates of shape ' s LCS normal(main) direction.
Xx , Xy , Xz : Coordinates of shape ' s LCS X direction.
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aTuple = self . MeasuOp . GetPosition ( theShape )
RaiseIfFailed ( " GetPosition " , self . MeasuOp )
return aTuple
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get kind of theShape.
#
# @param theShape Shape to get a kind of.
2012-08-09 07:58:02 +00:00
# @return Returns a kind of shape in terms of <VAR>GEOM.GEOM_IKindOfShape.shape_kind</VAR> enumeration
2008-03-07 07:45:34 +00:00
# and a list of parameters, describing the shape.
# @note Concrete meaning of each value, returned via \a theIntegers
2012-08-09 07:58:02 +00:00
# or \a theDoubles list depends on the kind() of the shape.
2009-02-13 12:16:39 +00:00
#
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " MeasuOp " )
2008-03-07 07:45:34 +00:00
def KindOfShape ( self , theShape ) :
2012-08-09 07:58:02 +00:00
"""
Get kind of theShape .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Shape to get a kind of .
Returns :
a kind of shape in terms of GEOM_IKindOfShape . shape_kind enumeration
and a list of parameters , describing the shape .
Note :
Concrete meaning of each value , returned via theIntegers
or theDoubles list depends on the geompy . kind of the shape
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestMeasures.py
2008-03-07 07:45:34 +00:00
aRoughTuple = self . MeasuOp . KindOfShape ( theShape )
RaiseIfFailed ( " KindOfShape " , self . MeasuOp )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
aKind = aRoughTuple [ 0 ]
anInts = aRoughTuple [ 1 ]
aDbls = aRoughTuple [ 2 ]
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
# Now there is no exception from this rule:
aKindTuple = [ aKind ] + aDbls + anInts
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
# If they are we will regroup parameters for such kind of shape.
# For example:
#if aKind == kind.SOME_KIND:
# # SOME_KIND int int double int double double
# aKindTuple = [aKind, anInts[0], anInts[1], aDbls[0], anInts[2], aDbls[1], aDbls[2]]
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
return aKindTuple
2009-02-13 12:16:39 +00:00
2014-06-25 18:28:02 +04:00
## Returns the string that describes if the shell is good for solid.
# This is a support method for MakeSolid.
#
# @param theShell the shell to be checked.
# @return Returns a string that describes the shell validity for
# solid construction.
@ManageTransactions ( " MeasuOp " )
def _IsGoodForSolid ( self , theShell ) :
"""
Returns the string that describes if the shell is good for solid .
This is a support method for MakeSolid .
Parameter :
theShell the shell to be checked .
Returns :
Returns a string that describes the shell validity for
solid construction .
"""
aDescr = self . MeasuOp . IsGoodForSolid ( theShell )
return aDescr
2009-02-13 12:16:39 +00:00
# end of l2_measure
## @}
## @addtogroup l2_import_export
## @{
2014-06-04 15:17:38 +04:00
## Import a shape from the BREP, IGES, STEP or other file
2008-03-07 07:45:34 +00:00
# (depends on given format) with given name.
2014-06-04 15:17:38 +04:00
#
# Note: this function is deprecated, it is kept for backward compatibility only
# Use Import<FormatName> instead, where <FormatName> is a name of desirable format to import.
#
2008-03-07 07:45:34 +00:00
# @param theFileName The file, containing the shape.
# @param theFormatName Specify format for the file reading.
# Available formats can be obtained with InsertOp.ImportTranslators() method.
2012-12-13 08:40:36 +00:00
# If format 'IGES_SCALE' is used instead of 'IGES' or
# format 'STEP_SCALE' is used instead of 'STEP',
# length unit will be set to 'meter' and result model will be scaled.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the imported shape.
2014-02-25 16:21:09 +04:00
# If material names are imported it returns the list of
# objects. The first one is the imported object followed by
# material groups.
# @note Auto publishing is allowed for the shape itself. Imported
# material groups are not automatically published.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_Import_Export "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2013-02-12 11:35:16 +00:00
def ImportFile ( self , theFileName , theFormatName , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2014-06-04 15:17:38 +04:00
Import a shape from the BREP , IGES , STEP or other file
2012-08-09 07:58:02 +00:00
( depends on given format ) with given name .
2014-06-04 15:17:38 +04:00
Note : this function is deprecated , it is kept for backward compatibility only
Use Import < FormatName > instead , where < FormatName > is a name of desirable format to import .
Parameters :
2012-08-09 07:58:02 +00:00
theFileName The file , containing the shape .
theFormatName Specify format for the file reading .
2012-12-13 08:40:36 +00:00
Available formats can be obtained with geompy . InsertOp . ImportTranslators ( ) method .
If format ' IGES_SCALE ' is used instead of ' IGES ' or
format ' STEP_SCALE ' is used instead of ' STEP ' ,
length unit will be set to ' meter ' and result model will be scaled .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the imported shape .
2014-02-25 16:21:09 +04:00
If material names are imported it returns the list of
objects . The first one is the imported object followed by
material groups .
Note :
Auto publishing is allowed for the shape itself . Imported
material groups are not automatically published .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2014-06-04 15:17:38 +04:00
print """
WARNING : Function ImportFile is deprecated , use Import < FormatName > instead ,
where < FormatName > is a name of desirable format for importing .
"""
2014-02-25 16:21:09 +04:00
aListObj = self . InsertOp . ImportFile ( theFileName , theFormatName )
2013-02-12 11:35:16 +00:00
RaiseIfFailed ( " ImportFile " , self . InsertOp )
2014-02-25 16:21:09 +04:00
aNbObj = len ( aListObj )
if aNbObj > 0 :
self . _autoPublish ( aListObj [ 0 ] , theName , " imported " )
if aNbObj == 1 :
return aListObj [ 0 ]
return aListObj
2012-08-09 07:58:02 +00:00
## Deprecated analog of ImportFile()
2013-02-12 11:35:16 +00:00
def Import ( self , theFileName , theFormatName , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
2013-02-12 11:35:16 +00:00
Deprecated analog of geompy . ImportFile , kept for backward compatibility only .
2012-08-09 07:58:02 +00:00
"""
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.ImportFile()
return self . ImportFile ( theFileName , theFormatName , theName )
2009-02-13 12:16:39 +00:00
2012-10-08 11:16:36 +00:00
## Read a shape from the binary stream, containing its bounding representation (BRep).
# @note This method will not be dumped to the python script by DumpStudy functionality.
# @note GEOM.GEOM_Object.GetShapeStream() method can be used to obtain the shape's BRep stream.
# @param theStream The BRep binary stream.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return New GEOM_Object, containing the shape, read from theStream.
#
# @ref swig_Import_Export "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2013-02-12 11:35:16 +00:00
def RestoreShape ( self , theStream , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Read a shape from the binary stream , containing its bounding representation ( BRep ) .
Note :
shape . GetShapeStream ( ) method can be used to obtain the shape ' s BRep stream.
2014-06-25 18:28:02 +04:00
Parameters :
2012-10-08 11:16:36 +00:00
theStream The BRep binary stream .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
New GEOM_Object , containing the shape , read from theStream .
"""
# Example: see GEOM_TestOthers.py
anObj = self . InsertOp . RestoreShape ( theStream )
RaiseIfFailed ( " RestoreShape " , self . InsertOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " restored " )
2012-10-08 11:16:36 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Export the given shape into a file with given name.
2014-06-04 15:17:38 +04:00
#
# Note: this function is deprecated, it is kept for backward compatibility only
# Use Export<FormatName> instead, where <FormatName> is a name of desirable format to export.
#
2008-03-07 07:45:34 +00:00
# @param theObject Shape to be stored in the file.
# @param theFileName Name of the file to store the given shape in.
# @param theFormatName Specify format for the shape storage.
2013-02-12 11:35:16 +00:00
# Available formats can be obtained with
# geompy.InsertOp.ExportTranslators()[0] method.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_Import_Export "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2012-12-13 08:40:36 +00:00
def Export ( self , theObject , theFileName , theFormatName ) :
2012-08-09 07:58:02 +00:00
"""
Export the given shape into a file with given name .
2014-06-04 15:17:38 +04:00
Note : this function is deprecated , it is kept for backward compatibility only
Use Export < FormatName > instead , where < FormatName > is a name of desirable format to export .
Parameters :
2012-08-09 07:58:02 +00:00
theObject Shape to be stored in the file .
theFileName Name of the file to store the given shape in .
theFormatName Specify format for the shape storage .
2013-02-12 11:35:16 +00:00
Available formats can be obtained with
geompy . InsertOp . ExportTranslators ( ) [ 0 ] method .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2014-06-04 15:17:38 +04:00
print """
WARNING : Function Export is deprecated , use Export < FormatName > instead ,
where < FormatName > is a name of desirable format for exporting .
"""
2008-03-07 07:45:34 +00:00
self . InsertOp . Export ( theObject , theFileName , theFormatName )
if self . InsertOp . IsDone ( ) == 0 :
raise RuntimeError , " Export : " + self . InsertOp . GetErrorCode ( )
pass
pass
2009-02-13 12:16:39 +00:00
# end of l2_import_export
## @}
## @addtogroup l3_blocks
## @{
2008-03-07 07:45:34 +00:00
## Create a quadrangle face from four edges. Order of Edges is not
# important. It is not necessary that edges share the same vertex.
# @param E1,E2,E3,E4 Edges for the face bound.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_building_by_blocks_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeQuad ( self , E1 , E2 , E3 , E4 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a quadrangle face from four edges . Order of Edges is not
important . It is not necessary that edges share the same vertex .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
E1 , E2 , E3 , E4 Edges for the face bound .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created face .
2014-06-25 18:28:02 +04:00
Example of usage :
2012-08-09 07:58:02 +00:00
qface1 = geompy . MakeQuad ( edge1 , edge2 , edge3 , edge4 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeQuad ( E1 , E2 , E3 , E4 )
RaiseIfFailed ( " MakeQuad " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " quad " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a quadrangle face on two edges.
# The missing edges will be built by creating the shortest ones.
# @param E1,E2 Two opposite edges for the face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_building_by_blocks_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeQuad2Edges ( self , E1 , E2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a quadrangle face on two edges .
The missing edges will be built by creating the shortest ones .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
E1 , E2 Two opposite edges for the face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created face .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Example of usage :
# create vertices
p1 = geompy . MakeVertex ( 0. , 0. , 0. )
p2 = geompy . MakeVertex ( 150. , 30. , 0. )
p3 = geompy . MakeVertex ( 0. , 120. , 50. )
p4 = geompy . MakeVertex ( 0. , 40. , 70. )
# create edges
edge1 = geompy . MakeEdge ( p1 , p2 )
edge2 = geompy . MakeEdge ( p3 , p4 )
# create a quadrangle face from two edges
qface2 = geompy . MakeQuad2Edges ( edge1 , edge2 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeQuad2Edges ( E1 , E2 )
RaiseIfFailed ( " MakeQuad2Edges " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " quad " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a quadrangle face with specified corners.
# The missing edges will be built by creating the shortest ones.
# @param V1,V2,V3,V4 Corner vertices for the face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeQuad4Vertices "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeQuad4Vertices ( self , V1 , V2 , V3 , V4 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a quadrangle face with specified corners .
The missing edges will be built by creating the shortest ones .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
V1 , V2 , V3 , V4 Corner vertices for the face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created face .
Example of usage :
# create vertices
p1 = geompy . MakeVertex ( 0. , 0. , 0. )
p2 = geompy . MakeVertex ( 150. , 30. , 0. )
p3 = geompy . MakeVertex ( 0. , 120. , 50. )
p4 = geompy . MakeVertex ( 0. , 40. , 70. )
# create a quadrangle from four points in its corners
qface3 = geompy . MakeQuad4Vertices ( p1 , p2 , p3 , p4 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeQuad4Vertices ( V1 , V2 , V3 , V4 )
RaiseIfFailed ( " MakeQuad4Vertices " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " quad " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a hexahedral solid, bounded by the six given faces. Order of
# faces is not important. It is not necessary that Faces share the same edge.
# @param F1,F2,F3,F4,F5,F6 Faces for the hexahedral solid.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created solid.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeHexa "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeHexa ( self , F1 , F2 , F3 , F4 , F5 , F6 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a hexahedral solid , bounded by the six given faces . Order of
faces is not important . It is not necessary that Faces share the same edge .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
F1 , F2 , F3 , F4 , F5 , F6 Faces for the hexahedral solid .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the created solid .
Example of usage :
solid = geompy . MakeHexa ( qface1 , qface2 , qface3 , qface4 , qface5 , qface6 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeHexa ( F1 , F2 , F3 , F4 , F5 , F6 )
RaiseIfFailed ( " MakeHexa " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " hexa " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create a hexahedral solid between two given faces.
# The missing faces will be built by creating the smallest ones.
# @param F1,F2 Two opposite faces for the hexahedral solid.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the created solid.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_building_by_blocks_page "Example 1"
# \n @ref swig_MakeHexa2Faces "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeHexa2Faces ( self , F1 , F2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a hexahedral solid between two given faces .
The missing faces will be built by creating the smallest ones .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
F1 , F2 Two opposite faces for the hexahedral solid .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the created solid .
Example of usage :
solid1 = geompy . MakeHexa2Faces ( qface1 , qface2 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeHexa2Faces ( F1 , F2 )
RaiseIfFailed ( " MakeHexa2Faces " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " hexa " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_blocks
## @}
## @addtogroup l3_blocks_op
## @{
2008-03-07 07:45:34 +00:00
## Get a vertex, found in the given shape by its coordinates.
# @param theShape Block or a compound of blocks.
# @param theX,theY,theZ Coordinates of the sought vertex.
# @param theEpsilon Maximum allowed distance between the resulting
# vertex and point with the given coordinates.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found vertex.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetPoint "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetPoint ( self , theShape , theX , theY , theZ , theEpsilon , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a vertex , found in the given shape by its coordinates .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Block or a compound of blocks .
theX , theY , theZ Coordinates of the sought vertex .
theEpsilon Maximum allowed distance between the resulting
vertex and point with the given coordinates .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the found vertex .
Example of usage :
pnt = geompy . GetPoint ( shape , - 50 , 50 , 50 , 0.01 )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetPoint ( theShape , theX , theY , theZ , theEpsilon )
RaiseIfFailed ( " GetPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find a vertex of the given shape, which has minimal distance to the given point.
# @param theShape Any shape.
# @param thePoint Point, close to the desired vertex.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found vertex.
#
# @ref swig_GetVertexNearPoint "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetVertexNearPoint ( self , theShape , thePoint , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find a vertex of the given shape , which has minimal distance to the given point .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Any shape .
thePoint Point , close to the desired vertex .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found vertex .
Example of usage :
pmidle = geompy . MakeVertex ( 50 , 0 , 50 )
edge1 = geompy . GetEdgeNearPoint ( blocksComp , pmidle )
"""
# Example: see GEOM_TestOthers.py
anObj = self . BlocksOp . GetVertexNearPoint ( theShape , thePoint )
RaiseIfFailed ( " GetVertexNearPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " vertex " )
2012-08-09 07:58:02 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Get an edge, found in the given shape by two given vertices.
# @param theShape Block or a compound of blocks.
# @param thePoint1,thePoint2 Points, close to the ends of the desired edge.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found edge.
2008-03-07 07:45:34 +00:00
#
2012-08-09 07:58:02 +00:00
# @ref swig_GetEdge "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetEdge ( self , theShape , thePoint1 , thePoint2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get an edge , found in the given shape by two given vertices .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Block or a compound of blocks .
thePoint1 , thePoint2 Points , close to the ends of the desired edge .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found edge .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetEdge ( theShape , thePoint1 , thePoint2 )
RaiseIfFailed ( " GetEdge " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edge " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find an edge of the given shape, which has minimal distance to the given point.
# @param theShape Block or a compound of blocks.
# @param thePoint Point, close to the desired edge.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found edge.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetEdgeNearPoint "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetEdgeNearPoint ( self , theShape , thePoint , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find an edge of the given shape , which has minimal distance to the given point .
2014-06-25 18:28:02 +04:00
Parameters :
2012-08-09 07:58:02 +00:00
theShape Block or a compound of blocks .
thePoint Point , close to the desired edge .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found edge .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetEdgeNearPoint ( theShape , thePoint )
RaiseIfFailed ( " GetEdgeNearPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " edge " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Returns a face, found in the given shape by four given corner vertices.
# @param theShape Block or a compound of blocks.
2009-02-13 12:16:39 +00:00
# @param thePoint1,thePoint2,thePoint3,thePoint4 Points, close to the corners of the desired face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetFaceByPoints ( self , theShape , thePoint1 , thePoint2 , thePoint3 , thePoint4 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Returns a face , found in the given shape by four given corner vertices .
Parameters :
theShape Block or a compound of blocks .
thePoint1 , thePoint2 , thePoint3 , thePoint4 Points , close to the corners of the desired face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetFaceByPoints ( theShape , thePoint1 , thePoint2 , thePoint3 , thePoint4 )
RaiseIfFailed ( " GetFaceByPoints " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Get a face of block, found in the given shape by two given edges.
# @param theShape Block or a compound of blocks.
# @param theEdge1,theEdge2 Edges, close to the edges of the desired face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetFaceByEdges ( self , theShape , theEdge1 , theEdge2 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get a face of block , found in the given shape by two given edges .
Parameters :
theShape Block or a compound of blocks .
theEdge1 , theEdge2 Edges , close to the edges of the desired face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetFaceByEdges ( theShape , theEdge1 , theEdge2 )
RaiseIfFailed ( " GetFaceByEdges " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find a face, opposite to the given one in the given block.
# @param theBlock Must be a hexahedral solid.
# @param theFace Face of \a theBlock, opposite to the desired face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetOppositeFace "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetOppositeFace ( self , theBlock , theFace , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find a face , opposite to the given one in the given block .
Parameters :
theBlock Must be a hexahedral solid .
theFace Face of theBlock , opposite to the desired face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM . GEOM_Object , containing the found face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetOppositeFace ( theBlock , theFace )
RaiseIfFailed ( " GetOppositeFace " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find a face of the given shape, which has minimal distance to the given point.
# @param theShape Block or a compound of blocks.
# @param thePoint Point, close to the desired face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetFaceNearPoint "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetFaceNearPoint ( self , theShape , thePoint , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find a face of the given shape , which has minimal distance to the given point .
Parameters :
theShape Block or a compound of blocks .
thePoint Point , close to the desired face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetFaceNearPoint ( theShape , thePoint )
RaiseIfFailed ( " GetFaceNearPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find a face of block, whose outside normale has minimal angle with the given vector.
2009-02-13 12:16:39 +00:00
# @param theBlock Block or a compound of blocks.
2008-03-07 07:45:34 +00:00
# @param theVector Vector, close to the normale of the desired face.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found face.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetFaceByNormale ( self , theBlock , theVector , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find a face of block , whose outside normale has minimal angle with the given vector .
Parameters :
theBlock Block or a compound of blocks .
theVector Vector , close to the normale of the desired face .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found face .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetFaceByNormale ( theBlock , theVector )
RaiseIfFailed ( " GetFaceByNormale " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " face " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Find all sub-shapes of type \a theShapeType of the given shape,
# which have minimal distance to the given point.
# @param theShape Any shape.
# @param thePoint Point, close to the desired shape.
# @param theShapeType Defines what kind of sub-shapes is searched GEOM::shape_type
# @param theTolerance The tolerance for distances comparison. All shapes
# with distances to the given point in interval
# [minimal_distance, minimal_distance + theTolerance] will be gathered.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM_Object, containing a group of all found shapes.
#
# @ref swig_GetShapesNearPoint "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetShapesNearPoint ( self , theShape , thePoint , theShapeType , theTolerance = 1e-07 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find all sub - shapes of type theShapeType of the given shape ,
which have minimal distance to the given point .
Parameters :
theShape Any shape .
thePoint Point , close to the desired shape .
theShapeType Defines what kind of sub - shapes is searched ( see GEOM : : shape_type )
theTolerance The tolerance for distances comparison . All shapes
with distances to the given point in interval
[ minimal_distance , minimal_distance + theTolerance ] will be gathered .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM_Object , containing a group of all found shapes .
"""
# Example: see GEOM_TestOthers.py
anObj = self . BlocksOp . GetShapesNearPoint ( theShape , thePoint , theShapeType , theTolerance )
RaiseIfFailed ( " GetShapesNearPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " group " )
2012-08-09 07:58:02 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l3_blocks_op
## @}
## @addtogroup l4_blocks_measure
## @{
2008-03-07 07:45:34 +00:00
## Check, if the compound of blocks is given.
# To be considered as a compound of blocks, the
# given shape must satisfy the following conditions:
2015-01-22 12:14:55 +03:00
# - Each element of the compound should be a Block (6 faces).
# - Each face should be a quadrangle, i.e. it should have only 1 wire
# with 4 edges. If <VAR>theIsUseC1</VAR> is set to True and
# there are more than 4 edges in the only wire of a face,
# this face is considered to be quadrangle if it has 4 bounds
# (1 or more edge) of C1 continuity.
2008-03-07 07:45:34 +00:00
# - A connection between two Blocks should be an entire quadrangle face or an entire edge.
# - The compound should be connexe.
# - The glue between two quadrangle faces should be applied.
# @param theCompound The compound to check.
2015-01-22 12:14:55 +03:00
# @param theIsUseC1 Flag to check if there are 4 bounds on a face
# taking into account C1 continuity.
# @param theAngTolerance the angular tolerance to check if two neighbor
# edges are codirectional in the common vertex with this
# tolerance. This parameter is used only if
# <VAR>theIsUseC1</VAR> is set to True.
2008-03-07 07:45:34 +00:00
# @return TRUE, if the given shape is a compound of blocks.
# If theCompound is not valid, prints all discovered errors.
#
2014-12-16 19:27:28 +03:00
# @ref tui_check_compound_of_blocks_page "Example 1"
2009-02-13 12:16:39 +00:00
# \n @ref swig_CheckCompoundOfBlocks "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2015-01-22 12:14:55 +03:00
def CheckCompoundOfBlocks ( self , theCompound , theIsUseC1 = False ,
theAngTolerance = 1.e-12 ) :
2012-08-09 07:58:02 +00:00
"""
Check , if the compound of blocks is given .
To be considered as a compound of blocks , the
given shape must satisfy the following conditions :
2015-01-22 12:14:55 +03:00
- Each element of the compound should be a Block ( 6 faces ) .
- Each face should be a quadrangle , i . e . it should have only 1 wire
with 4 edges . If theIsUseC1 is set to True and
there are more than 4 edges in the only wire of a face ,
this face is considered to be quadrangle if it has 4 bounds
( 1 or more edge ) of C1 continuity .
2012-08-09 07:58:02 +00:00
- A connection between two Blocks should be an entire quadrangle face or an entire edge .
- The compound should be connexe .
- The glue between two quadrangle faces should be applied .
Parameters :
theCompound The compound to check .
2015-01-22 12:14:55 +03:00
theIsUseC1 Flag to check if there are 4 bounds on a face
taking into account C1 continuity .
theAngTolerance the angular tolerance to check if two neighbor
edges are codirectional in the common vertex with this
tolerance . This parameter is used only if
theIsUseC1 is set to True .
2012-08-09 07:58:02 +00:00
Returns :
TRUE , if the given shape is a compound of blocks .
2014-06-25 18:28:02 +04:00
If theCompound is not valid , prints all discovered errors .
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2015-01-22 12:14:55 +03:00
aTolerance = - 1.0
if theIsUseC1 :
aTolerance = theAngTolerance
( IsValid , BCErrors ) = self . BlocksOp . CheckCompoundOfBlocks ( theCompound , aTolerance )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " CheckCompoundOfBlocks " , self . BlocksOp )
if IsValid == 0 :
Descr = self . BlocksOp . PrintBCErrors ( theCompound , BCErrors )
print Descr
return IsValid
2009-02-13 12:16:39 +00:00
2012-10-08 11:16:36 +00:00
## Retrieve all non blocks solids and faces from \a theShape.
# @param theShape The shape to explore.
2015-01-22 12:14:55 +03:00
# @param theIsUseC1 Flag to check if there are 4 bounds on a face
# taking into account C1 continuity.
# @param theAngTolerance the angular tolerance to check if two neighbor
# edges are codirectional in the common vertex with this
# tolerance. This parameter is used only if
# <VAR>theIsUseC1</VAR> is set to True.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return A tuple of two GEOM_Objects. The first object is a group of all
# non block solids (= not 6 faces, or with 6 faces, but with the
# presence of non-quadrangular faces). The second object is a
2015-01-22 12:14:55 +03:00
# group of all non quadrangular faces (= faces with more then
# 1 wire or, if <VAR>theIsUseC1</VAR> is set to True, faces
# with 1 wire with not 4 edges that do not form 4 bounds of
# C1 continuity).
2012-10-08 11:16:36 +00:00
#
2014-12-16 19:27:28 +03:00
# @ref tui_get_non_blocks_page "Example 1"
2012-10-08 11:16:36 +00:00
# \n @ref swig_GetNonBlocks "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2015-01-22 12:14:55 +03:00
def GetNonBlocks ( self , theShape , theIsUseC1 = False ,
theAngTolerance = 1.e-12 , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Retrieve all non blocks solids and faces from theShape .
Parameters :
theShape The shape to explore .
2015-01-22 12:14:55 +03:00
theIsUseC1 Flag to check if there are 4 bounds on a face
taking into account C1 continuity .
theAngTolerance the angular tolerance to check if two neighbor
edges are codirectional in the common vertex with this
tolerance . This parameter is used only if
theIsUseC1 is set to True .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
A tuple of two GEOM_Objects . The first object is a group of all
non block solids ( = not 6 faces , or with 6 faces , but with the
presence of non - quadrangular faces ) . The second object is a
2015-01-22 12:14:55 +03:00
group of all non quadrangular faces ( = faces with more then
1 wire or , if < VAR > theIsUseC1 < / VAR > is set to True , faces
with 1 wire with not 4 edges that do not form 4 bounds of
C1 continuity ) .
2012-10-08 11:16:36 +00:00
Usage :
( res_sols , res_faces ) = geompy . GetNonBlocks ( myShape1 )
"""
# Example: see GEOM_Spanner.py
2015-01-22 12:14:55 +03:00
aTolerance = - 1.0
if theIsUseC1 :
aTolerance = theAngTolerance
aTuple = self . BlocksOp . GetNonBlocks ( theShape , aTolerance )
2012-10-08 11:16:36 +00:00
RaiseIfFailed ( " GetNonBlocks " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aTuple , theName , ( " groupNonHexas " , " groupNonQuads " ) )
2012-10-08 11:16:36 +00:00
return aTuple
2008-03-07 07:45:34 +00:00
## Remove all seam and degenerated edges from \a theShape.
# Unite faces and edges, sharing one surface. It means that
# this faces must have references to one C++ surface object (handle).
# @param theShape The compound or single solid to remove irregular edges from.
2012-08-09 07:58:02 +00:00
# @param doUnionFaces If True, then unite faces. If False (the default value),
# do not unite faces.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return Improved shape.
#
2009-02-13 12:16:39 +00:00
# @ref swig_RemoveExtraEdges "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def RemoveExtraEdges ( self , theShape , doUnionFaces = False , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Remove all seam and degenerated edges from theShape .
Unite faces and edges , sharing one surface . It means that
this faces must have references to one C + + surface object ( handle ) .
Parameters :
theShape The compound or single solid to remove irregular edges from .
doUnionFaces If True , then unite faces . If False ( the default value ) ,
do not unite faces .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Improved shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2012-08-09 07:58:02 +00:00
nbFacesOptimum = - 1 # -1 means do not unite faces
if doUnionFaces is True : nbFacesOptimum = 0 # 0 means unite faces
anObj = self . BlocksOp . RemoveExtraEdges ( theShape , nbFacesOptimum )
2008-03-07 07:45:34 +00:00
RaiseIfFailed ( " RemoveExtraEdges " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " removeExtraEdges " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2013-05-24 08:52:30 +00:00
## Performs union faces of \a theShape
# Unite faces sharing one surface. It means that
# these faces must have references to one C++ surface object (handle).
# @param theShape The compound or single solid that contains faces
# to perform union.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return Improved shape.
#
# @ref swig_UnionFaces "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-05-24 08:52:30 +00:00
def UnionFaces ( self , theShape , theName = None ) :
"""
Performs union faces of theShape .
Unite faces sharing one surface . It means that
these faces must have references to one C + + surface object ( handle ) .
Parameters :
theShape The compound or single solid that contains faces
to perform union .
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2014-06-25 18:28:02 +04:00
Returns :
2013-05-24 08:52:30 +00:00
Improved shape .
"""
# Example: see GEOM_TestOthers.py
anObj = self . BlocksOp . UnionFaces ( theShape )
RaiseIfFailed ( " UnionFaces " , self . BlocksOp )
self . _autoPublish ( anObj , theName , " unionFaces " )
return anObj
2008-03-07 07:45:34 +00:00
## Check, if the given shape is a blocks compound.
# Fix all detected errors.
# \note Single block can be also fixed by this method.
2009-02-13 12:16:39 +00:00
# @param theShape The compound to check and improve.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2008-03-07 07:45:34 +00:00
# @return Improved compound.
#
2009-02-13 12:16:39 +00:00
# @ref swig_CheckAndImprove "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def CheckAndImprove ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Check , if the given shape is a blocks compound .
Fix all detected errors .
Note :
Single block can be also fixed by this method .
Parameters :
theShape The compound to check and improve .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
Improved compound .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . CheckAndImprove ( theShape )
RaiseIfFailed ( " CheckAndImprove " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " improved " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
# end of l4_blocks_measure
## @}
## @addtogroup l3_blocks_op
## @{
2008-03-07 07:45:34 +00:00
## Get all the blocks, contained in the given compound.
# @param theCompound The compound to explode.
# @param theMinNbFaces If solid has lower number of faces, it is not a block.
# @param theMaxNbFaces If solid has higher number of faces, it is not a block.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note If theMaxNbFaces = 0, the maximum number of faces is not restricted.
#
2012-08-09 07:58:02 +00:00
# @return List of GEOM.GEOM_Object, containing the retrieved blocks.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_explode_on_blocks "Example 1"
# \n @ref swig_MakeBlockExplode "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeBlockExplode ( self , theCompound , theMinNbFaces , theMaxNbFaces , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Get all the blocks , contained in the given compound .
Parameters :
theCompound The compound to explode .
theMinNbFaces If solid has lower number of faces , it is not a block .
theMaxNbFaces If solid has higher number of faces , it is not a block .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
If theMaxNbFaces = 0 , the maximum number of faces is not restricted .
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
List of GEOM . GEOM_Object , containing the retrieved blocks .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
theMinNbFaces , theMaxNbFaces , Parameters = ParseParameters ( theMinNbFaces , theMaxNbFaces )
2008-03-07 07:45:34 +00:00
aList = self . BlocksOp . ExplodeCompoundOfBlocks ( theCompound , theMinNbFaces , theMaxNbFaces )
RaiseIfFailed ( " ExplodeCompoundOfBlocks " , self . BlocksOp )
2009-02-13 12:16:39 +00:00
for anObj in aList :
anObj . SetParameters ( Parameters )
pass
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " block " )
2008-03-07 07:45:34 +00:00
return aList
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find block, containing the given point inside its volume or on boundary.
# @param theCompound Compound, to find block in.
# @param thePoint Point, close to the desired block. If the point lays on
# boundary between some blocks, we return block with nearest center.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found block.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetBlockNearPoint ( self , theCompound , thePoint , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find block , containing the given point inside its volume or on boundary .
Parameters :
theCompound Compound , to find block in .
thePoint Point , close to the desired block . If the point lays on
boundary between some blocks , we return block with nearest center .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the found block .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetBlockNearPoint ( theCompound , thePoint )
RaiseIfFailed ( " GetBlockNearPoint " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " block " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Find block, containing all the elements, passed as the parts, or maximum quantity of them.
# @param theCompound Compound, to find block in.
# @param theParts List of faces and/or edges and/or vertices to be parts of the found block.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the found block.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetBlockByParts "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetBlockByParts ( self , theCompound , theParts , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Find block , containing all the elements , passed as the parts , or maximum quantity of them .
Parameters :
theCompound Compound , to find block in .
theParts List of faces and / or edges and / or vertices to be parts of the found block .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
2014-06-25 18:28:02 +04:00
Returns :
2012-08-09 07:58:02 +00:00
New GEOM_Object , containing the found block .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . GetBlockByParts ( theCompound , theParts )
RaiseIfFailed ( " GetBlockByParts " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " block " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Return all blocks, containing all the elements, passed as the parts.
# @param theCompound Compound, to find blocks in.
# @param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return List of GEOM.GEOM_Object, containing the found blocks.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def GetBlocksByParts ( self , theCompound , theParts , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Return all blocks , containing all the elements , passed as the parts .
Parameters :
theCompound Compound , to find blocks in .
theParts List of faces and / or edges and / or vertices to be parts of the found blocks .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of GEOM . GEOM_Object , containing the found blocks .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
2008-03-07 07:45:34 +00:00
aList = self . BlocksOp . GetBlocksByParts ( theCompound , theParts )
RaiseIfFailed ( " GetBlocksByParts " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aList , theName , " block " )
2008-03-07 07:45:34 +00:00
return aList
## Multi-transformate block and glue the result.
# Transformation is defined so, as to superpose direction faces.
# @param Block Hexahedral solid to be multi-transformed.
# @param DirFace1 ID of First direction face.
# @param DirFace2 ID of Second direction face.
# @param NbTimes Quantity of transformations to be done.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @note Unique ID of sub-shape can be obtained, using method GetSubShapeID().
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_transformation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeMultiTransformation1D ( self , Block , DirFace1 , DirFace2 , NbTimes , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Multi - transformate block and glue the result .
Transformation is defined so , as to superpose direction faces .
Parameters :
Block Hexahedral solid to be multi - transformed .
DirFace1 ID of First direction face .
DirFace2 ID of Second direction face .
NbTimes Quantity of transformations to be done .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Note :
Unique ID of sub - shape can be obtained , using method GetSubShapeID ( ) .
Returns :
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
DirFace1 , DirFace2 , NbTimes , Parameters = ParseParameters ( DirFace1 , DirFace2 , NbTimes )
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeMultiTransformation1D ( Block , DirFace1 , DirFace2 , NbTimes )
RaiseIfFailed ( " MakeMultiTransformation1D " , self . BlocksOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " transformed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Multi-transformate block and glue the result.
# @param Block Hexahedral solid to be multi-transformed.
# @param DirFace1U,DirFace2U IDs of Direction faces for the first transformation.
# @param DirFace1V,DirFace2V IDs of Direction faces for the second transformation.
# @param NbTimesU,NbTimesV Quantity of transformations to be done.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return New GEOM.GEOM_Object, containing the result shape.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_multi_transformation "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def MakeMultiTransformation2D ( self , Block , DirFace1U , DirFace2U , NbTimesU ,
DirFace1V , DirFace2V , NbTimesV , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Multi - transformate block and glue the result .
Parameters :
Block Hexahedral solid to be multi - transformed .
DirFace1U , DirFace2U IDs of Direction faces for the first transformation .
DirFace1V , DirFace2V IDs of Direction faces for the second transformation .
NbTimesU , NbTimesV Quantity of transformations to be done .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
New GEOM . GEOM_Object , containing the result shape .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_Spanner.py
DirFace1U , DirFace2U , NbTimesU , DirFace1V , DirFace2V , NbTimesV , Parameters = ParseParameters (
DirFace1U , DirFace2U , NbTimesU , DirFace1V , DirFace2V , NbTimesV )
2008-03-07 07:45:34 +00:00
anObj = self . BlocksOp . MakeMultiTransformation2D ( Block , DirFace1U , DirFace2U , NbTimesU ,
DirFace1V , DirFace2V , NbTimesV )
RaiseIfFailed ( " MakeMultiTransformation2D " , self . BlocksOp )
2009-02-13 12:16:39 +00:00
anObj . SetParameters ( Parameters )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " transformed " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Build all possible propagation groups.
# Propagation group is a set of all edges, opposite to one (main)
# edge of this group directly or through other opposite edges.
# Notion of Opposite Edge make sence only on quadrangle face.
# @param theShape Shape to build propagation groups on.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return List of GEOM.GEOM_Object, each of them is a propagation group.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_Propagate "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " BlocksOp " )
2013-02-12 11:35:16 +00:00
def Propagate ( self , theShape , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Build all possible propagation groups .
Propagation group is a set of all edges , opposite to one ( main )
edge of this group directly or through other opposite edges .
Notion of Opposite Edge make sence only on quadrangle face .
Parameters :
theShape Shape to build propagation groups on .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
List of GEOM . GEOM_Object , each of them is a propagation group .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
listChains = self . BlocksOp . Propagate ( theShape )
RaiseIfFailed ( " Propagate " , self . BlocksOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( listChains , theName , " propagate " )
2008-03-07 07:45:34 +00:00
return listChains
2009-02-13 12:16:39 +00:00
# end of l3_blocks_op
## @}
## @addtogroup l3_groups
## @{
2012-08-09 07:58:02 +00:00
## Creates a new group which will store sub-shapes of theMainShape
2008-03-07 07:45:34 +00:00
# @param theMainShape is a GEOM object on which the group is selected
2012-08-09 07:58:02 +00:00
# @param theShapeType defines a shape type of the group (see GEOM::shape_type)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return a newly created GEOM group (GEOM.GEOM_Object)
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_working_with_groups_page "Example 1"
# \n @ref swig_CreateGroup "Example 2"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def CreateGroup ( self , theMainShape , theShapeType , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Creates a new group which will store sub - shapes of theMainShape
Parameters :
theMainShape is a GEOM object on which the group is selected
theShapeType defines a shape type of the group : " COMPOUND " , " COMPSOLID " ,
" SOLID " , " SHELL " , " FACE " , " WIRE " , " EDGE " , " VERTEX " , " SHAPE " .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
a newly created GEOM group
Example of usage :
group = geompy . CreateGroup ( Box , geompy . ShapeType [ " FACE " ] )
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . GroupOp . CreateGroup ( theMainShape , theShapeType )
RaiseIfFailed ( " CreateGroup " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " group " )
2008-03-07 07:45:34 +00:00
return anObj
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Adds a sub-object with ID theSubShapeId to the group
# @param theGroup is a GEOM group to which the new sub-shape is added
# @param theSubShapeID is a sub-shape ID in the main object.
# \note Use method GetSubShapeID() to get an unique ID of the sub-shape
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_working_with_groups_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def AddObject ( self , theGroup , theSubShapeID ) :
2012-08-09 07:58:02 +00:00
"""
Adds a sub - object with ID theSubShapeId to the group
Parameters :
theGroup is a GEOM group to which the new sub - shape is added
theSubShapeID is a sub - shape ID in the main object .
Note :
2014-06-25 18:28:02 +04:00
Use method GetSubShapeID ( ) to get an unique ID of the sub - shape
2012-08-09 07:58:02 +00:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . AddObject ( theGroup , theSubShapeID )
2012-08-09 07:58:02 +00:00
if self . GroupOp . GetErrorCode ( ) != " PAL_ELEMENT_ALREADY_PRESENT " :
RaiseIfFailed ( " AddObject " , self . GroupOp )
pass
2008-03-07 07:45:34 +00:00
pass
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Removes a sub-object with ID \a theSubShapeId from the group
# @param theGroup is a GEOM group from which the new sub-shape is removed
# @param theSubShapeID is a sub-shape ID in the main object.
# \note Use method GetSubShapeID() to get an unique ID of the sub-shape
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_working_with_groups_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def RemoveObject ( self , theGroup , theSubShapeID ) :
2012-08-09 07:58:02 +00:00
"""
Removes a sub - object with ID theSubShapeId from the group
Parameters :
theGroup is a GEOM group from which the new sub - shape is removed
theSubShapeID is a sub - shape ID in the main object .
Note :
Use method GetSubShapeID ( ) to get an unique ID of the sub - shape
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . RemoveObject ( theGroup , theSubShapeID )
RaiseIfFailed ( " RemoveObject " , self . GroupOp )
pass
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
2012-08-09 07:58:02 +00:00
# @param theGroup is a GEOM group to which the new sub-shapes are added.
# @param theSubShapes is a list of sub-shapes to be added.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref tui_working_with_groups_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def UnionList ( self , theGroup , theSubShapes ) :
2012-08-09 07:58:02 +00:00
"""
Adds to the group all the given shapes . No errors , if some shapes are alredy included .
Parameters :
theGroup is a GEOM group to which the new sub - shapes are added .
theSubShapes is a list of sub - shapes to be added .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . UnionList ( theGroup , theSubShapes )
RaiseIfFailed ( " UnionList " , self . GroupOp )
pass
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Adds to the group all the given shapes. No errors, if some shapes are alredy included.
# @param theGroup is a GEOM group to which the new sub-shapes are added.
# @param theSubShapes is a list of indices of sub-shapes to be added.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_UnionIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def UnionIDs ( self , theGroup , theSubShapes ) :
2012-08-09 07:58:02 +00:00
"""
Adds to the group all the given shapes . No errors , if some shapes are alredy included .
Parameters :
theGroup is a GEOM group to which the new sub - shapes are added .
theSubShapes is a list of indices of sub - shapes to be added .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . UnionIDs ( theGroup , theSubShapes )
RaiseIfFailed ( " UnionIDs " , self . GroupOp )
pass
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Removes from the group all the given shapes. No errors, if some shapes are not included.
# @param theGroup is a GEOM group from which the sub-shapes are removed.
# @param theSubShapes is a list of sub-shapes to be removed.
#
2009-02-13 12:16:39 +00:00
# @ref tui_working_with_groups_page "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def DifferenceList ( self , theGroup , theSubShapes ) :
2012-08-09 07:58:02 +00:00
"""
Removes from the group all the given shapes . No errors , if some shapes are not included .
Parameters :
theGroup is a GEOM group from which the sub - shapes are removed .
theSubShapes is a list of sub - shapes to be removed .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . DifferenceList ( theGroup , theSubShapes )
RaiseIfFailed ( " DifferenceList " , self . GroupOp )
pass
2012-08-09 07:58:02 +00:00
## Removes from the group all the given shapes. No errors, if some shapes are not included.
# @param theGroup is a GEOM group from which the sub-shapes are removed.
# @param theSubShapes is a list of indices of sub-shapes to be removed.
2008-03-07 07:45:34 +00:00
#
2009-02-13 12:16:39 +00:00
# @ref swig_DifferenceIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def DifferenceIDs ( self , theGroup , theSubShapes ) :
2012-08-09 07:58:02 +00:00
"""
Removes from the group all the given shapes . No errors , if some shapes are not included .
Parameters :
theGroup is a GEOM group from which the sub - shapes are removed .
theSubShapes is a list of indices of sub - shapes to be removed .
2014-06-25 18:28:02 +04:00
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
self . GroupOp . DifferenceIDs ( theGroup , theSubShapes )
RaiseIfFailed ( " DifferenceIDs " , self . GroupOp )
pass
2009-02-13 12:16:39 +00:00
2012-10-08 11:16:36 +00:00
## Union of two groups.
# New group is created. It will contain all entities
# which are present in groups theGroup1 and theGroup2.
# @param theGroup1, theGroup2 are the initial GEOM groups
# to create the united group from.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_union_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def UnionGroups ( self , theGroup1 , theGroup2 , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Union of two groups .
New group is created . It will contain all entities
which are present in groups theGroup1 and theGroup2 .
Parameters :
theGroup1 , theGroup2 are the initial GEOM groups
to create the united group from .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . UnionGroups ( theGroup1 , theGroup2 )
RaiseIfFailed ( " UnionGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
## Intersection of two groups.
# New group is created. It will contain only those entities
# which are present in both groups theGroup1 and theGroup2.
# @param theGroup1, theGroup2 are the initial GEOM groups to get common part of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_intersect_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def IntersectGroups ( self , theGroup1 , theGroup2 , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Intersection of two groups .
New group is created . It will contain only those entities
which are present in both groups theGroup1 and theGroup2 .
Parameters :
theGroup1 , theGroup2 are the initial GEOM groups to get common part of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . IntersectGroups ( theGroup1 , theGroup2 )
RaiseIfFailed ( " IntersectGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
## Cut of two groups.
# New group is created. It will contain entities which are
# present in group theGroup1 but are not present in group theGroup2.
# @param theGroup1 is a GEOM group to include elements of.
# @param theGroup2 is a GEOM group to exclude elements of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_cut_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def CutGroups ( self , theGroup1 , theGroup2 , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Cut of two groups .
New group is created . It will contain entities which are
present in group theGroup1 but are not present in group theGroup2 .
Parameters :
theGroup1 is a GEOM group to include elements of .
theGroup2 is a GEOM group to exclude elements of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . CutGroups ( theGroup1 , theGroup2 )
RaiseIfFailed ( " CutGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
## Union of list of groups.
# New group is created. It will contain all entities that are
# present in groups listed in theGList.
# @param theGList is a list of GEOM groups to create the united group from.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_union_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def UnionListOfGroups ( self , theGList , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Union of list of groups .
New group is created . It will contain all entities that are
present in groups listed in theGList .
Parameters :
theGList is a list of GEOM groups to create the united group from .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . UnionListOfGroups ( theGList )
RaiseIfFailed ( " UnionListOfGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
## Cut of lists of groups.
# New group is created. It will contain only entities
2013-06-17 12:42:48 +00:00
# which are present in groups listed in theGList.
# @param theGList is a list of GEOM groups to include elements of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_intersect_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def IntersectListOfGroups ( self , theGList , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Cut of lists of groups .
New group is created . It will contain only entities
2013-06-17 12:42:48 +00:00
which are present in groups listed in theGList .
2012-10-08 11:16:36 +00:00
Parameters :
2013-06-17 12:42:48 +00:00
theGList is a list of GEOM groups to include elements of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . IntersectListOfGroups ( theGList )
RaiseIfFailed ( " IntersectListOfGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
## Cut of lists of groups.
# New group is created. It will contain only entities
2014-06-25 18:28:02 +04:00
# which are present in groups listed in theGList1 but
2012-10-08 11:16:36 +00:00
# are not present in groups from theGList2.
# @param theGList1 is a list of GEOM groups to include elements of.
# @param theGList2 is a list of GEOM groups to exclude elements of.
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-10-08 11:16:36 +00:00
# @return a newly created GEOM group.
2013-02-12 11:35:16 +00:00
#
2012-10-08 11:16:36 +00:00
# @ref tui_cut_groups_anchor "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2013-02-12 11:35:16 +00:00
def CutListOfGroups ( self , theGList1 , theGList2 , theName = None ) :
2012-10-08 11:16:36 +00:00
"""
Cut of lists of groups .
New group is created . It will contain only entities
2014-06-25 18:28:02 +04:00
which are present in groups listed in theGList1 but
2012-10-08 11:16:36 +00:00
are not present in groups from theGList2 .
Parameters :
theGList1 is a list of GEOM groups to include elements of .
theGList2 is a list of GEOM groups to exclude elements of .
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-10-08 11:16:36 +00:00
Returns :
a newly created GEOM group .
"""
# Example: see GEOM_TestOthers.py
aGroup = self . GroupOp . CutListOfGroups ( theGList1 , theGList2 )
RaiseIfFailed ( " CutListOfGroups " , self . GroupOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( aGroup , theName , " group " )
2012-10-08 11:16:36 +00:00
return aGroup
2012-08-09 07:58:02 +00:00
## Returns a list of sub-objects ID stored in the group
2008-03-07 07:45:34 +00:00
# @param theGroup is a GEOM group for which a list of IDs is requested
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetObjectIDs "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def GetObjectIDs ( self , theGroup ) :
2012-08-09 07:58:02 +00:00
"""
Returns a list of sub - objects ID stored in the group
Parameters :
theGroup is a GEOM group for which a list of IDs is requested
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
ListIDs = self . GroupOp . GetObjects ( theGroup )
RaiseIfFailed ( " GetObjects " , self . GroupOp )
return ListIDs
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Returns a type of sub-objects stored in the group
2008-03-07 07:45:34 +00:00
# @param theGroup is a GEOM group which type is returned.
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetType "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def GetType ( self , theGroup ) :
2012-08-09 07:58:02 +00:00
"""
Returns a type of sub - objects stored in the group
Parameters :
theGroup is a GEOM group which type is returned .
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
aType = self . GroupOp . GetType ( theGroup )
RaiseIfFailed ( " GetType " , self . GroupOp )
return aType
2009-02-13 12:16:39 +00:00
2012-08-09 07:58:02 +00:00
## Convert a type of geom object from id to string value
# @param theId is a GEOM obect type id.
# @return type of geom object (POINT, VECTOR, PLANE, LINE, TORUS, ... )
# @ref swig_GetType "Example"
def ShapeIdToType ( self , theId ) :
"""
Convert a type of geom object from id to string value
Parameters :
theId is a GEOM obect type id .
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Returns :
type of geom object ( POINT , VECTOR , PLANE , LINE , TORUS , . . . )
"""
if theId == 0 :
return " COPY "
if theId == 1 :
return " IMPORT "
if theId == 2 :
return " POINT "
if theId == 3 :
return " VECTOR "
if theId == 4 :
return " PLANE "
if theId == 5 :
return " LINE "
if theId == 6 :
return " TORUS "
if theId == 7 :
return " BOX "
if theId == 8 :
return " CYLINDER "
if theId == 9 :
return " CONE "
if theId == 10 :
return " SPHERE "
if theId == 11 :
return " PRISM "
if theId == 12 :
return " REVOLUTION "
if theId == 13 :
return " BOOLEAN "
if theId == 14 :
return " PARTITION "
if theId == 15 :
return " POLYLINE "
if theId == 16 :
return " CIRCLE "
if theId == 17 :
return " SPLINE "
if theId == 18 :
return " ELLIPSE "
if theId == 19 :
return " CIRC_ARC "
if theId == 20 :
return " FILLET "
if theId == 21 :
return " CHAMFER "
if theId == 22 :
return " EDGE "
if theId == 23 :
return " WIRE "
if theId == 24 :
return " FACE "
if theId == 25 :
return " SHELL "
if theId == 26 :
return " SOLID "
if theId == 27 :
return " COMPOUND "
if theId == 28 :
return " SUBSHAPE "
if theId == 29 :
return " PIPE "
if theId == 30 :
return " ARCHIMEDE "
if theId == 31 :
return " FILLING "
if theId == 32 :
return " EXPLODE "
if theId == 33 :
return " GLUED "
if theId == 34 :
return " SKETCHER "
if theId == 35 :
return " CDG "
if theId == 36 :
return " FREE_BOUNDS "
if theId == 37 :
return " GROUP "
if theId == 38 :
return " BLOCK "
if theId == 39 :
return " MARKER "
if theId == 40 :
return " THRUSECTIONS "
if theId == 41 :
return " COMPOUNDFILTER "
if theId == 42 :
return " SHAPES_ON_SHAPE "
if theId == 43 :
return " ELLIPSE_ARC "
if theId == 44 :
return " 3DSKETCHER "
if theId == 45 :
return " FILLET_2D "
if theId == 46 :
return " FILLET_1D "
if theId == 201 :
return " PIPETSHAPE "
return " Shape Id not exist. "
2008-03-07 07:45:34 +00:00
## Returns a main shape associated with the group
# @param theGroup is a GEOM group for which a main shape object is requested
# @return a GEOM object which is a main shape for theGroup
#
2009-02-13 12:16:39 +00:00
# @ref swig_GetMainShape "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " GroupOp " )
2008-03-07 07:45:34 +00:00
def GetMainShape ( self , theGroup ) :
2012-08-09 07:58:02 +00:00
"""
Returns a main shape associated with the group
Parameters :
theGroup is a GEOM group for which a main shape object is requested
Returns :
a GEOM object which is a main shape for theGroup
Example of usage : BoxCopy = geompy . GetMainShape ( CreateGroup )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestOthers.py
2008-03-07 07:45:34 +00:00
anObj = self . GroupOp . GetMainShape ( theGroup )
RaiseIfFailed ( " GetMainShape " , self . GroupOp )
return anObj
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create group of edges of theShape, whose length is in range [min_length, max_length].
# If include_min/max == 0, edges with length == min/max_length will not be included in result.
2012-08-09 07:58:02 +00:00
# @param theShape given shape (see GEOM.GEOM_Object)
# @param min_length minimum length of edges of theShape
# @param max_length maximum length of edges of theShape
# @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
# @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
2012-08-09 07:58:02 +00:00
# @return a newly created GEOM group of edges
2013-02-12 11:35:16 +00:00
#
2012-08-09 07:58:02 +00:00
# @@ref swig_todo "Example"
2013-02-12 11:35:16 +00:00
def GetEdgesByLength ( self , theShape , min_length , max_length , include_min = 1 , include_max = 1 , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create group of edges of theShape , whose length is in range [ min_length , max_length ] .
If include_min / max == 0 , edges with length == min / max_length will not be included in result .
Parameters :
theShape given shape
min_length minimum length of edges of theShape
max_length maximum length of edges of theShape
include_max indicating if edges with length == max_length should be included in result , 1 - yes , 0 - no ( default = 1 )
include_min indicating if edges with length == min_length should be included in result , 1 - yes , 0 - no ( default = 1 )
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
a newly created GEOM group of edges .
"""
2013-04-04 07:06:43 +00:00
edges = self . SubShapeAll ( theShape , self . ShapeType [ " EDGE " ] )
2008-03-07 07:45:34 +00:00
edges_in_range = [ ]
for edge in edges :
Props = self . BasicProperties ( edge )
if min_length < = Props [ 0 ] and Props [ 0 ] < = max_length :
if ( not include_min ) and ( min_length == Props [ 0 ] ) :
skip = 1
else :
if ( not include_max ) and ( Props [ 0 ] == max_length ) :
skip = 1
else :
edges_in_range . append ( edge )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
if len ( edges_in_range ) < = 0 :
print " No edges found by given criteria "
2013-02-12 11:35:16 +00:00
return None
2009-02-13 12:16:39 +00:00
2013-02-12 11:35:16 +00:00
# note: auto-publishing is done in self.CreateGroup()
2013-04-04 07:06:43 +00:00
group_edges = self . CreateGroup ( theShape , self . ShapeType [ " EDGE " ] , theName )
2008-03-07 07:45:34 +00:00
self . UnionList ( group_edges , edges_in_range )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
return group_edges
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
## Create group of edges of selected shape, whose length is in range [min_length, max_length].
# If include_min/max == 0, edges with length == min/max_length will not be included in result.
2012-08-09 07:58:02 +00:00
# @param min_length minimum length of edges of selected shape
# @param max_length maximum length of edges of selected shape
# @param include_max indicating if edges with length == max_length should be included in result, 1-yes, 0-no (default=1)
# @param include_min indicating if edges with length == min_length should be included in result, 1-yes, 0-no (default=1)
# @return a newly created GEOM group of edges
2009-02-13 12:16:39 +00:00
# @ref swig_todo "Example"
def SelectEdges ( self , min_length , max_length , include_min = 1 , include_max = 1 ) :
2012-08-09 07:58:02 +00:00
"""
Create group of edges of selected shape , whose length is in range [ min_length , max_length ] .
If include_min / max == 0 , edges with length == min / max_length will not be included in result .
Parameters :
min_length minimum length of edges of selected shape
max_length maximum length of edges of selected shape
include_max indicating if edges with length == max_length should be included in result , 1 - yes , 0 - no ( default = 1 )
include_min indicating if edges with length == min_length should be included in result , 1 - yes , 0 - no ( default = 1 )
Returns :
a newly created GEOM group of edges .
"""
2008-03-07 07:45:34 +00:00
nb_selected = sg . SelectedCount ( )
if nb_selected < 1 :
print " Select a shape before calling this function, please. "
return 0
if nb_selected > 1 :
print " Only one shape must be selected "
return 0
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
id_shape = sg . getSelected ( 0 )
shape = IDToObject ( id_shape )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
group_edges = self . GetEdgesByLength ( shape , min_length , max_length , include_min , include_max )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
left_str = " < "
right_str = " < "
if include_min : left_str = " <= "
if include_max : right_str = " <= "
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
self . addToStudyInFather ( shape , group_edges , " Group of edges with " + ` min_length `
+ left_str + " length " + right_str + ` max_length ` )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
sg . updateObjBrowser ( 1 )
2009-02-13 12:16:39 +00:00
2008-03-07 07:45:34 +00:00
return group_edges
2009-02-13 12:16:39 +00:00
# end of l3_groups
## @}
2012-08-09 07:58:02 +00:00
#@@ insert new functions before this line @@ do not remove this line @@#
2009-02-13 12:16:39 +00:00
## Create a copy of the given object
#
2012-08-09 07:58:02 +00:00
# @param theOriginal geometry object for copy
2013-02-12 11:35:16 +00:00
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM_Object, containing the copied shape.
#
2013-04-17 10:43:10 +00:00
# @ingroup l1_geomBuilder_auxiliary
2012-08-09 07:58:02 +00:00
# @ref swig_MakeCopy "Example"
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2013-02-12 11:35:16 +00:00
def MakeCopy ( self , theOriginal , theName = None ) :
2012-08-09 07:58:02 +00:00
"""
Create a copy of the given object
2013-03-15 14:28:11 +00:00
Parameters :
2012-08-09 07:58:02 +00:00
theOriginal geometry object for copy
2013-02-12 11:35:16 +00:00
theName Object name ; when specified , this parameter is used
for result publication in the study . Otherwise , if automatic
publication is switched on , default value is used for result name .
2012-08-09 07:58:02 +00:00
Returns :
2013-02-12 11:35:16 +00:00
New GEOM_Object , containing the copied shape .
2012-08-09 07:58:02 +00:00
Example of usage : Copy = geompy . MakeCopy ( Box )
"""
2009-02-13 12:16:39 +00:00
# Example: see GEOM_TestAll.py
anObj = self . InsertOp . MakeCopy ( theOriginal )
RaiseIfFailed ( " MakeCopy " , self . InsertOp )
2013-02-12 11:35:16 +00:00
self . _autoPublish ( anObj , theName , " copy " )
2009-02-13 12:16:39 +00:00
return anObj
2008-03-07 07:45:34 +00:00
## Add Path to load python scripts from
2012-08-09 07:58:02 +00:00
# @param Path a path to load python scripts from
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2008-03-07 07:45:34 +00:00
def addPath ( self , Path ) :
2012-08-09 07:58:02 +00:00
"""
Add Path to load python scripts from
Parameters :
Path a path to load python scripts from
"""
2008-03-07 07:45:34 +00:00
if ( sys . path . count ( Path ) < 1 ) :
sys . path . append ( Path )
2012-08-09 07:58:02 +00:00
pass
pass
## Load marker texture from the file
# @param Path a path to the texture file
# @return unique texture identifier
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2012-08-09 07:58:02 +00:00
def LoadTexture ( self , Path ) :
"""
Load marker texture from the file
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Parameters :
Path a path to the texture file
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
Returns :
unique texture identifier
"""
# Example: see GEOM_TestAll.py
ID = self . InsertOp . LoadTexture ( Path )
RaiseIfFailed ( " LoadTexture " , self . InsertOp )
return ID
2012-12-13 08:40:36 +00:00
## Get internal name of the object based on its study entry
# @note This method does not provide an unique identifier of the geometry object.
2014-06-25 18:28:02 +04:00
# @note This is internal function of GEOM component, though it can be used outside it for
2012-12-13 08:40:36 +00:00
# appropriate reason (e.g. for identification of geometry object).
2012-08-09 07:58:02 +00:00
# @param obj geometry object
# @return unique object identifier
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2012-08-09 07:58:02 +00:00
def getObjectID ( self , obj ) :
"""
2012-12-13 08:40:36 +00:00
Get internal name of the object based on its study entry .
Note : this method does not provide an unique identifier of the geometry object .
2014-06-25 18:28:02 +04:00
It is an internal function of GEOM component , though it can be used outside GEOM for
2012-12-13 08:40:36 +00:00
appropriate reason ( e . g . for identification of geometry object ) .
2012-08-09 07:58:02 +00:00
Parameters :
obj geometry object
Returns :
unique object identifier
"""
ID = " "
entry = salome . ObjectToID ( obj )
if entry is not None :
lst = entry . split ( " : " )
if len ( lst ) > 0 :
2014-06-25 18:28:02 +04:00
ID = lst [ - 1 ] # -1 means last item in the list
2012-08-09 07:58:02 +00:00
return " GEOM_ " + ID
return ID
2014-06-25 18:28:02 +04:00
2012-08-09 07:58:02 +00:00
## Add marker texture. @a Width and @a Height parameters
# specify width and height of the texture in pixels.
# If @a RowData is @c True, @a Texture parameter should represent texture data
# packed into the byte array. If @a RowData is @c False (default), @a Texture
# parameter should be unpacked string, in which '1' symbols represent opaque
# pixels and '0' represent transparent pixels of the texture bitmap.
#
# @param Width texture width in pixels
# @param Height texture height in pixels
# @param Texture texture data
# @param RowData if @c True, @a Texture data are packed in the byte stream
# @return unique texture identifier
2013-04-04 07:06:43 +00:00
# @ingroup l1_geomBuilder_auxiliary
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " InsertOp " )
2012-08-09 07:58:02 +00:00
def AddTexture ( self , Width , Height , Texture , RowData = False ) :
"""
Add marker texture . Width and Height parameters
specify width and height of the texture in pixels .
If RowData is True , Texture parameter should represent texture data
packed into the byte array . If RowData is False ( default ) , Texture
parameter should be unpacked string , in which ' 1 ' symbols represent opaque
pixels and ' 0 ' represent transparent pixels of the texture bitmap .
Parameters :
Width texture width in pixels
Height texture height in pixels
Texture texture data
RowData if True , Texture data are packed in the byte stream
Returns :
return unique texture identifier
"""
if not RowData : Texture = PackData ( Texture )
ID = self . InsertOp . AddTexture ( Width , Height , Texture )
RaiseIfFailed ( " AddTexture " , self . InsertOp )
return ID
2008-03-07 07:45:34 +00:00
2014-11-27 16:09:06 +03:00
## Transfer not topological data from one GEOM object to another.
#
# @param theObjectFrom the source object of non-topological data
# @param theObjectTo the destination object of non-topological data
# @param theFindMethod method to search sub-shapes of theObjectFrom
# in shape theObjectTo. Possible values are: GEOM.FSM_GetInPlace,
# GEOM.FSM_GetInPlaceByHistory and GEOM.FSM_GetInPlace_Old.
# Other values of GEOM.find_shape_method are not supported.
#
# @return True in case of success; False otherwise.
#
# @ingroup l1_geomBuilder_auxiliary
#
# @ref swig_TransferData "Example"
@ManageTransactions ( " InsertOp " )
def TransferData ( self , theObjectFrom , theObjectTo ,
theFindMethod = GEOM . FSM_GetInPlace ) :
"""
Transfer not topological data from one GEOM object to another .
Parameters :
theObjectFrom the source object of non - topological data
theObjectTo the destination object of non - topological data
theFindMethod method to search sub - shapes of theObjectFrom
in shape theObjectTo . Possible values are :
GEOM . FSM_GetInPlace , GEOM . FSM_GetInPlaceByHistory
and GEOM . FSM_GetInPlace_Old . Other values of
GEOM . find_shape_method are not supported .
Returns :
True in case of success ; False otherwise .
# Example: see GEOM_TestOthers.py
"""
# Example: see GEOM_TestAll.py
isOk = self . InsertOp . TransferData ( theObjectFrom ,
theObjectTo , theFindMethod )
RaiseIfFailed ( " TransferData " , self . InsertOp )
return isOk
2013-06-28 08:18:20 +00:00
## Creates a new folder object. It is a container for any GEOM objects.
# @param Name name of the container
2014-06-25 18:28:02 +04:00
# @param Father parent object. If None,
2013-06-28 08:18:20 +00:00
# folder under 'Geometry' root object will be created.
# @return a new created folder
2013-11-26 10:12:49 +00:00
# @ingroup l1_publish_data
2013-06-28 08:18:20 +00:00
def NewFolder ( self , Name , Father = None ) :
"""
Create a new folder object . It is an auxiliary container for any GEOM objects .
2014-06-25 18:28:02 +04:00
2013-06-28 08:18:20 +00:00
Parameters :
Name name of the container
2014-06-25 18:28:02 +04:00
Father parent object . If None ,
2013-06-28 08:18:20 +00:00
folder under ' Geometry ' root object will be created .
2014-06-25 18:28:02 +04:00
2013-06-28 08:18:20 +00:00
Returns :
a new created folder
"""
if not Father : Father = self . father
return self . CreateFolder ( Name , Father )
## Move object to the specified folder
# @param Object object to move
# @param Folder target folder
2013-11-26 10:12:49 +00:00
# @ingroup l1_publish_data
2013-06-28 08:18:20 +00:00
def PutToFolder ( self , Object , Folder ) :
"""
Move object to the specified folder
2014-06-25 18:28:02 +04:00
2013-06-28 08:18:20 +00:00
Parameters :
Object object to move
Folder target folder
"""
self . MoveToFolder ( Object , Folder )
pass
## Move list of objects to the specified folder
# @param ListOfSO list of objects to move
# @param Folder target folder
2013-11-26 10:12:49 +00:00
# @ingroup l1_publish_data
2013-06-28 08:18:20 +00:00
def PutListToFolder ( self , ListOfSO , Folder ) :
"""
Move list of objects to the specified folder
2014-06-25 18:28:02 +04:00
2013-06-28 08:18:20 +00:00
Parameters :
ListOfSO list of objects to move
Folder target folder
"""
self . MoveListToFolder ( ListOfSO , Folder )
pass
2013-09-30 11:45:32 +00:00
## @addtogroup l2_field
## @{
## Creates a field
# @param shape the shape the field lies on
# @param name the field name
# @param type type of field data: 0 - bool, 1 - int, 2 - double, 3 - string
# @param dimension dimension of the shape the field lies on
# 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
# @param componentNames names of components
# @return a created field
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " FieldOp " )
2013-09-30 11:45:32 +00:00
def CreateField ( self , shape , name , type , dimension , componentNames ) :
"""
Creates a field
Parameters :
shape the shape the field lies on
name the field name
type type of field data
dimension dimension of the shape the field lies on
0 - VERTEX , 1 - EDGE , 2 - FACE , 3 - SOLID , - 1 - whole shape
componentNames names of components
2014-06-25 18:28:02 +04:00
2013-09-30 11:45:32 +00:00
Returns :
a created field
"""
if isinstance ( type , int ) :
if type < 0 or type > 3 :
raise RuntimeError , " CreateField : Error: data type must be within [0-3] range "
type = [ GEOM . FDT_Bool , GEOM . FDT_Int , GEOM . FDT_Double , GEOM . FDT_String ] [ type ]
f = self . FieldOp . CreateField ( shape , name , type , dimension , componentNames )
RaiseIfFailed ( " CreateField " , self . FieldOp )
global geom
geom . _autoPublish ( f , " " , name )
return f
## Removes a field from the GEOM component
# @param field the field to remove
def RemoveField ( self , field ) :
" Removes a field from the GEOM component "
global geom
if isinstance ( field , GEOM . _objref_GEOM_Field ) :
geom . RemoveObject ( field )
elif isinstance ( field , geomField ) :
geom . RemoveObject ( field . field )
else :
raise RuntimeError , " RemoveField() : the object is not a field "
return
## Returns number of fields on a shape
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " FieldOp " )
2013-09-30 11:45:32 +00:00
def CountFields ( self , shape ) :
" Returns number of fields on a shape "
nb = self . FieldOp . CountFields ( shape )
RaiseIfFailed ( " CountFields " , self . FieldOp )
return nb
## Returns all fields on a shape
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " FieldOp " )
2013-09-30 11:45:32 +00:00
def GetFields ( self , shape ) :
" Returns all fields on a shape "
ff = self . FieldOp . GetFields ( shape )
RaiseIfFailed ( " GetFields " , self . FieldOp )
return ff
## Returns a field on a shape by its name
2014-06-25 18:28:02 +04:00
@ManageTransactions ( " FieldOp " )
2013-09-30 11:45:32 +00:00
def GetField ( self , shape , name ) :
" Returns a field on a shape by its name "
f = self . FieldOp . GetField ( shape , name )
RaiseIfFailed ( " GetField " , self . FieldOp )
return f
# end of l2_field
## @}
2008-03-07 07:45:34 +00:00
import omniORB
2013-04-04 07:06:43 +00:00
# Register the new proxy for GEOM_Gen
omniORB . registerObjref ( GEOM . _objref_GEOM_Gen . _NP_RepositoryId , geomBuilder )
2013-09-30 11:45:32 +00:00
## Field on Geometry
# @ingroup l2_field
class geomField ( GEOM . _objref_GEOM_Field ) :
def __init__ ( self ) :
GEOM . _objref_GEOM_Field . __init__ ( self )
self . field = GEOM . _objref_GEOM_Field
return
## Returns the shape the field lies on
def getShape ( self ) :
" Returns the shape the field lies on "
return self . field . GetShape ( self )
## Returns the field name
def getName ( self ) :
" Returns the field name "
return self . field . GetName ( self )
## Returns type of field data as integer [0-3]
def getType ( self ) :
" Returns type of field data "
return self . field . GetDataType ( self ) . _v
## Returns type of field data:
# one of GEOM.FDT_Bool, GEOM.FDT_Int, GEOM.FDT_Double, GEOM.FDT_String
def getTypeEnum ( self ) :
" Returns type of field data "
return self . field . GetDataType ( self )
## Returns dimension of the shape the field lies on:
# 0 - VERTEX, 1 - EDGE, 2 - FACE, 3 - SOLID, -1 - whole shape
def getDimension ( self ) :
""" Returns dimension of the shape the field lies on:
0 - VERTEX , 1 - EDGE , 2 - FACE , 3 - SOLID , - 1 - whole shape """
return self . field . GetDimension ( self )
## Returns names of components
def getComponents ( self ) :
" Returns names of components "
return self . field . GetComponents ( self )
## Adds a time step to the field
2014-05-21 18:56:48 +04:00
# @param step the time step number further used as the step identifier
2013-09-30 11:45:32 +00:00
# @param stamp the time step time
# @param values the values of the time step
def addStep ( self , step , stamp , values ) :
" Adds a time step to the field "
stp = self . field . AddStep ( self , step , stamp )
if not stp :
raise RuntimeError , \
" Field.addStep() : Error: step %s already exists in this field " % step
global geom
geom . _autoPublish ( stp , " " , " Step %s , %s " % ( step , stamp ) )
self . setValues ( step , values )
return stp
## Remove a time step from the field
def removeStep ( self , step ) :
" Remove a time step from the field "
2013-10-15 10:30:22 +00:00
stepSO = None
try :
stepObj = self . field . GetStep ( self , step )
if stepObj :
stepSO = geom . myStudy . FindObjectID ( stepObj . GetStudyEntry ( ) )
except :
#import traceback
#traceback.print_exc()
pass
2013-09-30 11:45:32 +00:00
self . field . RemoveStep ( self , step )
2013-10-15 10:30:22 +00:00
if stepSO :
geom . myBuilder . RemoveObjectWithChildren ( stepSO )
2013-09-30 11:45:32 +00:00
return
## Returns number of time steps in the field
def countSteps ( self ) :
" Returns number of time steps in the field "
return self . field . CountSteps ( self )
## Returns a list of time step IDs in the field
def getSteps ( self ) :
" Returns a list of time step IDs in the field "
return self . field . GetSteps ( self )
## Returns a time step by its ID
def getStep ( self , step ) :
" Returns a time step by its ID "
stp = self . field . GetStep ( self , step )
if not stp :
raise RuntimeError , " Step %s is missing from this field " % step
return stp
## Returns the time of the field step
def getStamp ( self , step ) :
" Returns the time of the field step "
return self . getStep ( step ) . GetStamp ( )
## Changes the time of the field step
def setStamp ( self , step , stamp ) :
" Changes the time of the field step "
return self . getStep ( step ) . SetStamp ( stamp )
## Returns values of the field step
def getValues ( self , step ) :
" Returns values of the field step "
return self . getStep ( step ) . GetValues ( )
## Changes values of the field step
def setValues ( self , step , values ) :
" Changes values of the field step "
stp = self . getStep ( step )
errBeg = " Field.setValues(values) : Error: "
try :
ok = stp . SetValues ( values )
except Exception , e :
excStr = str ( e )
if excStr . find ( " WrongPythonType " ) > 0 :
raise RuntimeError , errBeg + \
" wrong type of values, %s values are expected " % str ( self . getTypeEnum ( ) ) [ 4 : ]
raise RuntimeError , errBeg + str ( e )
if not ok :
nbOK = self . field . GetArraySize ( self )
nbKO = len ( values )
if nbOK != nbKO :
raise RuntimeError , errBeg + " len(values) must be %s but not %s " % ( nbOK , nbKO )
else :
raise RuntimeError , errBeg + " failed "
return
pass # end of class geomField
# Register the new proxy for GEOM_Field
omniORB . registerObjref ( GEOM . _objref_GEOM_Field . _NP_RepositoryId , geomField )
2013-04-04 07:06:43 +00:00
## Create a new geomBuilder instance.The geomBuilder class provides the Python
# interface to GEOM operations.
#
# Typical use is:
# \code
# import salome
# salome.salome_init()
# from salome.geom import geomBuilder
# geompy = geomBuilder.New(salome.myStudy)
# \endcode
# @param study SALOME study, generally obtained by salome.myStudy.
# @param instance CORBA proxy of GEOM Engine. If None, the default Engine is used.
# @return geomBuilder instance
def New ( study , instance = None ) :
"""
Create a new geomBuilder instance . The geomBuilder class provides the Python
interface to GEOM operations .
Typical use is :
import salome
salome . salome_init ( )
from salome . geom import geomBuilder
geompy = geomBuilder . New ( salome . myStudy )
Parameters :
study SALOME study , generally obtained by salome . myStudy .
instance CORBA proxy of GEOM Engine . If None , the default Engine is used .
Returns :
geomBuilder instance
"""
#print "New geomBuilder ", study, instance
global engine
global geom
global doLcc
engine = instance
if engine is None :
doLcc = True
geom = geomBuilder ( )
assert isinstance ( geom , geomBuilder ) , " Geom engine class is %s but should be geomBuilder.geomBuilder. Import geomBuilder before creating the instance. " % geom . __class__
geom . init_geom ( study )
return geom
2014-06-04 15:17:38 +04:00
# Register methods from the plug-ins in the geomBuilder class
plugins_var = os . environ . get ( " GEOM_PluginsList " )
plugins = None
if plugins_var is not None :
plugins = plugins_var . split ( " : " )
plugins = filter ( lambda x : len ( x ) > 0 , plugins )
if plugins is not None :
for pluginName in plugins :
pluginBuilderName = pluginName + " Builder "
try :
exec ( " from salome. %s . %s import * " % ( pluginName , pluginBuilderName ) )
except Exception , e :
from salome_utils import verbose
print " Exception while loading %s : %s " % ( pluginBuilderName , e )
continue
exec ( " from salome. %s import %s " % ( pluginName , pluginBuilderName ) )
plugin = eval ( pluginBuilderName )
# add methods from plugin module to the geomBuilder class
for k in dir ( plugin ) :
if k [ 0 ] == ' _ ' : continue
method = getattr ( plugin , k )
if type ( method ) . __name__ == ' function ' :
if not hasattr ( geomBuilder , k ) :
setattr ( geomBuilder , k , method )
pass
pass
del pluginName
pass
pass