I want to Move a sub object of type BrepObject or InstanceObject inside an InstanceObject.
does any one know what the best way for that is?
I’m using Rhino8 and c#
thanks
Not sure if there is a way, to Translate a single Object that belongs to a InstanceDefinition.
(it looks like changing the Attributes of the underlaying RhinoObjects works, but Transforming / Replacing the geometry does not)
There is ModifyGeometry
the following script/snippet without any error-checking / handling does the job here:
using System;
using System.Collections.Generic;
using System.Linq;
using Rhino;
using Rhino.DocObjects;
using Rhino.Geometry;
RhinoDoc doc = RhinoDoc.ActiveDoc;
InstanceDefinition block01 = doc.InstanceDefinitions[0];
RhinoObject[] objs = block01.GetObjects();
ObjectAttributes[] attrs = objs.Select(item => item.Attributes).ToArray();
GeometryBase[] geos = objs.Select(item => item.Geometry).ToArray();
Transform xForm = Transform.Translation(new Vector3d(0,0,20.0));
geos[0].Transform(xForm);
doc.InstanceDefinitions.ModifyGeometry(block01.Index, geos, attrs);
doc.Views.Redraw();
hope this helps - kind regards -tom
Thanks Tom_P