Skip to content

Dialogs

Parameters like plane references or file paths need an extra dialog to be displayed for an easier input. Instead of e.g., making the user of the PythonPart to have to type the complete file path, we can provide him a file selection dialog. This is done with the tag <ValueDialog> and in this chapter, we will go through all the dialogs currently available in the palette.

Library symbol

With SymbolDialog the user is being provided a dialog for a symbol selection from the Allplan library. A typical use case can be selecting a steel beam profile from the catalog. After the selection, the complete path to the symbol is being assigned to the parameter value. On the button only the symbol name is being displayed.

Symbol button

<Parameter>
    <Name>SymbolName</Name>
    <Text>SymbolDialog</Text> 
    <Value><!--(1)!--></Value>
    <ValueType>String</ValueType>
    <ValueDialog>SymbolDialog</ValueDialog>
</Parameter>
  1. The default path and filename can be set here. By using one of the following shortcuts, path can point to Allplan standard folders.

    shortcut directory
    etc standard directory
    std office standard directory
    usr user's private directory
    prj current project directory
Dialog

Symbol dialog

Trade

With Trade the user is being provided a dialog for a trade selection. After the selection an integer representing the trade is assigned to the parameter value and the name of the selected trade is being displayed on the button.

Trade button

<Parameter>
    <Name>TradeID</Name>
    <Text>Trade</Text>
    <Value>0</Value>
    <ValueType>Integer</ValueType>
    <ValueDialog>Trade</ValueDialog>
</Parameter>
Dialog

Trade dialog

Attribute

With AttributeSelection the user is being provided a dialog for an attribute selection. After the selection an integer of the attribute ID is assigned to the parameter value and the name of the selected attribute is being displayed on the button.

Attribute selection button

<Parameter>
    <Name>AttributeID</Name>
    <Text>Attribute</Text>
    <Value>0</Value>
    <ValueType>Integer</ValueType>
    <ValueDialog>AttributeSelection</ValueDialog><!--(1)!-->
</Parameter>
  1. To limit the attributes that can be selected, different type of dialogs can be displayed. Here is a brief overview:

    Dialog Limitation
    AttributeSelection No limitation. All attributes can be selected.
    AttributeSelectionInsert Allow to select the insert attributes (additional to the default object attributes).
    AttributeSelectionProject Allow to select the project attributes.
Dialog

Attribute selection dialog

RGB color

With RGBColorDialog the user is being provided a dialog for the definition of a RGB color. After the selection an RGB integer of the defined color is assigned to the parameter value and the color itself is being displayed on the button.

RGB Color button

<Parameter>
    <Name>ColorID</Name>
    <Text>Color</Text>
    <Value>255</Value>
    <ValueType>Integer</ValueType>
    <ValueDialog>RGBColorDialog</ValueDialog>
</Parameter>
Dialog

RGB Color dialog

Tip

To extract the individual RGB channels from the integer returned by this kind of parameter, in order to construct an ARGB object, we can use bitwise shifting and masking:

AllplanBasisElements.ARGB(red   = (build_ele.ColorID.value >> 16) & 255,
                          green = (build_ele.ColorID.value >> 8) & 255,
                          blue  = build_ele.ColorID.value & 255,
                          alpha = 0)

Bitmap

With BitmapResourceDialog the user is being provided a dialog for the selection of a bitmap. After the selection the complete path to the symbol is being assigned to the parameter value. On the button only the file name is being displayed.

Bitmap button

<Parameter>
    <Name>BitmapName</Name>
    <Text>Bitmap</Text>
    <Value><!--(1)!--></Value> 
    <ValueType>String</ValueType>
    <ValueDialog>BitmapResourceDialog</ValueDialog>
</Parameter>
  1. The default path and filename can be set here. By using one of the following shortcuts, path can point to Allplan standard folders.

    shortcut directory
    etc standard directory
    std office standard directory
    usr user's private directory
    prj current project directory
Dialog

Bitmap dialog

Plane references

To let the user define a reference to a plane, a dialog for the selection must be provided. There are several ways a user can define a plane reference, for each one of them different dialogs must be provided:

  • by defining the top reference only
  • by defining the bottom reference only
  • by defining both bottom and top plane references

After the defining the plane, a PlaneReferences object is being assigned to the parameter value.

Top plane button

<Parameter>
    <Name>BottomPlane</Name>
    <Text>Bottom plane</Text>
    <Value></Value>
    <ValueType>PlaneReferences</ValueType>
    <ValueDialog>TopPlaneReferences</ValueDialog>
</Parameter>
Dialog

Top plane dialog

Bottom plane button

<Parameter>
    <Name>BottomPlane</Name>
    <Text>Bottom plane</Text>
    <Value></Value>
    <ValueType>PlaneReferences</ValueType>
    <ValueDialog>BottomPlaneReferences</ValueDialog>
</Parameter>
Dialog

Bottom plane dialog

Bottom plane button

<Parameter>
    <Name>BottomPlane</Name>
    <Text>Bottom plane</Text>
    <Value></Value>
    <ValueType>PlaneReferences</ValueType>
    <ValueDialog>PlaneReferences</ValueDialog>
</Parameter>
Dialog

Bottom plane dialog

Note

Note that the object PlaneReferences holds information about references to both top and bottom level. Providing a dialog to define only one of them will make the other one refers to the default level.

Constraints

Room height

In addition to the PlaneReferences it's possible to display the height between the absolute bottom and top elevation of the planes inside the property palette. This can be done by the <Constraint> tag.

<Parameter>
    <Name>RoomHeight</Name>
    <Text>Room height</Text>
    <Value>-1</Value><!--(1)!-->
    <ValueType>Length</ValueType>
    <Constraint>RoomPlaneReferences</Constraint><!--(2)!-->
</Parameter>

<Parameter>
    <Name>RoomPlaneReferences</Name>
    <Text>Relative height</Text>
    <Value></Value>
    <ValueType>PlaneReferences</ValueType>
    <ValueDialog>PlaneReferences</ValueDialog>
    <Constraint>RoomHeight</Constraint><!--(3)!-->
</Parameter>
  1. By defining the height parameter as -1, the value is initialized by calculating the difference between the absolute bottom and top elevation of the used planes.
  2. A change in the height value updates the absolute top elevation of the top plane defined in the parameter RoomPlaneReferences.
  3. A change of the planes updates the height value in the parameter RoomHeight.

Example

For a complete usage of Constraint, see the example found in:

  • …\etc\Examples\PythonParts\ArchitectureExamples\Objects\ RoomInput.pyp
  • …\etc\PythonPartsExampleScripts\ArchitectureExamples\Objects\ RoomInput.py

File

With OpenFileDialog and SaveFileDialog the user is being provided a dialog for respectively opening or saving a file. After closing the dialog, the complete file path is being assigned to the parameter value, and the file name is being displayed on the button.

File button

<Parameter>
<Name>FavoriteFile</Name>
    <Text>Open favorite file</Text>
    <Value><!--(5)!--></Value>
    <ValueType>String</ValueType>
    <ValueDialog>OpenFileDialog</ValueDialog> <!--(4)!-->
    <FileFilter>pyv-files(*.pyv)|*.pyv|</FileFilter> <!--(1)!-->
    <FileExtension>pyv</FileExtension> <!--(2)!-->
    <DefaultDirectories>etc|std|usr|prj</DefaultDirectories> <!--(3)!-->
</Parameter>
  1. The format of the filter must look like this:

    _text displayed_|_filter as regex_|_another text_|_another filter_|

  2. The default file extension is set here.

  3. Optional Add this tag if the button opening default directories is to be added on the left side of the file dialog. The following directories can be displayed.

    Shortcut Directory
    etc Standard directory
    std Office
    usr Private
    prj Current project
  4. See table below to learn about possible key words for this tag.

  5. The default path and filename can be set here. By using one of the following shortcuts, path can point to Allplan standard folders.

    shortcut directory
    etc standard directory
    std office standard directory
    usr user's private directory
    prj current project directory
<ValueDialog> <DefaultDirectories> Description
OpenFileDialog Display a file open dialog
SaveFileDialog Display a file save dialog
OpenFavoriteFileDialog Display a favorite file open dialog
SaveFavoriteFileDialog Display a favorite file save dialog
Dialog

File dialog