Using DetailViewObject PageToWorldTransform properly?

Hi all, I have a question about the DetailView PageToWorldTransform attribute that I was hoping someone could help with?

I’m trying to use this in a custom component to move some line geometry from the world coordinate system ( the lines are all on the world C-Plane right at the world origin) onto a Layout View (for printing purposes - sort of a reverse of the Make2D). I am able to get close, but I can’t quite get it to work properly?

I can get the transform attributes from the DetailViewObject just fine ( I think ) but when I try and use them to transform the geometry that I want to project onto the Layout, it comes out very small and in the an unexpected place. It appears to be rotated and aligned properly, its just at the ‘wrong’ scale / location:

I noticed in this post (link) @stevebaer instructed that “Combining these (WorldToPageTransform and PageToWorldTransform) will transform a point from detail space to page space.” but I can’t quite get that to work? I am assuming that ‘combine’ there means to multiply the transforms? When I try that here I get some odd results, certainly not what I was expecting:

if anyone has any pointers or reference material that could help me sort this out I would very much appreciate it!

thanks very much,
-Ed

Hi @ed.p.may,

To transform from world to page, just apply the DetailViewObject.WorldToPageTransform transformation.

if (null != detail)
{
  var point = Point3d.Origin;
  RhinoApp.WriteLine("World location: {0}", point.ToString());
  point.Transform(detail.WorldToPageTransform);
  RhinoApp.WriteLine("Page location: {0}", point.ToString());
}

– Dale

Hi @dale
Thanks so much for the quick reply!! Thats interesting, I had thought that would work - but when I try it with my curve geometry (which is all flat on the World C-Plane)

my results look like:

The geometry does look to be rotated correctly in the DetailView (not skewed at least) but its upside down, way off the page, and oversize compared to the original where I would expect it to land?

Seems that I get the same result whether I try it using native GH components or in the script - I seem to end up with the geom way off? It seems like I am referencing the right DetailView (I checked the name here to compare, note its the same as the name in the ‘Properties’ panel) and I’m just using .WorldToPageTransform to access the Transform attribute. Any place you see where I’m going wrong here?

Appreciate the help. thanks!
-Ed