1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 //=============================================================================
24 // File : GEOMImpl_IShapesOperations.hxx
26 // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
28 //=============================================================================
30 #ifndef _GEOMImpl_IShapesOperations_HXX_
31 #define _GEOMImpl_IShapesOperations_HXX_
33 #include "GEOM_IOperations.hxx"
35 #include "GEOMAlgo_State.hxx"
37 #include <TopoDS_Shape.hxx>
38 #include <TopTools_ListOfShape.hxx>
39 #include <NCollection_DataMap.hxx>
40 #include <TColStd_HSequenceOfTransient.hxx>
41 #include <TColStd_HSequenceOfInteger.hxx>
43 #include <Handle_Geom_Surface.hxx>
51 class Handle(GEOM_Object);
52 class Handle(TColStd_HArray1OfInteger);
54 inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2)
59 class GEOMImpl_IShapesOperations : public GEOM_IOperations
62 Standard_EXPORT GEOMImpl_IShapesOperations(GEOM_Engine* theEngine, int theDocID);
63 Standard_EXPORT ~GEOMImpl_IShapesOperations();
65 Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
66 Handle(GEOM_Object) thePoint2);
68 Standard_EXPORT Handle(GEOM_Object) MakeEdgeOnCurveByLength (Handle(GEOM_Object) theCurve,
69 const Standard_Real theLength,
70 Handle(GEOM_Object) theStartPoint);
72 Standard_EXPORT Handle(GEOM_Object) MakeEdgeWire (Handle(GEOM_Object) theWire,
73 const Standard_Real theLinearTolerance,
74 const Standard_Real theAngularTolerance);
76 Standard_EXPORT Handle(GEOM_Object) MakeWire (std::list<Handle(GEOM_Object)> theEdgesAndWires,
77 const Standard_Real theTolerance);
79 Standard_EXPORT Handle(GEOM_Object) MakeFace (Handle(GEOM_Object) theWire, const bool isPlanarWanted);
81 Standard_EXPORT Handle(GEOM_Object) MakeFaceWires (std::list<Handle(GEOM_Object)> theWires,
82 const bool isPlanarWanted);
84 Standard_EXPORT Handle(GEOM_Object) MakeShell (std::list<Handle(GEOM_Object)> theShapes);
86 Standard_EXPORT Handle(GEOM_Object) MakeSolidShells (std::list<Handle(GEOM_Object)> theShells);
88 Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes);
90 Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (Handle(GEOM_Object) theShape,
91 const Standard_Real theTolerance,
92 const Standard_Boolean doKeepNonSolids);
94 //Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueFaces (Handle(GEOM_Object) theShape,
95 // const Standard_Real theTolerance);
97 Standard_EXPORT Handle(GEOM_Object) MakeGlueFacesByList (Handle(GEOM_Object) theShape,
98 const Standard_Real theTolerance,
99 std::list<Handle(GEOM_Object)> theFaces,
100 const Standard_Boolean doKeepNonSolids,
101 const Standard_Boolean doGlueAllEdges);
103 Standard_EXPORT Handle(GEOM_Object) MakeGlueEdges (Handle(GEOM_Object) theShape,
104 const Standard_Real theTolerance);
106 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetGlueShapes (Handle(GEOM_Object) theShape,
107 const Standard_Real theTolerance,
108 const TopAbs_ShapeEnum theType);
110 Standard_EXPORT Handle(GEOM_Object) MakeGlueEdgesByList (Handle(GEOM_Object) theShape,
111 const Standard_Real theTolerance,
112 std::list<Handle(GEOM_Object)> theEdges);
114 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
115 (Handle(GEOM_Object) theShape,
116 const Standard_Boolean theGroupsOnly);
119 EXPLODE_OLD_INCLUDE_MAIN,
120 EXPLODE_NEW_INCLUDE_MAIN,
121 EXPLODE_NEW_EXCLUDE_MAIN
124 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode
125 (Handle(GEOM_Object) theShape,
126 const Standard_Integer theShapeType,
127 const Standard_Boolean isSorted,
128 const ExplodeType theExplodeType = EXPLODE_NEW_INCLUDE_MAIN);
130 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) SubShapeAllIDs
131 (Handle(GEOM_Object) theShape,
132 const Standard_Integer theShapeType,
133 const Standard_Boolean isSorted,
134 const ExplodeType theExplodeType = EXPLODE_NEW_INCLUDE_MAIN);
136 Standard_EXPORT Handle(GEOM_Object) GetSubShape (Handle(GEOM_Object) theMainShape,
137 const Standard_Integer theID);
139 Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeSubShapes
140 (Handle(GEOM_Object) theMainShape,
141 Handle(TColStd_HArray1OfInteger) theIndices);
143 Standard_EXPORT Standard_Integer GetSubShapeIndex (Handle(GEOM_Object) theMainShape,
144 Handle(GEOM_Object) theSubShape);
146 Standard_EXPORT Standard_Integer GetTopologyIndex (Handle(GEOM_Object) theMainShape,
147 Handle(GEOM_Object) theSubShape);
149 Standard_EXPORT TCollection_AsciiString GetShapeTypeString (Handle(GEOM_Object) theShape);
151 Standard_EXPORT Standard_Integer NumberOfSubShapes (Handle(GEOM_Object) theShape,
152 const Standard_Integer theShapeType);
154 Standard_EXPORT Handle(GEOM_Object) ReverseShape(Handle(GEOM_Object) theShapes);
156 Standard_EXPORT Handle(TColStd_HSequenceOfInteger) GetFreeFacesIDs (Handle(GEOM_Object) theShape);
158 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
159 GetSharedShapes (Handle(GEOM_Object) theShape1,
160 Handle(GEOM_Object) theShape2,
161 const Standard_Integer theShapeType);
163 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
164 GetSharedShapes (std::list<Handle(GEOM_Object)> theShapes,
165 const Standard_Integer theShapeType);
167 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
168 GetShapesOnPlane (const Handle(GEOM_Object)& theShape,
169 const Standard_Integer theShapeType,
170 const Handle(GEOM_Object)& theAx1,
171 const GEOMAlgo_State theState);
173 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
174 GetShapesOnPlaneWithLocation (const Handle(GEOM_Object)& theShape,
175 const Standard_Integer theShapeType,
176 const Handle(GEOM_Object)& theAx1,
177 const Handle(GEOM_Object)& thePnt,
178 const GEOMAlgo_State theState);
181 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
182 GetShapesOnCylinder (const Handle(GEOM_Object)& theShape,
183 const Standard_Integer theShapeType,
184 const Handle(GEOM_Object)& theAxis,
185 const Standard_Real theRadius,
186 const GEOMAlgo_State theState);
188 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
189 GetShapesOnCylinderWithLocation (const Handle(GEOM_Object)& theShape,
190 const Standard_Integer theShapeType,
191 const Handle(GEOM_Object)& theAxis,
192 const Handle(GEOM_Object)& thePnt,
193 const Standard_Real theRadius,
194 const GEOMAlgo_State theState);
196 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
197 GetShapesOnSphere (const Handle(GEOM_Object)& theShape,
198 const Standard_Integer theShapeType,
199 const Handle(GEOM_Object)& theCenter,
200 const Standard_Real theRadius,
201 const GEOMAlgo_State theState);
203 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
204 GetShapesOnPlaneIDs (const Handle(GEOM_Object)& theShape,
205 const Standard_Integer theShapeType,
206 const Handle(GEOM_Object)& theAx1,
207 const GEOMAlgo_State theState);
209 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
210 GetShapesOnPlaneWithLocationIDs (const Handle(GEOM_Object)& theShape,
211 const Standard_Integer theShapeType,
212 const Handle(GEOM_Object)& theAx1,
213 const Handle(GEOM_Object)& thePnt,
214 const GEOMAlgo_State theState);
216 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
217 GetShapesOnCylinderIDs (const Handle(GEOM_Object)& theShape,
218 const Standard_Integer theShapeType,
219 const Handle(GEOM_Object)& theAxis,
220 const Standard_Real theRadius,
221 const GEOMAlgo_State theState);
223 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
224 GetShapesOnCylinderWithLocationIDs (const Handle(GEOM_Object)& theShape,
225 const Standard_Integer theShapeType,
226 const Handle(GEOM_Object)& theAxis,
227 const Handle(GEOM_Object)& thePnt,
228 const Standard_Real theRadius,
229 const GEOMAlgo_State theState);
231 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
232 GetShapesOnSphereIDs (const Handle(GEOM_Object)& theShape,
233 const Standard_Integer theShapeType,
234 const Handle(GEOM_Object)& theCenter,
235 const Standard_Real theRadius,
236 const GEOMAlgo_State theState);
239 * \brief Find subshapes complying with given status about quadrangle
240 * \param theShape - the shape to explore
241 * \param theShapeType - type of subshape of theShape
242 * \param theTopLeftPoint - top left quadrangle corner
243 * \param theTopRigthPoint - top right quadrangle corner
244 * \param theBottomLeftPoint - bottom left quadrangle corner
245 * \param theBottomRigthPoint - bottom right quadrangle corner
246 * \param theState - required state
247 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
249 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
250 GetShapesOnQuadrangle (const Handle(GEOM_Object)& theShape,
251 const Standard_Integer theShapeType,
252 const Handle(GEOM_Object)& theTopLeftPoint,
253 const Handle(GEOM_Object)& theTopRigthPoint,
254 const Handle(GEOM_Object)& theBottomLeftPoint,
255 const Handle(GEOM_Object)& theBottomRigthPoint,
256 const GEOMAlgo_State theState);
259 * \brief Find IDs of subshapes complying with given status about quadrangle
260 * \param theShape - the shape to explore
261 * \param theShapeType - type of subshape of theShape
262 * \param theTopLeftPoint - top left quadrangle corner
263 * \param theTopRigthPoint - top right quadrangle corner
264 * \param theBottomLeftPoint - bottom left quadrangle corner
265 * \param theBottomRigthPoint - bottom right quadrangle corner
266 * \param theState - required state
267 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
269 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
270 GetShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
271 const Standard_Integer theShapeType,
272 const Handle(GEOM_Object)& theTopLeftPoint,
273 const Handle(GEOM_Object)& theTopRigthPoint,
274 const Handle(GEOM_Object)& theBottomLeftPoint,
275 const Handle(GEOM_Object)& theBottomRigthPoint,
276 const GEOMAlgo_State theState);
278 Standard_EXPORT Handle(GEOM_Object) GetShapesOnCylinderOld (Handle(GEOM_Object) theShape,
279 const Standard_Integer theShapeType,
280 Handle(GEOM_Object) theAxis,
281 const Standard_Real theRadius);
283 Standard_EXPORT Handle(GEOM_Object) GetShapesOnSphereOld (Handle(GEOM_Object) theShape,
284 const Standard_Integer theShapeType,
285 Handle(GEOM_Object) theCenter,
286 const Standard_Real theRadius);
288 void GetShapeProperties(const TopoDS_Shape aShape, Standard_Real propertiesArray[], gp_Pnt & aPnt);
290 Standard_EXPORT Handle(GEOM_Object) GetInPlace (Handle(GEOM_Object) theShapeWhere,
291 Handle(GEOM_Object) theShapeWhat);
293 Standard_EXPORT Handle(GEOM_Object) GetInPlaceByHistory (Handle(GEOM_Object) theShapeWhere,
294 Handle(GEOM_Object) theShapeWhat);
297 * \brief Searches a shape equal to theWhat in the context of theWhere
298 * \param theShapeWhere - a context shap
299 * \param theShapeWhat - a sample shape
300 * \retval Handle(GEOM_Object) - found shape
302 Standard_EXPORT Handle(GEOM_Object) GetSame(const Handle(GEOM_Object)& theShapeWhere,
303 const Handle(GEOM_Object)& theShapeWhat);
306 * \brief Find IDs of subshapes complying with given status about surface
307 * \param theBox - the box to check state of subshapes against
308 * \param theShape - the shape to explore
309 * \param theShapeType - type of subshape of theShape
310 * \param theState - required state
311 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
313 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
314 GetShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
315 const Handle(GEOM_Object)& theShape,
316 const Standard_Integer theShapeType,
317 GEOMAlgo_State theState);
320 * \brief Find subshapes complying with given status about surface
321 * \param theBox - the box to check state of subshapes against
322 * \param theShape - the shape to explore
323 * \param theShapeType - type of subshape of theShape
324 * \param theState - required state
325 * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
327 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
328 GetShapesOnBox(const Handle(GEOM_Object)& theBox,
329 const Handle(GEOM_Object)& theShape,
330 const Standard_Integer theShapeType,
331 GEOMAlgo_State theState);
334 * \brief Find IDs of subshapes complying with given status about surface
335 * \param theCheckShape - the shape to check state of subshapes against
336 * \param theShape - the shape to explore
337 * \param theShapeType - type of subshape of theShape
338 * \param theState - required state
339 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
341 Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
342 GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
343 const Handle(GEOM_Object)& theShape,
344 const Standard_Integer theShapeType,
345 GEOMAlgo_State theState);
348 * \brief Find subshapes complying with given status about surface
349 * \param theCheckShape - the shape to check state of subshapes against
350 * \param theShape - the shape to explore
351 * \param theShapeType - type of subshape of theShape
352 * \param theState - required state
353 * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
355 Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
356 GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
357 const Handle(GEOM_Object)& theShape,
358 const Standard_Integer theShapeType,
359 GEOMAlgo_State theState);
360 Standard_EXPORT Handle(GEOM_Object)
361 GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
362 const Handle(GEOM_Object)& theShape,
363 const Standard_Integer theShapeType,
364 GEOMAlgo_State theState);
368 * \brief Sort shapes in the list by their coordinates.
369 * \param SL The list of shapes to sort.
371 struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
373 CompareShapes (bool isOldSorting)
374 : myIsOldSorting(isOldSorting) {}
376 bool operator()(const TopoDS_Shape& lhs, const TopoDS_Shape& rhs);
378 typedef NCollection_DataMap<TopoDS_Shape, std::pair<double, double> > NCollection_DataMapOfShapeDouble;
379 NCollection_DataMapOfShapeDouble myMap;
383 Standard_EXPORT static void SortShapes (TopTools_ListOfShape& SL,
384 const Standard_Boolean isOldSorting = Standard_True);
387 * \brief Convert TopoDS_COMPSOLID to TopoDS_COMPOUND.
389 * If the argument shape is not of type TopoDS_COMPSOLID, this method returns it as is.
391 * \param theCompsolid The compsolid to be converted.
392 * \retval TopoDS_Shape Returns the resulting compound.
394 Standard_EXPORT static TopoDS_Shape CompsolidToCompound (const TopoDS_Shape& theCompsolid);
397 * \brief Build a triangulation on \a theShape if it is absent.
398 * \param theShape The shape to check/build triangulation on.
399 * \retval bool Returns false if the shape has no faces, i.e. impossible to build triangulation.
401 Standard_EXPORT static bool CheckTriangulation (const TopoDS_Shape& theShape);
404 * \brief Return type of shape for explode. In case of compound it will be a type of its first sub shape.
405 * \param theShape The shape to get type of.
406 * \retval TopAbs_ShapeEnum Return type of shape for explode.
408 Standard_EXPORT static TopAbs_ShapeEnum GetTypeOfSimplePart (const TopoDS_Shape& theShape);
411 Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
412 const Standard_Integer theObjectType,
413 const Standard_Integer theFunctionType,
414 const TCollection_AsciiString& theMethodName);
416 // ----------------------------------------------------
417 // methods common for all GetShapesOnXXX() functions
418 // ----------------------------------------------------
421 * \brief Checks if theShapeType parameter of GetShapesOnXXX() is OK
422 * \param theShapeType - the shape type to check
423 * \retval bool - result of the check
425 bool checkTypeShapesOn(const Standard_Integer theShapeType);
428 * \brief Creates Geom_Plane
429 * \param theAx1 - edge defining plane normal
430 * \retval Handle(Geom_Surface) - resulting surface
432 Handle(Geom_Surface) makePlane(const TopoDS_Shape& theAx1);
435 * \brief Creates Geom_CylindricalSurface
436 * \param theAx1 - edge defining cylinder axis
437 * \param theRadius - cylinder radius
438 * \retval Handle(Geom_Surface) - resulting surface
440 Handle(Geom_Surface) makeCylinder(const TopoDS_Shape& theAx1,
441 const Standard_Real theRadius);
444 * \brief Find IDs of subshapes complying with given status about surface
445 * \param theSurface - the surface to check state of subshapes against
446 * \param theShape - the shape to explore
447 * \param theShapeType - type of subshape of theShape
448 * \param theState - required state
449 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
451 Handle(TColStd_HSequenceOfInteger)
452 getShapesOnSurfaceIDs(const Handle(Geom_Surface)& theSurface,
453 const TopoDS_Shape& theShape,
454 TopAbs_ShapeEnum theShapeType,
455 GEOMAlgo_State theState);
458 * \brief Find subshapes complying with given status about surface
459 * \param theSurface - the surface to check state of subshapes against
460 * \param theShape - the shape to explore
461 * \param theShapeType - type of subshape of theShape
462 * \param theState - required state
463 * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
464 * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
466 Handle(TColStd_HSequenceOfTransient)
467 getShapesOnSurface(const Handle(Geom_Surface)& theSurface,
468 const Handle(GEOM_Object)& theShape,
469 TopAbs_ShapeEnum theShapeType,
470 GEOMAlgo_State theState,
471 TCollection_AsciiString & theShapeEntries);
474 * \brief Find IDs of subshapes complying with given status about quadrangle
475 * \param theShape - the shape to explore
476 * \param theShapeType - type of subshape of theShape
477 * \param theTopLeftPoint - top left quadrangle corner
478 * \param theTopRigthPoint - top right quadrangle corner
479 * \param theBottomLeftPoint - bottom left quadrangle corner
480 * \param theBottomRigthPoint - bottom right quadrangle corner
481 * \param theState - required state
482 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
484 Handle(TColStd_HSequenceOfInteger)
485 getShapesOnQuadrangleIDs (const Handle(GEOM_Object)& theShape,
486 const Standard_Integer theShapeType,
487 const Handle(GEOM_Object)& theTopLeftPoint,
488 const Handle(GEOM_Object)& theTopRigthPoint,
489 const Handle(GEOM_Object)& theBottomLeftPoint,
490 const Handle(GEOM_Object)& theBottomRigthPoint,
491 const GEOMAlgo_State theState);
494 * \brief Find IDs of subshapes complying with given status about surface
495 * \param theBox - the box to check state of subshapes against
496 * \param theShape - the shape to explore
497 * \param theShapeType - type of subshape of theShape
498 * \param theState - required state
499 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
501 Handle(TColStd_HSequenceOfInteger) getShapesOnBoxIDs(const Handle(GEOM_Object)& theBox,
502 const Handle(GEOM_Object)& theShape,
503 const Standard_Integer theShapeType,
504 GEOMAlgo_State theState);
507 * \brief Find IDs of subshapes complying with given status about surface
508 * \param theCheckShape - the shape to check state of subshapes against
509 * \param theShape - the shape to explore
510 * \param theShapeType - type of subshape of theShape
511 * \param theState - required state
512 * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found subshapes
514 Handle(TColStd_HSequenceOfInteger) getShapesOnShapeIDs
515 (const Handle(GEOM_Object)& theCheckShape,
516 const Handle(GEOM_Object)& theShape,
517 const Standard_Integer theShapeType,
518 GEOMAlgo_State theState);
521 * \brief Find shape objects and their entries by their ids
522 * \param theShape - the main shape
523 * \param theShapeIDs - theShapeIDs - incoming shape ids
524 * \param theShapeEntries - outgoing entries like "entry1, entry2, ..."
525 * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
527 Handle(TColStd_HSequenceOfTransient)
528 getObjectsShapesOn(const Handle(GEOM_Object)& theShape,
529 const Handle(TColStd_HSequenceOfInteger)& theShapeIDs,
530 TCollection_AsciiString & theShapeEntries);
533 * \brief Select the object created last
534 * \param theObj1 - Object 1
535 * \param theObj2 - Object 2
536 * \retval Handle(GEOM_Object) - selected object
538 static Handle(GEOM_Object) getCreatedLast(const Handle(GEOM_Object)& theObj1,
539 const Handle(GEOM_Object)& theObj2);