Hi,
I’m trying to use a picked object to move and rotate the CPlane in Rhino, and then create a new geometry (e.g. a surface) based on the new construction plane coordinates. I successfully move the CPlane to the desired location, but when I try to add a new object (inside the plugin) to the Rhino document, it takes the World coordinate system. However, if I try to interactively add, let’s say, a point to my document, it uses the construction plane coordinate system!
So, I’m doing something like this:
-
I ask the user to pick a circle object.
-
then I get the origin and the plane of this circle from OpenNURBS.
-
I get the current construction plane:
CRhinoView* view = ::RhinoApp().ActiveView();
if (!view)
return CRhinoCommand::failure;
ON_3dmConstructionPlane cplane = view->Viewport().ConstructionPlane();
-
I modify the m_plane of the construction plane
cplane.m_plane.CreateFromNormal(New_Origin, Normal_To_The_Plane);
-
I set the new construction plane and redraw:
view->Viewport().SetConstructionPlane(cplane);
view->Redraw();
at this point, I can see in the debug-mode that the construction plane has moved successfully.
-
Then I send the radius of the circle to a function where I define a NURBS surface based on that.
ON_NurbsSurface Base_Surface = CreateTheBaseSurface(Radius);
(I take the origin for this surface to be (0,0,0))
-
Finally, I add the surface object to the document and redraw:
context.m_doc.AddSurfaceObject(Base_Surface );
context.m_doc.Redraw();
But, the surface pops in the World’s coordinate system.
I have tried many things, but couldn’t figure out what the problem is. Am I missing something here?
I know that I can transform my object to the place that I want, but it would be easier if the construction plane thing were working.
Any help regarding this is greatly appreciated.
P.S.: I’m writing the plug-in in C++ and Rhino 6.
P.S.2: view->Viewport().PushConstructionPlane(cplane)
also doesn’t work