i wrote a small c# plugin to generate a textdot with font&colour choices, mostly to see how previewing works. i log the various internal overrides, especially DrawViewportWires where the preview logic is done.
when i drop my component on the grasshopper canvas the preview fundamentally works as expected
… however …
if i activate one of the (top, right, left …) viewports the DrawViewportWires is called once for each viewport displayed, so when the standard 4 are displayed, DrawViewportWires is called 4 times, once for each viewport and the preview is as expected.
however if i activate the one of the perspective type viewports, DrawViewportWires gets called in a continuous loop, basically a call to each viewport on the screen, over and over …
cpu goes up to about 2% and the memory utilization keeps ever increasing, i assume it will eventually fail but i have a lot of memory and the leak is small…
if i select another view port, say top, the looping stops … and after a while (few minutes) the memory goes down slowly to the original values…
i assume its a bug of some sort??
regards
eric
i was going to attach the code, but can’t figure how to attach a file…
Some code will definitely be required. You can upload files via the button on the toolbar which looks like a bar with an up arrow. If the file type you have is now allowed, then zip it first.
Sorry, I missed your response. Yes it’s what I needed. The DrawViewportWires method is called once for every viewport while redrawing, so you really don’t want to do anything heavy during the methods. Adding objects to the document during every redraw definitely falls into this category.
If you want to add objects to the Rhino document, do so in SolveInstance or AfterSolveInstance. Only use the drawing methods to draw stuff, not modify the document.
ok i understand what you are saying, but why 2 different behaviors??
if i select, for example TOP viewport, then the refresh is done once
if i select Perspective, it goes onto a loop
i don’t really want the objects in the document since i am not trying to bake them, i just want a “preview”
with selected colors and layers, its for debugging since it basically enumerates the major parts of the selected geometry and adds textdots …