Hi Experts,
I have a quesiotn about the api mdlElmdscr_areIdenticalToTolerance , i want to check whether two elements are identical,
6445.forImport.dgn
I try with the below code(option), but always return false for my model. where i have two identical mesh.
my code is as below,
bool isSame = mdlElmdscr_areIdenticalToTolerance(preEle, curEle, COMPAREOPT_IGNORE_UNORDEREDSIBLINGORDER, 0.1, 0.1);
also i try it with another model,
box slab.dgn
In this model, I have two elements, the second one is copied from the first one, and they are in different position, in my case, i will first move those two elements to the origin (0,0,0), so there in the same postion,
then i call the api to check whether thoes two elements are identicaly, but still return false. so what is the expected result for this case, i would expect it return true, since the two elements are the same one in the same position.
I am running with Microstation CE, 10.07.00.39
I have read other posts which was posted several years ago, but did not found any clue for my quesiton.
thanks,
Rick
You're telling MicroStation to compare two elements, ignoring the mesh sibling ord
Rick cheng said:ool isSame = mdlElmdscr_areIdenticalToTolerance(preEle, curEle, COMPAREOPT_IGNORE_UNORDEREDSIBLINGORDER, 0.1, 0.1);
ering. However, each element has a unique Element ID: they are guaranteed to be different in two different elements. Add COMPAREOPT_IGNORE_IDS to your options:
COMPAREOPT_IGNORE_IDS
bool isSame = mdlElmdscr_areIdenticalToTolerance(preEle, curEle, COMPAREOPT_IGNORE_UNORDEREDSIBLINGORDER | COMPAREOPT_IGNORE_IDS, 0.1, 0.1);
Regards, Jon Summers LA Solutions
Answer Verified By: Rick cheng
Hi Jon Jon Summers
this doest work for my first model, did u get this api work? in my case, i assume it will return true, but always return false. i have use the options as you suggested.
Rick cheng said:did u get this api work?
Yes. However, the elements I was comparing did not include the meshes that you are testing.
can u share with me your model where u campare the two elements. just leave two elements that identical. thanks,
I just want to make sure this api works in some scenary. thanks for all u replies.
Rick cheng said:I just want to make sure this api works
I suggest that you create a very simple DGN model. Draw one simple primitive element that is easy to analyse: for example, a rectangle. Now make a copy of that shape element. Run your code using those two shapes as the input.
Does that produce the result you expect? If not, post the DGN file here along with your code. If it does work, create a new model and add a more complex component; make a copy, and run your code again. Wash and repeat.
sure, i will try, and by the way, how to paste the shape element to the same location as the original shape element?
Rick cheng said:how to paste the shape element to the same location as the original shape element?
dx=0
thanks Jon, with the copied ones, the api works, in my case, the offset is not zero, but i transform the two elements to the same position, still return false in my case. might be need to set different option flags.
Hi Rick cheng,
If you can you provide a "test case" (simple, portable clearly showing the exact issue) we can work with that. If a portable test case is not provided too much guess work and assumptions are likely to be made vs. having the Exact minimal source code and data to reproduce a problem and make proper recommendations for. If you provide a simplified test case we can start to review it as soon as possible.
Thank you,Bob
thanks for the reply, now after change the options to standard ignore flags, my case pass the identical check, thanks all for u input.