public ImpositionTool(IEntityContainer container) { _initialEntities = container; using (PicFactory factory = new PicFactory(container)) { // compute lengthes PicVisitorDieCutLength visitor = new PicVisitorDieCutLength(); factory.ProcessVisitor(visitor); Dictionary <PicGraphics.LT, double> lengthes = visitor.Lengths; _unitLengthCut = lengthes.ContainsKey(PicGraphics.LT.LT_CUT) ? visitor.Lengths[PicGraphics.LT.LT_CUT] : 0.0; _unitLengthFold = lengthes.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitor.Lengths[PicGraphics.LT.LT_CREASING] : 0.0; // compute area try { PicToolArea picToolArea = new PicToolArea(); factory.ProcessTool(picToolArea); _unitArea = picToolArea.Area; } catch (PicToolTooLongException /*ex*/) { _unitArea = 0; } } }
public void CreateEntities(PicFactory factory) { if (!(listBoxSolutions.SelectedItem is ImpositionSolution solution)) { return; } solution.CreateEntities(factory); // insert dimensions short grp = 0; if (PicCotation.GetBBCotations(solution.Bbox, CotTypeBB, 0.1, out Vector2D pt0, out Vector2D pt1, out Vector2D pt2, out Vector2D pt3, out double delta0, out double delta1)) { PicCotationDistance cotH = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, pt0, pt1, delta0, "", 1) as PicCotationDistance; cotH.UseShortLines = true; cotH.Auto = true; PicCotationDistance cotV = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, pt2, pt3, delta1, "", 1) as PicCotationDistance; cotV.UseShortLines = true; cotV.Auto = true; } if (null != Format && PicCotation.GetBBCotations(new Box2D(solution.CardboardPosition, solution.CardboardDimensions), CotTypeFormat, 0.1, out Vector2D ptf0, out Vector2D ptf1, out Vector2D ptf2, out Vector2D ptf3, out double deltaf0, out double deltaf1)) { PicCotationDistance cotH = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, ptf0, ptf1, deltaf0, "", 1) as PicCotationDistance; cotH.UseShortLines = true; cotH.Auto = false; PicCotationDistance cotV = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, ptf2, ptf3, deltaf1, "", 1) as PicCotationDistance; cotV.UseShortLines = true; cotV.Auto = false; } factory.InsertCardboardFormat(solution.CardboardPosition, solution.CardboardDimensions); }
public void Dimensions(ParameterStack stack, out double width, out double height, out double lengthCut, out double lengthFold) { // build factory PicFactory factory = new PicFactory(); Component.CreateFactoryEntities(factory, stack); if (ReflexionX) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (ReflexionY) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } // get bounding box PicVisitorBoundingBox visitorBoundingBox = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitorBoundingBox, ShowCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation); Box2D box = visitorBoundingBox.Box; width = box.Width; height = box.Height; // get length PicVisitorDieCutLength visitorLength = new PicVisitorDieCutLength(); factory.ProcessVisitor(visitorLength, PicFilter.FilterNone); lengthCut = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CUT) ? visitorLength.Lengths[PicGraphics.LT.LT_CUT] : 0.0; lengthFold = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitorLength.Lengths[PicGraphics.LT.LT_CREASING] : 0.0; }
private void LoadDrawing(string filePath, string fileExt) { factoryViewCtrl.Visible = true; PicFactory factory = factoryViewCtrl.Factory; if (string.Equals("des", fileExt, StringComparison.CurrentCultureIgnoreCase)) { PicLoaderDes picLoaderDes = new PicLoaderDes(factory); using (DES_FileReader fileReader = new DES_FileReader()) fileReader.ReadFile(filePath, picLoaderDes); // remove existing quotations factory.Remove((new PicFilterCode(PicEntity.eCode.PE_COTATIONDISTANCE)) | (new PicFilterCode(PicEntity.eCode.PE_COTATIONHORIZONTAL)) | (new PicFilterCode(PicEntity.eCode.PE_COTATIONVERTICAL))); // build autoquotation PicAutoQuotation.BuildQuotation(factory); } else if (string.Equals("dxf", fileExt, StringComparison.CurrentCultureIgnoreCase)) { using (PicLoaderDxf picLoaderDxf = new PicLoaderDxf(factory)) { picLoaderDxf.Load(filePath); picLoaderDxf.FillFactory(); } } // update factoryViewCtrl factoryViewCtrl.FitView(); }
public static void Generate(string pluginPath, out Image bmp, Size size, PicFilter filter) { // instantiate factory PicFactory factory = new PicFactory(); factory.Clear(); // instantiate plugin Pic.Plugin.PluginServices pluginHost = new Pic.Plugin.PluginServices(pluginPath); IPlugin plugin = pluginHost.GetFirstPlugin(); // generate entities ParameterStack stack = plugin.Parameters; plugin.CreateFactoryEntities(factory, stack); // get bounding box PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); // draw image PicGraphicsImage picImage = new PicGraphicsImage(); picImage.ImageSize = size; PicBox2D box = visitor.Box; box.AddMarginRatio(0.05); picImage.DrawingBox = box; factory.Draw(picImage, filter); bmp = picImage.Bitmap; }
public void GenerateImage(Size size, ParameterStack stack, out Image bmp) { // check if plugin was instantiated if (null == Component) { throw new Exception("No valid plugin instance loaded!"); } // instantiate factory PicFactory factory = new PicFactory(); // generate entities Component.CreateFactoryEntities(factory, stack); // apply any needed transformation if (ReflexionX) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (ReflexionY) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } // draw image PicGraphicsImage picImage = new PicGraphicsImage(size, Factory2D.Tools.BoundingBox(factory, 0.05)); factory.Draw(picImage, ShowCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation); bmp = picImage.Bitmap; }
public PicLoaderDes(PicFactory factory) { // initialize data member factory _factory = factory; // clear factory before loading data _factory.Clear(); }
public void CreateEntities(PicFactory factory) { ImpositionSolution solution = listBoxSolutions.SelectedItem as ImpositionSolution; if (null == solution) return; solution.CreateEntities(factory); factory.InsertCardboardFormat(solution.CardboardPosition, solution.CardboardDimensions); }
public void BuildLayout() { using (PicFactory factory = new PicFactory()) { // build factory entities Component.CreateFactoryEntities(factory, CurrentParameterStack); if (ReflectionX) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (ReflectionY) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } var form = new FormImposition() { FormatLoader = CardboardFormatLoader, Factory = factory, Offset = Component.ImpositionOffset(CurrentParameterStack) }; if (DialogResult.OK == form.ShowDialog()) { } } }
private bool LoadDrawing(string filePath) { try { // show factory viewer control _factoryViewer.Visible = true; // get factory reference PicFactory factory = _factoryViewer.Factory; // clear factory factory.Clear(); string fileExt = System.IO.Path.GetExtension(filePath).ToLower(); if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase)) { // load des file DES_FileReader fileReader = new DES_FileReader(); PicLoaderDes picLoader = new PicLoaderDes(factory); fileReader.ReadFile(filePath, picLoader); } else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase)) { // load dxf file PicLoaderDxf picLoader = new PicLoaderDxf(factory); picLoader.Load(filePath); picLoader.FillFactory(); } // fit view to loaded entities _factoryViewer.FitView(); } catch (Exception /*ex*/) { } return(true); }
public void GenerateImage(Size size, ParameterStack stack, out Image bmp) { // check if plugin was instantiated if (null == _component) { throw new Exception("No valid plugin instance loaded!"); } // instantiate factory PicFactory factory = new PicFactory(); // generate entities _component.CreateFactoryEntities(factory, stack); // apply any needed transformation if (_reflexionX) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (_reflexionY) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } // get bounding box PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); Pic.Factory2D.Box2D box = visitor.Box; box.AddMarginRatio(0.05); // draw image PicGraphicsImage picImage = new PicGraphicsImage(size, box); factory.Draw(picImage, _showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation); bmp = picImage.Bitmap; }
public static void GenerateImage(Size size, string filePath, string thumbnailFilePath) { // load file PicFactory factory = new PicFactory(); string fileExt = System.IO.Path.GetExtension(filePath); if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase)) { PicLoaderDes picLoaderDes = new PicLoaderDes(factory); using (DES_FileReader fileReader = new DES_FileReader()) fileReader.ReadFile(filePath, picLoaderDes); } else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase)) { using (PicLoaderDxf picLoaderDxf = new PicLoaderDxf(factory)) { picLoaderDxf.Load(filePath); picLoaderDxf.FillFactory(); } } // draw image Image bmp; ThumbnailGenerator.GenerateImage(size, factory, false, out bmp); bmp.Save(thumbnailFilePath); }
public PicLoaderDes(PicFactory factory) { // initialize data member factory Factory = factory; // clear factory before loading data Factory.Clear(); }
public override void Initialize(PicFactory factory) { _exporter.Initialize(); // PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); _exporter.SetBoundingBox(visitor.Box.XMin, visitor.Box.YMin, visitor.Box.XMax, visitor.Box.YMax); }
public void CreateEntities(PicFactory factory) { if (!(listBoxSolutions.SelectedItem is ImpositionSolution solution)) { return; } solution.CreateEntities(factory); factory.InsertCardboardFormat(solution.CardboardPosition, solution.CardboardDimensions); }
public override void Initialize(PicFactory factory) { _exporter.Initialize(); _exporter.AuthoringTool = _authoringTool; // set bounding box Box2D bbox = Tools.BoundingBox(factory, 0.0); _exporter.SetBoundingBox(bbox.XMin, bbox.YMin, bbox.XMax, bbox.YMax); }
/* * internal ImpositionPattern GeneratePattern(int id, Vector2D minDistance, Vector2D impositionOffset, bool orthoImp) * { * ImpositionPattern pattern = null; * * KeyValuePair<int, bool> kvpIndexOrtho = new KeyValuePair<int, bool>(id, orthoImp); * switch (id) * { * case 0: pattern = new PatternDefault(); break; * case 1: pattern = new PatternRotationInRow(); break; * case 2: pattern = new PatternRotationInColumn(); break; * } * return pattern; * } */ #endregion #region Public methods public bool GenerateEntities(string patternName, bool orthogonalImposition, ref PicFactory factory) { ImpositionPattern pattern = GetPatternByName(patternName); pattern.GeneratePattern(InitialEntities, SpaceBetween, ImpositionOffset, orthogonalImposition); ImpositionSolution solution = GenerateSolution(pattern, orthogonalImposition); solution.CreateEntities(factory); return(true); }
public static void GenerateImage(Size size, PicFactory factory, bool showCotations, out Image bmp) { // get bounding box Box2D box = Tools.BoundingBox(factory, 0.05); // draw image PicGraphicsImage picImage = new PicGraphicsImage(size, box); factory.Draw(picImage, showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation); bmp = picImage.Bitmap; }
public static void GenerateImage(Size size, PicFactory factory, bool showCotations, out Image bmp) { // get bounding box PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); Box2D box = visitor.Box; box.AddMarginRatio(0.05); // draw image PicGraphicsImage picImage = new PicGraphicsImage(size, box); factory.Draw(picImage, showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation); bmp = picImage.Bitmap; }
public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { double L = stack.GetDoubleParameterValue("L"); double H = stack.GetDoubleParameterValue("H"); double R = stack.GetDoubleParameterValue("R"); bool Rounding0 = stack.GetBoolParameterValue("Rounding0"); bool Rounding1 = stack.GetBoolParameterValue("Rounding1"); bool Rounding2 = stack.GetBoolParameterValue("Rounding2"); bool Rounding3 = stack.GetBoolParameterValue("Rounding3"); double Ang = stack.GetDoubleParameterValue("Angle") * Math.PI / 180.0; // segments PicFactory fTemp = new PicFactory(); List <PicEntity> entityList = new List <PicEntity>(); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(0.0, 0.0) , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang)) , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang)) , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang)) , new Vector2D(0.0, 0.0))); if (Rounding0) { fTemp.ProcessTool(new PicToolRound(entityList[0], entityList[1], R)); } if (Rounding1) { fTemp.ProcessTool(new PicToolRound(entityList[1], entityList[2], R)); } if (Rounding2) { fTemp.ProcessTool(new PicToolRound(entityList[2], entityList[3], R)); } if (Rounding3) { fTemp.ProcessTool(new PicToolRound(entityList[3], entityList[0], R)); } factory.AddEntities(fTemp, transform); }
public void GenerateThumbnail() { using (PicFactory factory = new PicFactory()) { CreateEntities(factory); // insert format factory.InsertCardboardFormat(CardboardPosition, CardboardDimensions); // draw thumbnail PicGraphicsImage picImage = new PicGraphicsImage(new Size(ThumbnailWidth, ThumbnailWidth), Tools.BoundingBox(factory, PicFilter.FilterNone, 0.01)); factory.Draw(picImage); // save thumbnail Thumbnail = picImage.Bitmap; } }
// global quotation private void BuildGlobalQuotation(PicFactory factory, short grp, Box2D box) { if (!box.IsValid) { return; } double delta = 0.1 * Math.Max(box.Width, box.Height); PicCotationDistance cotH = factory.AddCotation(PicCotation.CotType.COT_HORIZONTAL, grp, 0, box.PtMin, new Vector2D(box.XMax, box.YMin), -delta, "", 1) as PicCotationDistance; cotH.UseShortLines = true; PicCotationDistance cotV = factory.AddCotation(PicCotation.CotType.COT_VERTICAL, grp, 0, box.PtMin, new Vector2D(box.XMin, box.YMax), delta, "", 1) as PicCotationDistance; cotV.UseShortLines = true; }
public static void ProcessEntities(PicFactory factory, Dictionary <PicGraphics.LT, CutTool> dictTool, ref List <PicTypedDrawable> entities) { if (null == entities) { entities = new List <PicTypedDrawable>(); } entities.Clear(); // get factory bounding box PicVisitorBoundingBox visitorBBox = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitorBBox, new PicFilterTypedDrawable()); // translate factory PicVisitorTransform visitorTranslation = new PicVisitorTransform(Transform2D.Translation(-visitorBBox.Box.PtMin)); factory.ProcessVisitor(visitorTranslation, new PicFilter()); // sort entities by type Vector2D currentPt = Vector2D.Zero; foreach (PicGraphics.LT lt in dictTool.Keys) { // get entities with linetype = lt PicVisitorCollectTypedDrawables visitorCollect = new PicVisitorCollectTypedDrawables(); factory.ProcessVisitor(visitorCollect, new PicFilterLineType(lt)); List <PicTypedDrawable> tempList1 = visitorCollect.Entities; // move entities from tempList1 to tempList2 from point to point List <PicTypedDrawable> tempList2 = new List <PicTypedDrawable>(); while (tempList1.Count > 0) { int index = 0; double minDist = double.MaxValue; for (int i = 0; i < tempList1.Count; ++i) { double dist = DistanceEntityPt(tempList1[i], currentPt); if (dist < minDist) { index = i; minDist = dist; } } currentPt = OppositePoint(tempList1[index], currentPt); tempList2.Add(tempList1[index]); tempList1.RemoveAt(index); } // concatenate list entities.AddRange(tempList2); } }
public PicFactory GetFactory() { PicFactory factory = new PicFactory(); Component.CreateFactoryEntities(factory, CurrentParameterStack); if (_reflectionX) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); } if (_reflectionY) { factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); } return(factory); }
public static void BuildQuotation(PicFactory factory) { PicAutoQuotation autoQuotation = new PicAutoQuotation(); for (short grp = 0; grp < 16; ++grp) { // get min max box grp PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor, new PicFilterGroup(grp)); autoQuotation.BuildHQuotation(factory, grp, visitor.Box); autoQuotation.BuildVQuotation(factory, grp, visitor.Box); autoQuotation.BuildGlobalQuotation(factory, grp, visitor.Box); } }
private void onShowForm(object sender, EventArgs e) { try { PicFactory factory = new PicFactory(); PicLoaderDes picLoaderDes = new PicLoaderDes(factory); using (DES_FileReader fileReader = new DES_FileReader()) fileReader.ReadFile(FilePath, picLoaderDes); Generator.ShowProcessor(factory, "test"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public override void Initialize(PicFactory factory) { _box.Reset(); try { if (null != factory.Format) _box.Extend(factory.Format.Box); else if (factory.IsEmpty) _box.Extend(Sharp3D.Math.Core.Vector2D.Zero); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private bool LoadDrawing(string filePath) { try { // show factory viewer control factoryViewer.Visible = true; // get factory reference PicFactory factory = factoryViewer.Factory; // clear factory factory.Clear(); string fileExt = System.IO.Path.GetExtension(filePath).ToLower(); if (string.Equals(".des", fileExt, StringComparison.CurrentCultureIgnoreCase)) { // load des file DES_FileReader fileReader = new DES_FileReader(); PicLoaderDes picLoader = new PicLoaderDes(factory); fileReader.ReadFile(filePath, picLoader); } else if (string.Equals(".dxf", fileExt, StringComparison.CurrentCultureIgnoreCase)) { // load dxf file PicLoaderDxf picLoader = new PicLoaderDxf(factory); picLoader.Load(filePath); picLoader.FillFactory(); } else if (string.Equals(".ai", fileExt, StringComparison.CurrentCultureIgnoreCase)) { // load ai file } // fit view to loaded entities factoryViewer.FitView(); if (textBoxName.Text.Length == 0) { textBoxName.Text = System.IO.Path.GetFileNameWithoutExtension(filePath); } if (textBoxDescription.Text.Length == 0) { textBoxDescription.Text = System.IO.Path.GetFileNameWithoutExtension(filePath); } } catch (Exception ex) { _log.Error(ex.ToString()); } return(true); }
public static Box2D BoundingBox(PicFactory factory, double marginRatio = 0.0, bool takePicBlocsIntoAccount = true) { var visitor = new PicVisitorBoundingBox() { TakePicBlocksIntoAccount = takePicBlocsIntoAccount }; factory.ProcessVisitor(visitor, !PicFilter.FilterCotation); Box2D box = visitor.Box; if (box.IsValid && marginRatio > 0.0) { box.AddMarginRatio(marginRatio); } return(box); }
public List <Guid> GetDependancies(ParameterStack stack) { // clear list of dependancies _dependancyList.Clear(); // instanciate handler of ComponentLoader.OnPluginAccessed ComponentLoader.PluginAccessed handler = new ComponentLoader.PluginAccessed(OnGuidLoaded); ComponentLoader.OnPluginAccessed += handler; // instantiate factory PicFactory factory = new PicFactory(); _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity); // on plugin accessed ComponentLoader.OnPluginAccessed -= handler; // dependancy list return(_dependancyList); }
public static DESQuerier LoadFile(string filePath) { if (!File.Exists(filePath)) throw new DESQuerierFileNotFoundException(filePath); // instantiate factory PicFactory factory = new PicFactory(); // instantiate loader PicLoaderDes picLoader = new PicLoaderDes(factory); // load file DesLib4NET.DES_FileReader reader = new DES_FileReader(); reader.ReadFile(filePath, picLoader); // test for valid entities // return DESQuerier return new DESQuerier(factory); }
public void ComputeLengthCutFold() { if (_lengthCut <= 0) { _lengthCut = 0.0; using (PicFactory factory = new PicFactory()) { // fill factory with entities CreateEntities(factory); // counting added length only PicVisitorComputeLength visitorComputeLength = new PicVisitorComputeLength(); factory.ProcessVisitor(visitorComputeLength /*, new PicFilterLineType(PicGraphics.LT.LT_CUT)*/); // cut length _lengthCut = visitorComputeLength.Length; } } }
/// <summary> /// Initialize DES_Writer object /// </summary> /// <param name="factory"></param> public override void Initialize(PicFactory factory) { // save factory _factory = factory; // build .des file header DES_Header header = new DES_Header(); PicVisitorBoundingBox bbVisitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(bbVisitor); header._xmin = (float)bbVisitor.Box.XMin; header._xmax = (float)bbVisitor.Box.XMax; header._ymin = (float)bbVisitor.Box.YMin; header._ymax = (float)bbVisitor.Box.YMax; // initialize des writer _desWriter = new DES_WriterMem(header); DES_SuperBaseHeader superBaseHeader = new DES_SuperBaseHeader(); _desWriter.WriteSuperBaseHeader(superBaseHeader); }
private void LoadDrawing(string filePath, string fileExt) { _log.Info($"Loading file {filePath}..."); if (!System.IO.File.Exists(filePath)) { _log.Error($"File ({filePath}) does not exist."); return; } factoryViewCtrl.Visible = true; PicFactory factory = factoryViewCtrl.Factory; switch (fileExt.ToLower()) { case "des": { PicLoaderDes picLoaderDes = new PicLoaderDes(factory); using (DES_FileReader fileReader = new DES_FileReader()) fileReader.ReadFile(filePath, picLoaderDes); // remove existing quotations factory.Remove((new PicFilterCode(PicEntity.ECode.PE_COTATIONDISTANCE)) | (new PicFilterCode(PicEntity.ECode.PE_COTATIONHORIZONTAL)) | (new PicFilterCode(PicEntity.ECode.PE_COTATIONVERTICAL))); // build autoquotation PicAutoQuotation.BuildQuotation(factory); } break; case "dxf": { using (PicLoaderDXF picLoaderDxf = new PicLoaderDXF(factory)) { if (!picLoaderDxf.Load(filePath)) { return; } } } break; default: break; } // update factoryViewCtrl factoryViewCtrl.FitView(); }
/// <summary> /// Initialize DES_Writer object /// </summary> /// <param name="factory"></param> public override void Initialize(PicFactory factory) { // save factory _factory = factory; // build .des file header DES_Header header = new DES_Header(); Box2D bbox = Tools.BoundingBox(factory, 0.0); header._xmin = (float)bbox.XMin; header._xmax = (float)bbox.XMax; header._ymin = (float)bbox.YMin; header._ymax = (float)bbox.YMax; // initialize des writer _desWriter = new DES_WriterMem(header); DES_SuperBaseHeader superBaseHeader = new DES_SuperBaseHeader(); _desWriter.WriteSuperBaseHeader(superBaseHeader); }
public void CreateEntities(PicFactory factory) { PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT; PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING; // free variables double B = this.ParamB; double H = this.ParamH; double L = this.ParamL; double ep = this.ParamEp; double hpr = this.ParamHpr; double hr = this.ParamHr; double lp = this.ParamLp; // formulas double b1 = B / 2; double b2 = L / 4; double l2 = L / 2; double Rp = hpr - 1; double Re = (hr / 2) - 3; SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>(); // segments double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0; // 3 : (478.344, 543.631) <-> (465.844, 556.131) x0 = 425.844 + lp + 12.5; y0 = 296.131 + hr + b1 - 12.5; x1 = 425.844 + lp; y1 = 296.131 + hr + b1; entities.Add(3, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 4 : (478.344, 543.631) <-> (478.344, 296.131) x0 = 425.844 + lp + 12.5; y0 = 296.131 + hr + b1 - 12.5; x1 = 425.844 + lp + 12.5; y1 = 296.131; entities.Add(4, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 5 : (478.344, 296.131) <-> (615.844, 296.131) x0 = 425.844 + lp + 12.5; y0 = 296.131; x1 = 425.844 + lp + b2; y1 = 296.131; entities.Add(5, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 6 : (615.844, 296.131) <-> (615.844, 356.131) x0 = 425.844 + lp + b2; y0 = 296.131; x1 = 425.844 + lp + b2; y1 = 296.131 + hr; entities.Add(6, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 7 : (615.844, 356.131) <-> (915.844, 356.131) x0 = 425.844 + lp + b2; y0 = 296.131 + hr; x1 = 425.844 + lp + b2 + l2; y1 = 296.131 + hr; entities.Add(7, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 8 : (915.844, 356.131) <-> (915.844, 296.131) x0 = 425.844 + lp + b2 + l2; y0 = 296.131 + hr; x1 = 425.844 + lp + b2 + l2; y1 = 296.131; entities.Add(8, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 9 : (915.844, 296.131) <-> (1053.34, 296.131) x0 = 425.844 + lp + b2 + l2; y0 = 296.131; x1 = 425.844 + lp + L - 12.5; y1 = 296.131; entities.Add(9, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 10 : (1053.34, 296.131) <-> (1053.34, 543.631) x0 = 425.844 + lp + L - 12.5; y0 = 296.131; x1 = 425.844 + lp + L - 12.5; y1 = 296.131 + hr + b1 - 12.5; entities.Add(10, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 11 : (1053.34, 543.631) <-> (1065.84, 556.131) x0 = 425.844 + lp + L - 12.5; y0 = 296.131 + hr + b1 - 12.5; x1 = 425.844 + lp + L; y1 = 296.131 + hr + b1; entities.Add(11, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 12 : (1065.84, 556.131) <-> (1265.84, 356.131) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + b1; y1 = 296.131 + hr; entities.Add(12, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 13 : (1265.84, 356.131) <-> (1244.5, 328.303) x0 = 425.844 + lp + L + b1; y0 = 296.131 + hr; x1 = 425.844 + lp + L + b1 - 21.3455; y1 = 296.131 + hr - 27.8274; entities.Add(13, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 14 : (1260.37, 296.131) <-> (1453.34, 296.131) x0 = 425.844 + lp + L + b1 - 5.47632; y0 = 296.131; x1 = 425.844 + lp + L + B - 12.5007; y1 = 296.131; entities.Add(14, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 15 : (1453.34, 296.131) <-> (1453.34, 543.631) x0 = 425.844 + lp + L + B - 12.5007; y0 = 296.131; x1 = 425.844 + lp + L + B - 12.5007; y1 = 296.131 + hr + b1 - 12.5; entities.Add(15, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 16 : (1453.34, 543.631) <-> (1465.84, 556.131) x0 = 425.844 + lp + L + B - 12.5007; y0 = 296.131 + hr + b1 - 12.5; x1 = 425.844 + lp + L + B; y1 = 296.131 + hr + b1; entities.Add(16, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 17 : (1465.84, 556.131) <-> (1615.84, 356.131) x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + b2; y1 = 296.131 + hr; entities.Add(17, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 18 : (1615.84, 356.131) <-> (1615.84, 296.131) x0 = 425.844 + lp + L + B + b2; y0 = 296.131 + hr; x1 = 425.844 + lp + L + B + b2; y1 = 296.131; entities.Add(18, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 19 : (1615.84, 296.131) <-> (1915.84, 296.131) x0 = 425.844 + lp + L + B + b2; y0 = 296.131; x1 = 425.844 + lp + L + B + b2 + l2; y1 = 296.131; entities.Add(19, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 20 : (1915.84, 296.131) <-> (1915.84, 356.131) x0 = 425.844 + lp + L + B + b2 + l2; y0 = 296.131; x1 = 425.844 + lp + L + B + b2 + l2; y1 = 296.131 + hr; entities.Add(20, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 21 : (1915.84, 356.131) <-> (2065.84, 556.131) x0 = 425.844 + lp + L + B + b2 + l2; y0 = 296.131 + hr; x1 = 425.844 + lp + L + B + L; y1 = 296.131 + hr + b1; entities.Add(21, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 22 : (2065.85, 556.131) <-> (2078.35, 543.631) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L + 12.5024; y1 = 296.131 + hr + b1 - 12.5; entities.Add(22, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 23 : (2078.35, 543.631) <-> (2078.35, 296.131) x0 = 425.844 + lp + L + B + L + 12.5024; y0 = 296.131 + hr + b1 - 12.5; x1 = 425.844 + lp + L + B + L + 12.5024; y1 = 296.131; entities.Add(23, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 24 : (2078.35, 296.131) <-> (2271.32, 296.131) x0 = 425.844 + lp + L + B + L + 12.5022; y0 = 296.131; x1 = 425.844 + lp + L + B + L + b1 + 5.47681; y1 = 296.131; entities.Add(24, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 25 : (2287.19, 328.304) <-> (2265.84, 356.131) x0 = 425.844 + lp + L + B + L + b1 + 21.3457; y0 = 296.131 + hr - 27.8272; x1 = 425.844 + lp + L + B + L + b1; y1 = 296.131 + hr; entities.Add(25, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 26 : (2265.84, 356.131) <-> (2465.84, 556.131) x0 = 425.844 + lp + L + B + L + b1; y0 = 296.131 + hr; x1 = 425.844 + lp + L + B + L + B; y1 = 296.131 + hr + b1; entities.Add(26, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 27 : (1065.84, 846.131) <-> (1465.84, 846.131) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B; y1 = 296.131 + hr + b1 + H - ep; entities.Add(27, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 28 : (2065.84, 846.131) <-> (2465.84, 846.131) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + L + B; y1 = 296.131 + hr + b1 + H - ep; entities.Add(28, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 29 : (1065.84, 846.131) <-> (1078.34, 856.131) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(29, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 30 : (1065.84, 556.131) <-> (1065.84, 846.131) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L; y1 = 296.131 + hr + b1 + H - ep; entities.Add(30, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 31 : (465.844, 556.131) <-> (465.844, 856.131) x0 = 425.844 + lp; y0 = 296.131 + hr + b1; x1 = 425.844 + lp; y1 = 296.131 + hr + b1 + H; entities.Add(31, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 32 : (465.844, 856.131) <-> (1078.34, 856.131) x0 = 425.844 + lp; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(32, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 33 : (1465.84, 846.131) <-> (1453.34, 856.131) x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B - 12.5007; y1 = 296.131 + hr + b1 + H; entities.Add(33, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 34 : (2065.84, 846.131) <-> (2078.34, 856.131) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + L + 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(34, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 35 : (1465.84, 556.131) <-> (1465.84, 846.131) x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B; y1 = 296.131 + hr + b1 + H - ep; entities.Add(35, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 36 : (2065.84, 556.131) <-> (2065.84, 846.131) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L; y1 = 296.131 + hr + b1 + H - ep; entities.Add(36, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 37 : (465.844, 856.131) <-> (453.344, 868.631) x0 = 425.844 + lp; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp - 12.5; y1 = 296.131 + hr + b1 + H + 12.5; entities.Add(37, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 38 : (465.844, 556.131) <-> (425.844, 556.131) x0 = 425.844 + lp; y0 = 296.131 + hr + b1; x1 = 425.844; y1 = 296.131 + hr + b1; entities.Add(38, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 39 : (425.844, 556.131) <-> (425.844, 856.131) x0 = 425.844; y0 = 296.131 + hr + b1; x1 = 425.844; y1 = 296.131 + hr + b1 + H; entities.Add(39, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 40 : (425.844, 856.131) <-> (465.844, 856.131) x0 = 425.844; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp; y1 = 296.131 + hr + b1 + H; entities.Add(40, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 41 : (2465.84, 556.131) <-> (2465.84, 846.131) x0 = 425.844 + lp + L + B + L + B; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L + B; y1 = 296.131 + hr + b1 + H - ep; entities.Add(41, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 42 : (2465.84, 846.131) <-> (2453.34, 856.131) x0 = 425.844 + lp + L + B + L + B; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + L + B - 12.5024; y1 = 296.131 + hr + b1 + H; entities.Add(42, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 43 : (453.344, 868.631) <-> (453.344, 1256.13) x0 = 425.844 + lp - 12.5; y0 = 296.131 + hr + b1 + H + 12.5; x1 = 425.844 + lp - 12.5; y1 = 296.131 + hr + b1 + H + B; entities.Add(43, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 44 : (453.344, 1256.13) <-> (465.844, 1256.13) x0 = 425.844 + lp - 12.5; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp; y1 = 296.131 + hr + b1 + H + B; entities.Add(44, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 45 : (1465.84, 846.131) <-> (1478.34, 856.131) x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + 12.4993; y1 = 296.131 + hr + b1 + H; entities.Add(45, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 46 : (2065.84, 846.131) <-> (2053.34, 856.131) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + L - 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(46, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 47 : (1478.34, 856.131) <-> (2053.34, 856.131) x0 = 425.844 + lp + L + B + 12.4995; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + L + B + L - 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(47, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 48 : (2453.34, 856.131) <-> (2453.34, 1046.13) x0 = 425.844 + lp + L + B + L + B - 12.5024; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + L + B + L + B - 12.5024; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(48, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 49 : (2078.34, 856.131) <-> (2078.34, 1046.13) x0 = 425.844 + lp + L + B + L + 12.5; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + L + B + L + 12.5; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(49, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 50 : (2078.34, 1046.13) <-> (2453.34, 1046.13) x0 = 425.844 + lp + L + B + L + 12.5; y0 = 296.131 + hr + b1 + H - ep + b1; x1 = 425.844 + lp + L + B + L + B - 12.5024; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(50, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 51 : (1453.34, 856.131) <-> (1453.34, 1046.13) x0 = 425.844 + lp + L + B - 12.5007; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + L + B - 12.5007; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(51, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 52 : (1453.34, 1046.13) <-> (1078.34, 1046.13) x0 = 425.844 + lp + L + B - 12.5007; y0 = 296.131 + hr + b1 + H - ep + b1; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(52, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 53 : (465.844, 1256.13) <-> (465.844, 1276.13) x0 = 425.844 + lp; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp; y1 = 296.131 + hr + b1 + H + B + 20; entities.Add(53, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 54 : (505.844, 1316.13) <-> (1025.84, 1316.13) x0 = 425.844 + lp + 40; y0 = 296.131 + hr + b1 + H + B + hpr; x1 = 425.844 + lp + L - 40; y1 = 296.131 + hr + b1 + H + B + hpr; entities.Add(54, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 55 : (1065.84, 1276.13) <-> (1065.84, 1256.13) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + H + B + 20; x1 = 425.844 + lp + L; y1 = 296.131 + hr + b1 + H + B; entities.Add(55, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 56 : (1065.84, 1256.13) <-> (1078.34, 1256.13) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H + B; entities.Add(56, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 57 : (1065.84, 1256.13) <-> (465.844, 1256.13) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp; y1 = 296.131 + hr + b1 + H + B; entities.Add(57, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 79 : (465.844, 556.131) <-> (1065.84, 556.131) x0 = 425.844 + lp; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L; y1 = 296.131 + hr + b1; entities.Add(79, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 80 : (1065.84, 556.131) <-> (1265.84, 556.131) x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + b1; y1 = 296.131 + hr + b1; entities.Add(80, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 81 : (1265.84, 556.131) <-> (1465.84, 556.131) x0 = 425.844 + lp + L + b1; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B; y1 = 296.131 + hr + b1; entities.Add(81, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 82 : (1465.84, 556.131) <-> (2065.84, 556.131) x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L; y1 = 296.131 + hr + b1; entities.Add(82, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 83 : (2065.85, 556.131) <-> (2265.84, 556.131) x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L + b1; y1 = 296.131 + hr + b1; entities.Add(83, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 84 : (2265.84, 556.131) <-> (2465.84, 556.131) x0 = 425.844 + lp + L + B + L + b1; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + L + B + L + B; y1 = 296.131 + hr + b1; entities.Add(84, factory.AddSegment(ltFold, 0, 1, x0, y0, x1, y1)); // 85 : (1078.34, 1046.13) <-> (1078.34, 856.131) x0 = 425.844 + lp + L + 12.5; y0 = 296.131 + hr + b1 + H - ep + b1; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H; entities.Add(85, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 86 : (1078.34, 1256.13) <-> (1078.34, 1046.13) x0 = 425.844 + lp + L + 12.5; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp + L + 12.5; y1 = 296.131 + hr + b1 + H - ep + b1; entities.Add(86, factory.AddSegment(ltCut, 0, 1, x0, y0, x1, y1)); // 58 : radius = 40 s0 = 54 s1 = 55 factory.ProcessTool(new PicToolRound( entities[54] , entities[55] , Rp // radius )); // 59 : radius = 40 s0 = 53 s1 = 54 factory.ProcessTool(new PicToolRound( entities[53] , entities[54] , Rp // radius )); // 89 : radius = 20 s0 = 13 s1 = 14 factory.ProcessTool(new PicToolRound( entities[13] , entities[14] , Re // radius )); // 90 : radius = 20 s0 = 24 s1 = 25 factory.ProcessTool(new PicToolRound( entities[24] , entities[25] , Re // radius )); // cotations double offset = 0.0; // 60: Pt0 = ( 2257.61, 846.131) Pt1 = ( 2257.61, 1046.13) offset = -8.7301 x0 = 425.844 + lp + L + B + L + b1 - 8.23413; y0 = 296.131 + hr + b1 + H - ep; x1 = 425.844 + lp + L + B + L + b1 - 8.23413; y1 = 296.131 + hr + b1 + H - ep + b1; offset = -8.7301; entities.Add(60, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 5, 1, x0, y0, x1, y1, offset, "")); // 61: Pt0 = ( 856.89, 556.131) Pt1 = ( 856.89, 356.131) offset = -21.0876 x0 = 425.844 + lp + b2 + l2 - 58.9536; y0 = 296.131 + hr + b1; x1 = 425.844 + lp + b2 + l2 - 58.9536; y1 = 296.131 + hr; offset = -21.0876; entities.Add(61, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 62: Pt0 = ( 669.711, 1256.13) Pt1 = ( 669.711, 856.131) offset = -48.2816 x0 = 425.844 + lp + b2 + 53.8672; y0 = 296.131 + hr + b1 + H + B; x1 = 425.844 + lp + b2 + 53.8672; y1 = 296.131 + hr + b1 + H; offset = -48.2816; entities.Add(62, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 93: Pt0 = ( 465.844, 593.295) Pt1 = ( 1065.84, 593.295) offset = 2.71844 x0 = 425.844 + lp; y0 = 296.131 + hr + b1 + 37.1644; x1 = 425.844 + lp + L; y1 = 296.131 + hr + b1 + 37.1644; offset = 2.71844; entities.Add(93, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 94: Pt0 = ( 1065.84, 598.732) Pt1 = ( 1465.84, 598.732) offset = -2.71851 x0 = 425.844 + lp + L; y0 = 296.131 + hr + b1 + 42.6013; x1 = 425.844 + lp + L + B; y1 = 296.131 + hr + b1 + 42.6013; offset = -2.71851; entities.Add(94, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 95: Pt0 = ( 1465.84, 590.577) Pt1 = ( 2065.84, 590.577) offset = 2.71851 x0 = 425.844 + lp + L + B; y0 = 296.131 + hr + b1 + 34.4459; x1 = 425.844 + lp + L + B + L; y1 = 296.131 + hr + b1 + 34.4459; offset = 2.71851; entities.Add(95, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 96: Pt0 = ( 2065.84, 596.014) Pt1 = ( 2465.84, 596.014) offset = 0 x0 = 425.844 + lp + L + B + L; y0 = 296.131 + hr + b1 + 39.8828; x1 = 425.844 + lp + L + B + L + B; y1 = 296.131 + hr + b1 + 39.8828; offset = 0; entities.Add(96, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); // 97: Pt0 = ( 628.84, 856.131) Pt1 = ( 628.84, 556.131) offset = -3.36783 x0 = 425.844 + lp + b2 + 12.996; y0 = 296.131 + hr + b1 + H; x1 = 425.844 + lp + b2 + 12.996; y1 = 296.131 + hr + b1; offset = -3.36783; entities.Add(97, factory.AddCotation(PicCotation.CotType.COT_DISTANCE, 1, 1, x0, y0, x1, y1, offset, "")); }
public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { double L = stack.GetDoubleParameterValue("L"); double H = stack.GetDoubleParameterValue("H"); double R = stack.GetDoubleParameterValue("R"); bool Rounding0 = stack.GetBoolParameterValue("Rounding0"); bool Rounding1 = stack.GetBoolParameterValue("Rounding1"); bool Rounding2 = stack.GetBoolParameterValue("Rounding2"); bool Rounding3 = stack.GetBoolParameterValue("Rounding3"); double Ang = stack.GetDoubleParameterValue("Angle") * Math.PI / 180.0; // segments PicFactory fTemp = new PicFactory(); List<PicEntity> entityList = new List<PicEntity>(); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(0.0, 0.0) , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(L * Math.Cos(Ang), L * Math.Sin(Ang)) , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(L * Math.Cos(Ang) - H * Math.Sin(Ang), L * Math.Sin(Ang) + H * Math.Cos(Ang)) , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang)))); entityList.Add(fTemp.AddSegment( PicGraphics.LT.LT_CUT , new Vector2D(-H * Math.Sin(Ang), H * Math.Cos(Ang)) , new Vector2D(0.0, 0.0))); if (Rounding0) fTemp.ProcessTool(new PicToolRound(entityList[0], entityList[1], R)); if (Rounding1) fTemp.ProcessTool(new PicToolRound(entityList[1], entityList[2], R)); if (Rounding2) fTemp.ProcessTool(new PicToolRound(entityList[2], entityList[3], R)); if (Rounding3) fTemp.ProcessTool(new PicToolRound(entityList[3], entityList[0], R)); factory.AddEntities(fTemp, transform); }
/// <summary> /// /// </summary> /// <param name="factory"></param> public override void ProcessFactory(PicFactory factory) { // will only work with 2 segments if (null == _picSeg0 || null == _picSeg1) throw new NotImplementedException("Only segment entities are supported"); // get inner segments Segment seg0 = new Segment(_picSeg0.Pt0, _picSeg0.Pt1); Segment seg1 = new Segment(_picSeg1.Pt0, _picSeg1.Pt1); // find line intersection and extend segments so that they intersect Intersection2D interobj; if (!IntersectMethods.IntersectLines(seg0, seg1, out interobj) || interobj == null || interobj.Type != Intersection2D.IntersectionType.I2D_POINT) return; Vector2D ptExt = (Vector2D)interobj.Result; seg0 = extendSegment(seg0, ptExt); seg1 = extendSegment(seg1, ptExt); // create parallel segments Segment seg00, seg01; getParalleleSegments(seg0, _radius, out seg00, out seg01); Segment seg10, seg11; getParalleleSegments(seg1, _radius, out seg10, out seg11); // compute intersection if (IntersectMethods.Intersect(seg00, seg10, out interobj)) { } else if (IntersectMethods.Intersect(seg00, seg11, out interobj)) { } else if (IntersectMethods.Intersect(seg01, seg10, out interobj)) { } else if (IntersectMethods.Intersect(seg01, seg11, out interobj)) { } if (interobj == null || interobj.Type != Intersection2D.IntersectionType.I2D_POINT) return; Vector2D ptCenter = (Vector2D)interobj.Result; // get intersection of normal with seg0 if (IntersectMethods.Intersect(seg0, new Segment(ptCenter, ptCenter + new Vector2D(-(seg0.P1 - seg0.P0).Y, (seg0.P1 - seg0.P0).X)), out interobj)) { } else if (IntersectMethods.Intersect(seg0, new Segment(ptCenter, ptCenter + new Vector2D((seg0.P1 - seg0.P0).Y, -(seg0.P1 - seg0.P0).X)), out interobj)) { } else return; if (interobj == null && interobj.Type != Intersection2D.IntersectionType.I2D_POINT) return; Vector2D pt0 = (Vector2D)interobj.Result; if (IntersectMethods.Intersect(seg1, new Segment(ptCenter, ptCenter + new Vector2D(-(seg1.P1 - seg1.P0).Y, (seg1.P1 - seg1.P0).X)), out interobj)) { } else if (IntersectMethods.Intersect(seg1, new Segment(ptCenter, ptCenter + new Vector2D((seg1.P1 - seg1.P0).Y, -(seg1.P1 - seg1.P0).X)), out interobj)) { } else return; if (interobj == null && interobj.Type != Intersection2D.IntersectionType.I2D_POINT) return; Vector2D pt1 = (Vector2D)interobj.Result; // intersection of 2D segments if (!IntersectMethods.Intersect(seg0, seg1, out interobj)) return; if (interobj == null && interobj.Type != Intersection2D.IntersectionType.I2D_POINT) return; Vector2D ptInter = (Vector2D)interobj.Result; // modify segments if ((seg0.P0 - ptInter).GetLength() < (seg0.P1 - ptInter).GetLength()) { _picSeg0.Pt0 = pt0; _picSeg0.Pt1 = seg0.P1; } else { _picSeg0.Pt0 = pt0; _picSeg0.Pt1 = seg0.P0; } if ((seg1.P0 - ptInter).GetLength() < (seg1.P1 - ptInter).GetLength()) { _picSeg1.Pt0 = pt1; _picSeg1.Pt1 = seg1.P1; } else { _picSeg1.Pt0 = pt1; _picSeg1.Pt1 = seg1.P0; } // create new arc of circle if (Vector2D.KrossProduct(pt0 - ptCenter, pt1 - ptCenter) > 0) // go from pt0 to pt1 factory.AddArc(_picSeg0.LineType, _picSeg0.Group, _picSeg0.Layer, ptCenter, pt0, pt1); else // from pt1 to pt0 factory.AddArc(_picSeg0.LineType, _picSeg0.Group, _picSeg0.Layer, ptCenter, pt1, pt0); }
static public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { PicFactory fTemp = new PicFactory(); const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT; const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING; // free variables double A = stack.GetDoubleParameterValue("A"); double B = stack.GetDoubleParameterValue("B"); double H = stack.GetDoubleParameterValue("H"); double e = stack.GetDoubleParameterValue("e"); double g = stack.GetDoubleParameterValue("g"); double hc = stack.GetDoubleParameterValue("hc"); double pr = stack.GetDoubleParameterValue("pr"); // formulas double hp = B / 2 - e; double v9 = g * Tand(15); double v1 = 8; double v2 = 8; double v3 = hp * Tand(15); double r = pr / 4; SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>(); // segments double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0; // 3 : (481.462, 303.394) <-> (481.462, 467.206) x0 = 69.6211 + g + A + B + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(3, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 4 : (223.218, 468.17) <-> (352.341, 468.17) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; entities.Add(4, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 5 : (352.341, 467.206) <-> (480.017, 467.206) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(5, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 6 : (352.34, 302.431) <-> (223.218, 302.431) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; entities.Add(6, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 7 : (352.34, 303.394) <-> (480.017, 303.394) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(7, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 8 : (223.218, 240.761) <-> (101.323, 240.761) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(8, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 9 : (223.218, 211.853) <-> (101.323, 211.853) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(9, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 10 : (352.34, 211.853) <-> (474.235, 211.853) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(10, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 11 : (352.34, 240.761) <-> (474.235, 240.761) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(11, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 12 : (352.341, 530.804) <-> (461.326, 530.804) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; x1 = 69.6211 + g + A + B + A - e - v3; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(12, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 13 : (94.0963, 467.206) <-> (69.6211, 462.388) x0 = 69.6211 + g; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H - v9; entities.Add(13, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 14 : (69.6211, 308.213) <-> (69.6211, 462.388) x0 = 69.6211; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + v9; x1 = 69.6211; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H - v9; entities.Add(14, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 15 : (94.0963, 303.395) <-> (69.621, 308.213) x0 = 69.6211 + g; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + v9; entities.Add(15, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 16 : (223.218, 303.394) <-> (95.542, 303.394) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(16, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 17 : (223.218, 467.206) <-> (95.5415, 467.206) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(17, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 18 : (352.34, 149.701) <-> (474.235, 149.701) x0 = 69.6211 + g + A + B; y0 = 120.793 + g; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g; entities.Add(18, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 19 : (466.489, 120.793) <-> (360.086, 120.793) x0 = 69.6211 + g + A + B + A - e - v2 - v9; y0 = 120.793; x1 = 69.6211 + g + A + B + v9; y1 = 120.793; entities.Add(19, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 20 : (480.017, 467.206) <-> (480.017, 476.842) x0 = 69.6211 + g + A + B + A - e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5; entities.Add(20, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 21 : (474.235, 482.623) <-> (480.017, 476.842) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5; entities.Add(21, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 22 : (474.235, 482.623) <-> (461.326, 530.804) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2; x1 = 69.6211 + g + A + B + A - e - v3; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(22, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 23 : (223.218, 530.804) <-> (114.233, 530.804) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; x1 = 69.6211 + g + e + v3; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(23, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 24 : (95.5415, 467.206) <-> (95.5415, 476.842) x0 = 69.6211 + g + e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5; entities.Add(24, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 25 : (101.323, 482.624) <-> (95.5415, 476.842) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5; entities.Add(25, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 26 : (101.323, 482.624) <-> (114.233, 530.804) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + hp / 5 + v2; x1 = 69.6211 + g + e + v3; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(26, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 27 : (223.218, 149.701) <-> (101.323, 149.701) x0 = 69.6211 + g + A; y0 = 120.793 + g; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g; entities.Add(27, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 28 : (215.473, 120.793) <-> (109.069, 120.793) x0 = 69.6211 + g + A - v9; y0 = 120.793; x1 = 69.6211 + g + e + v2 + v9; y1 = 120.793; entities.Add(28, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 29 : (480.017, 303.394) <-> (480.017, 293.759) x0 = 69.6211 + g + A + B + A - e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5; entities.Add(29, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 30 : (474.235, 287.977) <-> (480.017, 293.759) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2; x1 = 69.6211 + g + A + B + A - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5; entities.Add(30, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 31 : (95.542, 303.394) <-> (95.542, 293.759) x0 = 69.6211 + g + e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5; entities.Add(31, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 32 : (101.323, 287.978) <-> (95.542, 293.759) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5; entities.Add(32, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 33 : (101.323, 149.701) <-> (109.069, 120.793) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g; x1 = 69.6211 + g + e + v2 + v9; y1 = 120.793; entities.Add(33, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 34 : (223.218, 149.701) <-> (215.473, 120.793) x0 = 69.6211 + g + A; y0 = 120.793 + g; x1 = 69.6211 + g + A - v9; y1 = 120.793; entities.Add(34, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 35 : (352.34, 149.699) <-> (360.086, 120.793) x0 = 69.6211 + g + A + B; y0 = 120.793 + g; x1 = 69.6211 + g + A + B + v9; y1 = 120.793; entities.Add(35, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 36 : (474.235, 149.701) <-> (466.489, 120.793) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g; x1 = 69.6211 + g + A + B + A - e - v2 - v9; y1 = 120.793; entities.Add(36, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 37 : (609.621, 303.394) <-> (609.621, 467.206) x0 = 69.6211 + g + A + B + A + B - e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A + B - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(37, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 38 : (94.0963, 467.206) <-> (95.5415, 467.206) x0 = 69.6211 + g; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(38, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 39 : (94.0963, 303.394) <-> (95.542, 303.394) x0 = 69.6211 + g; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(39, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 40 : (94.0963, 303.394) <-> (94.0963, 467.206) x0 = 69.6211 + g; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(40, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 41 : (236.709, 594.401) <-> (338.85, 594.401) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; x1 = 69.6211 + g + A + B - 2 * e - v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; entities.Add(41, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 42 : (340.524, 625.236) <-> (235.034, 625.236) x0 = 69.6211 + g + A + B - 2 * e - v1 + 1.6741; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr; x1 = 69.6211 + g + A + 2 * e + v1 - 1.67455; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr; entities.Add(42, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 43 : (348.524, 617.236) <-> (348.524, 596.328) x0 = 69.6211 + g + A + B - 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr - 8.00006; x1 = 69.6211 + g + A + B - 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(43, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 59 : (227.034, 617.236) <-> (227.034, 596.328) x0 = 69.6211 + g + A + 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + pr - 8; x1 = 69.6211 + g + A + 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(59, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 69 : (338.85, 176.2) <-> (236.709, 176.2) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; x1 = 69.6211 + g + A + 2 * e + v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; entities.Add(69, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 70 : (235.035, 145.365) <-> (339.525, 145.364) x0 = 69.6211 + g + A + 2 * e + v1 - 1.67406; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - pr; x1 = 69.6211 + g + A + B - 2 * e - v1 + 0.674561; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - pr; entities.Add(70, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 71 : (227.035, 153.365) <-> (227.035, 174.272) x0 = 69.6211 + g + A + 2 * e; y0 = 120.793 + g + 3.66388; x1 = 69.6211 + g + A + 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(71, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 73 : (348.525, 174.272) <-> (348.525, 154.364) x0 = 69.6211 + g + A + B - 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + B - 2 * e; y1 = 120.793 + g + 4.66336; entities.Add(73, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 98 : (227.034, 596.328) <-> (223.218, 596.328) x0 = 69.6211 + g + A + 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(98, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 99 : (236.709, 596.328) <-> (227.034, 596.328) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A + 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(99, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 100 : (352.341, 303.394) <-> (352.341, 467.206) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(100, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 101 : (352.341, 467.206) <-> (352.341, 467.399) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(101, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 102 : (223.218, 303.394) <-> (223.218, 467.206) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(102, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 103 : (223.218, 467.206) <-> (223.218, 467.399) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(103, fTemp.AddSegment(ltFold, 1, 1, x0, y0, x1, y1)); // 104 : (480.017, 467.206) <-> (481.462, 467.206) x0 = 69.6211 + g + A + B + A - e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A + B + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(104, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 105 : (481.462, 467.206) <-> (609.621, 467.206) x0 = 69.6211 + g + A + B + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A + B + A + B - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(105, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 106 : (480.017, 303.394) <-> (481.462, 303.394) x0 = 69.6211 + g + A + B + A - e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(106, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 107 : (481.462, 303.394) <-> (609.621, 303.394) x0 = 69.6211 + g + A + B + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; x1 = 69.6211 + g + A + B + A + B - e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(107, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 108 : (352.341, 468.17) <-> (352.341, 467.399) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; entities.Add(108, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 109 : (352.341, 530.804) <-> (352.341, 468.17) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; entities.Add(109, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 110 : (352.341, 596.328) <-> (352.341, 530.804) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(110, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 111 : (223.218, 467.399) <-> (223.218, 468.17) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; entities.Add(111, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 112 : (223.218, 468.17) <-> (223.218, 530.804) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; entities.Add(112, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 113 : (223.218, 530.804) <-> (223.218, 596.328) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + B / 2 - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(113, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 114 : (474.235, 149.701) <-> (474.235, 211.853) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(114, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 115 : (474.235, 211.853) <-> (474.235, 240.761) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(115, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 116 : (474.235, 240.761) <-> (474.235, 287.977) x0 = 69.6211 + g + A + B + A - e - v2; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + A + B + A - e - v2; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2; entities.Add(116, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 117 : (101.323, 149.701) <-> (101.323, 211.853) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(117, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 118 : (101.323, 211.853) <-> (101.323, 240.761) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(118, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 119 : (101.323, 240.761) <-> (101.323, 287.978) x0 = 69.6211 + g + e + v2; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + e + v2; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - hp / 5 - v2; entities.Add(119, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 120 : (223.218, 149.701) <-> (223.218, 174.272) x0 = 69.6211 + g + A; y0 = 120.793 + g; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(120, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 121 : (223.218, 174.272) <-> (223.218, 211.853) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(121, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 122 : (223.218, 211.853) <-> (223.218, 240.761) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(122, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 123 : (223.218, 240.761) <-> (223.218, 302.431) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; entities.Add(123, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 124 : (223.218, 302.431) <-> (223.218, 303.394) x0 = 69.6211 + g + A; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(124, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 125 : (352.34, 149.701) <-> (352.34, 174.272) x0 = 69.6211 + g + A + B; y0 = 120.793 + g; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(125, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 126 : (352.34, 174.272) <-> (352.34, 211.853) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e; entities.Add(126, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 127 : (352.34, 211.853) <-> (352.34, 240.761) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc; entities.Add(127, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 128 : (352.34, 240.761) <-> (352.34, 302.431) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; entities.Add(128, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 129 : (352.34, 302.431) <-> (352.34, 303.394) x0 = 69.6211 + g + A + B; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e; entities.Add(129, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 130 : (338.85, 596.328) <-> (348.524, 596.328) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A + B - 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(130, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 131 : (348.524, 596.328) <-> (352.341, 596.328) x0 = 69.6211 + g + A + B - 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(131, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 132 : (338.85, 592.474) <-> (338.85, 594.401) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A - e; x1 = 69.6211 + g + A + B - 2 * e - v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; entities.Add(132, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 133 : (338.85, 594.401) <-> (338.85, 596.328) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; x1 = 69.6211 + g + A + B - 2 * e - v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; entities.Add(133, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 134 : (236.709, 594.401) <-> (236.709, 592.474) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; x1 = 69.6211 + g + A + 2 * e + v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A - e; entities.Add(134, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 135 : (236.709, 596.328) <-> (236.709, 594.401) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A + e; x1 = 69.6211 + g + A + 2 * e + v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e + H + e + A; entities.Add(135, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 136 : (338.85, 174.272) <-> (348.525, 174.272) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + B - 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(136, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 137 : (348.525, 174.272) <-> (352.341, 174.272) x0 = 69.6211 + g + A + B - 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + B; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(137, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 138 : (227.035, 174.272) <-> (223.218, 174.272) x0 = 69.6211 + g + A + 2 * e; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(138, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 139 : (236.709, 174.272) <-> (227.035, 174.272) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + 2 * e; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(139, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 140 : (236.709, 176.2) <-> (236.709, 174.272) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; x1 = 69.6211 + g + A + 2 * e + v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; entities.Add(140, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 141 : (236.709, 178.127) <-> (236.709, 176.2) x0 = 69.6211 + g + A + 2 * e + v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A + e; x1 = 69.6211 + g + A + 2 * e + v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; entities.Add(141, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 142 : (338.85, 174.272) <-> (338.85, 176.2) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A - e; x1 = 69.6211 + g + A + B - 2 * e - v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; entities.Add(142, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // 143 : (338.85, 176.2) <-> (338.85, 178.127) x0 = 69.6211 + g + A + B - 2 * e - v1; y0 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A; x1 = 69.6211 + g + A + B - 2 * e - v1; y1 = 120.793 + g + B / 2 - 2 * e + hc + B / 2 - e - e - A + e; entities.Add(143, fTemp.AddSegment(ltCut, 1, 1, x0, y0, x1, y1)); // arcs // 44 : radius = 8 s0 = 42 s1 = 43 fTemp.ProcessTool(new PicToolRound( entities[42] , entities[43] , r // radius )); // 60 : radius = 8 s0 = 42 s1 = 59 fTemp.ProcessTool(new PicToolRound( entities[42] , entities[59] , r // radius )); // 72 : radius = 8 s0 = 70 s1 = 71 fTemp.ProcessTool(new PicToolRound( entities[70] , entities[71] , r // radius )); // 144 : radius = 9 s0 = 70 s1 = 73 fTemp.ProcessTool(new PicToolRound( entities[70] , entities[73] , r // radius )); factory.AddEntities(fTemp, transform); }
static void Main(string[] args) { // set up a simple configuration that logs on the console. XmlConfigurator.Configure(); string assemblyName = System.Reflection.Assembly.GetExecutingAssembly().CodeBase; try { _log.Info(assemblyName + " starting..."); const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT; // instantiate factory PicFactory initialFactory = new PicFactory(); ParameterStack stack = Program.Parameters; Program.CreateFactoryEntities(initialFactory, stack, Transform2D.Identity); // imposition double width = 1000.0, height = 1000.0; ImpositionTool impositionTool = new ImpositionToolCardboardFormat(initialFactory, new CardboardFormat(0, "Format1", "Format1", width, height)); impositionTool.SpaceBetween = new Vector2D(0.0, 0.0); impositionTool.Margin = new Vector2D(0.0, 0.0); List<ImpositionSolution> solutions; impositionTool.GenerateSortedSolutionList(null, out solutions); _log.Info(string.Format("{0} : Solutions", solutions.Count)); if (solutions.Count <= 0) return; foreach (ImpositionSolution chosenSolution in solutions) { _log.Info(string.Format("NoRows={0}, NoCols={1}", chosenSolution.Rows, chosenSolution.Cols)); PicFactory factoryOut = new PicFactory(); chosenSolution.CreateEntities(factoryOut); factoryOut.AddSegment(ltCut, new Vector2D(0.0, 0.0), new Vector2D(width, 0.0)); factoryOut.AddSegment(ltCut, new Vector2D(width, 0.0), new Vector2D(width, height)); factoryOut.AddSegment(ltCut, new Vector2D(width, height), new Vector2D(0.0, height)); factoryOut.AddSegment(ltCut, new Vector2D(0.0, height), new Vector2D(0.0, 0.0)); // get bounding box Box2D box = new Box2D(); using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox()) { factoryOut.ProcessVisitor(visitor); box = visitor.Box; } string filePath = Path.Combine(Path.GetTempPath(), "Imposition.bmp"); PicGraphicsImage picImage = new PicGraphicsImage(); picImage.ImageSize = new System.Drawing.Size(4096, 4096); box.AddMargin(1.0); picImage.DrawingBox = box; factoryOut.Draw(picImage); picImage.SaveAs(filePath); System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), filePath); _log.Info(assemblyName + " ending..."); } } catch (Exception ex) { _log.Error(ex.ToString()); } }
static void Main(string[] args) { XmlConfigurator.Configure(); try { // instantiate factory PicFactory factory = new PicFactory(); // load plugins PluginPathData configData = ConfigurationManager.GetSection("PluginSettings") as PluginPathData; if (null == configData) throw new Exception("Failed to load valid PluinPathData object!"); if (!Directory.Exists(configData.Path)) throw new Exception(string.Format("Directory \"{0}\" does not exist.", configData.Path)); ComponentLoader loader = new ComponentLoader(); DirectoryInfo dir = new DirectoryInfo(configData.Path); foreach (FileInfo fileInfo in dir.GetFiles()) { try { Component component = loader.LoadComponent(fileInfo.FullName); if (null == component) continue; System.Console.WriteLine("Name = " + component.Name); System.Console.WriteLine("Description = " + component.Description); System.Console.WriteLine("Author = " + component.Author); System.Console.WriteLine("Source code = " + component.SourceCode); System.Console.WriteLine("------------"); // get thumbnail if (component.HasEmbeddedThumbnail) { string thumbPath = Path.Combine(Path.GetTempPath(), component.Name + "_thumbnail.bmp"); System.Drawing.Bitmap thumbnail = component.Thumbnail; thumbnail.Save(thumbPath); if (launchPaint) System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), "\"" + thumbPath + "\""); } // generate entities ParameterStack stack = component.BuildParameterStack(null); factory.Clear(); component.CreateFactoryEntities(factory, stack); // get bounding box PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); // save string filePath = Path.Combine(Path.GetTempPath(), component.Name + ".jpeg"); PicGraphicsImage picImage = new PicGraphicsImage(); picImage.ImageSize = new System.Drawing.Size(512, 512); Box2D box = visitor.Box; box.AddMargin(5); picImage.DrawingBox = box; factory.Draw(picImage); picImage.SaveAs(filePath); if (launchPaint) System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), "\"" + filePath + "\""); } catch (System.Exception ex) { _log.Debug(ex.Message); } } } catch (System.Exception ex) { _log.Error(ex.ToString()); } }
// private constructor private DESQuerier(PicFactory factory) { _factory = factory; }
public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { PicFactory fTemp = new PicFactory(); // free variables double a0 = stack.GetDoubleParameterValue("a0"); double a1 = stack.GetDoubleParameterValue("a1"); bool bbox = stack.GetBoolParameterValue("bbox"); bool arcDefault = stack.GetBoolParameterValue("Arc default"); bool arcReflX = stack.GetBoolParameterValue("Arc Refl X"); bool arcReflY = stack.GetBoolParameterValue("Arc Refl Y"); bool arcReflXY = stack.GetBoolParameterValue("Arc Refl XY"); bool arcComplement = stack.GetBoolParameterValue("Complement"); if (arcDefault) { PicArc arc0 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1); arc0.Transform(Transform2D.Identity); if (bbox) { Box2D box = arc0.Box; fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0 , box.PtMin.X // x0 , box.PtMin.Y // y0 , box.PtMax.X // x1 , box.PtMin.Y // y1 ); fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0 , box.PtMax.X // x0 , box.PtMin.Y // y0 , box.PtMax.X // x1 , box.PtMax.Y // y1 ); fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0 , box.PtMin.X // x0 , box.PtMax.Y // y0 , box.PtMax.X // x1 , box.PtMax.Y // y1 ); fTemp.AddSegment(PicGraphics.LT.LT_CUT, 0, 0 , box.PtMin.X // x0 , box.PtMin.Y // y0 , box.PtMin.X // x1 , box.PtMax.Y // y1 ); } } if (arcReflY) { PicArc arc1 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1); arc1.Transform(Transform2D.ReflectionY); } if (arcReflX) { PicArc arc2 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1); arc2.Transform(Transform2D.ReflectionX); } if (arcReflXY) { PicArc arc3 = fTemp.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0), 100.0, a0, a1); arc3.Transform(Transform2D.ReflectionX * Transform2D.ReflectionY); } if (arcComplement) { PicArc arc4 = fTemp.AddArc(PicGraphics.LT.LT_COTATION, new Vector2D(0.0, 0.0), 100.0, a0, a1); arc4.Complement(); } // end factory.AddEntities(fTemp, transform); }
public List<Guid> GetDependancies(ParameterStack stack) { // clear list of dependancies _dependancyList.Clear(); // instanciate handler of ComponentLoader.OnPluginAccessed ComponentLoader.PluginAccessed handler = new ComponentLoader.PluginAccessed(OnGuidLoaded); ComponentLoader.OnPluginAccessed += handler; // instantiate factory PicFactory factory = new PicFactory(); _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity); // on plugin accessed ComponentLoader.OnPluginAccessed -= handler; // dependancy list return _dependancyList; }
public override void Initialize(PicFactory factory) { _dictionnaryLength.Clear(); }
public override void Initialize(PicFactory factory) { }
/// <summary> /// Create factory entities /// </summary> /// <param name="factory"></param> /// <param name="stack"></param> public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { // get parameter values double ParamX1 = stack.GetDoubleParameterValue("ParamX1"); double L1 = stack.GetDoubleParameterValue("L1"); double B1 = stack.GetDoubleParameterValue("B1"); double L2 = stack.GetDoubleParameterValue("L2"); double B2 = stack.GetDoubleParameterValue("B2"); double H1 = stack.GetDoubleParameterValue("H1"); double RL = stack.GetDoubleParameterValue("RL"); double RB = stack.GetDoubleParameterValue("RB"); double Xo = stack.GetDoubleParameterValue("Xo"); double Yo = stack.GetDoubleParameterValue("Yo"); double Diro = stack.GetDoubleParameterValue("Diro"); bool Symy = stack.GetBoolParameterValue("Symy"); double m15 = stack.GetDoubleParameterValue("m15"); double m16 = stack.GetDoubleParameterValue("m16"); double decalenc = stack.GetDoubleParameterValue("decalenc"); double encoche = stack.GetDoubleParameterValue("encoche"); int PoignsurTete = stack.GetIntParameterValue("PoignsurTete"); bool caisse_en_2 = stack.GetBoolParameterValue("caisse_en_2"); int caisse_en_4 = stack.GetIntParameterValue("caisse_en_4"); double lgPatte = stack.GetDoubleParameterValue("lgPatte"); IPlugin DemiPatteCol = stack.GetPluginParameterValue("DemiPatteCol"); IPlugin Poignee = stack.GetPluginParameterValue("Poignee"); double HY = 0.0; double ec1 = 0.0, ec2 = 0.0; CalEncoche(ref ec1, ref ec2, m15, m16, decalenc, encoche); if (caisse_en_2 || caisse_en_4 > 0) { B1 = B2; L2 = 0.0; B2 = 0.0; } if (caisse_en_4 == 1 || caisse_en_4 == 3) { B1 = 0.0; RB = RL; L2 = 0.0; B2 = 0.0; } if (caisse_en_4 == 2 || caisse_en_4 == 4) { L1 = B1; RL = RB; B1 = 0.0; L2 = 0.0; B2 = 0.0; } double PX1 = lgPatte; double PX2 = L1; double PX3 = B1; double PX4 = L2; double PX5 = B2; double RBY1 = 0.0, RBY2 = 0.0, RBY3 = 0.0, RBY4 = 0.0, RBY5 = 0.0; double RHY1 = 0.0, RHY2 = 0.0, RHY3 = 0.0, RHY4 = 0.0, RHY5 = 0.0; double patProlong = 0.0; if (Symy) { RBY1 = patProlong; RBY2 = RL; RBY3 = RB; RBY4 = RL; RBY5 = RB; } else { RHY1 = patProlong; RHY2 = RL; RHY3 = RB; RHY4 = RL; RHY5 = RB; } HY = HY + H1; if (caisse_en_2 || caisse_en_4 > 0) { if (PX5 != 0) PX3 = PX5; PX4 = 0; PX5 = 0; RHY4 = 0; RHY5 = 0; RBY4 = 0; RBY5 = 0; } double V0 = 0.0; double v1 = V0 + lgPatte; double v2 = v1 + L1; double v3 = v2 + B1; double v4 = v3 + L2; double V5 = v4 + B2; double V6 = H1; double w0 = 0.0; double w1 = V6 + RL; double w2 = V6 + RB; double w3 = V6 + RL; double w4 = V6 + RB; SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>(); PicFactory fTemp = new PicFactory(); // segments double x1 = 0.0, y1 = 0.0, x2 = 0.0, y2 = 0.0; uint index = 0; const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT; const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING; if (3 == caisse_en_4) { x1 = v1; y1 = V6; x2 = v2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); x1 = v1; y1 = w0; x2 = x1; y2 = w2; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); x1 = x2; y1 = y2; x2 = v2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); x1 = x2; y1 = y2; x2 = x1; y2 = w0; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); } else { x1 = v1; y1 = w0; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); x1 = v2; y1 = w0; x2 = x1; y2 = V6; if (!caisse_en_2 && 0 == caisse_en_4) { entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); x1 = v3; y1 = w0; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); x1 = v4; y1 = w0; x2 = x1; y2 = V6; } if (0 == caisse_en_4) { entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); x1 = v1 + ec2; y1 = V6; x2 = v2 - ec2; } else { x1 = v1 + ec2; y1 = V6; if (caisse_en_4 == 4) x2 = v2 - ec2; else x2 = v2; } y2 = y1; entities.Add(++index, fTemp.AddSegment(ltFold, 1, 1, x1, y1, x2, y2)); if (caisse_en_4 == 4) { x1 = x2; y1 = y2; x2 = x1 + ec1; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); } x1 = v2 + ec1; y1 = V6; if (!caisse_en_2 && caisse_en_4 == 0) x2 = v3 - ec1; else x2 = v3; y2 = y1; if (caisse_en_4 == 0) entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); if (!caisse_en_2 && caisse_en_4 == 0) { // 9 x1 = v3 + ec2; y1 = V6; x2 = v4 - ec2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 10 x1 = v4 + ec1; y1 = V6; x2 = V5; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); } // 11 if (!caisse_en_2 && caisse_en_4 == 0) x1 = V5; else { if (caisse_en_4 == 0) x1 = v3; else x1 = v2; } y1 = w0; x2 = x1; if (caisse_en_4 == 4) y2 = V6; else y2 = w4; entities.Add(++index, fTemp.AddSegment(caisse_en_4 == 4 ? ltFold : ltCut, 1, 1, x1, y1, x2, y2)); if (caisse_en_4 == 4) { x1 = x1 - ec1; x2 = x1; y1 = y2; y2 = w4; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); } if (!caisse_en_2 && caisse_en_4 == 0) { // 12 x1 = x2; y1 = y2; x2 = v4 + ec1; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 13 x1 = x2; y1 = y2; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 14 x1 = x2; y1 = y2; x2 = v4 - ec2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 15 x1 = x2; y1 = y2; x2 = x1; y2 = w3; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 16 x1 = x2; y1 = y2; x2 = v3 + ec2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 17 x1 = x2; y1 = y2; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 18 x1 = x2; y1 = y2; x2 = v3 - ec1; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 19 x1 = x2; y1 = y2; x2 = x1; y2 = w2; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); } // 20 x1 = x2; y1 = y2; y2 = y1; if (caisse_en_4 == 0) { x2 = v2 + ec1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 21 x1 = x2; y1 = y2; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 22 x1 = x2; y1 = y2; x2 = v2 - ec2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 23 x1 = x2; y1 = y2; x2 = x1; y2 = w1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 24 } else { if (caisse_en_4 != 4) x2 = v2; } x1 = x2; y1 = y2; x2 = v1 + ec2; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 25 x1 = x2; y1 = y2; x2 = x1; y2 = V6; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // 26 x1 = x2; y1 = y2; x2 = v1; y2 = y1; entities.Add(++index, fTemp.AddSegment(ltCut, 1, 1, x1, y1, x2, y2)); // Patte de Collage ParameterStack stackDemiPatteCol = DemiPatteCol.Parameters; if (caisse_en_4 != 3) { //Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, 0#, 0#, 0#, False) DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform); } if (caisse_en_4 == 4) { // Call DemiPatteCol(ParamX1, lgPatte, H1, ec1, anglPc, patProlong, L1 + 2 * lgPatte, 0#, 180, True) DemiPatteCol.CreateFactoryEntities(fTemp, stackDemiPatteCol, transform); } } if ((!Symy && PoignsurTete > 0) && caisse_en_4 == 0) { if (L1 < B1) { v1 = lgPatte + L1 / 2.0; v2 = lgPatte + L1 + B1 + L2 / 2.0; } else { v1 = lgPatte + L1 + B1 / 2.0; v2 = lgPatte + L1 + B1 + L2 + B2 / 2.0; } // ParamX1, v1, H1, 0, False ParameterStack stackPoignee = Poignee.Parameters; stackPoignee.SetDoubleParameter("", v1); stackPoignee.SetDoubleParameter("", H1); stackPoignee.SetDoubleParameter("", 0); stackPoignee.SetBoolParameter("", false); Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform); //(ParamX1, v2, H1, 0, False) if (!caisse_en_2) Poignee.CreateFactoryEntities(fTemp, stackPoignee, transform); } factory.AddEntities(fTemp, transform); /* int hom = 0; if (Symy) hom = -1; else hom = 1; //ParamX1.Tranf2d Index(index1), Index(idxcour), Xo, Yo, Diro, hom */ }
/// <summary> /// Initialize string builder with initial sections + line types /// Instantiate DL_Dxf class and DL_Writer class /// </summary> /// <param name="factory"></param> public override void Initialize(PicFactory factory) { DL_Codes.dxfversion version = DL_Codes.dxfversion.AC1012; dw = new DL_Writer(version); dxf = new DL_Dxf(); dxf.writeHeader(dw); dw.sectionEnd(); // opening the table section dw.sectionTables(); // writing viewports dxf.writeVPort(dw); // writing line types dw.tableLineTypes(25); dxf.writeLineType(dw, new DL_LineTypeData("BYBLOCK", 0)); dxf.writeLineType(dw, new DL_LineTypeData("BYLAYER", 0)); dxf.writeLineType(dw, new DL_LineTypeData("CONTINUOUS", 0)); dxf.writeLineType(dw, new DL_LineTypeData("ACAD_ISO02W100", 0)); dxf.writeLineType(dw, new DL_LineTypeData("ACAD_ISO03W100", 0)); dxf.writeLineType(dw, new DL_LineTypeData("ACAD_ISO04W100", 0)); dxf.writeLineType(dw, new DL_LineTypeData("ACAD_ISO05W100", 0)); dxf.writeLineType(dw, new DL_LineTypeData("BORDER", 0)); dxf.writeLineType(dw, new DL_LineTypeData("BORDER2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("BORDERX2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("CENTER", 0)); dxf.writeLineType(dw, new DL_LineTypeData("CENTER2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("CENTERX2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHDOT", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHDOT2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHDOTX2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHED", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHED2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DASHEDX2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DIVIDE", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DIVIDE2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DIVIDEX2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DOT", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DOT2", 0)); dxf.writeLineType(dw, new DL_LineTypeData("DOTX2", 0)); dw.tableEnd(); // writing the layers int numberOfLayers = 3; dw.tableLayers(numberOfLayers); // CUT dxf.writeLayer(dw, new DL_LayerData("L5-113", 0), new DL_Attributes("", // leave empty (int)DL_Codes.dxfcolor.red, // default color 100, // default width "CONTINUOUS")); // default line style // FOLD dxf.writeLayer(dw, new DL_LayerData("L8-123", 0), new DL_Attributes("", // leave empty (int)DL_Codes.dxfcolor.blue, // default color 100, // default width "CONTINUOUS")); // default line style // COTATION dxf.writeLayer(dw, new DL_LayerData("LDM-4", 0), new DL_Attributes("", // leave empty (int)DL_Codes.dxfcolor.green, // default color 100, // default width "CONTINUOUS")); // default line style dw.tableEnd(); dw.sectionEnd(); // write all entities dw.sectionEntities(); }
public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { PicFactory fTemp = new PicFactory(); const PicGraphics.LT ltCut = PicGraphics.LT.LT_CUT; const PicGraphics.LT ltFold = PicGraphics.LT.LT_CREASING; // get parameter values double L = stack.GetDoubleParameterValue("L"); double H = stack.GetDoubleParameterValue("H"); double E = stack.GetDoubleParameterValue("E"); int PoignsurTete = stack.GetMultiParameterValue("PoignsurTete"); short layer = 1; short grp = 1; PicGraphics.LT lt = ltCut; if (PoignsurTete >= 2) { lt = ltFold; layer = 2; } double x1 = (L-H)/2.0; double y1 = 0.0; double x2 = x1 - (L - H); double y2 = y1; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); lt = ltCut; double ry = H / 2.0; double xc = x2; double yc = - H / 2.0; fTemp.AddArc(lt, grp, layer, xc, yc, ry, 90.0, 270.0); x1 = xc; y1 = -H; x2 = x1 + (L - H); y2 = y1; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); ry = H / 2.0; xc = x2; yc = -H / 2.0; fTemp.AddArc(lt, grp, layer, xc, yc, ry, -90.0, 90.0); if (PoignsurTete == 3) { lt = ltCut; x1 = (L - H) / 2.0; y1 = 0.0; x2 = x1; y2 = y1 + E; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); x1 = x2; y1 = y2; x2 = x1 + E; y2 = y1; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); x1 = -(L - H) / 2.0; y1 = 0.0; x2 = x1; y2 = y1 + E; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); x1 = x2; y1 = y2; x2 = x1 - E; y2 = y1; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); lt = ltFold; x2 = x1 + (L - H); y2 = y1; fTemp.AddSegment(lt, grp, layer, x1, y1, x2, y2); } factory.AddEntities(fTemp, transform); }
public void CreateFactoryEntities(PicFactory factory, ParameterStack stack, Transform2D transform) { PicFactory fTemp = new PicFactory(); // free variables double a = stack.GetDoubleParameterValue("a"); double b = stack.GetDoubleParameterValue("b"); double h = stack.GetDoubleParameterValue("h"); double e = stack.GetDoubleParameterValue("e"); double g = stack.GetDoubleParameterValue("g"); int iTop = stack.GetMultiParameterValue("TOP"); int iBot = stack.GetMultiParameterValue("BOTTOM"); double gg = 15.0; // formulas SortedList<uint, PicEntity> entities = new SortedList<uint, PicEntity>(); if (g < 5) { // Glue_flap IPlugin pluginIn = Host.GetPluginByGuid("729625f4-921d-4f72-af43-4248835a59f3"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); gg = stackIn.GetDoubleParameterValue("g"); } else gg = g; //---------- TOP Architecture --------------------- if (iTop == 0) { // Sleeve IPlugin pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("H", h / 2); // H stackIn.SetDoubleParameter("g", gg); // g bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iTop == 1) { // Tuck_end int iTuck = stack.GetMultiParameterValue("TUCK"); IPlugin pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // A stackIn.SetDoubleParameter("b", b); // B stackIn.SetDoubleParameter("h", h / 2); // H stackIn.SetDoubleParameter("e", e); // t stackIn.SetDoubleParameter("g", g); // g if (2 == iTuck) { int iHole = stack.GetMultiParameterValue("HOLE"); stackIn.SetMultiParameter("HOLE", iHole); // Hanging Hole } stackIn.SetDoubleParameter("bp", iTuck); bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iTop == 2) { // Inverted_Tuck_end int iTuck = stack.GetMultiParameterValue("TUCK"); IPlugin pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // A stackIn.SetDoubleParameter("b", b); // B stackIn.SetDoubleParameter("h", h / 2); // H stackIn.SetDoubleParameter("e", e); // t stackIn.SetDoubleParameter("g", g); // g stackIn.SetDoubleParameter("bp", iTuck); bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iTop == 3) { // Edge_Lock int iEdge = stack.GetMultiParameterValue("Edge"); IPlugin pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("g", gg); // g stackIn.SetMultiParameter("Edge", iEdge); // Edge Lock stackIn.SetDoubleParameter("A1", b); // A1 bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iTop == 4) { // Seal_End int iSeal = stack.GetMultiParameterValue("Seal"); IPlugin pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("g", gg); // g stackIn.SetMultiParameter("Seal", iSeal); // Seal End stackIn.SetDoubleParameter("e", e); // e bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } //---------- BOTTOM Architecture --------------------- if (iBot == 0) { // Sleeve IPlugin pluginIn = Host.GetPluginByGuid("da290efa-83a5-4ccd-808c-9a5eec81f36b"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("H", h / 2); // H stackIn.SetDoubleParameter("g", gg); // g bool reflectionX = true, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 1) { // Tuck_end int iBTuck = stack.GetMultiParameterValue("BTUCK"); IPlugin pluginIn = Host.GetPluginByGuid("818567a3-ce01-45f5-b328-04031713c12c"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // A stackIn.SetDoubleParameter("b", b); // B stackIn.SetDoubleParameter("h", h / 2); // H stackIn.SetDoubleParameter("e", e); // t stackIn.SetDoubleParameter("g", g); // g stackIn.SetDoubleParameter("bp", 0.0); if (iBTuck == 2) stackIn.SetDoubleParameter("bp", 0); else stackIn.SetDoubleParameter("bp", iBTuck); bool reflectionX = true, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 2) { // Inverted_Tuck_end int iBTuck = stack.GetMultiParameterValue("BTUCK"); IPlugin pluginIn = Host.GetPluginByGuid("66e5437d-a8a8-404d-951c-e7bf944d2342"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // A stackIn.SetDoubleParameter("b", b); // B stackIn.SetDoubleParameter("h", h / 2); // H stackIn.SetDoubleParameter("e", e); // t stackIn.SetDoubleParameter("g", g); // g stackIn.SetDoubleParameter("bp", 0.0); if (iBTuck == 2) stackIn.SetDoubleParameter("bp", 0); else stackIn.SetDoubleParameter("bp", iBTuck); bool reflectionX = true, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 3) { // Snap_lock_base IPlugin pluginIn = Host.GetPluginByGuid("2c366e1f-35d1-4e72-ba2b-7786e699f94c"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // a stackIn.SetDoubleParameter("b", b); // b stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("g", g); // g bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 4) { // Crash_lock_base IPlugin pluginIn = Host.GetPluginByGuid("2015adce-a857-49c8-b051-b6891b90b941"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("a", a); // a stackIn.SetDoubleParameter("b", b); // b stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("d", e); // d stackIn.SetDoubleParameter("g", g); // g bool reflectionX = false, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(0.0, -h / 2)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 5) { // Edge_Lock int iBEdge = stack.GetMultiParameterValue("BEdge"); IPlugin pluginIn = Host.GetPluginByGuid("827b4625-ccad-41f8-823a-c165852ca8f4"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("e", e); // e stackIn.SetDoubleParameter("g", gg); // g stackIn.SetMultiParameter("Edge", iBEdge); // Edge Lock stackIn.SetDoubleParameter("A1", b); // A1 bool reflectionX = true, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } else if (iBot == 6) { // Seal_End int iBSeal = stack.GetMultiParameterValue("BSeal"); IPlugin pluginIn = Host.GetPluginByGuid("af7fb901-90de-4034-9a27-c21d51f826d2"); ParameterStack stackIn = Host.GetInitializedParameterStack(pluginIn); stackIn.SetDoubleParameter("A", a); // A stackIn.SetDoubleParameter("B", b); // B stackIn.SetDoubleParameter("h", h / 2); // h stackIn.SetDoubleParameter("g", gg); // g stackIn.SetMultiParameter("Seal", iBSeal); // Seal End stackIn.SetDoubleParameter("e", e); // e bool reflectionX = true, reflectionY = false; Transform2D transfReflect = (reflectionY ? Transform2D.ReflectionY : Transform2D.Identity) * (reflectionX ? Transform2D.ReflectionX : Transform2D.Identity); pluginIn.CreateFactoryEntities(fTemp, stackIn, Transform2D.Translation(new Vector2D(gg, 0.0)) * Transform2D.Rotation(0.0) * transfReflect); } factory.AddEntities(fTemp, transform); }
public void GenerateImage(Size size, ParameterStack stack, out Image bmp) { // check if plugin was instantiated if (null == _component) throw new Exception("No valid plugin instance loaded!"); // instantiate factory PicFactory factory = new PicFactory(); // generate entities _component.CreateFactoryEntities(factory, stack); // apply any needed transformation if (_reflexionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); if (_reflexionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); // get bounding box PicVisitorBoundingBox visitor = new PicVisitorBoundingBox(); factory.ProcessVisitor(visitor); Pic.Factory2D.Box2D box = visitor.Box; box.AddMarginRatio(0.05); // draw image PicGraphicsImage picImage = new PicGraphicsImage(size, box); factory.Draw(picImage, _showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation); bmp = picImage.Bitmap; }
public override void ProcessFactory(PicFactory factory) { // initialization _segList.Clear(); _box = new Box2D(); _area = 0.0; // build list of segments with entities that belongs to group factory.ProcessToolAllEntities(this); _box.AddMarginRatio(0.2); // exit if no of segments exceeds MAXSEG int maxSeg = Pic.Factory2D.Properties.Settings.Default.AreaMaxNoSegments; if (_segList.Count > maxSeg) throw new PicToolTooLongException(string.Format("No of segments exceeds {0}", maxSeg)); // compute actual step size uint iNoStep = (uint)(_box.Width / _stepSize); iNoStep = Math.Min(iNoStep, _iNoStepMax); double stepDefault = _box.Width / iNoStep; // compute area for (int i = 0; i < iNoStep; ++i) { double xh = _box.XMin + i * stepDefault; int nby = 1; double stepCurrent = stepDefault; List<double> tabyh = new List<double>(); tabyh.Add(double.MaxValue); bool bAgain = false; do { bAgain = false; stepCurrent = stepDefault; foreach (Segment segTemp in _segList) { Segment seg; if (segTemp.P0.X <= segTemp.P1.X) seg = segTemp; else seg = new Segment(segTemp.P1, segTemp.P0); if (xh >= seg.P0.X && xh <= seg.P1.X) { // cas intersections confondues if ((Math.Abs(xh - seg.P0.X) < 0.001) || (Math.Abs(seg.P1.X - xh) < 0.001)) { // restart loop from the beginning nby = 1; tabyh[0] = double.MaxValue; stepCurrent = 0.9 * stepDefault; xh -= stepDefault * 0.1; bAgain = true; break; } else { double yh = seg.P0.Y + (xh - seg.P0.X) * ((seg.P1.Y - seg.P0.Y) / (seg.P1.X - seg.P0.X)); tabyh.Add(yh); } } } } while (bAgain); tabyh.Sort(); nby = tabyh.Count; // increment area if (nby > 1 && (nby % 2 != 0)) { for (int l = 0; l < nby - 1; l += 2) { _area = _area + stepCurrent * (tabyh[l + 1] - tabyh[l]); } } } }
public void BuildLayout() { Pic.Factory2D.Control.FormImpositionSettings formSettings = new Pic.Factory2D.Control.FormImpositionSettings(); if (null != _cardboardFormatLoader) formSettings.FormatLoader = _cardboardFormatLoader; // get offset Vector2D impositionOffset = Component.ImpositionOffset(CurrentParameterStack); // initialize form with offsets formSettings.OffsetX = impositionOffset.X; formSettings.OffsetY = impositionOffset.Y; if (DialogResult.OK == formSettings.ShowDialog()) { using (PicFactory factory = new PicFactory()) { // build factory entities Component.CreateFactoryEntities(factory, CurrentParameterStack); if (_reflectionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX)); if (_reflectionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY)); // build imposition solutions if (formSettings.Mode == 0) _impositionTool = new ImpositionToolCardboardFormat(factory, formSettings.CardboardFormat); else _impositionTool = new ImpositionToolXY(factory, formSettings.NumberDirX, formSettings.NumberDirY); // -> margins _impositionTool.HorizontalAlignment = formSettings.HorizontalAlignment; _impositionTool.VerticalAlignment = formSettings.VerticalAlignment; _impositionTool.SpaceBetween = new Vector2D(formSettings.ImpSpaceX, formSettings.ImpSpaceY); _impositionTool.Margin = new Vector2D(formSettings.ImpMarginLeftRight, formSettings.ImpMarginBottomTop); _impositionTool.MinMargin = new Vector2D(formSettings.ImpRemainingMarginLeftRight, formSettings.ImpRemainingMarginBottomTop); // -> allowed patterns _impositionTool.AllowRotationInColumnDirection = formSettings.AllowColumnRotation; _impositionTool.AllowRotationInRowDirection = formSettings.AllowRowRotation; // -> offsets _impositionTool.ImpositionOffset = new Vector2D(formSettings.OffsetX, formSettings.OffsetY); // instantiate ProgressWindow and launch process ProgressWindow progress = new ProgressWindow(); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(GenerateImpositionSolutions), progress); progress.ShowDialog(); // show dialog if (null != _solutions && _solutions.Count > 0) { Pic.Factory2D.Control.FormImposition form = new Pic.Factory2D.Control.FormImposition(); form.Solutions = _solutions; form.Format = formSettings.CardboardFormat; if (DialogResult.OK == form.ShowDialog(this)) { } } } } }
static void Main(string[] args) { // set up a simple configuration that logs on the console. XmlConfigurator.Configure(); try { _log.Info("Pic.Factory2D.Test.exe starting..."); // testing Sharp3D.Math.Core.Matrix3D Transform2D transf0 = Transform2D.Translation(new Vector2D(10.0, 10.0)) * Transform2D.Rotation(45.0); Vector2D pt0 = transf0.transform(new Vector2D(100.0, 100.0)); _log.Info(pt0.ToString()); Transform2D transf1 = transf0.Inverse(); Vector2D pt1 = transf1.transform(pt0); _log.Info(pt1.ToString()); // instantiate factory1 PicFactory factory0 = new PicFactory(); factory0.AddPoint(PicGraphics.LT.LT_CUT, new Vector2D(0.0, 0.0)); factory0.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(50.0, 50.0), new Vector2D(100.0, 100.0)); factory0.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(-100.0, 100.0), new Vector2D(100.0, -100.0)); factory0.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(50.0, 50.0), 50.0 * Math.Sqrt(2.0), 0.0, 360.0); factory0.AddArc(PicGraphics.LT.LT_CUT, new Vector2D(75.0, 75.0), 25.0 * Math.Sqrt(2.0), 0.0, 360.0); factory0.AddNurb(PicGraphics.LT.LT_CUT); _log.Debug(factory0.ToString()); // get bounding box + draw using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox()) { factory0.ProcessVisitor(visitor); _log.Info(visitor.Box.ToString()); // save as image string filePath = Path.Combine(Path.GetTempPath(), "PicImage0.jpeg"); PicGraphicsImage picImage = new PicGraphicsImage(); picImage.ImageSize = new System.Drawing.Size(512, 512); Box2D box = visitor.Box; box.AddMargin(5); picImage.DrawingBox = box; factory0.Draw(picImage); picImage.SaveAs(filePath); _log.Debug("File path = " + filePath); _log.Debug("Path = " + Path.Combine(Environment.SystemDirectory, "mspaint.exe")); System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), filePath); } // output to dxf file Pic.Factory2D.PicVisitorDxfOutput dxfOutputVisitor = new Pic.Factory2D.PicVisitorDxfOutput(); factory0.ProcessVisitor(dxfOutputVisitor); // load dxf file PicFactory factory1 = new PicFactory(); PicLoaderDxf loaderDxf = new PicLoaderDxf(factory1); loaderDxf.Load(@"K:\Codesion\PicSharp\Samples\F1034.EV.DXF"); loaderDxf.FillFactory(); // save as image // get bounding box + draw using (PicVisitorBoundingBox visitor1 = new PicVisitorBoundingBox()) { factory1.ProcessVisitor(visitor1); _log.Info(visitor1.Box.ToString()); string filePath1 = Path.Combine(Path.GetTempPath(), "PicImage1.jpeg"); PicGraphicsImage picImage1 = new PicGraphicsImage(); picImage1.ImageSize = new System.Drawing.Size(512, 512); Box2D box1 = visitor1.Box; box1.AddMargin(5); picImage1.DrawingBox = box1; factory1.Draw(picImage1); picImage1.SaveAs(filePath1); _log.Debug("File path = " + filePath1); _log.Debug("Path = " + Path.Combine(Environment.SystemDirectory, "mspaint.exe")); System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), filePath1); } // instantiate factory2 PicFactory factory2 = new PicFactory(); PicBlock block = factory2.AddBlock(factory0); factory2.AddBlockRef(block, new Vector2D(0.0, 0.0), 0.0); factory2.AddBlockRef(block, new Vector2D(400.0, 0.0), 0.0); factory2.AddBlockRef(block, new Vector2D(0.0, 400.0), 0.0); factory2.AddBlockRef(block, new Vector2D(400.0, 400.0), 45.0); // get bounding box of factory2 using (PicVisitorBoundingBox visitor = new PicVisitorBoundingBox()) { factory2.ProcessVisitor(visitor); _log.Info(visitor.Box.ToString()); // save as image string filePath = Path.Combine(Path.GetTempPath(), "PicImage2.jpeg"); PicGraphicsImage picImage = new PicGraphicsImage(); picImage.ImageSize = new System.Drawing.Size(512, 512); Box2D box = visitor.Box; box.AddMargin(5); picImage.DrawingBox = box; factory2.Draw(picImage); picImage.SaveAs(filePath); _log.Debug("File path = " + filePath); _log.Debug("Path = " + Path.Combine(Environment.SystemDirectory, "mspaint.exe")); System.Diagnostics.Process.Start(Path.Combine(Environment.SystemDirectory, "mspaint.exe"), filePath); } // compute area PicFactory factory3 = new PicFactory(); factory3.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(-100.0, -100.0), new Vector2D(100.0, -100.0)); factory3.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(100.0, -100.0), new Vector2D(100.0, 100.0)); factory3.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(100.0, 100.0), new Vector2D(-100.0, 100.0)); factory3.AddSegment(PicGraphics.LT.LT_CUT, new Vector2D(-100.0, 100.0), new Vector2D(-100.0, -100.0)); PicToolArea picToolArea = new PicToolArea(); factory3.ProcessTool(picToolArea); _log.Info(string.Format("Area of factory3 is {0}", picToolArea.Area)); _log.Info("Pic.Factory2D.Test.exe finishing..."); } catch (Exception ex) { _log.Error(ex.ToString()); } }
/// <summary> /// Creates factory entities (mostly segment, arcs, cotations...) in <see cref="PicFactory"/> class instance passed as first argument /// </summary> /// <param name="factory">Instance of class <see cref="PicFactory"/> to be populated with entities</param> /// <param name="stack">Array of <see cref="Paramerter"/> to apply while generating entities</param> public void CreateFactoryEntities(PicFactory factory, ParameterStack stack) { _instance.CreateFactoryEntities(factory, stack, Transform2D.Identity); }
public abstract void Initialize(PicFactory factory);