1 # GEOM GEOM_SWIG : binding of C++ omplementaion with Python
3 # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License.
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 # See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
25 # Author : Paul RASCLE, EDF
29 from batchmode_salome import *
31 geom = lcc.FindOrLoadComponent("FactoryServer", "GEOM")
32 myBuilder = myStudy.NewBuilder()
34 father = myStudy.FindComponent("GEOM")
36 father = myBuilder.NewComponent("GEOM")
37 A1 = myBuilder.FindOrCreateAttribute(father, "AttributeName")
38 FName = A1._narrow(SALOMEDS.AttributeName)
39 FName.SetValue("Geometry")
40 A2 = myBuilder.FindOrCreateAttribute(father, "AttributePixMap")
41 aPixmap = A2._narrow(SALOMEDS.AttributePixMap)
42 aPixmap.SetPixMap("ICON_OBJBROWSER_Geometry")
43 myBuilder.DefineComponentInstance(father,geom)
45 # -----------------------------------------------------------------------------
47 # -----------------------------------------------------------------------------
49 def SubShapeName(aSubObj, aMainObj):
54 # -----------------------------------------------------------------------------
55 # The code below is common with geompy.py
56 # -----------------------------------------------------------------------------
58 def addToStudy(aShape, aName):
60 aSObject = geom.AddInStudy(myStudy, aShape, aName, None)
62 print "addToStudy() failed"
64 return aShape.GetStudyEntry()
66 def addToStudyInFather(aFather, aShape, aName):
68 # myBuilder.NewCommand()
69 aSObject = geom.AddInStudy(myStudy, aShape, aName, aFather)
70 # myBuilder.CommitCommand()
72 print "addToStudyInFather() failed"
74 return aShape.GetStudyEntry()
76 # -----------------------------------------------------------------------------
77 # enumeration ShapeType as a dictionary
78 # -----------------------------------------------------------------------------
80 ShapeType = {"COMPOUND":0, "COMPSOLID":1, "SOLID":2, "SHELL":3, "FACE":4, "WIRE":5, "EDGE":6, "VERTEX":7, "SHAPE":8}
82 # -----------------------------------------------------------------------------
83 # Get Operations Interfaces
84 # -----------------------------------------------------------------------------
86 BasicOp = geom.GetIBasicOperations (myStudyId)
87 CurvesOp = geom.GetICurvesOperations (myStudyId)
88 PrimOp = geom.GetI3DPrimOperations (myStudyId)
89 ShapesOp = geom.GetIShapesOperations (myStudyId)
90 HealOp = geom.GetIHealingOperations (myStudyId)
91 InsertOp = geom.GetIInsertOperations (myStudyId)
92 BoolOp = geom.GetIBooleanOperations (myStudyId)
93 TrsfOp = geom.GetITransformOperations(myStudyId)
94 LocalOp = geom.GetILocalOperations (myStudyId)
95 MeasuOp = geom.GetIMeasureOperations (myStudyId)
96 BlocksOp = geom.GetIBlocksOperations (myStudyId)
97 GroupOp = geom.GetIGroupOperations (myStudyId)
99 # -----------------------------------------------------------------------------
101 # -----------------------------------------------------------------------------
103 def MakeVertex(x,y,z):
104 anObj = BasicOp.MakePointXYZ(x,y,z)
105 if BasicOp.IsDone() == 0:
106 print "MakePointXYZ : ", BasicOp.GetErrorCode()
109 def MakeVertexWithRef(vertex,x,y,z):
110 anObj = BasicOp.MakePointWithReference(vertex,x,y,z)
111 if BasicOp.IsDone() == 0:
112 print "MakePointWithReference : ", BasicOp.GetErrorCode()
115 def MakeVertexOnCurve(curve,par):
116 anObj = BasicOp.MakePointOnCurve(curve,par)
117 if BasicOp.IsDone() == 0:
118 print "MakePointOnCurve : ", BasicOp.GetErrorCode()
121 def MakeVectorDXDYDZ(dx,dy,dz):
122 anObj = BasicOp.MakeVectorDXDYDZ(dx,dy,dz)
123 if BasicOp.IsDone() == 0:
124 print "MakeVectorDXDYDZ : ", BasicOp.GetErrorCode()
127 def MakeVector(p1,p2):
128 anObj = BasicOp.MakeVectorTwoPnt(p1, p2)
129 if BasicOp.IsDone() == 0:
130 print "MakeVectorTwoPnt : ", BasicOp.GetErrorCode()
133 def MakeLine(p1, p2):
134 anObj = BasicOp.MakeLineTwoPnt(p1,p2)
135 if BasicOp.IsDone() == 0:
136 print "MakeLineTwoPnt : ", BasicOp.GetErrorCode()
139 def MakePlane(p1,v1,trimsize):
140 anObj = BasicOp.MakePlanePntVec(p1,v1,trimsize)
141 if BasicOp.IsDone() == 0:
142 print "MakePlanePntVec : ", BasicOp.GetErrorCode()
145 def MakePlaneThreePnt(p1,p2,p3,trimsize):
146 anObj = BasicOp.MakePlaneThreePnt(p1,p2,p3,trimsize)
147 if BasicOp.IsDone() == 0:
148 print "MakePlaneThreePnt : ", BasicOp.GetErrorCode()
151 def MakePlaneFace(face,trimsize):
152 anObj = BasicOp.MakePlaneFace(face,trimsize)
153 if BasicOp.IsDone() == 0:
154 print "MakePlaneFace : ", BasicOp.GetErrorCode()
157 def MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ):
158 anObj = BasicOp.MakeMarker(OX,OY,OZ, XDX,XDY,XDZ, YDX,YDY,YDZ)
159 if BasicOp.IsDone() == 0:
160 print "MakeMarker : ", BasicOp.GetErrorCode()
163 # -----------------------------------------------------------------------------
165 # -----------------------------------------------------------------------------
167 def MakeArc(p1,p2,p3):
168 anObj = CurvesOp.MakeArc(p1,p2,p3)
169 if CurvesOp.IsDone() == 0:
170 print "MakeArc : ", CurvesOp.GetErrorCode()
173 def MakeCircle(p1,v1,radius):
174 anObj = CurvesOp.MakeCirclePntVecR(p1,v1,radius)
175 if CurvesOp.IsDone() == 0:
176 print "MakeCirclePntVecR : ", CurvesOp.GetErrorCode()
179 def MakeCircleThreePnt(p1,p2,p3):
180 anObj = CurvesOp.MakeCircleThreePnt(p1,p2,p3)
181 if CurvesOp.IsDone() == 0:
182 print "MakeCircleThreePnt : ", CurvesOp.GetErrorCode()
185 def MakeEllipse(p1,v1,radiusMaj,radiusMin):
186 anObj = CurvesOp.MakeEllipse(p1,v1,radiusMaj, radiusMin)
187 if CurvesOp.IsDone() == 0:
188 print "MakeEllipse : ", CurvesOp.GetErrorCode()
191 def MakePolyline(ListShape):
192 anObj = CurvesOp.MakePolyline(ListShape)
193 if CurvesOp.IsDone() == 0:
194 print "MakePolyline : ", CurvesOp.GetErrorCode()
197 def MakeBezier(ListShape):
198 anObj = CurvesOp.MakeSplineBezier(ListShape)
199 if CurvesOp.IsDone() == 0:
200 print "MakeSplineBezier : ", CurvesOp.GetErrorCode()
203 def MakeInterpol(ListShape):
204 anObj = CurvesOp.MakeSplineInterpolation(ListShape)
205 if CurvesOp.IsDone() == 0:
206 print "MakeSplineInterpolation : ", CurvesOp.GetErrorCode()
209 def MakeSketcher(Cmd, WPL):
210 anObj = CurvesOp.MakeSketcher(Cmd, WPL)
211 if CurvesOp.IsDone() == 0:
212 print "MakeSketcher : ", CurvesOp.GetErrorCode()
215 # -----------------------------------------------------------------------------
216 # Create 3D Primitives
217 # -----------------------------------------------------------------------------
219 def MakeBox(x1,y1,z1,x2,y2,z2):
220 pnt1 = MakeVertex(x1,y1,z1)
221 pnt2 = MakeVertex(x2,y2,z2)
222 return MakeBoxTwoPnt(pnt1,pnt2)
224 def MakeBoxDXDYDZ(dx,dy,dz):
225 anObj = PrimOp.MakeBoxDXDYDZ(dx,dy,dz)
226 if PrimOp.IsDone() == 0:
227 print "MakeBoxDXDYDZ : ", PrimOp.GetErrorCode()
230 def MakeBoxTwoPnt(point1, point2):
231 anObj = PrimOp.MakeBoxTwoPnt(point1, point2)
232 if PrimOp.IsDone() == 0:
233 print "MakeBoxTwoPnt : ", PrimOp.GetErrorCode()
236 def MakeCylinder(p1,v1,radius,height):
237 anObj = PrimOp.MakeCylinderPntVecRH(p1,v1,radius,height)
238 if PrimOp.IsDone() == 0:
239 print "MakeCylinderPntVecRH : ", PrimOp.GetErrorCode()
242 def MakeCylinderRH(radius,height):
243 anObj = PrimOp.MakeCylinderRH(radius,height)
244 if PrimOp.IsDone() == 0:
245 print "MakeCylinderRH : ", PrimOp.GetErrorCode()
248 def MakeSphere(point,radius):
249 anObj = PrimOp.MakeSpherePntR(point,radius)
250 if PrimOp.IsDone() == 0:
251 print "MakeSpherePntR : ", PrimOp.GetErrorCode()
254 def MakeSphereR(radius):
255 anObj = PrimOp.MakeSphereR(radius)
256 if PrimOp.IsDone() == 0:
257 print "MakeSphereR : ", PrimOp.GetErrorCode()
260 def MakeCone(p1,v1,radius1,radius2,height):
261 anObj = PrimOp.MakeConePntVecR1R2H(p1,v1,radius1,radius2,height)
262 if PrimOp.IsDone() == 0:
263 print "MakeConePntVecR1R2H : ", PrimOp.GetErrorCode()
266 def MakeConeR1R2H(radius1,radius2,height):
267 anObj = PrimOp.MakeConeR1R2H(radius1,radius2,height)
268 if PrimOp.IsDone() == 0:
269 print "MakeConeR1R2H : ", PrimOp.GetErrorCode()
272 def MakeTorus(p1,v1,major_radius,minor_radius):
273 anObj = PrimOp.MakeTorusPntVecRR(p1,v1,major_radius,minor_radius)
274 if PrimOp.IsDone() == 0:
275 print "MakeTorusPntVecRR : ", PrimOp.GetErrorCode()
278 def MakeTorusRR(major_radius,minor_radius):
279 anObj = PrimOp.MakeTorusRR(major_radius,minor_radius)
280 if PrimOp.IsDone() == 0:
281 print "MakeTorusRR : ", PrimOp.GetErrorCode()
284 def MakePrism(baseShape,vector,height):
285 anObj = PrimOp.MakePrismVecH(baseShape,vector,height)
286 if PrimOp.IsDone() == 0:
287 print "MakePrismVecH : ", PrimOp.GetErrorCode()
290 def MakePrismTwoPnt(baseShape,point1,point2):
291 anObj = PrimOp.MakePrismTwoPnt(baseShape,point1,point2)
292 if PrimOp.IsDone() == 0:
293 print "MakePrismTwoPnt : ", PrimOp.GetErrorCode()
296 def MakePipe(baseShape,pathShape):
297 anObj = PrimOp.MakePipe(baseShape,pathShape)
298 if PrimOp.IsDone() == 0:
299 print "MakePipe : ", PrimOp.GetErrorCode()
302 def MakeRevolution(aShape,axis,angle):
303 anObj = PrimOp.MakeRevolutionAxisAngle(aShape,axis,angle)
304 if PrimOp.IsDone() == 0:
305 print "MakeRevolutionAxisAngle : ", PrimOp.GetErrorCode()
308 # -----------------------------------------------------------------------------
310 # -----------------------------------------------------------------------------
313 anObj = ShapesOp.MakeEdge(p1,p2)
314 if ShapesOp.IsDone() == 0:
315 print "MakeEdge : ", ShapesOp.GetErrorCode()
318 def MakeWire(ListShape):
319 anObj = ShapesOp.MakeWire(ListShape)
320 if ShapesOp.IsDone() == 0:
321 print "MakeWire : ", ShapesOp.GetErrorCode()
324 def MakeFace(aShapeWire,WantPlanarFace):
325 anObj = ShapesOp.MakeFace(aShapeWire,WantPlanarFace)
326 if ShapesOp.IsDone() == 0:
327 print "MakeFace : ", ShapesOp.GetErrorCode()
330 def MakeFaceWires(ListWires,WantPlanarFace):
331 anObj = ShapesOp.MakeFaceWires(ListWires,WantPlanarFace)
332 if ShapesOp.IsDone() == 0:
333 print "MakeFaceWires : ", ShapesOp.GetErrorCode()
336 def MakeShell(ListOfShapes):
337 anObj = ShapesOp.MakeShell(ListOfShapes)
338 if ShapesOp.IsDone() == 0:
339 print "MakeShell : ", ShapesOp.GetErrorCode()
342 def MakeSolid(ListOfShells):
343 anObj = ShapesOp.MakeSolidShells(ListOfShells)
344 if ShapesOp.IsDone() == 0:
345 print "MakeSolid : ", ShapesOp.GetErrorCode()
348 def MakeCompound(ListShape):
349 anObj = ShapesOp.MakeCompound(ListShape)
350 if ShapesOp.IsDone() == 0:
351 print "MakeCompound : ", ShapesOp.GetErrorCode()
354 def ChangeOrientation(Shape):
355 anObj = ShapesOp.ChangeOrientation(Shape)
356 if ShapesOp.IsDone() == 0:
357 print "ChangeOrientation : ", ShapesOp.GetErrorCode()
360 # -----------------------------------------------------------------------------
362 # -----------------------------------------------------------------------------
364 def SubShape(aShape,ListOfId):
365 anObj = geom.AddSubShape(aShape,ListOfId)
368 def SubShapeAll(aShape,type):
369 ListObj = ShapesOp.MakeExplode(aShape,type,0)
370 if ShapesOp.IsDone() == 0:
371 print "MakeExplode : ", ShapesOp.GetErrorCode()
374 def SubShapeAllSorted(aShape,type):
375 ListObj = ShapesOp.MakeExplode(aShape,type,1)
376 if ShapesOp.IsDone() == 0:
377 print "MakeExplode : ", ShapesOp.GetErrorCode()
380 def GetSubShapeID(aShape, aSubShape):
381 return LocalOp.GetSubShapeIndex(aShape, aSubShape)
383 # -----------------------------------------------------------------------------
385 # -----------------------------------------------------------------------------
387 def ProcessShape(Shape, Operators, Parameters, Values):
388 anObj = HealOp.ProcessShape(Shape, Operators, Parameters, Values)
389 if HealOp.IsDone() == 0:
390 print "ProcessShape : ", HealOp.GetErrorCode()
393 def SuppressFaces(aShape,ListOfId):
394 anObj = HealOp.SuppressFaces(aShape,ListOfId)
395 if HealOp.IsDone() == 0:
396 print "SuppressFaces : ", HealOp.GetErrorCode()
399 def MakeSewing(ListShape,precision):
400 comp = MakeCompound(ListShape)
401 anObj = Sew(comp,precision)
404 def Sew(aShape,precision):
405 anObj = HealOp.Sew(aShape,precision)
406 if HealOp.IsDone() == 0:
407 print "Sew : ", HealOp.GetErrorCode()
410 def SuppressInternalWires(aShape, Wires):
411 anObj = HealOp.RemoveIntWires(aShape, Wires)
412 if HealOp.IsDone() == 0:
413 print "SuppressInternalWires : ", HealOp.GetErrorCode()
416 def SuppressHoles(aShape, ListOfId):
417 anObj = HealOp.FillHoles(aShape,ListOfId)
418 if HealOp.IsDone() == 0:
419 print "SuppressHoles : ", HealOp.GetErrorCode()
422 def CloseContour(aShape, Wires, IsCommonVertex):
423 anObj = HealOp.CloseContour(aShape, Wires, IsCommonVertex)
424 if HealOp.IsDone() == 0:
425 print "CloseContour : ", HealOp.GetErrorCode()
428 def DivideEdge(aShape, EdgeID, Value, IsByParameter):
429 anObj = HealOp.DivideEdge(aShape, EdgeID, Value, IsByParameter)
430 if HealOp.IsDone() == 0:
431 print "DivideEdge : ", HealOp.GetErrorCode()
434 def GetFreeBoundary(Shape):
435 anObj = HealOp.GetFreeBoundary(Shape)
436 if HealOp.IsDone() == 0:
437 print "GetFreeBoundaries : ", HealOp.GetErrorCode()
440 # -----------------------------------------------------------------------------
441 # Create advanced objects
442 # -----------------------------------------------------------------------------
444 def MakeCopy(aShape):
445 anObj = InsertOp.MakeCopy(aShape)
446 if InsertOp.IsDone() == 0:
447 print "MakeCopy : ", InsertOp.GetErrorCode()
450 def MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter):
451 anObj = PrimOp.MakeFilling(aShape,mindeg,maxdeg,tol2d,tol3d,nbiter)
452 if PrimOp.IsDone() == 0:
453 print "MakeFilling : ", PrimOp.GetErrorCode()
456 def MakeGlueFaces(aShape,aTolerance):
457 anObj = ShapesOp.MakeGlueFaces(aShape,aTolerance)
458 if ShapesOp.IsDone() == 0:
459 print "MakeGlueFaces : ", ShapesOp.GetErrorCode()
462 # -----------------------------------------------------------------------------
463 # Boolean (Common, Cut, Fuse, Section)
464 # -----------------------------------------------------------------------------
466 def MakeBoolean(shape1,shape2,operation):
467 anObj = BoolOp.MakeBoolean(shape1,shape2,operation)
468 if BoolOp.IsDone() == 0:
469 print "MakeBoolean : ", BoolOp.GetErrorCode()
472 def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
473 Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
474 anObj = BoolOp.MakePartition(ListShapes, ListTools,
475 ListKeepInside, ListRemoveInside,
476 Limit, RemoveWebs, ListMaterials);
477 if BoolOp.IsDone() == 0:
478 print "MakePartition : ", BoolOp.GetErrorCode()
481 # -----------------------------------------------------------------------------
483 # -----------------------------------------------------------------------------
485 def MakeTranslationTwoPoints(aShape,point1,point2):
486 anObj = TrsfOp.TranslateTwoPointsCopy(aShape,point1,point2)
487 if TrsfOp.IsDone() == 0:
488 print "TranslateTwoPointsCopy : ", TrsfOp.GetErrorCode()
491 def MakeTranslation(aShape,dx,dy,dz):
492 anObj = TrsfOp.TranslateDXDYDZCopy(aShape,dx,dy,dz)
493 if TrsfOp.IsDone() == 0:
494 print "TranslateDXDYDZCopy : ", TrsfOp.GetErrorCode()
497 def MakeRotation(aShape,axis,angle):
498 anObj = TrsfOp.RotateCopy(aShape,axis,angle)
499 if TrsfOp.IsDone() == 0:
500 print "RotateCopy : ", TrsfOp.GetErrorCode()
503 def MakeScaleTransform(aShape,theCenterofScale,factor):
504 anObj = TrsfOp.ScaleShapeCopy(aShape,theCenterofScale,factor)
505 if TrsfOp.IsDone() == 0:
506 print "ScaleShapeCopy : ", TrsfOp.GetErrorCode()
509 def MakeMirrorByPlane(aShape,aPlane):
510 anObj = TrsfOp.MirrorPlaneCopy(aShape,aPlane)
511 if TrsfOp.IsDone() == 0:
512 print "MirrorPlaneCopy : ", TrsfOp.GetErrorCode()
515 def MakePosition(aShape,theStartLCS,theEndLCS):
516 anObj = TrsfOp.PositionShapeCopy(aShape,theStartLCS,theEndLCS)
517 if TrsfOp.IsDone() == 0:
518 print "PositionShapeCopy : ", TrsfOp.GetErrorCode()
521 def MakeOffset(aShape, anOffset):
522 anObj = TrsfOp.OffsetShapeCopy(aShape, anOffset)
523 if TrsfOp.IsDone() == 0:
524 print "OffsetShapeCopy : ", TrsfOp.GetErrorCode()
527 # -----------------------------------------------------------------------------
529 # -----------------------------------------------------------------------------
531 def MakeMultiTranslation1D(aShape,aDir,aStep,aNbTimes):
532 anObj = TrsfOp.MultiTranslate1D(aShape,aDir,aStep,aNbTimes)
533 if TrsfOp.IsDone() == 0:
534 print "MultiTranslate1D : ", TrsfOp.GetErrorCode()
537 def MakeMultiTranslation2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2):
538 anObj = TrsfOp.MultiTranslate2D(aShape,d1,step1,nbtimes1,d2,step2,nbtimes2)
539 if TrsfOp.IsDone() == 0:
540 print "MultiTranslate2D : ", TrsfOp.GetErrorCode()
543 def MakeMultiRotation1D(aShape,aVec,aNbTimes):
544 anObj = TrsfOp.MultiRotate1D(aShape,aVec,aNbTimes)
545 if TrsfOp.IsDone() == 0:
546 print "MultiRotate1D : ", TrsfOp.GetErrorCode()
549 def MakeMultiRotation2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2):
550 anObj = TrsfOp.MultiRotate2D(aShape,aVec,anAngle,nbtimes1,aStep,nbtimes2)
551 if TrsfOp.IsDone() == 0:
552 print "MultiRotate2D : ", TrsfOp.GetErrorCode()
555 # -----------------------------------------------------------------------------
557 # -----------------------------------------------------------------------------
559 def MakeFilletAll(aShape,radius):
560 anObj = LocalOp.MakeFilletAll(aShape,radius)
561 if LocalOp.IsDone() == 0:
562 print "MakeFilletAll : ", LocalOp.GetErrorCode()
565 def MakeFillet(aShape,radius,aShapeType,ListShape):
567 if aShapeType == ShapeType["EDGE"]:
568 anObj = LocalOp.MakeFilletEdges(aShape,radius,ListShape)
570 anObj = LocalOp.MakeFilletFaces(aShape,radius,ListShape)
571 if LocalOp.IsDone() == 0:
572 print "MakeFillet : ", LocalOp.GetErrorCode()
575 def MakeChamferAll(aShape,d):
576 anObj = LocalOp.MakeChamferAll(aShape,d)
577 if LocalOp.IsDone() == 0:
578 print "MakeChamferAll : ", LocalOp.GetErrorCode()
581 def MakeChamferEdge(aShape,d1,d2,face1,face2):
582 anObj = LocalOp.MakeChamferEdge(aShape,d1,d2,face1,face2)
583 if LocalOp.IsDone() == 0:
584 print "MakeChamferEdge : ", LocalOp.GetErrorCode()
587 def MakeChamferFaces(aShape,d1,d2,ListShape):
588 anObj = LocalOp.MakeChamferFaces(aShape,d1,d2,ListShape)
589 if LocalOp.IsDone() == 0:
590 print "MakeChamferFaces : ", LocalOp.GetErrorCode()
593 def Archimede(aShape,weight,WaterDensity,MeshingDeflection):
594 anObj = LocalOp.MakeArchimede(aShape,weight,WaterDensity,MeshingDeflection)
595 if LocalOp.IsDone() == 0:
596 print "MakeArchimede : ", LocalOp.GetErrorCode()
599 def MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes):
600 anObj = BlocksOp.MakeMultiTransformation1D(Block, DirFaceID1, DirFaceID2, NbTimes)
601 if BlocksOp.IsDone() == 0:
602 print "MakeMultiTransformation1D : ", BlocksOp.GetErrorCode()
605 def MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, DirFaceID1V, DirFaceID2V, NbTimesV):
606 anObj = BlocksOp.MakeMultiTransformation2D(Block, DirFaceID1U, DirFaceID2U, NbTimesU, DirFaceID1V, DirFaceID2V, NbTimesV)
607 if BlocksOp.IsDone() == 0:
608 print "MakeMultiTransformation2D : ", BlocksOp.GetErrorCode()
611 def MakeBlockExplode(Compound, MinNbFaces, MaxNbFaces):
612 aList = BlocksOp.ExplodeCompoundOfBlocks(Compound, MinNbFaces, MaxNbFaces)
613 if BlocksOp.IsDone() == 0:
614 print "MakeBlockExplode : ", BlocksOp.GetErrorCode()
617 # -----------------------------------------------------------------------------
618 # Information objects
619 # -----------------------------------------------------------------------------
621 def PointCoordinates(Point):
622 aTuple = MeasuOp.PointCoordinates(Point)
623 if MeasuOp.IsDone() == 0:
624 print "PointCoordinates : ", MeasuOp.GetErrorCode()
627 def BasicProperties(Shape):
628 aTuple = MeasuOp.GetBasicProperties(Shape)
629 if MeasuOp.IsDone() == 0:
630 print "BasicProperties : ", MeasuOp.GetErrorCode()
633 def BoundingBox(Shape):
634 aTuple = MeasuOp.GetBoundingBox(Shape)
635 if MeasuOp.IsDone() == 0:
636 print "BoundingBox : ", MeasuOp.GetErrorCode()
640 aTuple = MeasuOp.GetInertia(Shape)
641 if MeasuOp.IsDone() == 0:
642 print "Inertia : ", MeasuOp.GetErrorCode()
645 def MinDistance(Shape1, Shape2):
646 aTuple = MeasuOp.GetMinDistance(Shape1, Shape2)
647 if MeasuOp.IsDone() == 0:
648 print "MinDistance : ", MeasuOp.GetErrorCode()
651 def Tolerance(Shape):
652 aTuple = MeasuOp.GetTolerance(Shape)
653 if MeasuOp.IsDone() == 0:
654 print "Tolerance : ", MeasuOp.GetErrorCode()
658 aDescr = MeasuOp.WhatIs(Shape)
659 if MeasuOp.IsDone() == 0:
660 print "WhatIs : ", MeasuOp.GetErrorCode()
664 anObj = MeasuOp.GetCentreOfMass(aShape)
665 if MeasuOp.IsDone() == 0:
666 print "GetCentreOfMass : ", MeasuOp.GetErrorCode()
669 def CheckShape(aShape):
670 (IsValid, Status) = MeasuOp.CheckShape(aShape)
671 if MeasuOp.IsDone() == 0:
672 print "CheckShape : ", MeasuOp.GetErrorCode()
678 # -----------------------------------------------------------------------------
679 # Import/Export objects
680 # -----------------------------------------------------------------------------
682 def Import(filename, formatname):
683 anObj = InsertOp.Import(filename, formatname)
684 if InsertOp.IsDone() == 0:
685 print "Import : ", InsertOp.GetErrorCode()
688 def Export(aShape, filename, formatname):
689 InsertOp.Export(aShape, filename, formatname)
690 if InsertOp.IsDone() == 0:
691 print "Export : ", InsertOp.GetErrorCode()
693 # -----------------------------------------------------------------------------
695 # -----------------------------------------------------------------------------
697 def MakeQuadFace(E1, E2, E3, E4):
698 anObj = BlocksOp.MakeQuadFaceFourEdges(E1, E2, E3, E4)
699 if BlocksOp.IsDone() == 0:
700 print "MakeQuadFace : ", BlocksOp.GetErrorCode()
703 def MakeQuadFaceTwoEdges(E1, E2):
704 anObj = BlocksOp.MakeQuadFaceTwoEdges(E1, E2)
705 if BlocksOp.IsDone() == 0:
706 print "MakeQuadFaceEdge : ", BlocksOp.GetErrorCode()
709 def MakeQuadFaceVertices(V1, V2, V3, V4):
710 anObj = BlocksOp.MakeQuadFaceFourVertices(V1, V2, V3, V4)
711 if BlocksOp.IsDone() == 0:
712 print "MakeQuadFaceVertex : ", BlocksOp.GetErrorCode()
715 def MakeHexaSolid(F1, F2, F3, F4, F5, F6):
716 anObj = BlocksOp.MakeHexaSolidSixFaces(F1, F2, F3, F4, F5, F6)
717 if BlocksOp.IsDone() == 0:
718 print "MakeHexaSolid : ", BlocksOp.GetErrorCode()
721 def MakeHexaSolidTwoFaces(F1, F2):
722 anObj = BlocksOp.MakeHexaSolidTwoFaces(F1, F2)
723 if BlocksOp.IsDone() == 0:
724 print "MakeHexaSolidTwoFace : ", BlocksOp.GetErrorCode()
727 # -----------------------------------------------------------------------------
729 # -----------------------------------------------------------------------------
731 def CreateGroup(MainShape, ShapeType):
732 anObj = GroupOp.CreateGroup(MainShape, ShapeType)
733 if GroupOp.IsDone() == 0:
734 print "CreateGroup : ", GroupOp.GetErrorCode()
737 def AddObject(Group, SubShapeID):
738 anObj = GroupOp.AddObject(Group, SubShapeID)
739 if GroupOp.IsDone() == 0:
740 print "AddObject : ", GroupOp.GetErrorCode()
743 def RemoveObject(Group, SubShapeID):
744 anObj = GroupOp.RemoveObject(Group, SubShapeID)
745 if GroupOp.IsDone() == 0:
746 print "RemoveObject : ", GroupOp.GetErrorCode()
749 def GetObjectIDs(Group):
750 anObj = GroupOp.GetObjects(Group)
751 if GroupOp.IsDone() == 0:
752 print "GetObjectIDs : ", GroupOp.GetErrorCode()