Conduits very slow

Hi, im porting some of my commands from R5 to R6 but the interface crawls when enabling the conduit was used, and then stays slow even after exiting and disposing.

this command uses drawforeground and predraw, runs snappy in R5. First time in clip is r6, next is r5

I’ll need some details on what you are attempting to draw in your conduit to help. We should be able to make the display for conduits faster than V5 instead of dramatically slower

Ill send you my code? Need the whole project (its biggish) or just the bits relevant to this command?

The smaller the better. Let’s start with just the bits relevant to your command.
Thanks

this is the class. I run GetPoint and pass the points to the list for the dynamic line.
I single out the target mesh, and load it as the “dynamicmesh”.

this works fine in R5 as is, but in r6 once i run it, the whole r6 interface drags, even after closing the command.

class PointsConduit : DisplayConduit
    {
        public static List<Point3d> PointList = new List<Point3d>();
        public static Mesh DynamicMesh = new Mesh();
        public static DisplayMaterial m_material = new DisplayMaterial();

        protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e)
        {
            if (null != DynamicMesh)
            {
                BoundingBox bbox = DynamicMesh.GetBoundingBox(false);
                e.IncludeBoundingBox(bbox);
            }
        }
        protected override void DrawForeground(DrawEventArgs e)
        {
            Curve Curvey = Curve.CreateInterpolatedCurve(PointList, 3);
            e.Display.DrawCurve(Curvey, Color.Red,2);
        }

        protected override void PreDrawObjects(DrawEventArgs e)
        {
            base.PreDrawObjects(e);
            var vp = e.Display.Viewport;
            e.Display.DrawMeshShaded(DynamicMesh, m_material);         
        }
    }

I would place a breakpoint in your conduit functions to see if there are getting hit after your command completes. It sounds like code is getting called that shouldn’t be called after the command finishes.

If that doesn’t help pin down the problem, I’ll probably need to see more code as what you sent doesn’t really have any issues that jump out at me.

Hi Steve.

This was my first thought too. I added code to dispose of the mesh and pointlist on command exit in both success or fail scenarios. Set a breakpoint in the mesh display conduit but it doesnt trigger after command exits.

However.

In rhino5 if I rerun the command it starts “fresh”.

In rhino6 when my command runs a second time and asks for the target mesh, the last mesh I used displays in the conduit, even after disposing it. Like its somehow stuck in there. Once I select a new mesh it does change to the new one though.

In my watch window the mesh is Null when the command calls the second time, but for sure shows up in the conduit. Is there a conduit dispose method I shoyld be following for rhino 6 that will force flush any geometry in it?

I will seperate this code out as a seperate command and post up full code later today.