public override void OnActivate() { _pointAdded = false; var firstShape = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (firstShape == null) { ErrorSplineSelected(); return; } _function = firstShape.Get <FunctionInterpreter>(); if (_function == null) { ErrorSplineSelected(); return; } if (_function.Name != FunctionNames.Spline) { ErrorSplineSelected(); return; } Document.Transact(); _pointAdded = true; var mouseCursorInput = Inputs[InputNames.MouseCursorInput]; mouseCursorInput.Send(NotificationNames.SetResourceManager, MetaActionResource.ResourceManager); mouseCursorInput.Send(NotificationNames.SetCursorName, "splineaddpoint.cur"); }
private void ProposeSelectedReferenceShape(TopoDSShape face, Mouse3DPosition mouseData) { SceneSelectedEntity selectedNode = null; if (face != null) { selectedNode = GeomUtils.IdentifyNode(Document.Root, face); if (selectedNode == null) { return; } } else { var node = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (node != null) { selectedNode = new SceneSelectedEntity(node); } } if (selectedNode == null) { return; } if (_axisBuilder.Node != null && selectedNode.Node.Index == _axisBuilder.Node.Index) { SetWorkingPlane(); _dragging = true; _startDragPos = mouseData.Point; return; } // The scene selected entity is hold as reference Propose(selectedNode); }
public override void OnActivate() { Reset(); _selectedNode = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (_selectedNode == null) { BackToNeutralModifier(); } }
public override void OnActivate() { base.OnActivate(); // Close all loacal contexts to draw on the Neutral Point var clipboard = Inputs[InputNames.ClipboardManager]; clipboard.Send(ClipboardManager.ClipboardInputConstants.CopyNode, NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root)); //UpdateViewAndTree(); BackToNeutralModifier(); }
public override void OnActivate() { base.OnActivate(); _fileDialog = new SaveFileDialog { Filter = @"*.step|*.step" }; var result = _fileDialog.ShowDialog(); if (result == DialogResult.Cancel) { BackToNeutralModifier(); return; } var entities = Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get <List <SceneSelectedEntity> >(); var nodes = entities; var selectedNodes = new List <TopoDSShape>(); foreach (var entity in nodes) { var shapeInterpreter = entity.Node.Get <TopoDsShapeInterpreter>(); if (shapeInterpreter != null) { selectedNodes.Add(shapeInterpreter.Shape); } } NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (selectedNodes.Count != 0) { MeshTopoShapeInterpreter.SaveShapeToStep(selectedNodes, _fileDialog.FileName); } else { SaveCommonCodes.SaveToStep(_fileDialog.FileName, Document); } BackToNeutralModifier(); }
private void ProposeSelectedReferenceShape(TopoDSShape face) { var dependency = _metaAction.Dependency; if (dependency == null) { return; } if (dependency.StepName != InterpreterNames.Reference) { return; } SceneSelectedEntity selectedNode = null; if (face != null) { selectedNode = GeomUtils.IdentifyNode(Document.Root, face); if (selectedNode == null) { return; } } else { var node = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (node != null) { selectedNode = new SceneSelectedEntity(node); } } if (selectedNode == null) { return; } // The scene selected entity is hold as reference dependency.Propose(selectedNode, true); }
/// <summary> /// Receives click events. Called at mouse down and at mouse up. /// </summary> /// <param name = "mouseData"></param> protected override void OnMouseClick3DAction(Mouse3DPosition mouseData) { if (Document == null) { return; } if (!mouseData.MouseDown) { return; } bool firstClick = (_translatedNode == null) && (Points.Count == 0); // Check if a shape was selected before launching the tool if (Points.Count == 0) { _translatedNode = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (_translatedNode == null) { return; } } // First the object is selected if (firstClick) { return; } // Start a translation process if (Points.Count < 1) { AddToPointList(mouseData.Point); if (Points.Count == 1) { Log.Info("Translate - translation started"); Document.Transact(); } return; } // The translation finished Log.Info("Translate - translation finished"); InitSession(); // Apply transformation if (_translatedNode != null) { var transformation = _translatedNode.Set <TransformationInterpreter>(); transformation.TranslateWith( new Point3D(new gpPnt(mouseData.Point.X, mouseData.Point.Y, mouseData.Point.Z))); transformation.Pivot = mouseData.Point.GpPnt; // Commit CommitFinal("Translate"); _translatedNode = null; } else { Document.Revert(); } }
public override void OnActivate() { // Get the selected Node var selectedNode = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); if (selectedNode == null) { return; } // Check that the selected object is a group var func = selectedNode.Set <FunctionInterpreter>(); if (func.Name != FunctionNames.Face) { return; } // Disable the notifications var referenceInterpreter = func.Dependency[0].Node.Get <ReferenceListInterpreter>(); if (referenceInterpreter != null) { referenceInterpreter.Disable(); } var nodeList = func.Dependency[0].ReferenceList; foreach (var sceneNode in nodeList) { var node = sceneNode.Node; // Display the Nodes that compose the group node.Set <DrawingAttributesInterpreter>().Visibility = ObjectVisibility.ToBeDisplayed; node.Remove <TreeViewVisibilityInterpreter>(); node.Get <NamedShapeInterpreter>().Shape = node.Get <NamedShapeInterpreter>().Shape; } func.Dependency[0].ReferenceList = new List <SceneSelectedEntity>(); if (referenceInterpreter != null) { referenceInterpreter.Enable(); } // Hide the group Node NodeUtils.Hide(selectedNode); selectedNode.Set <TreeViewVisibilityInterpreter>(); selectedNode.Get <NamedShapeInterpreter>().Shape = selectedNode.Get <NamedShapeInterpreter>().Shape; // Reload the tree view TreeView.LoadTree(Document.Root); // Clear the property view // Finish the transaction Document.Commit(String.Format("Apply ungroup")); UpdateView(); // Change back to selection mode BackToNeutralModifier(); }
private void DialogSetSelectedNode() { var node = NodeBuilderUtils.IdentifySelectedObjectLabel(Document.Root); _dialog.SetNode(node); }