Hello,
Is this possible within the Rhino 5 C++ SDK? I have my custom curve object and I want to add custom points in such a way that they appear as construction points when Osnap is on.
Many thanks,
Pablo
Hello,
Is this possible within the Rhino 5 C++ SDK? I have my custom curve object and I want to add custom points in such a way that they appear as construction points when Osnap is on.
Many thanks,
Pablo
@mikko, any ideas here?
Seems to me this should be possible by overriding CRhinoObject::SnapTo for the custom object. You’ll probably want to call CRhinoCurveObject::SnapTo in it to get the basic curve snapping.
Thank you @mikko , this looks indeed the way to go.
Just to know, is there any sample showing how to use it? (mainly CRhinoSnapContext
and CRhinoSnapEvent
)? @dale?
Pablo
Hi @pagarcia,
The suggestion was that if you have a custom object that derives from CRhinoCurveObject
then override the CRhinoObject::SnapTo
virtual function. Picking will automatically use the “snap to” results.
Does this make sense?
– Dale
Hi @dale,
Just a question about the actual use of it. Imagine I want to add ON_3dPoint A
to the snapping points of the object. How to do it? I tried this (assume A is globally known):
bool CRhinoCurveObject::SnapTo(const CRhinoSnapContext& snap_context, CRhinoSnapEvent& snap_event) const
{
return snap_context.SnapToPoint(A);
}
Pablo
Hi @pagarcia,
Call base class first, per @mikko suggesions.
bool CMyCurveObject::SnapTo(const CRhinoSnapContext& snap_context, CRhinoSnapEvent& snap_event) const
{
bool rc = CRhinoCurveObject::SnapTo(snap_context, snap_event);
if (!rc)
{
// todo...
}
return rc;
}
– Dale
Hello,
Is it possible to do something similar from RhinoCommon?
Márton
Sorry, no. Can you explain what your looking to do?
– Dale
Hey @dale,
To resurrect this topic, myself personally, I would love to be able to add custom snap points to a CustomCurveObject that do not lie on the curve so that a user could snap to those points when dimensioning etc.
– cs
Hi @csykes,
I’ve added the request to the pile.
https://mcneel.myjetbrains.com/youtrack/issue/RH-70609
– Dale
Hey @dale,
Thanks for adding it, I did manager to create this in a hacky way by creating a ray that intersects the curve as a surface and getting the nearest point to the curve and having the custom curve object follow that point around the edges, which gives an-ok-ish “Snap-To” effect. But a native function would be much better
– cs