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.

  • Transient Elements for Temporary Display

    sathish:
    I want display the line for temporary use.

    Use transient elements. Create an element descriptor in the usual way, then add it to the global transient descriptor, or to your own transient descriptor list. Delete the transient descriptor when done. See the mdlTransient_xxx API.

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • Hi,

    I know that mdlElement_display are deprecated in Microstation XM Edition. you suggest to use mdlTransient_xxx function to highlighting the element

    Code snippet :
    ==============

    int draw_line( DPoint3d pnt[])
    {
    TransDescrP msTransientElmP;
    DgnModelRefP pModelRef;
    int status;
    UInt32 filepos;

    if(mdlLine_create(&line_elm,NULL,pnt)!= SUCCESS)
    {
    print_error(MS_CREATE_ERROR, "", TRUE);
    return FALSE;
    }

    msTransientElmP = mdlTransient_addElement ((msTransientElmP == NULL ? NULL : msTransientElmP), &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1);
    mdlElement_display (&line_elm,NORMALDRAW);
    mdlView_updateSingle(tcb->lstvw);
    mdlTransient_free (&msTransientElmP, FALSE);
    return TRUE;
    }

    But still not highlighting line element.   If in this code any incosistency rewrite the code give it me. 

     Thanks & Regards,

    V. Sathish. 

     

     

  • Display of Local Variable

    sathish:
    
    int draw_line( DPoint3d pnt[])
    {
    TransDescrP msTransientElmP; // local variable
    ... create line
    msTransientElmP = mdlTransient_addElement ((msTransientElmP == NULL ? NULL : msTransientElmP), &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1); 
    //mdlElement_display (&line_elm,NORMALDRAW); // not required
    //mdlView_updateSingle(tcb->lstvw); // not required
    // Free local variable
    mdlTransient_free (&msTransientElmP, FALSE); 
    
    
    But still not highlighting line element.

    You've created a line element, added it to a transient descriptor, then destroyed that descriptor. Assuming you have a 1GHz processor, and each line takes, say, 100 CPU cycles to execute, your line was displayed for about 400ns. Unfortunately the response time of the human eye is a lot slower than that.

    You need to make the transient descriptor hang around for a good while for it to be displayed. One way is to make your msTransientElmP a global variable: create it in this function, then free it some time later.

    msTransientElmP MDL Global

    Your naming convention is confusing. A general purpose transient descriptor is defined by the MDL built-in global variable, msTransientElmP. Your local variable has the same name, which is a Bad Idea. Try this:

    
    int draw_line( DPoint3d pnt[])
    {
    //  Assign MDL global variable
    msTransientElmP = mdlTransient_addElement (msTransientElmP, &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1); 
    }
    
    

    Regards, Jon Summers
    LA Solutions

     
    Regards, Jon Summers
    LA Solutions

  • 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. 

Reply Children
No Data