help me in mdlElmdscr_close

 i want to know this function mdlElmdscr_close (&pClosed, pOriginal, modelRef)

i cant understand the term &pClosed, pOriginal. please help me with simple example!

  • Closed and Open Topology

    A closed element has an area (2D) and possibly a volume (3D). Examples of closed elements are polygons, ellipses and B-spline surfaces. Examples of open elements are line-strings and arcs.

    An open element may appear closed. For example, a line-string having more than four vertices and coincident start and end points looks like a closed polygon but remains a line-string; an arc having a sweep angle of 360° may look like a circle or ellipse but remains an open element.

    There's an article that shows how to determine whether an element is open or closed.

    mdlElmdscr_close

     const BoolInt Erase = TRUE;
    MSElementDescr* pLine = NULL;
    MSElementDescr* pClosed = NULL;
    ... read line-string into memory
    if (SUCCESS == mdlElmdscr_close (&pClosed, pLine, modelRef))
    {
       mdlElmdscr_add (pClosed);
       // Free memory
       mdlElmdscr_free (pClosed);
       // You may want to delete the line
       mdlElmdscr_undoableDelete (pLine, filePos, Erase);
       mdlElmdscr_free (pLine);
    }

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • can any one give me some suggestion to make a closed shape if the linestrings seems to be in shape but not in the shape.

  • Have you read the MDL help documentation for that function?

    Unknown said:
    linestrings seems to be in shape but not in the shape

    What, exactly, do you mean by that?  As usual, a picture is worth 1,000 words.  Why not post a small DGN model that illustrates 'seems to be in shape but not in the shape'.

     
    Regards, Jon Summers
    LA Solutions

  • here i ve attached a small example.. should i directly use the function mdlElmdscr_closeto make it shape or needs to do other things?

    regards

    cjan

    eg.dgn
  • Hi cjan,

    in this case you should make use of the mdlRegion_floodFill - Function.

    It automatically corrects overlappings and you are allowed to enter a closure tolerance.

    This function is a prgrammatical call to the "Create Region"-Tool of the Microstation. (under Tools/Groups/Create Region).

  • Unknown said:
    Should I directly use the function mdlElmdscr_closeto make it a shape?

    Surely it's quicker to add that function to your code than to post a question here?

     MSElementDescr* pLine = NULL;
    DgnModelRefP modelRef = ...
    ... get line string and modelRef from somewhere
    MSElementDescr* pShape = NULL;
    if (SUCCESS == mdlElmdscr_close2 (&pShape, pLine, modelRef))
    {
       mdlElmdscr_add (pShape);
       mdlElmdscr_display (pShape, NORMALDRAW);
       mdlElmdscr_freeAll (&pShape);
    }

    A possible problem with your line-string is the zero-width portion. You might be able to create a shape, but it would be topologically invalid. That may or may not be an issue.  If it is an issue, then adopt Stefan's suggestion.

     
    Regards, Jon Summers
    LA Solutions

  • the function mdlRegion_floodFill is not in my api file so i ve no idea about it. Can any1 suggest me to use this functions like its attributes and all.

    regards

    cjan

  • MDL Function Reference and header files

    Unknown said:
    The function mdlRegion_floodFill is not in my api file

    Then you have not looked very hard.

    Search for that function in the MDL Function Reference (see screenshot).

    Do you notice Required Header <msregion.fdf> That means you should #include <msregion.fdf> in your source code.

    Have you looked in that header file?

    Unknown said:
    I've no idea about it

    Use text file-search techniques to locate function names in header files. There are a few programmer's text editors that provide file-search tools. Window's findstr can also be helpful.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • i ve used the code as

    if (SUCCESS == mdlElmdscr_close2 (&pShape, pLine, modelRef))
    {
      //  mdlElmdscr_add (pShape);
       // mdlElmdscr_display (pShape, NORMALDRAW);
       mdlElmdscr_freeAll (&pShape);
    }

    but the line where i marked // is showing incompatible in shell. what is the problem? Please help me...

  • Hi cjan,

    your code looks good.

    What do you mean by "is showing incompatible"?

    As I mentioned earlier mdlElmdscr_close2 will not solve your problem.

    This function is only applicable when converting an even correct open element into a closed one.

    But the line string in your example is not topologically correct. It contains doubled points and even a gap.

    You wont get that closed with mdlElmdscr_close2, thus the function will not return SUCCESS for your example and the if-statement will not be computed.

    Best regards,

    Stefan.

    P.S.

    Do you speak spanish, by any chance? (Then you could send me spanish mails to stefan@centauron.de)