public static EditResult CutSegment(CadObjectDB db, MarkSegment seg, Vector3d p) { EditResult result = new EditResult(); if (seg.Figure.Type != CadFigure.Types.POLY_LINES) { return(result); } CrossInfo ci = CadMath.PerpendicularCrossSeg(seg.pA.vector, seg.pB.vector, p); if (!ci.IsCross) { return(result); } CadFigure org = db.GetFigure(seg.FigureID); int a = Math.Min(seg.PtIndexA, seg.PtIndexB); int b = Math.Max(seg.PtIndexA, seg.PtIndexB); CadFigure fa = db.NewFigure(CadFigure.Types.POLY_LINES); CadFigure fb = db.NewFigure(CadFigure.Types.POLY_LINES); fa.AddPoints(org.PointList, 0, a + 1); fa.AddPoint(new CadVertex(ci.CrossPoint)); fb.AddPoint(new CadVertex(ci.CrossPoint)); fb.AddPoints(org.PointList, b); if (org.IsLoop) { fb.AddPoint(fa.GetPointAt(0)); } result.AddList.Add(new EditResult.Item(seg.LayerID, fa)); result.AddList.Add(new EditResult.Item(seg.LayerID, fb)); result.RemoveList.Add(new EditResult.Item(org.LayerID, org)); return(result); }
public void Set(MarkSegment mks, DrawContext dc) { Ruler[RCount] = CadRuler.Create(mks.Figure, mks.PtIndexA, mks.PtIndexB); RCount++; }
public void Clean() { MarkSeg = default(MarkSegment); MarkSeg.Clean(); CheckPriority = Priority.NONE; }