public Profile2D GetClosedProfile() { var interasseArc = new Arc2D() { Center = new Point2D(CentroX, CentroY) }; var clockWise = false; var angoloStartRad = GeometryHelper.DegreeToRadian(AngoloStart); var angoloEndRad = GeometryHelper.DegreeToRadian(AngoloStart + AngoloAmpiezza); interasseArc.Radius = RaggioInterasse; interasseArc.ClockWise = false; interasseArc.Start = GeometryHelper.GetCoordinate(angoloStartRad, RaggioInterasse); interasseArc.End = GeometryHelper.GetCoordinate(angoloEndRad, RaggioInterasse); var offset = Larghezza / 2; var arc1 = GeometryHelper.GetParallel(interasseArc, offset, true); arc1.ClockWise = false; var arc2 = GeometryHelper.GetParallel(interasseArc, offset, false); arc2.ClockWise = true; var temp = arc2.Start; arc2.Start = arc2.End; arc2.End = temp; var arcEndCaps = new Arc2D() { Center = interasseArc.End, ClockWise = true, Start = arc1.End, End = arc2.Start, Radius = Larghezza / 2, }; var arcStartCaps = new Arc2D() { Center = interasseArc.Start, ClockWise = true, Start = arc2.End, End = arc1.Start, Radius = Larghezza / 2, }; var profile2D = new Profile2D(); profile2D.AddEntity(arc1); profile2D.AddEntity(arcEndCaps); profile2D.AddEntity(arc2); profile2D.AddEntity(arcStartCaps); arc1.PlotStyle = arc2.PlotStyle = arcStartCaps.PlotStyle = arcEndCaps.PlotStyle = EnumPlotStyle.Element; return(profile2D); }
///// <summary> ///// Raccorda elementi 2D dove primo elemento è linea e secondo è arco. ///// </summary> ///// <param name="line"></param> ///// <param name="arc"></param> ///// <param name="radiusValue"></param> ///// <param name="radiusSuccess"></param> ///// <returns></returns> //private static IEnumerable<IEntity2D> CreateChamfer(Line2D line, Arc2D arc, double radiusValue, out bool radiusSuccess) //{ // Arc2D filletArc = null; // var rsl = GeometryHelper.FilletEntity(arc, line, radiusValue, true, out filletArc); // if (rsl) // { // var lineWithRadius = new List<IEntity2D>(); // arc.Start = filletArc.End; // line.End = filletArc.Start; // lineWithRadius.Add(line); // lineWithRadius.Add(filletArc); // foreach (var entity2D in lineWithRadius) // entity2D.PlotStyle = line.PlotStyle; // radiusSuccess = true; // return lineWithRadius; // } // radiusSuccess = false; // return null; //} /// <summary> /// Risolve il profilo, se ci sono problemi ritorna profilo fino al problema. /// Poi dice dove è errore, dove metto errore ? nel IRawMove2D ?? /// </summary> /// <returns></returns> public Profile2D GetProfileResult(bool closed) { /* * closed indica se il profilo che serve è chiuso o meno.. * * è già settato con costruttore. * */ if (Count == 0) { return(null); } var rslt = UpdateCycle(); var profile = new Profile2D(); foreach (var entity2D in rslt) { profile.AddEntity(entity2D); } return(profile); }
public Profile2D GetClosedProfile() { var cerchio = new Arc2D { Center = new Point2D(CentroX, CentroY), Radius = Raggio, ClockWise = false, Start = { X = CentroX + Raggio }, End = { X = CentroX + Raggio }, }; cerchio.Start.Y = CentroY; cerchio.End.Y = CentroY; var profile2D = new Profile2D(); profile2D.AddEntity(cerchio); cerchio.PlotStyle = EnumPlotStyle.Element; return(profile2D); }
/// <summary> /// Come anteprima creo rettangolo.. /// </summary> /// <returns></returns> protected override List <IEntity3D> GetFinalPreview() { var diaExt = MaschiaturaSelezionata.DiametroMetrico; var passo = MaschiaturaSelezionata.Passo; var diaMin = diaExt - passo; var zIni = ZIniziale; var zEnd = ZIniziale - LunghezzaFiletto; var p = new Profile2D(); var l1 = new Line2D { Start = new Point2D { X = zIni, Y = diaExt, }, End = new Point2D { X = zEnd, Y = diaExt, } }; var l2 = new Line2D { Start = l1.End, End = new Point2D { X = zEnd, Y = diaMin, } }; var l3 = new Line2D { Start = l2.End, End = new Point2D { X = zIni, Y = diaMin, } }; var l4 = new Line2D { Start = l3.End, End = l1.Start, }; p.AddEntity(l1); p.AddEntity(l2); p.AddEntity(l3); p.AddEntity(l4); p.SetPlotStyle(); var l = Entity3DHelper.Get3DProfile(p.Source); return(new List <IEntity3D>(l)); }