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.
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
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.
} Help me
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.
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.
V. Sathish.
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.
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);
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.
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); }
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); }
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.
sathish: Dear Jon, Still line element not highlighting. ... msTransientElmP = mdlTransient_addElement (msTransientElmP, &line_elm, 0, 0x00ff, DRAW_MODE_Normal, 1, 1, 1);
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]
Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx
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.
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.
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.