[Microstation V8i MDL C++ API] Creating complex shape causing my subchildren to connect even though the element is closed.

Hello!

I´m trying to create a complex element consisting of multiple subelements :

  1. Line
  2. Complex chain consisting of N segments
  3. Line
  4. Complex chain consisting of N segments

For that I´m using C++ MDL API.  First I create complex header via mdlComplexChain_createHeader. Then I create my subelements. Lines are created within single mdlLine call, while Complex chains are in loops with multiple mdlLine calls and then appending them to the mother header(The complex chain). After I create them, i append them to the owner with mdlElmdscr_appendDscr() . However, even though my creation is closed element (all lines are connected), microstation keeps adding a line between my two single lines, like the shape wasnt closed or something. Im also attaching a picture describing my problem. The same behavior happens even if i dont add the complex chains...

Thanks for any tips.

Lubo

Parents
  • First I create complex header via mdlComplexChain_createHeader. Then I create my subelements. Lines are created within single mdlLine call, while Complex chains are in loops with multiple mdlLine calls and then appending them to the mother header(The complex chain). After I create them, i append them to the owner with mdlElmdscr_appendDscr()

    It's faster to post a code sample than to describe it.  Also, a code sample removes any ambiguity in our interpretation of what you're doing.

    MicroStation keeps adding a line between my two single lines

    The direction of lines is important.  In the closed shape you are creating, all components must be clockwise or counter-clockwise.

    I use MSVC

    Here's a table of Visual Studio and MicroStation SDK versions.

     
    Regards, Jon Summers
    LA Solutions

  • I tried to play around also with the directions of my lines, sometimes the "connection line"(the problematic one) changes direction too ( changes the vertices that its connecting), but I never got to get rid of it. I also tried to specify in mdlComplexChain_createHeader that I wanted to create complex chain instead of complex shape(in hope of this line disappearing), but didnt work as well. The problem is also that I cant access this problematic line from code, so cant hide it manually after creating my element. 

  • I tried to play around

    As Jon wrote: Post your code.

    To explain by words what your code does, does not provide any usable details and the problem cannot be analyzed.

    It's like to discuss a problem with playing on piano describing what finger to when put on what key, but to do not share music notation. I think you agree it would be time wasting useless discussion.

    Regards,

      Jan

  • It's like to discuss a problem with playing on piano describing what finger to when put on what key

    Good analogy!

     
    Regards, Jon Summers
    LA Solutions

  • MSElement elem;
    MSElementDescr *pDescr = NULL;
     
    mdlComplexChain_createHeader(&elem, true, 0); // Header for mother element
     
    mdlElmdscr_new(pDescr,NULL,&elem);
     
    /*
    CALCULATE POINT POSITIONS FOR LINES
    */
     
    //Create 1st line - same process goes for line 3 - the short lines
    MSElement line1;
    DPoint3D line1Data; //Calculated point
    MSElementDescr* line1 descr;
    line1_descr = mdlLine_create(&line1, NULL, &line1Data);
    
    mdlElmdscr_appendDscr(pDescr,line1_descr); //Add the created line to my header
    
    //Process for creating the complex chain is :
    MSElement chain1;
    mdlComplexChain_createHeader(&chain1, false, 0);
    
    MSElementDescr * chain1_descr = NULL;
    mdlElmdscr_new(chain1_descr,NULL,&chain1); //create descriptor for first chain
    
    
    //Now create the 2 lines that will be consisted in my complex chain.
    For each line, I use mdlLine_create with given points and also append it to my chain1_descr
    
    //After all the things are completed append created chain to my element:
    mdlElmdscr_appendDscr(pDescr,chain1_descr); //Add the created line to my header

    As the code is pretty robust and due to some privacy issues I cant share it entirely with you guys, I managed to do some "pseudo" idea of how I approached the problem. I know its not much but I hope that it will at least help to explain my approach.

  • I use mdlLine_create with given points

    And what are those points?  Are they supplied externally or from existing DGN elements?  As I wrote already, the direction of elements is important to your question MicroStation keeps adding a line between my two single lines.

    I suggest that, as a development exercise to enhance our understanding of your task, you create DGN elements separately rather than as a complex chain.  Then you can use MicroStation tools to examine those elements and attempt to create a complex chain.

     
    Regards, Jon Summers
    LA Solutions

  • I´ve tried to do that even manually from UI. I created complex chains, then added my lines. Then I used Create complex shape tool, but it didnt let me create complex shape containing other complex element, but it allowed me to select lines one by one, so basically it created complex shape created from lines, not chains+lines.

  • I used Create complex shape tool, but it didnt let me create complex shape containing other complex element

    It worked for me, using MicroStation CONNECT Update 14.2.  Or, more accurately, the tool lets me create a complex shape from a complex string and some lines: the complex string is taken apart and its components are used in the new complex shape.

    Please post a DGN model that includes the lines and line-strings you want to assemble.

    Don't tell us that your data is confidential and can't be posted: prepare an example without confidential information.

     
    Regards, Jon Summers
    LA Solutions

Reply
  • I used Create complex shape tool, but it didnt let me create complex shape containing other complex element

    It worked for me, using MicroStation CONNECT Update 14.2.  Or, more accurately, the tool lets me create a complex shape from a complex string and some lines: the complex string is taken apart and its components are used in the new complex shape.

    Please post a DGN model that includes the lines and line-strings you want to assemble.

    Don't tell us that your data is confidential and can't be posted: prepare an example without confidential information.

     
    Regards, Jon Summers
    LA Solutions

Children
No Data