[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.

Thanks

Francois Grobler

Parents
  • I found what I was looking for.

    Again by looking at C++ the API Documentation, I could find the equivalent NET classes.

    The missing "bridge" is the Create class which takes a SolidPrimitive and returns a SolidKernelEntity.

    So using the Bentley.DgnPlatformNET.Create class one of the conversion steps can be removed.

    The workflow is then:

    1. Generate primitive using: Bentley.GeometryNET.SolidPrimitive.CreateDgnBox(detail);
    2. Create SolidKernelEntity using: Bentley.DgnlatformNET.Create.BodyFromSolidPrimitive(out var entityOut, primitiveIn, model);
    3. Merge solids using: Bentley.DgnPlatformNET.Midify.BooleanUnion(ref targetSolid, ref tools, tools.Length);
    4. Create Element using: Bentley.DgnPlatformNET.Convert1.BodyToElement(out var newElement, targetSolid, null, model);

    This creates a cleaner flow without having to convert to and from elements.

    Hope it helps someone else.

    Cheers,
    Francois Grobler

    Answer Verified By: Francois Grobler 

Reply
  • I found what I was looking for.

    Again by looking at C++ the API Documentation, I could find the equivalent NET classes.

    The missing "bridge" is the Create class which takes a SolidPrimitive and returns a SolidKernelEntity.

    So using the Bentley.DgnPlatformNET.Create class one of the conversion steps can be removed.

    The workflow is then:

    1. Generate primitive using: Bentley.GeometryNET.SolidPrimitive.CreateDgnBox(detail);
    2. Create SolidKernelEntity using: Bentley.DgnlatformNET.Create.BodyFromSolidPrimitive(out var entityOut, primitiveIn, model);
    3. Merge solids using: Bentley.DgnPlatformNET.Midify.BooleanUnion(ref targetSolid, ref tools, tools.Length);
    4. Create Element using: Bentley.DgnPlatformNET.Convert1.BodyToElement(out var newElement, targetSolid, null, model);

    This creates a cleaner flow without having to convert to and from elements.

    Hope it helps someone else.

    Cheers,
    Francois Grobler

    Answer Verified By: Francois Grobler 

Children