public virtual void SetConverterFromKit(string kitName) { if (kitName == Kit?.Name) { return; } Kit = KitManager.Kits.FirstOrDefault(k => k.Name == kitName); SelectedKitName = Kit.Name; Converter = Kit.LoadConverter(Applications.Rhino); Converter.SetContextDocument(Rhino.RhinoDoc.ActiveDoc); Message = $"Using the {Kit.Name} Converter"; }
private void SetDefaultKitAndConverter() { Kit = KitManager.GetDefaultKit(); try { Converter = Kit.LoadConverter(Applications.Rhino); Converter.SetContextDocument(RhinoDoc.ActiveDoc); } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public void SetConverterFromKit(string kitName) { if (kitName == Kit.Name) { return; } Kit = KitManager.Kits.FirstOrDefault(k => k.Name == kitName); Converter = Kit.LoadConverter(Applications.Rhino); Message = $"Using the {Kit.Name} Converter"; ExpireSolution(true); }
public GetObjectValueByKeyAsync() : base("Speckle Object Value by Key Async", "Object K/V A", "Gets the value of a specific key in a Speckle object.", "Speckle 2 Dev", "Async Object Management") { Kit = KitManager.GetDefaultKit(); try { Converter = Kit.LoadConverter(Applications.Rhino); BaseWorker = new GetObjectValueByKeyWorker(this, Converter); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public ExtendSpeckleObjectAsync() : base("Extend Speckle Object Async", "ESOA", "Extend a current object with key/value pairs", "Speckle 2 Dev", "Async Object Management") { Kit = KitManager.GetDefaultKit(); try { Converter = Kit.LoadConverter(Applications.Rhino); BaseWorker = new ExtendSpeckleObjectWorker(this, Converter); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public virtual void SetConverterFromKit(string kitName) { if (kitName == Kit?.Name) { return; } Kit = KitManager.Kits.FirstOrDefault(k => k.Name == kitName); SelectedKitName = Kit.Name; Converter = Kit.LoadConverter(Applications.Rhino6); Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); SpeckleGHSettings.OnMeshSettingsChanged += (sender, args) => Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); Converter.SetContextDocument(Rhino.RhinoDoc.ActiveDoc); Message = $"Using the {Kit.Name} Converter"; }
public CreateSpeckleObjectAsync() : base("Create Speckle Object Async", "CSOA", "Allows you to create a Speckle object by setting its keys and values.", "Speckle 2 Dev", "Async Object Management") { Kit = KitManager.GetDefaultKit(); try { Converter = Kit.LoadConverter(Applications.Rhino); BaseWorker = new CreateSpeckleObjectWorker(this, Converter); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public ExpandSpeckleObjectAsync() : base("Expand Speckle Object Async", "ESOA", "Allows you to decompose a Speckle object in its constituent parts.", "Speckle 2 Dev", "Async Object Management") { Kit = KitManager.GetDefaultKit(); try { Converter = Kit.LoadConverter(Applications.Rhino); BaseWorker = new ExpandSpeckleObjectWorker(this, Converter); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public SelectKitAsyncComponentBase(string name, string nickname, string description, string category, string subCategory) : base(name, nickname, description, category, subCategory) { var key = "Speckle2:kit.default.name"; var n = Grasshopper.Instances.Settings.GetValue(key, "Objects"); Kit = KitManager.GetKitsWithConvertersForApp(Applications.Rhino).FirstOrDefault(kit => kit.Name == n); try { Converter = Kit.LoadConverter(Applications.Rhino); Converter.SetContextDocument(Rhino.RhinoDoc.ActiveDoc); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
private void SetDefaultKitAndConverter() { try { Kit = KitManager.GetDefaultKit(); Converter = Kit.LoadConverter(Applications.Rhino6); Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); SpeckleGHSettings.OnMeshSettingsChanged += (sender, args) => Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); Converter.SetContextDocument(RhinoDoc.ActiveDoc); foundKit = true; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); foundKit = false; } }
public override void AddedToDocument(GH_Document document) { base.AddedToDocument(document); var key = "Speckle2:kit.default.name"; var n = Grasshopper.Instances.Settings.GetValue(key, "Objects"); try { Kit = KitManager.GetKitsWithConvertersForApp(Applications.Rhino).FirstOrDefault(kit => kit.Name == n); Converter = Kit.LoadConverter(Applications.Rhino); Converter.SetContextDocument(Rhino.RhinoDoc.ActiveDoc); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public override void AddedToDocument(GH_Document document) { base.AddedToDocument(document); try { Kit = KitManager.GetKitsWithConvertersForApp(Applications.Rhino6).FirstOrDefault(kit => kit.Name == SpeckleGHSettings.SelectedKitName); Converter = Kit.LoadConverter(Applications.Rhino6); Converter.SetContextDocument(Rhino.RhinoDoc.ActiveDoc); Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); SpeckleGHSettings.OnMeshSettingsChanged += (sender, args) => Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); Message = $"{Kit.Name} Kit"; } catch { AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "No default kit found on this machine."); } }
public void SetConverterFromKit(string kitName) { if (Kit == null) { return; } if (kitName == Kit.Name) { return; } Kit = KitManager.Kits.FirstOrDefault(k => k.Name == kitName); Converter = Kit.LoadConverter(Applications.Rhino6); Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); SpeckleGHSettings.OnMeshSettingsChanged += (sender, args) => Converter.SetConverterSettings(SpeckleGHSettings.MeshSettings); Message = $"Using the {Kit.Name} Converter"; ExpireSolution(true); }
public void SetConverterFromKit(string kitName) { if (kitName == Kit.Name) { return; } try { Kit = KitManager.Kits.FirstOrDefault(k => k.Name == kitName); Converter = Kit.LoadConverter(Applications.Rhino); Converter.SetContextDocument(RhinoDoc.ActiveDoc); Message = $"Using the {Kit.Name} Converter"; ExpireSolution(true); } catch (Exception e) { // TODO: handle this. Console.WriteLine(e); } }