@flokart wrote:
Hi all,
is there a way to preview a imported instanceReference object in rhino before baking?
At the moment i import a instanceDefinition Geometry and his coresponding InstanceReference Xform Transformations to get a preview before i bake it.What i need is exactly what the transformNode in Grasshopper does but i am unable to duplicate the InstanceDefiniton Geometry and apply the InstanceReference Xform to it.
Any help to do this is welcomeGrasshopper is not able to show a InstanceReference Geometry.
import Rhino as rh import scriptcontext as sc File = rh.FileIO.File3dm.Read(x) # Get InstanceDefinition Geometry and Id by Name Obj = [] ObjId = [] for i in File.AllInstanceDefinitions: if i.Name == y: ObjId.append(i.Id) for o in i.GetObjectIds(): Obj.append(File.Objects.FindId(o).Geometry) # Get all InstanceReference Xform Transfomations TranObj = [] for i in File.Objects: if i.Geometry.ObjectType == rh.DocObjects.ObjectType.InstanceReference: if i.Geometry.ParentIdefId in ObjId: TranObj.append(i.Geometry.Xform) RTranObj = list(reversed(TranObj)) # Add InstanceDefinition to the document and get Index sc.doc.ActiveDoc.InstanceDefinitions.Add(y,"",z,Obj) InIndex = rh.RhinoDoc.ActiveDoc.InstanceDefinitions.Find(y).Index # Add InstanceReferences to the document TranObjRa = [] for t in range(0,v): TranObjRa.append(RTranObj[t]) if u: sc.doc.ActiveDoc.Objects.AddInstanceObject(InIndex,RTranObj[t])
Posts: 1
Participants: 1