HI Team ,
I'm currently porting my application from V82004 to V8i SS3. My app displays additonal lines (arrows) to each linear element on every view manipulation (update, move, zoom in/out, etc.). Everything works fine on V82004, when porting to V8i it crashs, so I modyfied my code as below. I don't know how to get every elem descriptor in processed view. I want to have these descriptors to add arrows on each element contained in view. Can anybody help me?
Thanks in advance for any help, Greg
Hi "Greg the Wizard",
Greg Czarodziej said:Everything works fine on V82004, when porting to V8i it crashs, so I modyfied my code as below.
I think there is an error in your MdlFunctionP user function prototype: The last parameter should be MSDisplayDescr*, not MSDisplayDescr* [].
MSDisplayDescr*
MSDisplayDescr* []
Greg Czarodziej said:I don't know how to get every elem descriptor in processed view.
Well, the problem is that you freely changed your code (based on what assumption?) in the wrong way:
mdlView_setFunction (UPDATE_EACH_ELEMENT, kierViewMonitor);
mdlView_setFunction (UPDATE_POST, lineViewMonitor);
Do you expect when you register for another type of event, the code will work in the same way?
Greg Czarodziej said:Can anybody help me?
I think the answer is in this discussion (I found it simply searching the forum for "mdlView_setFunction" phrase).
BDNzine article is mentioned, but because it is ancient (not existing anymore) magazine about very very very old products, it's not available. But articles were fortunately transformed into wiki articles, and the mentioned is here. A reason why it is about V8 XM Edition is that this ancestor of V8i was the first version based on DirectX, where plenty of view-related functions changed.
For more details, see Hooking the view update for elements paragraph.
General problem with any help is that V8i is obsolete and not supported anymore. And in CONNECT Edition, with rewritten API, the same functionality is available through strongly typed classes in more structured and friendly way.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Thanks everyone for Your answers, I think the problem in my code is UPDATE_EACH_ELEMENT, that is unsupported in V8iSS3, the new replacement is mdlView_setSubstituteElemFunc, as Robert mentioned, I can't see development of this, so can You give any sample how to use this function with callback, shortly applying my problem.
mdlView_setSubstituteElemFunc
Greg Czarodziej said:I can't see development of this
Did you read the wiki article I linked? There is code snippet including more details.
Also, when it is clear that the replacement is mdlView_setSubstituteElemFunc, did you try to search this forum for similar discussions? I receive 22 results, so I guess plenty of useful information can be found in the past discussions.
Thanks Jan, there are really many useful informations on closed discussions , now I'm trying to modify my code, I hope successfully.
I can't compile snippet with mdlView_setSubstituteElemFunc function
SubstituteElemStatus kierViewMonitor ( MSElementDescrH ppNewEd, int* priorityP, IViewportP viewPortP, DrawPurpose drawPurpose, IViewContextP context, bool allowDefer, ElemHandleCP elemIterP ) { MSElementCP pEl = elemIterP->GetElementCP(); int etype = mdlElement_getType (pEl); printf ("type=%i\n", etype ); return SUBSTELEM_STATUS_Normal; }
got errors:
error C2027: use of undefined type 'ElemHandle' c:\PROGRA~2\Bentley\MICROS~1\MICROS~1\\mdl\include\mstypes.h(460) : see declaration of 'ElemHandle'error C2227: left of '->GetElementCP' must point to class/struct/union
I want to get input elems on processed view, any ideas how to fix?
Greg Czarodziej said:got errors:
It's hard to guess what is wrong without access to complete project, but to solve standard errors (especially when identified by unique id) is daily workload of C++ programmers ;-)
The problem cannot be discussed when you do not share any information what header files are included. Also to know whether you try to check where ElemHandle declaration is located.
My guess is that you do not include header file where ElemtHandleCP is declared. In CE API, standard variants of types (R, CR, P, CP and Ptr) are generated automatically in DgnPlatform.h, whereas ElementHandle itself is declared in ElementHandle.h. Probably in V8i files are different, but concept maybe the same: one common header, generating type's variants, and something like ElemHandle.h with base declaration.
Another problem can be that you do not use namespaces correctly, so although headers are included correctly, types itself are hidden in own namespaces. But I do not remember how they were defined and used in V8i API.
Thanks Jan, that's the point, I've lost header files in my project, missed MicroStationAPI subdir, when linked in, averything seems to work fine, thanks for Your attention & helping to resolve my problem.
Regards, Greg