[CE C#/.NET] Example : Create a Solid Slab

As I search nothing in the Microstation Programming Forum, anyone could paste an example of creating solid slab element by .NET API ?

How are the rectangular solid elements to be united?

Thanks in advance.

  • You could use SolidPrimitive.CreateDgnExtrusion to extrude a rectangle into a slab.
  • Unknown said:
    SolidPrimitive.CreateDgnExtrusion

    Unknown said:
    SolidPrimitive.CreateDgnBox

    Good answers to a different question: those methods from the MicroStationAPI are not echoed in the DgnPlatformNET API, which is what the questioner asked.  I'm looking forward to finding a more complete DgnPlatformNET in a future MicroStation CONNECT.

     
    Regards, Jon Summers
    LA Solutions

  • They may not be in the documentation, but they are most certainly in the DgnPlatformNET API as I am using them in C#.

    Bentley.GeometryNET.SolidPrimitive

  • Unknown said:
    They are most certainly in the DgnPlatformNET API

    I'm pleased to read that.

    My reason for carping about non-documented functions is simple.  For many years, Bentley Systems have had the policy that, unless a function is both published and documented, it's not supported.  In this case, it's not enough for the method to exist in Bentley.GeometryNET.SolidPrimitive — it must also be documented.

    In other words, Bentley.GeometryNET.SolidPrimitive could disappear in MicroStation CONNECT Update 1, and we would have no redress.  That's why it's important, for us third-party developers, to have APIs that are both public and documented.

     
    Regards, Jon Summers
    LA Solutions

  • Not disagreeing with you :-) The documentation seems like it has been neglected since a very early stage in development.

  • Yes, it is a bit strange when ShapeElement, Text & Dimension Element in DgnPlatformNet whereas Solid Element are not included. May I have your comment on creating a 5x6x2(H) box?

    I could not understand why a box requires baseX, baseY etc but no Z are defined. A box which has an X and Y, why it needs a baseX and topX? So that's why I want to see an example to learn how to use those parameters.

            public static void Slab()
            {
                DgnModel oModel = Session.Instance.GetActiveDgnModel();
    
                DPoint3d baseOrigin = new DPoint3d(0, 0, 0);
                DPoint3d topOrigin = new DPoint3d(0, 0, 2);
    
                DVector3d vectorX = new DVector3d(1, 1, 0);
                DVector3d vectorY = new DVector3d(1, 1, 0);
    
                double baseX = 5;
                double baseY = 6;
                double topX = 5;
                double topY = 6;
                DgnBoxDetail odata = new DgnBoxDetail(baseOrigin, topOrigin, vectorX, vectorY, baseX, baseY, topX, topY, true);
                SolidPrimitive sample = SolidPrimitive.CreateDgnBox(odata);
    
                Element oElement = DraftingElementSchema.ToElement(oModel, sample, null);
                oElement.AddToModel();
            }
  • DgnBox does not only create slabs, but also something that resembles a Trapezoidal Prism.
    You need to specify the start point and vector for both the top and bottoms. http://imgur.com/EyyQrnq


    To do a slab in your example, you must first fix your X and Y vectors
    DVector3d vectorX = new DVector3d(1, 0, 0);
    DVector3d vectorY = new DVector3d(0, 1, 0);

    then it should work
  • Unknown said:
    I could not understand why a box requires baseX, baseY etc but no Z are defined. A box which has an X and Y, why it needs a baseX and topX? So that's why I want to see an example to learn how to use those parameters.

    The top/bottom faces of the box primitive aren't required to be the same size (i.e. it's a rectangular frustum). If you're not creating something like a truncated pyramid, then baseX/topX and baseY/topY will be the same value. The height (z) is defined by baseOrigin/topOrigin. So your snippet looks good other than vectorX/vectorY which I think you want to define as follows:

    DVector3d vectorX = new DVector3d(1, 0, 0);
    DVector3d vectorY = new DVector3d(0, 1, 0);

    HTH

    -B



    Answer Verified By: clever_anthony 

  • Okey, so how about the method of slab by extrusion? I saw no shape element content could be defined but only Vector (Z) 

    Also, slab should be in rectangular but it requires CurveVector (more likely to be sweep along path) 

            public static void SlablByExtrusion()
            {
                DgnModel oModel = Session.Instance.GetActiveDgnModel();
                CurveVector baseCurve = new CurveVector(CurveVector.BoundaryType.UnionRegion);
                DVector3d extrusionVector = new DVector3d(0,0,1);
    
                DgnExtrusionDetail data = new DgnExtrusionDetail(baseCurve, extrusionVector, true);
                SolidPrimitive sample = SolidPrimitive.CreateDgnExtrusion(data);
    
                Element oElement = DraftingElementSchema.ToElement(oModel, sample, null);
                oElement.AddToModel();
            }