CustomMeshObject and EdgeAnalysis

I find that my CustomMeshObject does not show naked edges when I give the _ShowEdges command whereas a “normal” mesh does. Other analysis modes (that I wrote myself) do work.

Also, when I press the “Zoom” button, the edges (and their control points) are visible.

Is this a bug, or do I need to do something special in my CustomMeshObject so that ShowEdges works correctly?

After selecting two meshes and running the ShowEdges command:

After pressing the “Zoom” button

Hi Menno,

When you say ShowEdges does not work with your custom mesh, what does this mean? Does the ShowEdges command allow your mesh to be selected? Or, is it just that your mesh does not have it’s naked edges drawn?

If order for your custom object to work with an analysis mode, it must return true when it’s EnableAnalysisMode member is called. This member is passed a uuid identifying the analysis mode. If you are testing the uuid for edge analysis is {197B765D-CDA3-4411-8A0A-AD8E0891A918}. If you have the C++ SDK, see rhinoSdkAnalysisModes.h for details.

Also, when you poke the Zoom button, the control points on the edges are drawn - the grips are not turned on. This is just a visual effect so when the user pokes the Mark option, they know where the points will be added.

– Dale

Ah, thanks @dale I wasn’t overriding EnableVisualAnalysismode. I’ll try it again on Monday.

@dale: The mesh is selectable, but its naked edges do not get drawn (first picture). But on clicking Zoom, the naked edges and the control points do get drawn (second picture)

Also, I get the correct result on the command line:

Found 16 edges total; 16 naked edges, no non-manifold edges.

The only problem (bug?) seems to be that the edges are not drawn in the viewports.

I’m trying to do this in RhinoCommon. This API does not have a virtual EnableVisualAnalysisMode method. If I create a new implementation of the method using the new keyword, the method does not get called.

@stevebaer: is it correct that RhinoObject.EnableVisualAnalysisMode should be virtual in RhinoCommon? Thanks.

My apologies, I thought CustomMeshObject was your class, not a RhinoCommon class. By inheriting from Rhino.DocObjects.Custom.CustomMeshObject, you should not have to do anything with EnableVisualAnalysisMode, as the base class will return true in this circumstance.

I would assume that if your class MeshGeometry member returned a valid Rhino.Geometry.Mesh object, then edge analysis would work correct. I wrote a minimal Rhino.DocObjects.Custom.CustomMeshObject object, and edge analysis seems to work correctly.

Is is possible to see some code that is not working for you?

Ah, finally solved it. My mistake, I did not call base.OnDraw in the OnDraw override. When I do that, the Edge Analysis works correctly. Also, I don’t have to draw the mesh myself, and this problem has also been solved.

Thanks for your help @dale

Thanks for the update.