private void InfeGlassesComponent_ObjectsAdded(object sender, GH_DocObjectEventArgs e) { foreach (var obj in e.Objects) { this.AddOneObject(obj); } }
/// <summary> /// Detecting the deletation of this component and run disconnect function. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void documentOnObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { e.Document.ObjectsDeleted -= documentOnObjectsDeleted; this.disconnect(); } }
private void ObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (!e.Objects.Contains(this)) { return; } EnabledGlobal = false; }
}//eof private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { e.Document.ObjectsDeleted -= DocumentObjectsDeleted; this.documentEventRegistered = false; this.httpHandler.stop(); } }
/// <summary> /// Check if a deleted object got added again and add it again to selecting in case. /// </summary> protected virtual void OnObjectsAdded(object sender, GH_DocObjectEventArgs e) { var intersectingDocumentObjectsGuid = _deletedDocumentObjectsGuid.Intersect(e.Objects.Select(x => x.InstanceGuid)).ToArray(); if (intersectingDocumentObjectsGuid.Any()) { _deletedDocumentObjectCounter -= intersectingDocumentObjectsGuid.Length; UpdateDocumentObjects(selectedDocumentObjects.Concat(e.Objects.Where(x => intersectingDocumentObjectsGuid.Contains(x.InstanceGuid))).ToArray()); } }
private void DocumentOnObjectsAdded(object sender, GH_DocObjectEventArgs e) { foreach (var userHistoryData in e.Objects.Select(x => x.ComponentGuid) .Where(x => !_userHistory.ContainsKey(x)) .Select(x => new UserHistoryData { ComponentGuid = x, UserName = Environment.UserName })) { _userHistory[userHistoryData.ComponentGuid] = userHistoryData; } }
private void ObjectsAddedAction(object sender, GH_DocObjectEventArgs e) { foreach (GH_DocumentObject docObj in e.Objects) { if (docObj is NamedViewPPTComponent && docObj != this) { NamedViewPPTComponent pptObj = docObj as NamedViewPPTComponent; string message = GetTransLation(new string[] { "Please place only one NamedViewPPT component per document! Or recompute this component.", "请在每个文档中只放置一个已命名视图幻灯片运算器!或者,重新计算一下此运算器。" }); pptObj.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, message); this.AddRuntimeMessage(GH_RuntimeMessageLevel.Error, message); } } }
/// <summary> /// Check if a documentObject from the selected documentObjects got deleted and update the documentObjects if so. /// </summary> protected virtual void OnObjectsDeleted(object sender, GH_DocObjectEventArgs e) { var intersectingDocumentObjects = selectedDocumentObjects.Intersect(e.Objects).ToArray(); if (intersectingDocumentObjects.Any()) { foreach (var documentObjectGuid in intersectingDocumentObjects.Select(x => x.InstanceGuid)) { _deletedDocumentObjectsGuid[_deletedDocumentObjectCounter % 128] = documentObjectGuid; _deletedDocumentObjectCounter++; } UpdateDocumentObjects(selectedDocumentObjects.Except(intersectingDocumentObjects).ToArray()); } }
/// <summary> /// This method detects if the user deletes the component from the Grasshopper canvas. /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (_nameUnique == true) { _objectManager.ToolNames.Remove(_toolName); } _objectManager.OldToolsQuaternionByGuid.Remove(this.InstanceGuid); // Runs SolveInstance on all other Robot Tools to check if robot tool names are unique. _objectManager.UpdateRobotTools(); } }
/// <summary> /// This method detects if the user deletes the component from the Grasshopper canvas. /// </summary> /// <param name="sender"> </param> /// <param name="e"> </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (_nameUnique == true) { _objectManager.ExternalAxisNames.Remove(_axisName); } _objectManager.ExternalLinearAxesByGuid.Remove(this.InstanceGuid); // Runs SolveInstance on all other ExternalAxis components to check if external axis names are unique. _objectManager.UpdateExternalAxis(); } }
private void GrasshopperObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e != null && e.Attributes != null) { for (int i = 0; i < e.ObjectCount; i++) { if (e.Attributes[i] != null && e.Attributes[i].InstanceGuid == this.InstanceGuid) { Dispose(); } Debug.Assert(e.Attributes[i] != null, "e.Attributes[i] is null"); } } Debug.Assert(e != null && e.Attributes != null, "e or e.Attributes is null"); }
/// <summary> /// Detect if the components gets removed from the canvas and deletes the /// objects created with this components from the object manager. /// </summary> /// <param name="sender"> The object that raises the event. </param> /// <param name="e"> The event data. </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (_namesUnique == true) { for (int i = 0; i < _speedDataNames.Count; i++) { _objectManager.SpeedDataNames.Remove(_speedDataNames[i]); } } _objectManager.OldSpeedDatasByGuid.Remove(this.InstanceGuid); // Run SolveInstance on other Speed Data instances with no unique Name to check if their name is now available _objectManager.UpdateSpeedDatas(); } }
/// <summary> /// Detect if the components gets removed from the canvas and deletes the /// objects created with this components from the object manager. /// </summary> /// <param name="sender"> The object that raises the event. </param> /// <param name="e"> The event data. </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (_namesUnique == true) { for (int i = 0; i < _woNames.Count; i++) { _objectManager.WorkObjectNames.Remove(_woNames[i]); } } _objectManager.OldWorkObjectsByGuid2.Remove(this.InstanceGuid); // Runs SolveInstance on all other WorkObjects to check if robot tool names are unique. _objectManager.UpdateWorkObjects(); } }
/// <summary> /// Detect if the components gets removed from the canvas and deletes the /// objects created with this components from the object manager. /// </summary> /// <param name="sender"> The object that raises the event. </param> /// <param name="e"> The event data. </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (namesUnique == true) { for (int i = 0; i < targetNames.Count; i++) { objectManager.TargetNames.Remove(targetNames[i]); } } objectManager.OldTargetsByGuid.Remove(this.InstanceGuid); /// Runs SolveInstance on all other Targets to check if robot tool names are unique. objectManager.UpdateTargets(); } }
/// <summary> /// Detect if the components gets removed from the canvase and disposes the controller /// </summary> /// <param name="sender"> The object that raises the event. </param> /// <param name="e"> The event data. </param> private void DocumentObjectsDeleted(object sender, GH_DocObjectEventArgs e) { if (e.Objects.Contains(this)) { if (_controllerGoo != null) { if (_controllerGoo.Value != null) { Controller controller = _controllerGoo.Value; if (controller.Connected == true) { controller.Logoff(); } controller.Dispose(); } } } }
//Event handler that will be expire the solution whenever a component is added or deleted public void OnChanged(Object sender, GH_DocObjectEventArgs e) { ExpireSolution(true); }