Hello, everyone! After my plugin is loaded, running my Plugin1
command. But the arrow cannot select any object, Why? What went wrong? Thank you very much!
//Joann
Hello, everyone! After my plugin is loaded, running my Plugin1
command. But the arrow cannot select any object, Why? What went wrong? Thank you very much!
//Joann
Can you post some code of that command?
CRhinoCommand::result CCommandTest::RunCommand( const CRhinoCommandContext& context )
{
CRhinoGetObject go;
go.SetCommandPrompt( L"Select curve" );
go.SetGeometryFilter( CRhinoGetObject::curve_object );
go.GetObjects( 1, 1 );
if( go.CommandResult() != success )
return go.CommandResult();
const CRhinoObjRef& obj_ref = go.Object(0);
const ON_Curve* crv = obj_ref.Curve();
if( 0 == crv )
return failure;
double crv_length = 0.0;
if( !crv->GetLength(&crv_length) )
return failure;
CRhinoGetNumber gn;
gn.SetCommandPrompt( L"Length from start" );
gn.SetLowerLimit( 0.0, TRUE );
gn.SetUpperLimit( crv_length, TRUE );
gn.GetNumber();
if( gn.CommandResult() != success )
return gn.CommandResult();
// Cook up a normalized arc length parameter,
// where 0.0 <= s <= 1.0.
double length = fabs( gn.Number() );
double s = 0.0;
if( length == 0.0 )
s = 0.0;
else if( length == crv_length )
s = 1.0;
else
s = length / crv_length;
// Get the parameter of the point on the curve that is a
// prescribed arc length from the start of the curve.
double t = 0.0;
if( crv->GetNormalizedArcLengthPoint(s, &t) )
{
ON_3dPoint pt = crv->PointAt( t );
context.m_doc.AddPointObject( pt );
context.m_doc.Redraw();
}
return success;
}
hello! The code sample cannot be wrong, I find it in Rhino developer docs
Hi @15951991225,
This:
CRhinoGetObject go;
go.SetCommandPrompt(L"Select curve");
go.SetGeometryFilter(CRhinoGetObject::curve_object);
go.GetObjects(1, 1);
Is prompting you to pick a curve object. Can you do this? I don’t see any curves in your screen capture.
– Dale
Thank you very much! Dear Dale! I think this is not a problem with the code, but a problem with my computer. I can running it in my another computer.