Display conduit redraw is not working

I made quite many tools in c# dot net with display conduit and it always work perfect with moving simulation. I have some moving polygons.
Unfortunately this time it is not redrawing viewport. It is showing all previous positions of the polygon objects. The viewport redraw is not working.

Please let me know few alternatives for redrawing viewport while using display conduit for polygons in rhino 6. I want to see only the current positions of the polygons. Do not want the trails.

Hi @tsiddikee,

There isn’t enough detail here for us to make any suggestions. Can you provide sample source code, that we can run, that replicates the problem?

– Dale

1 Like

Dear Dale, it is a big code I wrote for my client under NDA. In smaller examples it is working perfectly. I am not allowed to send out the big code. I am assuming I did some mistake while feeding data into the conduit.

Would you please just tell me, is there any alternative for redrawing viewport, other than writing :

Normally I redraw viewport by saying ;
And it redraw display conduit content.

Hi @tsiddikee,

Put a break point in your conduit drawing code and then trigger a redraw. Is the break point hit?

– Dale

Hi @tsiddikee,

ON_PointCloud::Destroy just purges all of the member data structures (arrays). I would think setting a PointCloud object to null would be about the equivlent.

– dale

1 Like

Yes it is hitting the breakpoint and working perfectly fine. I know now exact problem. I have point cloud, which should change position. The PointCloud is storing all point data from past positions.
When I say PointCloud.dispose() , it wipe out completely.
If I say cloud=new PointCloud(); before adding new position, it wipe out all point cloud again.
I have to find where I am feeding all past positions of the point cloud and stacking them all together. The code has a complex data structure and somewhere I did the mistake, trying to find.

Just debugging now. Hopefully I will find the mistake.
If any idea click in your mind please let me know.
Many Thanks!

Dale, you are correct. After some modification, when I thought the code is correct now, it is not hitting the breakpoint in conduit drawing code, when I am going through
doc.views.Redraw(); with a loop, which is changing point cloud positions.
Any idea why? Please let me know.

Dear Dale, the redraw is not hitting only when display conduit is declared before loop. The loop is for changing positions of point cloud. For each loop point cloud should change position and display conduit should redraw new position every time. But the conduit is drawing all positions of point cloud, past and present. The code has no mistake now.

If I use display conduit at the end outside the loop, it gives final position of the point cloud. That means, now my code is perfectly running and not stacking over past position. Only redraw is not hitting display conduit.

@dale in short I am saying the code is running without any error. Just not hitting the conduit when redraw is within the loop. Why is that? Please let me know. So far I remembered I have used redraw in similar complexity within loop in the past and it did work. If you think it is nothing to do with Rhino , rather I am missing something still please give me a small hint. Many thanks in advance!

Hi @tsiddikee,

Sorry, without any sample source code it isn’t possible to make any suggestions…

– Dale

Ok. Thanks Dale for the reply. But sample codes with simpler situation are working perfect.

Can you tell if any exceptions are being thrown from your code? That might be a reason the conduit is not being executed

Dear Steve, No, the code is running so smoothly and in debugging I can see how perfectly data is flowing. Just one problem. When I call redraw within a loop, it does not hit display conduit. So I cannot see the point cloud movement which is happening within that loop. But if I call redraw outside that loop at the end, it hits display conduit and redraw the final position of the point cloud.

So my only question is when I am changing position of entire point cloud in a method and after getting new position , I am calling redraw, why it is not hitting display conduit.

If the question looks too vague, please let me know. I will try to compile a sample code with same bug :slight_smile:

Try calling RhinoApp.Wait() right after redraw. The paint message may not be getting processed because you a in a loop.

Dear Steve, Thanks for the reply. I tried. Wait has no effect. When coming to redraw it should hit break point in display conduit. But it is not. So I guess I need to create a sample code creating banch of point cloud and changing there position in simpler way. Then see if it does the same thing. Tomorrow I will write a short similar code and will send you. Current code is doing lots of calculation inbetween for changing position of point cloud.