[CONNECT C++] How to programatically drop a parametric cell from native C++

The Drop Element tool will drop a parametric cell into it's sub-elements if I check the Application Elements option.  Is there a native C++ API that will let me do this from code?

Parents
  • Hi John,

    at first, please follow the best practices and specify what MicroStation version do you use. There have been (I guess) 17 versions of CE released so far, so to say "CONNECT" only is just not enough.

    I see my Drop Element parameters are different (I have extra "Solids" option) in CE Update 14.2 version.

    The Drop Element tool will drop a parametric cell into it's sub-elements if I check the Application Elements option

    I think it does not. Based on testing I did, when only Application Elements option is applied, Parametric solid is converted to SmartSolid, but it's not dropped to sub elements.

    Using Drop Element again, SmartSolid can be converted to wireframe or surfaces.

    Is there a native C++ API that will let me do this from code?

    Did you try to search (at least) this forum? Different aspects of parametric solids geometry and how to drop it has been discussed several times including code snippets (see e.g. this discussion).

    I am quite sure the right way is to use ElementGraphicsProcessor and to process retrieved data in a way that suits the best your needs (e.g. to use DraftingElementSchema to create new elements).

    With regards,

      Jan

  • There's a Drop method on DisplayHandler:

    //! Drop this element to a group of (simpler) primitive elements.
    //! @param[in] eh Element to drop
    //! @param[out] dropGeom Element agenda holding the result of the drop operation.
    //! @param[in] geometry Options to determine how drop should be handled
    //! @return SUCCESS if element was dropped and dropGeom is valid
    //! @bsimethod
    DGNPLATFORM_EXPORT StatusInt Drop (ElementHandleCR eh, ElementAgendaR dropGeom, DropGeometryCR geometry);

    DropGeometry::Options::OPTION_AppData corresponds to the "Application Elements" toggle on the Drop Element tool...

    /*=================================================================================**//**
    * DropGeometry is suplied to DisplayHandler::Drop to allow the handler to produce
    * a simplified representation that isn't necessarily just dumb graphics. * @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
    * @bsiclass
    +===============+===============+===============+===============+===============+======*/
    struct DropGeometry : RefCountedBase
    {
    public:

    enum Options
    {
    OPTION_None = (0), //!< No type/geometry specific drop options.
    OPTION_Text = (1<<0), //!< To drop text to geometry.
    OPTION_Dimensions = (1<<1), //!< To drop dimensions. (DIMENSION_Geometry)
    OPTION_Mlines = (1<<2), //!< To drop multi-lines to geometry.
    OPTION_Complex = (1<<3), //!< To drop complex elements. (ex. normal cells, complex shapes, complex chains, grouped holes, text nodes)
    OPTION_LinearSegments = (1<<4), //!< To drop shapes/linestrings to individual segments.
    OPTION_SharedCells = (1<<5), //!< To drop shared cells. (SHAREDCELL_NormalCell)
    OPTION_Solids = (1<<6), //!< To drop solids/surfaces. (SOLID_Wireframe)
    OPTION_AppData = (1<<7), //!< To drop application elements to geometry.
    };

    HTH

    -B



  • Hey Brien,

    Thanks.  The DisplayHandler Drop is what I ended up using in my code snippet above.

    Do you happen to know if there is an API that will return to me the constraints that are applied to any of my sub elements? 

    Thanks,

    John M.

Reply Children
  • Thanks.  The DisplayHandler Drop is what I ended up using in my code snippet above.

    Oops, completely missed that code snippet. :) I can tell you drop won't be at all helpful for getting constraint information...

    Do you happen to know if there is an API that will return to me the constraints that are applied to any of my sub elements?

    Sorry, I am not familiar with the parametric solid api.

    sub-elements isn't the correct term, a parametric solid doesn't have sub-elements like a type 2 cell does as it's not a "complex" element.

    The constraints I assume you are looking for are between edges, faces, and vertices, which are topological entities of a BRep, These are usually called sub-entities in our api...

    HTH

    -B