Hi everybody,
I use the function mdlClip_element with a non persistant element for the inputEdP and the function crashes.In the follwing code, DynAccroElmDscrP is non persistant.
if (mdlClip_getFence(clipP) == SUCCESS) { // DynAccroElmDscrP is a correct linestring element // the following line crashes mdlClip_element(InsideElmDynDscrPP, OutElmDynDscrPP,DynAccroElmDscrP, ACTIVEMODEL, clipP.get(), vue); }
With the following code, everythink is ok
if (mdlClip_getFence(clipP) == SUCCESS) { mdlElmdscr_addByModelRef(DynAccroElmDscrP, ACTIVEMODEL); mdlClip_element(InsideElmDynDscrPP, OutElmDynDscrPP, DynAccroElmDscrP, ACTIVEMODEL, clipP.get(), vue); }
But the problem is that I don't want to add this ElementDescr immediatly.
Thank's for your help!
Regards,
Hervé
Herve,
Did you ever come up with a solution to this problem. I am having the same problem.
Christine Joy said:I am having the same problem
In which version of MicroStation?
Herve Cuzon said:DgnPlatform::EditElementHandle ehh(DynAccroElmDscrP, false,true);
DgnPlatform::EditElementHandle ehh(DynAccroElmDscrP, false,true);
I find the bools in the ElementHandle constructor hard to remember, and prefer to document them like this...
bool
ElementHandle
const bool Owner = true; const bool IsUnmodified = true; DgnPlatform::EditElementHandle ehh(DynAccroElmDscrP, !Owner, IsUnmodified);
Herve Cuzon said:ehh.GetElementDescrP()
ehh.GetElementDescrP()
A comment in the MicroStationAPI tells us: This call should only be used where necessary, and should be avoided in readonly. Use PeekElementDescrCP to see whether this ElementHandle already has an MSElementDescr.
mdlClip_element(InsideElmDynDscrPP, OutElmDynDscrPP, ehh.PeekElementDescrCP(), ACTIVEMODEL, clipP.get(), view);
Without seeing your code it's hard to comment further.
Regards, Jon Summers LA Solutions
MicroStation V10.14.0.109 This is legacy v8i code that we are just trying to get to work in V10. mdlClip_isElemInside works perfectly when the element is a persistent element. It only crashes on elements that have not yet been added to the design file. I will try using EditElementHandle, but I thought Herve said that crashed too.
Christine Joy said:mdlClip_isElemInside works perfectly when the element is a persistent element. It only crashes on elements that have not yet been added to the design file
As Brien Bastings commented, a persistent element has a DGN model associated with it. A newly-created element in memory does not have a DGN model assigned.
One reason for suggesting use of an ElementHandle is that the DGN model can be specified in its constructor, or assigned later. An ElementHandle with a DGN model reference should behave in the same way as one obtained from a persistent element.
If you're using a raw MSElementDescr then you can assign a DGN model reference to its dgnModelRef member...
MSElementDescr
dgnModelRef
MSElementDescrP inputElement = ... inputElement->h.dgnModelRef = ACTIVEMODEL;
Please post your code for further analysis.
Answer Verified By: Robert Hook
Thank you Jon!
inputElement->h.dgnModelRef = ACTIVEMODEL; Fixed my problem