dynamicsoar's log


GH: convert a Referenced Surface to a Surface

I encountered an issue related to the Referenced object (surface) in the following situation:

  1. Launch a Rhino instance, place a surface.
  2. Launch a GH instance, place a Surface and choose the surface in the Rhino. If you check this with a Panel, it'll be shown as a Referenced Surface.
  3. Export the surface to a GHdata file via Data Output component.
  4. Open another Rhino instance, and open another GH instance.
  5. Import the saved surface via Data Input component from the GHdata file.
  6. In this 2nd GH file, the Referenced Surface is recognised (you can check with a Panel) but the preview won't actually show up in the 2nd Rhino window. Oops...?

I'm not 100% sure why this is happening but I suspect that for a "referenced" geometry to work, the corresponding object must be available in THE Rhino file that corresponds to the current GH file. The easiest solution came up to my mind is to convert the Referenced Surface in the 1st GH file into something else (before Data Output)... an "actual" surface. There may be many ways for this and perhaps the right way is to use GH_Convert.ObjRefToGeometry Method (GH_Convert.ObjRefToGeometry Method) but I just wanted to be simpler... and tried something else.

  1. Pass the Referenced Surface to Deconstruct Brep component. The "Faces" output shows the corresponding surface (Untrimmed Surface in my case). Happy.
  2. Somehow the Deconstruct Brep messes up the tree structure, so use the Path Mapper if you want, and choose Create Trim Mapping by right-clicking ((Trim Tree doesn't work here, as it's the innermost branches not the outermost branches that are added by the Deconstruct Brep.)).

I haven't tried the similar method for other object types such as Brep or Line or Points, but hoping something similar might work (or, I should probably actually use the GH API Method above... I know...).

Hope this helps to somebody having hard time in treating Referenced object with Data Output/Data Input...