public override bool Execute() { var edge1 = new BRepBuilderAPIMakeEdge(Dependency[0].TransformedPoint3D.GpPnt, Dependency[1].TransformedPoint3D.GpPnt).Edge; var edge2 = new BRepBuilderAPIMakeEdge(Dependency[1].TransformedPoint3D.GpPnt, Dependency[2].TransformedPoint3D.GpPnt).Edge; var edge3 = new BRepBuilderAPIMakeEdge(Dependency[2].TransformedPoint3D.GpPnt, Dependency[3].TransformedPoint3D.GpPnt).Edge; var edge4 = new BRepBuilderAPIMakeEdge(Dependency[3].TransformedPoint3D.GpPnt, Dependency[0].TransformedPoint3D.GpPnt).Edge; var mkWire = new BRepBuilderAPIMakeWire(); mkWire.Add(edge1); mkWire.Add(edge2); mkWire.Add(edge3); mkWire.Add(edge4); TopoDSFace faceProfile = null; if (mkWire.IsDone) { var wireProfile = mkWire.Wire; if (!wireProfile.IsNull) { faceProfile = new BRepBuilderAPIMakeFace(wireProfile, false).Face; } } Shape = faceProfile; return(true); }
private void DetectFaceUnderMouse(DataPackage data) { if (InteractiveWorkSuspended) { return; } var mousePosition = data.Get <Mouse3DPosition>(); Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.BuildSelections, mousePosition); var selectedEntities = Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetEntities).Get <List <SceneSelectedEntity> >(); if (selectedEntities.Count <= 0) { Face = null; return; } var shape = selectedEntities[0].TargetShape(); if (shape == null) { Face = null; return; } if (shape.ShapeType == TopAbsShapeEnum.TopAbs_FACE) { Face = TopoDS.Face(shape); } var container = Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetContainer).Get <SelectionContainer>(); // BuildDragAxis(container.Document, shape, 1); }
public static void ShowFaceDirection(TopoDSFace face, Document Document) { var p1 = new gpPnt(); var v1 = new gpVec(); var v2 = new gpVec(); var sf = new BRepAdaptorSurface(face, true); var u = sf.FirstUParameter; var x = sf.LastUParameter; if (Precision.IsInfinite(u)) { u = (Precision.IsInfinite(x)) ? 0.0 : x; } else if (!Precision.IsInfinite(x)) { u = (u + x) / 2.0; } var v = sf.FirstVParameter; x = sf.LastVParameter; if (Precision.IsInfinite(v)) { v = (Precision.IsInfinite(x)) ? 0.0 : x; } else if (!Precision.IsInfinite(x)) { v = (v + x) / 2.0; } sf.D1(u, v, p1, v1, v2); var vector = v1.Crossed(v2); x = vector.Magnitude; // The direction vector length const double length = 70.0; if (x > 0.0000001) { vector.Multiply(length / x); } else { vector.SetCoord(length / 2.0, 0, 0); } var p2 = new gpPnt(p1.X, p1.Y, p1.Z); p2.Translate(vector); if (p1.IsEqual(p2, Precision.Confusion)) { return; } DrawArrow(Document, p1, p2, face.Orientation()); }
protected override void FacePicked(TopoDSFace face) { base.FacePicked(face); if (_extrudeStages == ExtrudeStages.SelectAutoFace) { _underMouseFace = face; } }
public override void OnConnect() { base.OnConnect(); Face = null; if (Face != null) { AddData(Face); } }
public override void OnConnect() { _facePickerSuspended = false; Face = null; _lockedPlane = false; if (Face != null) { AddData(Face); } }
/// <summary> /// Called when notified that the FacPicker detected a new face selected. /// </summary> /// <param name = "face"></param> protected override void FacePicked(TopoDSFace face) { base.FacePicked(face); if (_metaAction == null) { return; } ProposeSelectedReferenceShape(face); }
private void NotifyListeners(TopoDSFace face) { var plane = GeomUtils.ExtractPlane(face); if (plane != null) { Inputs[InputNames.Mouse3DEventsPipe].Send(NotificationNames.SetPlane, plane); } AddData(face); }
protected override void FacePicked(TopoDSFace face) { var entity = GeomUtils.IdentifyNode(Document.Root, face); base.FacePicked(face); if (entity == null) { return; } _secondShape = entity.Node; }
/// <summary> /// Detects if a point is inside or outside of a face /// </summary> /// <param name = "face"></param> /// <param name = "point"></param> /// <returns>-1 inside, 1 outside</returns> private static int GetOffsetDirection(TopoDSFace face, gpPnt point) { var classifier = new IntToolsContext(); if (classifier.IsValidPointForFace(point, face, Precision.Confusion)) { return(-1); } return(1); }
protected override void OnNotification(string name, DataPackage dataPackage) { switch (name) { case NotificationNames.Suspend: if (_lockedPlane) { return; } if (_facePickerSuspended) { return; } if (!_facePickerSuspended) { _context.CloseAllContexts(true); } _facePickerSuspended = true; Log.Info("FacePickerPlane - suspended"); break; case NotificationNames.LockPlane: Send(NotificationNames.Suspend); Face = dataPackage.Get <TopoDSFace>(); _lockedPlane = true; break; case NotificationNames.Resume: if (_lockedPlane) { return; } if (!_facePickerSuspended) { return; } _facePickerSuspended = false; Face = null; Log.Info("FacePickerPlane - resumed"); break; case NotificationNames.Cleanup: break; default: NaroMessage.Show(@"Object name: " + name + @" is not handled in input notification"); break; } }
protected override void StartInteractiveDetection() { Face = null; var container = Inputs[InputNames.SelectionContainerPipe].GetData(NotificationNames.GetContainer).Get <SelectionContainer>(); PreviousSelectionMode = container.CurrentSelectionMode; //// Inputs[InputNames.SelectionContainerPipe].Send(NotificationNames.SwitchSelectionMode, TopAbsShapeEnum.TopAbs_FACE); }
/// <summary> /// Called when notified that the FacPicker detected a new face selected. /// </summary> protected virtual void FacePicked(TopoDSFace face) { // Don't allow null faces if ((face == null) || (face.IsNull)) { return; } // Filter duplicate faces if ((CurrentFacePicked != null) && (!CurrentFacePicked.IsNull) && (CurrentFacePicked.IsSame(face))) { return; } CurrentFacePicked = face; }
private void LockPlane(TopoDSFace face) { if (face == null) { return; } _internalFace = null; var aFaceElementAdaptor = new BRepAdaptorSurface(face, true); var surfaceType = aFaceElementAdaptor.GetType; if (surfaceType != GeomAbsSurfaceType.GeomAbs_Plane) { return; } _internalFace = face; }
/// <summary> /// Called when notified that the FacPicker detected a new face selected. /// </summary> protected override void FacePicked(TopoDSFace face) { base.FacePicked(face); if (face == null) { return; } _selectedNode = GeomUtils.IdentifyNode(Document.Root, face); //var selectedNodes = ActionsGraph[InputNames.SelectionContainerPipe].Get<List<SceneSelectedEntity>>(); //if (selectedNodes.Count == 0) //{ // if(_stage == Stages.None) // BackToNeutralModifier(); // return; //} //_selectedNode = selectedNodes[0]; }
public static bool BuildFaceDraft(BRepOffsetAPIDraftAngle draft, TopoDSFace draftedFace, gpDir draftDirection, double angle, gpPln neutralPlane) { try { draft.Add(draftedFace, draftDirection, angle, neutralPlane, true); if (!draft.AddDone) { //draft.Remove(draftedFace); return(false); } } catch (Exception) { return(false); } return(true); }
public static void AddUVBounds(TopoDSFace F, BndBox2d B) { BRepTools_AddUVBounds38403D27(F.Instance, B.Instance); }
public static void UVBounds(TopoDSFace F, TopoDSEdge E, ref double UMin, ref double UMax, ref double VMin, ref double VMax) { BRepTools_UVBounds5F413ED6(F.Instance, E.Instance, ref UMin, ref UMax, ref VMin, ref VMax); }
public static void UVBounds(TopoDSFace F, TopoDSWire W, ref double UMin, ref double UMax, ref double VMin, ref double VMax) { BRepTools_UVBoundsEF82485C(F.Instance, W.Instance, ref UMin, ref UMax, ref VMin, ref VMax); }
public static void UVBounds(TopoDSFace F, ref double UMin, ref double UMax, ref double VMin, ref double VMax) { BRepTools_UVBounds443C7451(F.Instance, ref UMin, ref UMax, ref VMin, ref VMax); }
public static bool IsReallyClosed(TopoDSEdge E, TopoDSFace F) { return(BRepTools_IsReallyClosed65EC701C(E.Instance, F.Instance)); }
public static TopoDSWire OuterWire(TopoDSFace F) { return(new TopoDSWire(BRepTools_OuterWireAEC70AC1(F.Instance))); }
public void Init(TopoDSFace Spine, GeomAbsJoinType Join) { BRepOffsetAPI_MakeOffset_InitA6167785(Instance, Spine.Instance, (int)Join); }
public BRepOffsetAPIMakeOffset(TopoDSFace Spine, GeomAbsJoinType Join) : base(BRepOffsetAPI_MakeOffset_CtorA6167785(Spine.Instance, (int)Join)) { }
public static void Update(TopoDSFace F) { BRepTools_UpdateAEC70AC1(F.Instance); }
public static void AddUVBounds(TopoDSFace F, TopoDSWire W, BndBox2d B) { BRepTools_AddUVBounds3ADDD719(F.Instance, W.Instance, B.Instance); }
public static void AddUVBounds(TopoDSFace F, TopoDSEdge E, BndBox2d B) { BRepTools_AddUVBounds5756543C(F.Instance, E.Instance, B.Instance); }
public bool IsValidBlockForFaces(double aT1, double aT2, IntToolsCurve aIC, TopoDSFace aF1, TopoDSFace aF2, double aTol) { return(IntTools_Context_IsValidBlockForFacesC37F6D8D(Instance, aT1, aT2, aIC.Instance, aF1.Instance, aF2.Instance, aTol)); }
public static void UpdateFaceUVPoints(TopoDSFace F) { BRepTools_UpdateFaceUVPointsAEC70AC1(F.Instance); }
public bool IsValidBlockForFace(double aT1, double aT2, IntToolsCurve aIC, TopoDSFace aF, double aTol) { return(IntTools_Context_IsValidBlockForFace3F82E9C8(Instance, aT1, aT2, aIC.Instance, aF.Instance, aTol)); }