Hi all,
I want to create some cells "On the fly" and set the Annotation Scale.
I've tried to follow the guidelines in this thread:
https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/83654/v8i-c-on-the-fly-cell-creation-and-annotation-scale/234571
Based on this I've now got these lines:
mdlCell_setIsAnnotation(pedCellElm, TRUE); TransformInfo addAnnotationScale; addAnnotationScale.SetOptions(TRANSFORM_OPTIONS_AllowSizeChange | TRANSFORM_OPTIONS_ApplyAnnotationScale); addAnnotationScale.SetAnnotationScaleAction(ANNOTATIONSCALE_ADD); addAnnotationScale.SetAnnotationScale(mdlModelRef_getEffectiveAnnotationScale(mdlModelRef_getActive())); EditElemHandle eeh(pedCellElm, true, false); eeh.GetHandler().ApplyTransform(eeh, addAnnotationScale);
My problem is that MicroStation crashes in the last line (ApplyTransform)
What am I doing wrong ?
Regards, Evan
EvanH said:My problem is that MicroStation crashes in the last line
Try this instead, so you can test whether MicroStation obtained a valid handler...
DisplayHandlerP handler = eeh.GetDisplayHandler (); if (handler) handler->ApplyTransform (...);
Regards, Jon Summers LA Solutions
Hi Jon,
Thank you very much for your swift reply. Unfortunately the result is still the same...
Just a guess...
Is pedCellElm->h.dgnModelRef NULL? If so, try assigning pedCellElm->h.dgnModelRef = mdlModelRef_getActive() before the call to create the EditElemHandle.
* The old mdl create functions typically don't set the modelRef and the newer C++ api no longer treats NULL as ACTIVEMODEL. Things are better in MicroStation Connect, the MSElementDescr element handle constructor allows an optional modelRef to be supplied for when the descriptor doesn't specify it, and there is less reason to get an MSElementDescr to begin with and mix mdl functions with the C++ methods as the published C++ api has more coverage...so this is just something to be cognizant of when working with V8i.
HTH
-B
Answer Verified By: EvanH
Hi Brien,
It works just fine now. Thank you very much for hour help...