As a MicroStation user, you're probably familiar with the Drop Element tool. It's used to break up one or more elements into simpler components. Tool settings are used to specify the element types on which the tool operates.
As a MicroStation programmer, you may want to replicate part of that tool for your own purposes.
The route to dropping is via a graphic element's
display handler.
DisplayHandler provides method Drop(),
which takes a complex element and copies its components to a list of elements in an
ElementAgenda
You decide what to do with the original complex element and the list in that ElementAgenda.
To emulate MicroStation's tool, you would add each element in the ElementAgenda to the active mode,
then delete the original.
Here's an example written by Bentley Systems Python advocate Leonard Jones.
That example shows how to write your Drop code …
DropOptions
DisplayHandler.Drop(), passing your options
# Get an ElementHandle from somewhere, and get its DisplayHandler disp_handler = eh.DisplayHandler # Create an empty ElementAgenda instance elm_agenda = ElementAgenda () # Create an empty DropGeometry instance drop_options = DropGeometry() # Specify the DropOptions you want drop_options.SetOptions (DropGeometry.eOPTION_Complex) # Call DisplayHandler.Drop status = disp_handler.Drop (eh, elm_agenda, drop_options)
The ElementAgenda is a list of the component elements.
You probably noticed the statement
drop_options.SetOptions (DropGeometry.eOPTION_Complex)
uses the DropGeometry enumeration.
It's there — but you won't find it in the Python documentation.
It is described in the C++ MicroStationAPI help, but that didn't make it into the Python documentation.
Here it is …
| Enumerator | Description |
|---|---|
| DropGeometry.eOPTION_None | No type/geometry specific drop options |
| DropGeometry.eOPTION_Text | To drop text to geometry |
| DropGeometry.eOPTION_Dimensions | To drop dimensions. (DIMENSION_Geometry) |
| DropGeometry.eOPTION_Mlines | To drop multi-lines to geometry |
| DropGeometry.eOPTION_Complex | To drop complex elements. (ex. normal cells, complex shapes, complex chains, grouped holes, text nodes) |
| DropGeometry.eOPTION_LinearSegments | To drop shapes/linestrings to individual segments |
| DropGeometry.eOPTION_SharedCells | To drop shared cells. (SHAREDCELL_NormalCell) |
| DropGeometry.eOPTION_Solids | To drop solids/surfaces. (SOLID_Wireframe) |
| DropGeometry.eOPTION_AppData | To drop application elements to geometry. |
Post questions about MicroStation Python programming to the MicroStation Programming Forum.