protected override Result RunCommand(RhinoDoc doc, RunMode mode) { Host.EnsureInitialisation(); PanelElementCollection elements = Core.Instance.ActiveDocument.Model.Elements.PanelElements; foreach (PanelElement lEl in elements) { RhinoMeshAvatar mAv = new RhinoMeshAvatar(); ((IMeshAvatar)mAv).Builder.AddPanelPreview(lEl); ((IMeshAvatar)mAv).FinalizeMesh(); RhinoOutput.BakeMesh(mAv.RenderMesh); } Host.Instance.Refresh(); return(Result.Success); }
protected override Result RunCommand(RhinoDoc doc, RunMode mode) { Host.EnsureInitialisation(); LinearElementCollection elements = Core.Instance.ActiveDocument.Model.Elements.LinearElements; foreach (LinearElement lEl in elements) { if (!lEl.IsDeleted) { RhinoMeshAvatar mAv = new RhinoMeshAvatar(); ((IMeshAvatar)mAv).Builder.AddSectionPreview(lEl); ((IMeshAvatar)mAv).FinalizeMesh(); Guid guid = RhinoOutput.BakeMesh(mAv.RenderMesh); if (guid != Guid.Empty) { RhinoOutput.SetObjectName(guid, lEl.Name); if (lEl.Family != null) { RhinoOutput.SetObjectUserString(guid, "Family", lEl.Family.Name); if (lEl.Family.GetPrimaryMaterial() != null) { RhinoOutput.SetObjectUserString(guid, "Material", lEl.Family.GetPrimaryMaterial().Name); } if (lEl.Family.Profile != null) { RhinoOutput.SetObjectUserString(guid, "Profile", lEl.Family.Profile.ToString()); } } } } } Host.Instance.Refresh(); return(Result.Success); }