public void AddDimensionDistance(DES_CotationDistance dimension) { PicCotation.CotType type = PicCotation.CotType.COT_DISTANCE; if (Math.Abs(dimension._dir) < 1.0) { type = PicCotation.CotType.COT_HORIZONTAL; } else if (Math.Abs(dimension._dir - 90.0) < 1.0) { type = PicCotation.CotType.COT_VERTICAL; } else { type = PicCotation.CotType.COT_DISTANCE; } Factory.AddCotation( type , dimension._grp, dimension._layer , new Vector2D(dimension.X1, dimension.Y1) , new Vector2D(dimension.X2, dimension.Y2) , dimension._offset , dimension._text , dimension._noDecimals); }
/// <summary> /// Create new horizontal cotation /// </summary> /// <param name="grp">Group</param> /// <param name="layer">Layer</param> /// <param name="pt0">First extremity</param> /// <param name="pt1">Second extremity</param> /// <param name="offset">Offset</param> /// <returns></returns> public PicCotation AddCotation(PicCotation.CotType cotationType, short grp, short layer, Vector2D pt0, Vector2D pt1, double offset, string text, short noDecimals) { PicCotation cotation; switch (cotationType) { case PicCotation.CotType.COT_DISTANCE: cotation = PicCotationDistance.CreateNewCotation(GetNewEntityId(), pt0, pt1, offset, noDecimals); break; case PicCotation.CotType.COT_HORIZONTAL: cotation = PicCotationHorizontal.CreateNewCotation(GetNewEntityId(), pt0, pt1, offset, noDecimals); break; case PicCotation.CotType.COT_VERTICAL: cotation = PicCotationVertical.CreateNewCotation(GetNewEntityId(), pt0, pt1, offset, noDecimals); break; default: throw new Exception("Invalid cotation type"); } cotation.Group = grp; cotation.Layer = layer; cotation.Text = text; AddEntity(cotation); return(cotation); }
public override void ProcessEntity(PicEntity entity) { if (entity is PicPoint point) { FactoryOut.AddPoint(point.LineType, point.Group, point.Layer, Multiplicator * point.Coord); } else if (entity is PicSegment seg) { FactoryOut.AddSegment(seg.LineType, seg.Group, seg.Layer, Multiplicator * seg.Pt0, Multiplicator * seg.Pt1); } else if (entity is PicArc arc) { FactoryOut.AddArc(arc.LineType, arc.Group, arc.Layer, Multiplicator * arc.Center, Multiplicator * arc.Radius, arc.AngleBeg, arc.AngleEnd); } else if (entity is PicNurb nurb) { FactoryOut.AddNurb(nurb.LineType, nurb.Group, nurb.Layer); } else if (entity is PicCotationDistance cotDist) { PicCotation.CotType eCotType = PicCotation.CotType.COT_DISTANCE;; if (entity is PicCotationDistance) { eCotType = PicCotation.CotType.COT_DISTANCE; } else if (entity is PicCotationHorizontal) { eCotType = PicCotation.CotType.COT_HORIZONTAL; } else if (entity is PicCotationVertical) { eCotType = PicCotation.CotType.COT_VERTICAL; } FactoryOut.AddCotation(eCotType, cotDist.Group, cotDist.Layer, Multiplicator * cotDist.Pt0, Multiplicator * cotDist.Pt1, Multiplicator * cotDist.Offset, cotDist.Text, 1); } }
public PicCotation AddCotation(PicCotation.CotType cotationType, short grp, short layer, double x0, double y0, double x1, double y1, double offset, string text) { return(AddCotation(cotationType, grp, layer, new Vector2D(x0, y0), new Vector2D(x1, y1), offset, text, 1)); }