[CE U16.2 C#] Bridge between Bentley.Geometry.SolidPrimitive and Bentley.DgnPlatformNET.SolidKernelEntity to use Bentley.DgnPlatformNET.Modify Boolean operations?

I have a DgnPrimitiveTool derivative that generates solids into a DGN from data in a database as an interpretation of the data.

This tool can generate individual Solid elements using the SolidPrimitive.CreateDgnBox(DgnBoxDetail) function with no problem, but it also need to merge these generated solids where they are next to each other or where they are overlapping before adding the result to the model.

The Modify.BooleanUnion method will do the merge, but it only operates on SolidKernelEntities and not on SolidPrimitives.

So currently my workflow is:

  1. Generate primitive using: SolidPrimitive.CreateDgnBox(detail)
  2. Convert primitive to element using: DraftingElementSchema.ToElement(model, primitive, null)
  3. Convert element to SolidKernelEntity using: Convert1.ElementToBody(out var entityOut, element, true, false, false)
  4. Merge Solids using: Modify.BooleanUnion(ref target, ref entities, entities.Length)
  5. Convert back to element using: Convert1.BodyToElement(out var newElement, target, null, model)

Does anyone know of a bridge to convert a SolidPrimitive to a SolidKernelEntity so that all these conversions can be skipped?

Surely one should be able to just merge SolidPrimitives using Boolean operations, just like one does with CurvePrimitives and CurveVectors using CurveVector.AreaUnion on a CurveVector of type: CurveVector.BoundaryType.UnionRegion?

It feels very inefficient to convert the same thing 4 times to get to an answer, where it could have been:

  1. Generate SolidPrimitives
  2. Merge SolidPrimitives
  3. Convert to element using DraftingElementSchema

Any suggestions on simplifying this workflow will be welcome.


Francois Grobler