Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8553

Problem with using a modified construction plane in the plug-in

$
0
0

@resammc wrote:

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:

  1. I ask the user to pick a circle object.

  2. then I get the origin and the plane of this circle from OpenNURBS.

  3. I get the current construction plane:
    CRhinoView* view = ::RhinoApp().ActiveView();
    if (!view)
    return CRhinoCommand::failure;

ON_3dmConstructionPlane cplane = view->Viewport().ConstructionPlane();

  1. I modify the m_plane of the construction plane
    cplane.m_plane.CreateFromNormal(New_Origin, Normal_To_The_Plane);

  2. 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.

  1. 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))

  2. 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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 8553

Trending Articles