#### 6.5.9.6. VirtualGeometry

`class compolyx.VirtualGeometry`(graph, obj, parent=None)

ComPoLyX Class to represent VirtualGeometry

`add`(shape)

  Creates a new CADReference object for the given shape. Returns the new CADReference object or the existing one if available

  Parameters

  - shape : A tuple. The first item is the shape object and the second the link path (root path) of the shape.

  If the the first item is None, the link path is used to link the shape with the virtual geometry.

  Usage

      >>> cad = db.active_model.geometry.cad_geometries['CadGeometry.1']
      >>> db.active_model.geometry.virtual_geometries['RefGeom'].add( (cad.root_shapes['top_surface'], "") )
      or
      >>> db.active_model.geometry.virtual_geometries['RefGeom'].add( (None, "CadGeometry.1/top_surface") )

`cad_geometry`

  Returns the linked CADGeometry. Read only.

`cad_references`

  Dictionary of all cad references.

`clear_cad_references`()

  Clear all linked references (VirtualGeometry becomes empty)

`create_cad_reference`(name='VirtualGeometry.1', id=None, path=None, size=None, cog=None, dimension=None, bounding_box_min=None, bounding_box_max=None)

  Creates a new Cad Reference and links it with the Virtual Geometry

  Parameters

  - name : Name of the object

  - id : ID of the object

  - path : Geometry path of the linked cad component

  - size : Size of the linked cad component. Size can be the volume, area or length depending on the type of the linked cad component.

  - cog : Center of gravity of the linked cad component.

  - dimension : The shape type of the cad component. CADCompound, CADSolid, CADShell or CADFace.

  - bounding_box_min : Minimum point of the bounding box

  - bounding_box_max : Maximum point of the bounding box

  Return

  - the new cad reference object

`dimension`

  Highest dimension of all cad references. 3=solid, 2=surface, 1=curve

`remove`(shape)

  Removes the CADReference object for the given shape

  Usage

      >>> cad = db.active_model.geometry.cad_geometries['CadGeometry.1']
      >>> db.active_model.geometry.virtual_geometries['RefGeom'].remove( (cad.root_shapes['top_surface'], "") )
      or
      >>> db.active_model.geometry.virtual_geometries['RefGeom'].remove( (None, "CadGeometry.1/top_surface") )

`serialize`()

  Serialize to Python string

`set`(shapes)

  Clears the existing CAD References and creates a new one for each given shape

  Parameters

  - shapes : A list of tuples. The first item is the shape object and the second the link path (root path) of the shape.

  Usage

      >>> shell = db.active_model.geometry.cad_geometries['CADGeometry.1'].root_shapes['cut_surface']
      >>> db.active_model.geometry.virtual_geometries['RefGeom.1'].set(shapes=[ (shell, "") ] )
      or
      >>> db.active_model.geometry.virtual_geometries['RefGeom.1'].set(paths=[ (None, "CADGeometry.1/cut_surface") ] )

`sub_shapes`

  Sub components of the VirtualGeometry.

Release 18.2 - © ANSYS, Inc. All rights reserved.