Skip to content

Hidden calculation

This chapter describes the geometry classes and functions from the Allplan Geometry Library which can be used for calculating 2D lines that represents visible and hidden edges of a given 3D geometry.

Hidden Calculation

Ground view hidden calculation

The function GroundViewHiddenCalculation can be used to calculate visible and hidden edges of 3D volumes, represented by BRep3D as well as Polyhedron3D. The calculation is always performed with a view direction pointing downwards (ground view).

Example

In the following example we calculate visible and hidden edges from a cone

error, visible_edges, hidden_edges = AllplanGeo.GroundViewHiddenCalculation(cone) #(1)!
  1. Depending on the cone geometry type: boundary representation (BRep3D) or tessellated solid (Polyhedron3D) the results will be different, see images below.

Hidden calculation Brep cone

When calculating BRep solids (on the left), no unnecessary edges will be calculated in round surfaces (result on the right)

Hidden calculation Polyhedron cone

When calculating tessellated solids (polyhedrons, on the left), the result (on the right) will include all edges, also these on the round surfaces, as in a polyhedron there are technically no round surfaces.

Hidden calculus

To have more control over the results of the calculation, we can use the HiddenCalculus. This class is much more complex and offers more settings influencing the geometry calculation, such as:

  • setting the point of view and its direction
  • setting the maximal angle of adjacent edges
  • assigning material index to the solids, in order to e.g., suspend the lines between solids of the same material

These settings are saved in the HiddenCalculationParameters object.

Example

hidden_param = AllplanGeo.HiddenCalculationParameters()
hidden_param.AdjacentEdgesMaxAngle = AllplanGeo.Angle()
hidden_param.AdjacentEdgesMaxAngle.Deg = 30

eye_point = AllplanGeo.Point3D()
view_point = AllplanGeo.Point3D(0, 0, 1000)
hidden_param.SetObserverMatrix(eye_point, view_point) #(1)!

hidden_calc = AllplanGeo.HiddenCalculus()
hidden_calc.Configure(hidden_param)
hidden_calc.AddElement(polyhed_cone, #(2)!
                    AllplanGeo.HiddenMaterial(),
                    0) #(3)!

# perform the calculation
hidden_calc.Calculate()

# extract the results
for index in range(hidden_calc.GetLinesCount()):
    line, result = hidden_calc.GetResultLine(index) #(4)!
  1. Alternatively we could pass the observer matrix directly to the property ObserverMatrix. The observer matrix is a Matrix3D object. By default, it is a 4x4 identity matrix, which would result in looking on the 3D solid from above.
  2. Here we pass the 3D geometry to the calculus.
  3. When calculating multiple solids, in addition to the Material, we can also append a tag to each of them. This tag will be hooked to each generated 2D line, giving us the ability to associate them with the 3D object, from which they were created, using the GetResultLineTag function.
  4. See the documentation of the GetResultLine function to learn, how the result is returned.

A result of the hidden calculation of a cone and a cylinder with different material may look like this:

Hidden Calculus

Example

The complete implementation of the hidden calculation is available in the PythonPart HiddenCalculus located in:

  • …\etc\Examples\PythonParts\GeometryExamplesServices\HiddenCalculus.pyp
  • …\etc\PythonPartsExampleScripts\GeometryExamplesServices\HiddenCalculus.py