[CONNECT C++] mdlClip_isElemInside() now observes view attributes

Hi folks,

While porting some V8i code, I noticed I get inconsistent results with clipping. In V8i when I call mdlClip_isElemInside(), it will give me consistent results regardless of the element class and view attributes. The element is either in, outside or overlapping the clip region (NB: to a point. There were some horrible bugs in SS3 that seem to still cause issues, but only in corner-cases and this particular thread isn't related to this problem).

In any case, In Connect Edition (Update 13), if I check an element that is construction class, and I have construction class turned OFF in the supplied view, it seems the element can never be in the clip, regardless of where it is in the model. Turning ON construction class in the view makes the clipping code behave as expected, and consistent with V8i.

So I want to know, is this a bug in Connect? Or is the change to the clipping functionality intentional? If this change is intentional, how are we meant to programmatically determine if an element is in or out of the clip? I don't want to rely on the user having the view attributes set up to some arbitrary settings, nor do I want to fiddle with the user's active view settings. Additionally, in a batch operation when scanning thousands of elements, I don't want to force view updates, that then have to be undone. All I want to know is whether an element is spatially inside or outside my clipping region, I don't care about the view settings (beyond the rotation matrix). Is there a lower level function we could be using to achieve the functionality we had in V8i and earlier?

Also, if this new functionality is working as intended, can the documentation be updated to reflect this "gotcha"?

Cheers.

[Edit at 15:52 31st Jan]

Some more testing reveals that there are a couple of extra problems:

1) Empty Text Nodes also have this problem. Disabling the display of Text Nodes in the view will also cause empty Text Nodes to always fall outside of the clipping area.

2) With construction lines, it is even more complex. Primitive elements with construction class behave normally regardless of class and view attributes. However, a cell (type 2 orphan or named cell) with construction class for all components will not be inside the clipping region if Construction lines are disabled in the view; however; if any one of the cell components is set to Primary class, then it will behave normally. 

This is a nightmare and feels like a bug more than intended functionality.

Parents Reply Children
  • Hi  (and Jon),

    I cannot comment on the inconsistencies mentioned at this time.  However, if you are willing to provide a small reproducible Test Case (minimal data and targeted compilable project code) I/we can investigate the issue(s) further.

    Although currently I do not see a C++ clip example (just a managed) in the SDK, the mdlClip_xxx() C API calls the public FenceParams C++ API to do the work needed.

    For the C++ API to perform a ClipInside processing you would use SetViewParams(), SetClip(), SetLocateInteriors(), SetClipMode (options), SetOverlapMode() then create an EditElementHandle iterator for your preferred SetModelRef() accepting all elements via your Fence Process - AcceptElement() method.

    Here are a few lines from the managed SDK example: ..\Elements\ManagedFenceExample\ModifyFenceContentsTool.cs+110; that may also help.

    Elements\ManagedFenceExample\ModifyFenceContentsTool.cs:110:    FenceParameters fenceParams = new FenceParameters(modelRef, DTransform3d.Identity);
    Elements\ManagedFenceExample\ModifyFenceContentsTool.cs:111:    FenceManager.InitFromActiveFence(fenceParams, modifyOptions.m_overlap, modifyOptions.m_doClip, modifyOptions.m_fenceClipMode);
    Elements\ManagedFenceExample\ModifyFenceContentsTool.cs:117:    FenceManager.BuildAgenda(fenceParams, eAgenda, modelRefList, false, false, false);
    Elements\ManagedFenceExample\ModifyFenceContentsTool.cs:139:            FenceManager.StretchElement(fenceParams, element, transform, FenceStretchFlags.None);
    Elements\ManagedFenceExample\ModifyFenceContentsTool.cs:153:            FenceManager.ClipElement(fenceParams, insideElems, outsideElems, element, FenceClipFlags.None);

    HTH,
    Bob