/// <summary> /// Tries to fit fillet arc between two selected curves. Fillet radius is given from user input box. /// </summary> private void CreateFilletEntity() { if (firstSelectedEntity == null) { if (selEntityIndex != -1) { firstSelectedEntity = Entities[selEntityIndex]; selEntityIndex = -1; return; } } else if (secondSelectedEntity == null) { DrawSelectionMark(mouseLocation); renderContext.EnableXOR(false); DrawText(mouseLocation.X, (int)Size.Height - mouseLocation.Y + 10, "Select second curve", new Font("Tahoma", 8.25f), DrawingColor, ContentAlignment.BottomLeft); } if (secondSelectedEntity == null) { if (selEntityIndex != -1) { secondSelectedEntity = Entities[selEntityIndex]; } } if (firstSelectedEntity is ICurve && secondSelectedEntity is ICurve) { if (firstSelectedEntity is Line && secondSelectedEntity is Line) { Line l1 = firstSelectedEntity as Line; Line l2 = secondSelectedEntity as Line; if (Vector3D.AreParallel(l1.Direction, l2.Direction)) { ClearAllPreviousCommandData(); return; } } #if NURBS Arc filletArc = null; try { if (Curve.Fillet((ICurve)firstSelectedEntity, (ICurve)secondSelectedEntity, filletRadius, false, false, true, true, out filletArc)) { AddAndRefresh(filletArc, ActiveLayerName); } else if (Curve.Fillet((ICurve)firstSelectedEntity, (ICurve)secondSelectedEntity, filletRadius, false, true, true, true, out filletArc)) { AddAndRefresh(filletArc, ActiveLayerName); } else if (Curve.Fillet((ICurve)firstSelectedEntity, (ICurve)secondSelectedEntity, filletRadius, true, false, true, true, out filletArc)) { AddAndRefresh(filletArc, ActiveLayerName); } else if (Curve.Fillet((ICurve)firstSelectedEntity, (ICurve)secondSelectedEntity, filletRadius, true, true, true, true, out filletArc)) { AddAndRefresh(filletArc, ActiveLayerName); } } catch { } #endif ClearAllPreviousCommandData(); } }