I need to draw in the Rhino document three arrows in order to let the user to see a custom reference system, beyond the Rhino default one.
How can I draw something, always visible and not clickable neither modifiable?
I though to draw the three arrows in a layer, and then lock it. But I don’t want to see such layer into the layers manager tool. I need to hide the existence of this layer but, at the same time, let the user to see the layer content, always.
I also look for a method to draw something outside any layer, as for the Rhino reference system or the Rhino grid but I did not find any solution.
Do you have any suggestion? I am open to each solution let me to draw something always visible and then keep it out from the user control.
You can use a CRhinoDisplayConduit to draw geometry and text that does not exist in the Rhino document. The Rhino SDK samples have a number of conduit samples that you can review.
thank you, CRhinoDisplayConduit seems to be perfect for my purpose.
I tried to implement an example, following some samples you linked me but I have two main problems now.
I can’t see my geometry when I am in the ray-tracing mode.
I suppose that CrhinoDisplayPipeline::DrawShadedBreps function it not enought for that but I don’t know what to do.
I can’t see the whole geometry in wireframe, shaded, ghosted and x-ray mode. The portion nearest to the view point is clipped.
It could be a CsupportChannels::SC_CALCBOUNDINGBOX problem but I don’t know exactly what I’m doing wrong.
The following is my CrhinoDisplayConduit extension…
Thank you for your support but unfortunately your code doesn’t work.
I noticed that the problem occurs when into the document is placed an object smaller then the conduit one.
You can reproduce the problem running the TestMargari command after to have opened the linked file.
I forgot to tell you that the clipping issue is only in the perspective view.
I’d also like to draw the brep in the ray-tracing rendering but I don’t know how.
Here is a perspective view in raytraced mode:
When I switch to the raytraced mode from an other one, I can see the raytraced conduit for half a second, the it disappears.
I don’t know if it can help but I don’t have the clipping issue running Rhino in Safe Mode but I have the following issue if I zoom a lot.
The vertical edge on the left should go from the base corner towards the top of the image.
I also tried to run the same command on Rhino5 – 64bit and it works well.
Of course, I had to modify some calls in order to use Rhino5 SDK:
case CSupportChannels::SC_CALCBOUNDINGBOX:
case CSupportChannels::SC_VIEWEXTENTS:
{
if (nullptr != m_brep)
{
ON_BoundingBox bbox;
m_brep->GetBoundingBox(bbox, false); // returns bbox with m_min={x=0.0 y=0.0 z=0.0} m_max={x=10.0 y=5.0 z=30.0} as expected
// Here m_pChannelAttrs->m_BoundingBox is m_min={x=1.0 y=0.0 z=0.0} m_max={x=-1.0 y=0.0 z=0.0}, I don't know if it is correct
m_pChannelAttrs->m_BoundingBox.Union(bbox);
// Here m_pChannelAttrs->m_BoundingBox is m_min={x=0.0 y=0.0 z=0.0} m_max={x=10.0 y=5.0 z=30.0} as expected
}
}
break;
Debugging the program, I noticed that, also if I set the m_pChannelAttrs->m_BoundingBox member during the SC_CALCBOUNDINGBOX step, during the following SC_POSTDRAWOBJECTS step that member is as I have never modified it.
Do you have any suggestions?
I also noticed that the frustum doesn’t change its near and far planes, after I set the bounding box.
Is it correct? I expected it to grow up in order to contain my brep.
I have tried the sample (that I posted above) on two different systems and it works perfectly. Please verify that you’ve had tried running this code without modification.
If are unable to make the code I posted work for you, then please send me the code to your plug-in project.
I tried running your code without modifications but no luck.
I only include your command in my solution.
I got around the problem using a phantom object in order to place an invisible box just around my conduit object. In this way the frustum near and far planes are automatically computed well.
I don’t believe there is a bug here - the code presented works for me on two different systems. But I’ve logged an issue so @stevebaer can have a closer look at this.
I suspect it could be a conflict between your command and another plugin of mine but I’m not sure.
I’ll investigate next week and I’ll let you know as soon as possible.