# Module : GEOM
# $Header$
-def GetFaceNearPoint (geompy, block, pnt):
- anObj = geompy.BlocksOp.GetFaceNearPoint(block, pnt)
- if anObj is None:
- print "GetFaceNearPoint : ", geompy.BlocksOp.GetErrorCode()
- return anObj
-
-def GetOppositeFace (geompy, block, face):
- anObj = geompy.BlocksOp.GetOppositeFace(block, face)
- if anObj is None:
- print "GetOppositeFace : ", geompy.BlocksOp.GetErrorCode()
- return anObj
-
-def GetFaceByNormale (geompy, block, vec):
- anObj = geompy.BlocksOp.GetFaceByNormale(block, vec)
- if anObj is None:
- print "GetFaceByNormale : ", geompy.BlocksOp.GetErrorCode()
- return anObj
-
-def GetBlockNearPoint (geompy, comp, pnt):
- anObj = geompy.BlocksOp.GetBlockNearPoint(comp, pnt)
- if anObj is None:
- print "GetBlockNearPoint : ", geompy.BlocksOp.GetErrorCode()
- return anObj
-
############# MakeSpanner #############
def MakeSpanner (salome, geompy, math, isBlocksTest = 0, isMeshTest = 0, smesh = None, hasGUI = 0):
Edge21 = geompy.MakeEdge(p_15_0, p_15_20)
id_edge21 = geompy.addToStudy(Edge21, "1 Edge for Block 2")
- Edge22 = BlocksOp.GetEdge(Block1, p_10_0, p_10_25)
- if Edge22 is None:
- print "BlocksOp.GetEdge(Block1, p_10_0, p_10_25) : ", BlocksOp.GetErrorCode()
+ Edge22 = geompy.GetEdge(Block1, p_10_0, p_10_25)
id_edge22 = geompy.addToStudy(Edge22, "2 Edge for Block 2")
Face21 = geompy.MakeQuad2Edges(Edge21, Edge22);
p_15_10_1 = geompy.MakeVertex(15., 10., 1.)
- Face31 = GetFaceNearPoint(geompy, Block2, p_15_10_1)
+ Face31 = geompy.GetFaceNearPoint(Block2, p_15_10_1)
id_face31 = geompy.addToStudy(Face31, "1 Face for Block 3")
Prism1 = geompy.MakePrismVecH(Face31, vx, 5);
### Block 4 ###
- Face41 = GetOppositeFace(geompy, Block3, Face31)
+ Face41 = geompy.GetOppositeFace(Block3, Face31)
id_face41 = geompy.addToStudy(Face41, "1 Face for Block 4")
p_25_5 = geompy.MakeVertex(25., 5., 0.)
p_30_0_1 = geompy.MakeVertex(30., 0., 1.)
- Face2s = GetFaceNearPoint(geompy, Block1s, p_30_0_1)
+ Face2s = geompy.GetFaceNearPoint(Block1s, p_30_0_1)
id_face2s = geompy.addToStudy(Face2s, "2 Face of Block 1s")
f2s_ind = geompy.LocalOp.GetSubShapeIndex(Block1s, Face2s)
p_55_0_1 = geompy.MakeVertex(55., 0., 1.)
p_55_110_1 = geompy.MakeVertex(55., -110., 1.)
- Face11l = GetFaceNearPoint(geompy, Block5, p_55_0_1)
+ Face11l = geompy.GetFaceNearPoint(Block5, p_55_0_1)
id_face11l = geompy.addToStudy(Face11l, "1 Face for Linking Block 1")
- Face12l = GetFaceNearPoint(geompy, Gear, p_55_110_1)
+ Face12l = geompy.GetFaceNearPoint(Gear, p_55_110_1)
id_face12l = geompy.addToStudy(Face12l, "2 Face for Linking Block 1")
Block1l = geompy.MakeHexa2Faces(Face11l, Face12l)
p_25_0_1 = geompy.MakeVertex(25., 0., 1.)
p_45_110_1 = geompy.MakeVertex(45., -110., 1.)
- Face21l = GetFaceNearPoint(geompy, Block4, p_25_0_1)
+ Face21l = geompy.GetFaceNearPoint(Block4, p_25_0_1)
id_face21l = geompy.addToStudy(Face21l, "1 Face for Linking Block 2")
- Face22l = GetFaceNearPoint(geompy, Gear, p_45_110_1)
+ Face22l = geompy.GetFaceNearPoint(Gear, p_45_110_1)
id_face22l = geompy.addToStudy(Face22l, "2 Face for Linking Block 2")
Block2l = geompy.MakeHexa2Faces(Face21l, Face22l)
p_55_30_1 = geompy.MakeVertex(55., 30., 1.)
p_65_110_1 = geompy.MakeVertex(65., -110., 1.)
- Face31l = GetFaceNearPoint(geompy, Mirror1, p_55_30_1)
+ Face31l = geompy.GetFaceNearPoint(Mirror1, p_55_30_1)
id_face31l = geompy.addToStudy(Face31l, "1 Face for Linking Block 3")
- Face32l = GetFaceNearPoint(geompy, Gear, p_65_110_1)
+ Face32l = geompy.GetFaceNearPoint(Gear, p_65_110_1)
id_face32l = geompy.addToStudy(Face32l, "2 Face for Linking Block 3")
Block3l = geompy.MakeHexa2Faces(Face31l, Face32l)
Handle = geompy.MakeGlueFaces(CompLB, 1e-5)
id_handle = geompy.addToStudy(Handle, "Handle")
- Block1h = GetBlockNearPoint(geompy, Handle, p_45_110_1)
+ Block1h = geompy.GetBlockNearPoint(Handle, p_45_110_1)
id_block1h = geompy.addToStudyInFather(Handle, Block1h, "Block 1 of Handle")
- Block2h = GetBlockNearPoint(geompy, Handle, p_65_110_1)
+ Block2h = geompy.GetBlockNearPoint(Handle, p_65_110_1)
id_block2h = geompy.addToStudyInFather(Handle, Block2h, "Block 2 of Handle")
- Face11h = GetFaceByNormale(geompy, Block1h, vx)
+ Face11h = geompy.GetFaceByNormale(Block1h, vx)
id_face11h = geompy.addToStudyInFather(Block1h, Face11h, "Face 1")
- Face12h = GetOppositeFace(geompy, Block1h, Face11h)
+ Face12h = geompy.GetOppositeFace(Block1h, Face11h)
id_face12h = geompy.addToStudyInFather(Block1h, Face12h, "Face 2")
- Face21h = GetFaceByNormale(geompy, Block2h, vx)
+ Face21h = geompy.GetFaceByNormale(Block2h, vx)
id_face21h = geompy.addToStudyInFather(Block2h, Face21h, "Face 1")
- Face22h = GetOppositeFace(geompy, Block2h, Face21h)
+ Face22h = geompy.GetOppositeFace(Block2h, Face21h)
id_face22h = geompy.addToStudyInFather(Block2h, Face22h, "Face 2")
Block3h = BlocksOp.GetBlockByParts(Handle, [Face11h, Face21h])
### Check the Spanner ###
- isCompOfBlocks6 = BlocksOp.IsCompoundOfBlocks(Spanner, 6, 6)
+ isCompOfBlocks6 = BlocksOp.CheckCompoundOfBlocks(Spanner)
if isCompOfBlocks6 == 0:
print "Spanner is not a compound of hexahedral solids"
else:
### Get Blocks 4 and 5 from the spanner ###
- Face42_sp = BlocksOp.GetFaceByEdges(Spanner, Edge41, Edge42)
- if Face42_sp is None:
- print "BlocksOp.GetFaceByEdges(Spanner, Edge41, Edge42) : ", BlocksOp.GetErrorCode()
+ Face42_sp = geompy.GetFaceByEdges(Spanner, Edge41, Edge42)
id_face42_sp = geompy.addToStudyInFather(Spanner, Face42_sp, "Face 4_2")
- Blocks_f4_sp = BlocksOp.GetBlocksByParts(Spanner, [Face42_sp])
- if Blocks_f4_sp is None:
- print "BlocksOp.GetBlocksByParts() : ", BlocksOp.GetErrorCode()
+ Blocks_f4_sp = geompy.GetBlocksByParts(Spanner, [Face42_sp])
+
+ isMRot2D = 0
for aBlock in Blocks_f4_sp:
name = geompy.SubShapeName(aBlock, Spanner)
f42_sp_ind = geompy.LocalOp.GetSubShapeIndex(aBlock, Face42_sp)
- Face_5_horiz = GetFaceByNormale(geompy, aBlock, vz)
+ Face_5_horiz = geompy.GetFaceByNormale(aBlock, vz)
f_5_horiz_ind = geompy.LocalOp.GetSubShapeIndex(aBlock, Face_5_horiz)
MRot = geompy.MakeMultiTransformation2D(aBlock, f42_sp_ind, 0, 3, f_5_horiz_ind, 0, 5)
if MRot is not None:
+ isMRot2D = 1
p_z100 = geompy.MakeVertex(0., 0., 100.)
MRot_tr = geompy.MakeTranslationTwoPoints(MRot, p0, p_z100)
id_MRot_tr = geompy.addToStudy(MRot_tr, "Multi-rotated block 5")
- if BlocksOp.IsDone() == 0:
- print "Operation failed"
+ if isMRot2D == 0:
+ print "2D Multi Transformation failed"
### Get one face of the Gear ###
p_40_0_tr = geompy.MakeTranslationTwoPoints(p_40_0 , p0, p_60_150_0)
p_40_0_r_tr = geompy.MakeTranslationTwoPoints(p_40_0_r, p0, p_60_150_0)
- Face_g_1 = BlocksOp.GetFaceByPoints(Gear, p_20_0_tr, p_20_0_r_tr, p_40_0_tr, p_40_0_r_tr)
- if Face_g_1 is None:
- print "BlocksOp.GetFaceByPoints(Gear, ...) : ", BlocksOp.GetErrorCode()
+ Face_g_1 = geompy.GetFaceByPoints(Gear, p_20_0_tr, p_20_0_r_tr, p_40_0_tr, p_40_0_r_tr)
id_face_g_1 = geompy.addToStudyInFather(Gear, Face_g_1, "Face of Gear by four points")
edgesNb = geompy.ShapesOp.NumberOfEdges(Face_g_1)
# ---- add a middle block of spanner handle in study
p_45_0_1 = geompy.MakeVertex(45., 0., 1.)
- BlockMh = GetBlockNearPoint(geompy, Spanner, p_45_0_1)
+ BlockMh = geompy.GetBlockNearPoint(Spanner, p_45_0_1)
id_blockMh = geompy.addToStudyInFather(Spanner, BlockMh, "Middle Block of Spanner Handle")
# ---- add the top face of the middle block in study
- FaceTop = GetFaceByNormale(geompy, BlockMh, vz)
+ FaceTop = geompy.GetFaceByNormale(BlockMh, vz)
id_facetop = geompy.addToStudyInFather(BlockMh, FaceTop, "Top Face")
# ---- add long edges of the top face in study
#Transform objects
Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
+ TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Scale = geompy.MakeScaleTransform(Box, p0, factor) #
Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
+ MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
Orientation = geompy.ChangeOrientation(Box)
print "CheckShape(Prism) = ", CheckShape
#Partition objects
- Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr
+ Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr
+ Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
#Add In Study
id_Sewing = geompy.addToStudy(Sewing, "Sewing")
id_Translation = geompy.addToStudy(Translation, "Translation")
+ id_TranslVect = geompy.addToStudy(TranslVect , "Translation along vector")
id_Rotation = geompy.addToStudy(Rotation, "Rotation")
id_Scale = geompy.addToStudy(Scale, "Scale")
- id_Mirror = geompy.addToStudy(Mirror, "Mirror")
+ id_Mirror = geompy.addToStudy(Mirror, "Mirror by Plane")
+ id_MirrorAxis = geompy.addToStudy(MirrorAxis, "Mirror by Axis")
+ id_MirrorPnt = geompy.addToStudy(MirrorPnt, "Mirror by Point")
id_Position = geompy.addToStudy(Position, "Positioned box")
id_Offset = geompy.addToStudy(Offset, "Offset")
id_Orientation = geompy.addToStudy(Orientation, "Orientation")
id_CDG = geompy.addToStudy(CDG, "CDG")
id_Archimede = geompy.addToStudy(Archimede, "Archimede")
- id_Partition = geompy.addToStudy(Partition, "Partition")
+ id_Partition = geompy.addToStudy(Partition, "Partition")
+ id_Partition1 = geompy.addToStudy(Partition1, "Half Partition")
#Decompose objects
SubFace = geompy.SubShape(Box, geompy.ShapeType["FACE"], [2])
id_ImportIGES = geompy.addToStudy(ImportIGES, "ImportIGES")
id_ImportSTEP = geompy.addToStudy(ImportSTEP, "ImportSTEP")
+ # NumberOfFaces
+ NumberOfFaces = geompy.NumberOfFaces(Box)
+ if NumberOfFaces != 6:
+ print "Bad number of faces in BOX!"
+
+ # NumberOfEdges
+ NumberOfEdges = geompy.NumberOfEdges(Box)
+ if NumberOfEdges != 12:
+ print "Bad number of edges in BOX!"
+
# MakeBlockExplode
Compound = geompy.MakeCompound([Box, Sphere])
MakeBlockExplode = geompy.MakeBlockExplode(Compound, 6, 6)
print "Group of Box's faces includes the following IDs:"
for ObjectID in GetObjectIDs:
print " ", ObjectID
+
+ BoxCopy = geompy.GetMainShape(CreateGroup)
+
+ # -----------------------------------------------------------------------------
+ # enumeration ShapeTypeString as a dictionary
+ # -----------------------------------------------------------------------------
+ ShapeTypeString = {'0':"COMPOUND", '1':"COMPSOLID", '2':"SOLID", '3':"SHELL", '4':"FACE", '5':"WIRE", '6':"EDGE", '7':"VERTEX", '8':"SHAPE"}
+
+ GroupType = geompy.GetType(CreateGroup)
+ print "Type of elements of the created group is ", ShapeTypeString[`GroupType`]
+
+ # Prepare data for the following operations
+ p0 = geompy.MakeVertex(0, 0, 0)
+ b0 = geompy.MakeBox(-50, -50, -50, 50, 50, 50)
+ s0 = geompy.MakeSphereR(100)
+
+ id_b0 = geompy.addToStudy(b0, "b0")
+ id_s0 = geompy.addToStudy(s0, "s0")
+
+ v_0pp = geompy.MakeVectorDXDYDZ( 0, 1, 1)
+ v_0np = geompy.MakeVectorDXDYDZ( 0, -1, 1)
+ v_p0p = geompy.MakeVectorDXDYDZ( 1, 0, 1)
+ v_n0p = geompy.MakeVectorDXDYDZ(-1, 0, 1)
+ v_pp0 = geompy.MakeVectorDXDYDZ( 1, 1, 0)
+ v_np0 = geompy.MakeVectorDXDYDZ(-1, 1, 0)
+
+ pln_0pp = geompy.MakePlane(p0, v_0pp, 200)
+ pln_0np = geompy.MakePlane(p0, v_0np, 200)
+ pln_p0p = geompy.MakePlane(p0, v_p0p, 200)
+ pln_n0p = geompy.MakePlane(p0, v_n0p, 200)
+ pln_pp0 = geompy.MakePlane(p0, v_pp0, 200)
+ pln_np0 = geompy.MakePlane(p0, v_np0, 200)
+
+ part_tool = geompy.MakePartition([b0, pln_0pp, pln_0np, pln_p0p, pln_n0p, pln_pp0, pln_np0],
+ [],
+ [],
+ [b0])
+ id_part_tool = geompy.addToStudy(part_tool, "part_tool")
+
+ part = geompy.MakePartition([s0], [part_tool])
+ geompy.addToStudy(part, "part")
+
+ # GetFreeFacesIDs
+ anIDs = geompy.GetFreeFacesIDs(part)
+ freeFaces = geompy.GetSubShape(part, anIDs)
+
+ geompy.addToStudy(freeFaces, "freeFaces")
+
+ # RemoveExtraEdges
+ freeFacesWithoutExtra = geompy.RemoveExtraEdges(freeFaces)
+
+ geompy.addToStudy(freeFacesWithoutExtra, "freeFacesWithoutExtra")
+
+ # GetSharedShapes
+ sharedFaces = geompy.GetSharedShapes(part, freeFacesWithoutExtra, geompy.ShapeType["FACE"])
+
+ for shFace in sharedFaces:
+ geompy.addToStudy(shFace, "sharedFace")
+
+ # CheckAndImprove
+ blocksComp = geompy.CheckAndImprove(part)
+
+ geompy.addToStudy(blocksComp, "blocksComp")
+
+ # Propagate
+ listChains = geompy.Propagate(blocksComp)
+
+ for chain in listChains:
+ geompy.addToStudyInFather(blocksComp, chain, "propagation chain")
+
+ # GetPoint(theShape, theX, theY, theZ, theEpsilon)
+ #
+ # (-50, 50, 50) .-----. (50, 50, 50)
+ # pb0_top_1 | |
+ # | . pmidle
+ # | |
+ # (-50, -50, 50) '-----' (50, -50, 50)
+ #
+ pb0_top_1 = geompy.GetPoint(blocksComp, -50, 50, 50, 0.01)
+ pb0_bot_1 = geompy.GetPoint(blocksComp, -50, -50, -50, 0.01)
+
+ geompy.addToStudyInFather(blocksComp, pb0_top_1, "point from blocksComp (-50, 50, 50)")
+ geompy.addToStudyInFather(blocksComp, pb0_bot_1, "point from blocksComp (-50, -50, -50)")
+
+ # GetEdgeNearPoint(theShape, thePoint)
+ pmidle = geompy.MakeVertex(50, 0, 50)
+ edge1 = geompy.GetEdgeNearPoint(blocksComp, pmidle)
+
+ geompy.addToStudyInFather(blocksComp, edge1, "edge near point (50, 0, 50)")
+
+ # GetBlockByParts(theCompound, theParts)
+ b0_image = geompy.GetBlockByParts(blocksComp, [pb0_top_1, pb0_bot_1, edge1])
+
+ geompy.addToStudyInFather(blocksComp, b0_image, "b0 image")
+
+ # GetShapesOnPlane(theShape, theShapeType, thePlane)
+ # GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
+ # GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
+
+ # GetInPlace(theShapeWhere, theShapeWhat)
# Basic primitives
# -----------------------------------------------------------------------------
-def MakeVertex(x,y,z):
- anObj = BasicOp.MakePointXYZ(x,y,z)
+def MakeVertex(theX, theY, theZ):
+ anObj = BasicOp.MakePointXYZ(theX, theY, theZ)
if BasicOp.IsDone() == 0:
print "MakePointXYZ : ", BasicOp.GetErrorCode()
return anObj
return anIDs
def GetSharedShapes(theShape1, theShape2, theShapeType):
- anObj = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
+ aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
if ShapesOp.IsDone() == 0:
print "GetSharedShapes : ", ShapesOp.GetErrorCode()
- return anObj
+ return aList
#def GetShapesOnPlane(theShape, theShapeType, thePlane):
# anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
print "SubShapeAllIDs : ", ShapesOp.GetErrorCode()
return ListObj
-def SubShapeAllSorted(aShape,aType):
+def SubShapeAllSorted(aShape, aType):
ListObj = ShapesOp.MakeExplode(aShape,aType,1)
if ShapesOp.IsDone() == 0:
print "MakeExplode : ", ShapesOp.GetErrorCode()
Limit, RemoveWebs, ListMaterials);
return anObj
-def MakeHalfPartition(theShape):
- anObj = BoolOp.MakeHalfPartition(theShape)
+def MakeHalfPartition(theShape, thePlane):
+ anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
if BoolOp.IsDone() == 0:
print "MakeHalfPartition : ", BoolOp.GetErrorCode()
return anObj
print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
return aList
+def GetBlockNearPoint(theCompound, thePoint):
+ anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
+ if BlocksOp.IsDone() == 0:
+ print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+ return anObj
+
def GetBlockByParts(theCompound, theParts):
anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
if BlocksOp.IsDone() == 0:
return anObj
def GetBlocksByParts(theCompound, theParts):
- anObj = BlocksOp.GetBlocksByParts(theCompound, theParts)
+ aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
if BlocksOp.IsDone() == 0:
print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
- return anObj
+ return aList
def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
return anObj
def Propagate(theShape):
- anObj = BlocksOp.Propagate(theShape)
+ listChains = BlocksOp.Propagate(theShape)
if BlocksOp.IsDone() == 0:
print "Propagate : ", BlocksOp.GetErrorCode()
- return anObj
+ return listChains
# -----------------------------------------------------------------------------
# Group operations
print "GetMainShape : ", GroupOp.GetErrorCode()
return anObj
+# Add Path to the system path
+#
def addPath(Path):
if (sys.path.count(Path) < 1):
sys.path.append(Path)
# * \param theShape Shape to count faces of.
# * \return Quantity of faces.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def NumberOfFaces(theShape):
nb_faces = ShapesOp.NumberOfFaces(theShape)
# * \param theShape Shape to count edges of.
# * \return Quantity of edges.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def NumberOfEdges(theShape):
nb_edges = ShapesOp.NumberOfEdges(theShape)
# * \param theShape Shape to find free faces in.
# * \return List of IDs of all free faces, contained in theShape.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetFreeFacesIDs(theShape):
anIDs = ShapesOp.GetFreeFacesIDs(theShape)
# * \param theShapeType Type of sub-shapes to be retrieved.
# * \return List of sub-shapes of theShape1, shared with theShape2.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetSharedShapes(theShape1, theShape2, theShapeType):
- anObj = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
+ aList = ShapesOp.GetSharedShapes(theShape1, theShape2, theShapeType)
if ShapesOp.IsDone() == 0:
print "GetSharedShapes : ", ShapesOp.GetErrorCode()
- return anObj
+ return aList
# * Get sub-shapes of theShape of the given type,
# * laying on the specified plane.
# * \param thePlane Face, specifying the plane to find shapes on.
# * \return Group of all found sub-shapes.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
#def GetShapesOnPlane(theShape, theShapeType, thePlane):
# anObj = ShapesOp.GetShapesOnPlane(theShape, theShapeType, thePlane)
# * \param theRadius Radius of the cylinder to find shapes on.
# * \return Group of all found sub-shapes.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
#def GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius):
# anObj = ShapesOp.GetShapesOnCylinder(theShape, theShapeType, theAxis, theRadius)
# * \param theRadius Radius of the sphere to find shapes on.
# * \return Group of all found sub-shapes.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
#def GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius):
# anObj = ShapesOp.GetShapesOnSphere(theShape, theShapeType, theCenter, theRadius)
# * \param theShapeWhat Shape, specifying what to find.
# * \return Group of all found sub-shapes or a single found sub-shape.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
#def GetInPlace(theShapeWhere, theShapeWhat):
# anObj = ShapesOp.GetInPlace(theShapeWhere, theShapeWhat)
# * \param thePlane Tool shape, to intersect theShape.
# * \return New GEOM_Object, containing the result shape.
#
-# * Example: see ???
+# * Example: see GEOM_TestAll.py
#
-def MakeHalfPartition(theShape):
- anObj = BoolOp.MakeHalfPartition(theShape)
+def MakeHalfPartition(theShape, thePlane):
+ anObj = BoolOp.MakeHalfPartition(theShape, thePlane)
if BoolOp.IsDone() == 0:
print "MakeHalfPartition : ", BoolOp.GetErrorCode()
return anObj
# * \param theVector The translation vector.
# * \return New GEOM_Object, containing the translated object.
#
-# * Example: see ???
+# * Example: see GEOM_TestAll.py
#
def MakeTranslationVector(theObject, theVector):
anObj = TrsfOp.TranslateVectorCopy(theObject, theVector)
# * \param theAxis Axis of symmetry.
# * \return New GEOM_Object, containing the mirrored shape.
#
-# * Example: see ???
+# * Example: see GEOM_TestAll.py
#
def MakeMirrorByAxis(theObject, theAxis):
anObj = TrsfOp.MirrorAxisCopy(theObject, theAxis)
# * \param thePoint Point of symmetry.
# * \return New GEOM_Object, containing the mirrored shape.
#
-# * Example: see ???
+# * Example: see GEOM_TestAll.py
#
def MakeMirrorByPoint(theObject, thePoint):
anObj = TrsfOp.MirrorPointCopy(theObject, thePoint)
# * vertex and point with the given coordinates.
# * \return New GEOM_Object, containing the found vertex.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetPoint(theShape, theX, theY, theZ, theEpsilon):
anObj = BlocksOp.GetPoint(theShape, theX, theY, theZ, theEpsilon)
# * \param thePoint1,thePoint2 Points, close to the ends of the desired edge.
# * \return New GEOM_Object, containing the found edge.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetEdge(theShape, thePoint1, thePoint2):
anObj = BlocksOp.GetEdge(theShape, thePoint1, thePoint2)
# * \param thePoint Point, close to the desired edge.
# * \return New GEOM_Object, containing the found edge.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetEdgeNearPoint(theShape, thePoint):
anObj = BlocksOp.GetEdgeNearPoint(theShape, thePoint)
# * \param thePoint1-thePoint4 Points, close to the corners of the desired face.
# * \return New GEOM_Object, containing the found face.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4):
anObj = BlocksOp.GetFaceByPoints(theShape, thePoint1, thePoint2, thePoint3, thePoint4)
# * \param theEdge1,theEdge2 Edges, close to the edges of the desired face.
# * \return New GEOM_Object, containing the found face.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetFaceByEdges(theShape, theEdge1, theEdge2):
anObj = BlocksOp.GetFaceByEdges(theShape, theEdge1, theEdge2)
# * \param theFace Face of \a theBlock, opposite to the desired face.
# * \return New GEOM_Object, containing the found face.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetOppositeFace(theBlock, theFace):
anObj = BlocksOp.GetOppositeFace(theBlock, theFace)
# * \param thePoint Point, close to the desired face.
# * \return New GEOM_Object, containing the found face.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetFaceNearPoint(theShape, thePoint):
anObj = BlocksOp.GetFaceNearPoint(theShape, thePoint)
# * \param theVector Vector, close to the normale of the desired face.
# * \return New GEOM_Object, containing the found face.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetFaceByNormale(theBlock, theVector):
anObj = BlocksOp.GetFaceByNormale(theBlock, theVector)
# * \return TRUE, if the given shape is a compound of blocks.
# * If theCompound is not valid, prints all discovered errors.
#
-# * Example: see GEOM_TestOthers.py
+# * Example: see GEOM_Spanner.py
#
def CheckCompoundOfBlocks(theCompound):
(IsValid, BCErrors) = BlocksOp.CheckCompoundOfBlocks(theCompound)
# * \param theShape The compound or single solid to remove irregular edges from.
# * \return Improved shape.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def RemoveExtraEdges(theShape):
anObj = BlocksOp.RemoveExtraEdges(theShape)
# * \param theCompound The compound to check and improve.
# * \return Improved compound.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def CheckAndImprove(theShape):
anObj = BlocksOp.CheckAndImprove(theShape)
print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
return aList
+# * 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.
+# * \return New GEOM_Object, containing the found block.
+#
+# * Example: see GEOM_Spanner.py
+#
+def GetBlockNearPoint(theCompound, thePoint):
+ anObj = BlocksOp.GetBlockNearPoint(theCompound, thePoint)
+ if BlocksOp.IsDone() == 0:
+ print "GetBlockNearPoint : ", BlocksOp.GetErrorCode()
+ return anObj
+
# * 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.
# * \return New GEOM_Object, containing the found block.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetBlockByParts(theCompound, theParts):
anObj = BlocksOp.GetBlockByParts(theCompound, theParts)
# * \param theParts List of faces and/or edges and/or vertices to be parts of the found blocks.
# * \return List of GEOM_Objects, containing the found blocks.
#
-# * Example: see ???
+# * Example: see GEOM_Spanner.py
#
def GetBlocksByParts(theCompound, theParts):
- anObj = BlocksOp.GetBlocksByParts(theCompound, theParts)
+ aList = BlocksOp.GetBlocksByParts(theCompound, theParts)
if BlocksOp.IsDone() == 0:
print "GetBlocksByParts : ", BlocksOp.GetErrorCode()
- return anObj
+ return aList
# * Multi-transformate block and glue the result.
# * Transformation is defined so, as to superpose direction faces.
# * \param theShape Shape to build propagation groups on.
# * \return List of GEOM_Objects, each of them is a propagation group.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def Propagate(theShape):
- anObj = BlocksOp.Propagate(theShape)
+ listChains = BlocksOp.Propagate(theShape)
if BlocksOp.IsDone() == 0:
print "Propagate : ", BlocksOp.GetErrorCode()
- return anObj
+ return listChains
# -----------------------------------------------------------------------------
# Group operations
# * Returns a type of sub objects stored in the group
# * \param theGroup is a GEOM group which type is returned.
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetType(theGroup):
aType = GroupOp.GetType(theGroup)
# * \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
#
-# * Example: see ???
+# * Example: see GEOM_TestOthers.py
#
def GetMainShape(theGroup):
anObj = GroupOp.GetMainShape(theGroup)