mdlElement_display

Hi,

I have problem when using mdlElement_display(). I have attached code snippet on this mail. I am trying to display line element in the dgn but  not displaying. The following code works in Microstation V7 very well but  not working in Microstation V8 XM Edition.I don't know problem where occurs will you please help me.

Code Snippet :

int draw_line(DPoint3d pnt[])

{

if(mdlLine_create(&line_elm,NULL,pnt)!= SUCCESS)

{ print_error(MS_CREATE_ERROR, "", TRUE); return FALSE; }

mdlElement_display(&line_elm, NORMALDRAW);

return TRUE;

 }

Thanks & Regards,

V.Sathish.

Parents
  • Changes to MicroStation Graphics

    sathish:
    I have problem when using mdlElement_display().

    From MicroStation XM the graphic subsytem changed. We MDL programmers no longer need to call mdlElement_display() (it's a no-op). The new graphic system takes care of element display automatically. However, it should not be a problem to leave it in your code for compatibility when compiling with an earlier version of V8.

    What leads you to suspect that mdlElement_display() is a problem?

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  •   I am not facing any problem in mdlElement_display.  But In V7 this code displays the line  wheb mouse button clicking.   Not shows in XM Edition. it shows hidden line. I want display the line for temporary not using mdlElement _add function.

    Code Snippet :

    int draw_line(DPoint3d pnt[])

    {

    if(mdlLine_create(&line_elm,NULL,pnt)!= SUCCESS)

    { print_error(MS_CREATE_ERROR, "", TRUE); return FALSE; }

    mdlElement_display(&line_elm, NORMALDRAW);

    return TRUE;

    }
    Help me

     

    Thanks  & Regards,

    V.Sathish.

  • Dear Jon,

       Still line element  not highlighting. I am  not declared msTransientElmP  as global variable you suggested code has implemented.  Actual problem is when i picking a  first point  and second point,  it not drawn any line between the points.

     int draw_line( DPoint3d pnt[])
    {
    ElementRef elemRef;
    int status;
    UInt32 filepos;

    if(mdlLine_create(&line_elm,NULL,pnt)!= SUCCESS)
    {
    print_error(MS_CREATE_ERROR, "", TRUE);
    return FALSE;
    }
    msTransientElmP = mdlTransient_addElement (msTransientElmP, &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1);
    return TRUE;
    }

    Help me

    Thanks & regards,

    V.Sathish

     

  • sathish:
    Still line element not highlighting.

    If you explicitly add the line to your model, do you see the line?

    
    if(SUCCESS == mdlLine_create (&line_elm, NULL, pnt)) 
    { 
    mdlElement_add (&line_elm);
    }
    
    

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  •  Dear jon,

              mdlElement_add function without using i want to display the line element. Because Our functionality we construct a temporary line finally we call mdlLinestring_create function. So please tell me without using mdlelment_add function.

     

    Thanks & Regards,

    V.Sathish.

     

     

     

     

     

     

     

  • sathish:

    Dear Jon,

       Still line element  not highlighting. 
    ...
    msTransientElmP = mdlTransient_addElement (msTransientElmP, &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1); 

     Why should it highlighting? You are creating transient as normal draw not hilite. 

  • Attached is some sample code that uses the transient element descriptor.

    HTH,

    mark anderson [Bentley]

     

    contour.zip
  • Debugging by e-mail

    sathish:
    mdlElement_add function without using I want to display the line element. We construct a temporary line finally we call mdlLinestring_create function. So please tell me without using mdlelment_add function.

    I know that you want to display the element temporarily. However, you have told us that you can't persuade the transient functions to do what you want. I asked you to use mdlElement_add in order to be certain that you really are creating a line element and that the line appears in the right place.

    None of us can see what you are doing, or how MicroStation behaves with your MDL code. If you want help in diagnosing your problem, then you have to cooperate.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  •  Hi all,

              From still i will not get the solution for displaying element. I have attached zip file on this mail. This mdl project   line displaying  in V7 version  but not  in V8 XM Edition. Please modify this attached code give to me. Without using "mdlElement_add"  function.

          Give me a solution. 

    Thanks & Regards,

    V.Sathish.

     

    DrawLine.zip
  • Try to Implement the Example Code

    It's not clear that you have attempted to implement the transient code provided by Mark.

    
    void Draw_TerminalLine(void)
    { 
    mdlState_startPrimitive (get_Draw_TerminalLine_point, get_Draw_TerminalLine_reset, 0, 0);
    }
    /*-----------------------------------------------------------------------------------------------*/
    static void get_Draw_TerminalLine_point(Dpoint3d *ppt,int view)
    { 
    MSElement el; 
    DPoint3d dpPnt[2]; 
    DgnModelRefP       modelRef ;
    dpPnt[0].x = dpPnt[0].y = 10.0; dpPnt[1].x = dpPnt[1].y = 20.0; 
    dpPnt[0].z = dpPnt[1].z = 0.0;   
    mdlLine_create( &el, NULL, dpPnt );   
    mdlElement_display( &el, NORMALDRAW);     
    exit(0);
    }
    
    

    Your code creates a line element, displays it, then exits. You have (i) not added the line element to the model, and (ii) you have not attempted to create a transient element. There is nothing to display.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Dear Jon,

         I am really sorry say still line element  not displaying after adding mdlTransient_addElement function.  Updated code attached on this mail.

     Thanks & Regards,

    V.Sathish

     

     

    DrawLine.zip
  • sathish:
    I am really sorry say still line element not displaying after adding mdlTransient_addElement function.

     

      • #define MAXLINEPNT 100 is unnecessary
      • The value MAX_VERTICES is already #defined in <msdefs.h>
      • Prefer to use mdlElement_maxLineStringPoints ()
      • get_Draw_TerminalLine_point is called when your user provides a datapoint
      • Dynamics is not called in this function
      • Start dynamics in the function where mdlState_startPrimitive is located
    1. Have you tried using, as already suggested, mdlElement_add to be sure that you create a valid line?

     

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Reply
  • sathish:
    I am really sorry say still line element not displaying after adding mdlTransient_addElement function.

     

      • #define MAXLINEPNT 100 is unnecessary
      • The value MAX_VERTICES is already #defined in <msdefs.h>
      • Prefer to use mdlElement_maxLineStringPoints ()
      • get_Draw_TerminalLine_point is called when your user provides a datapoint
      • Dynamics is not called in this function
      • Start dynamics in the function where mdlState_startPrimitive is located
    1. Have you tried using, as already suggested, mdlElement_add to be sure that you create a valid line?

     

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

Children