Annotation on a layout

hi

i currently try something similar to an already discussed topic there:
http://discourse.mcneel.com/t/crhinopageview-crhinodetailviewobject/5060

Unfortunately the final solution was not replied by the user and i have now a problem with perspective views. On top, side or right view the suggestion from steve works like a charm, but in perspective view it is totally wrong.

Does someone have a code example which works also with perspective views?

thank you

Hi Wolfgang;

If you are in a detail, you can obtain the correct transform as follows:

CRhinoPageView* page_view = 0;
CRhinoView* view = RhinoApp().ActiveView();
if (view && view->IsKindOf(RUNTIME_CLASS(CRhinoPageView)))
  page_view = static_cast<CRhinoPageView*>(view);

if (0 != page_view)
{
  const CRhinoDetailViewObject* detail = page_view->FindActiveDetailObject();
  if  (0 != detail)
  {
    ON_Xform world_to_page(1);
    detail->GetPageXforms(&world_to_page, 0);
    // TODO: transform stuff here...
  }
}

Does this help?

– Dale

Hi Dale,

thank you for your fast reply.
I already worked with this method and for simple point transformations it works.
The bad thing about this method is, it returns a transformation with a zero length z vector which results in a “flat” output. If you just need the position, it works perfect, but in my case i need to evaluate in which direction a vector is showing in a specific detail view. And with this transformation my vector will be flatten in z direction.

At the moment i use following code:

CRhinoPageView* page_view = 0;
CRhinoView* view = RhinoApp().ActiveView();
if (view && view->IsKindOf(RUNTIME_CLASS(CRhinoPageView)))
  page_view = static_cast<CRhinoPageView*>(view);

if (0 != page_view)
{
    ON_Xform world2screen, screen2page;
    detailedViews[i]->Viewport().m_v.m_vp.GetXform(ON::world_cs, ON::screen_cs, world2screen);
    page_view->Viewport().m_v.m_vp.GetXform(ON::screen_cs, ON::world_cs, screen2page);
    
    ON_Xform world_to_page(1);
    world_to_page = screen2page * world2screen;
    // TODO: transform stuff here...

}

But with this one i get wrong transformation in perspective views.

This is true. But stuff on a layout should be 2-D, as the layout is the paper, or print sheet.

Perhaps I need to know more about what you are trying to accomplish and why.

I should add that the method I presented is basically what the ChangeSpace command does. ChangeSpace is a new command in the Rhino WIP.

Basically we need to annotate some detailed views on a layout with some automatism. For this i need to analyze how a geometry is displayed in this view. Only if this geometry is shown more or less from the top, i want to annotate this object in this view.
Further, the annotation is not only a dot or a text, it’s a curve which describes the contour of the object. This should be displayed in the page view accordingly to the position of the geometry. E.g. if a disc is shown in a view slightly from the side, it looks like an ellipse. In this case i want also to draw a curve which looks like an ellipse.

In the end it should be something like a component placement specification for an assembly in 3D.

@lowell, do you have any suggestions for Wolfgang?

today i tried a few things with a conduit and i think i can achieve almost everything we need.
At the moment the only disadvantage i can see is that the component placement specification can only be shown and printed when our plugin is loaded.

@dale do you think this is a good solution to create the annotation within a conduit? Or do you know any issue i run into with this solution (e.g. performance)?