Surface

class xgbxml.xgbxml.Surface[source]
copy_opening(opening, tolerance=0.01)[source]

Makes a copy of an Opening and places it on the Surface.

Parameters:
  • opening (xgbxml.xgbxml.Opening) – The opening to be copied.

  • tolerance (fload) – The distance which an opening can be ‘snapped’ to a surface in meters.

Returns:

The newly created Opening.

Return type:

xgbxml.xgbxml.Opening

get_Spaces()[source]

Returns the space elements adjacent to the surface.

Returns:

The Spaces as given by the AdjacentSpaceId elements.

Return type:

gbCollection

get_area()[source]

Calculates the area of the surface (does not include the area of any openings)

Returns:

The area of the Surface (the shell area minus the Opening areas)

Return type:

float

get_holes()[source]

Returns the coordinates of the holes of the surface.

Return type:

list(tuple(tuple(float)))

get_polygon()[source]

Returns the polygon coordinates of the outer polyloop of the surface.

The following sources are tried in order:
  • PlanarGeometry

  • RectangularGeometry/PolyLoop

  • RectangularGeoemetry… from height and width

Returns:

(shell_coordinates, list of hole coordinates)

Return type:

( tuple(tuple(float)), list(tuple(tuple(float))) )

get_shell()[source]

Returns the shell coordinates of the outer polyloop of the opening.

The following sources are tried in order:
  • PlanarGeometry

  • RectangularGeometry/PolyLoop

  • RectangularGeoemetry… from height and width

Return type:

tuple(tuple(float))

render(ax=None, set_lims=True, surface_outline_kwargs=None, surface_fill_kwargs=None, opening_outline_kwargs=None, opening_fill_kwargs=None)[source]

Renders the Surface in 3D using matplotlib.

Parameters:
  • ax (matplotlib.axes._subplots.Axes3DSubplot) – A matplotlib 3D Axes instance. Optional, if not supplied then an axis is created and returned.

  • set_lims (bool) – If True, then the x, y and z axis limits are set automatically based on the geometry being rendered.

  • surface_outline_kwargs – matplotlib keywork arguments for formatting the outlines of surfaces (passed to ax.plot method).

  • surface_fill_kwargs – matplotlib keywork arguments for formatting the fill of surfaces (passed to Poly3DCollection method).

  • opening_outline_kwargs – matplotlib keywork arguments for formatting the outlines of openings (passed to ax.plot method).

  • opening_fill_kwargs – matplotlib keywork arguments for formatting the fill of openings (passed to Poly3DCollection method).

Returns:

The axis instance.

Return type:

matplotlib.axes._subplots.Axes3DSubplot