Preview symbols

The PythonPart preview can be extended by using preview symbols. Preview symbols are displayed in every Allplan view and have a fixed size, regardless of the zoom level.

../../../_images/PreviewSymbolsView.png

The symbol can be created from a text

../../../_images/PreviewSymbolsText.png

which allows to create a readable text in all views.

The PreviewSymbols class is a utility class used to create the preview symbols as follows

preview_symbols = PreviewSymbols()

preview_symbols.add_coord_cross(AllplanGeo.AxisPlacement3D(AllplanGeo.Point3D(1500, 1000, 500),
                                                           AllplanGeo.Vector3D(100, 0, 0),
                                                           AllplanGeo.Vector3D(0, 0, 100)),
                                build_ele.ArmSize.value)

preview_symbols.add_text("Text", AllplanGeo.Point3D(3000, 2000, 1000),
                        TextReferencePointPosition.CenterCenter,
                        build_ele.TextHeight.value, color,
                        AllplanGeo.Angle(math.radians(build_ele.RotationAngle.value)))

In a Standard PythonPart the PreviewSymbols object must be added to the CreateElementResult object like

return CreateElementResult(model_ele_list, preview_symbols = preview_symbols)

In an Interactor PythonPart the PreviewSymbols can be drawn like

preview_symbols.draw(insert_matrix,
                     coord_input.GetViewWorldProjection())

or by direct use of the API class PreviewSymbolBuilder like

AllplanIFW.PreviewSymbolBuilder.CoordCrossSymbol(axis_placement, arm_length, coord_input.view_projection)

The complete documentation of the members from the PreviewSymbols and PreviewSymbolBuilder class can be found here:

and a use of the preview symbols is implemented in the example

…\etc\Examples\PythonParts\BasisExamples\General\DrawPreviewSymbols.pyp
…\etc\PythonPartsExampleScripts\BasisExamples\General\DrawPreviewSymbols.py