/// <summary> /// Fügt Entity Objekte in einer bereits vorhandenen DXF Datei hinzu. /// </summary> /// <param name="dxf_path"> Pfad der DXF Datei, wo hinzugefügt werden soll</param> /// <param name="listObj"> Liste der hinzuzufügenden Entity Objekte</param> static public void JoinToDxF(string dxf_path, ElementManager.workpiece workPiece, params EntityObject[] listObj) { DxfDocument doc; if (File.Exists(dxf_path)) { FileInfo file = new FileInfo(dxf_path); if (file.Extension == ".dxf") { doc = DxfDocument.Load(dxf_path); foreach (EntityObject item in listObj) { item.Layer = new netDxf.Tables.Layer(workPiece.werkzeugName); doc.AddEntity(item); } netDxf.Entities.Point newPt = new netDxf.Entities.Point(workPiece.height, workPiece.width, workPiece.depth); doc.AddEntity(newPt); doc.Save(dxf_path); } else { throw new Exception(" Error NTB_DXF_200003 : The file you gave is not a dxf file"); } } else { throw new Exception(" Error NTB_DXF_200004 : The path you entered is not corrrect"); } }
/// <summary> /// Fügt Arbeitseigenschaften in einer bereits vorhandenen DXF Datei hinzu. /// </summary> /// <param name="dxf_path">Pfad des DXF Documents, wo es hingespeichert werden soll</param> /// <param name="doc">DXF Document wo es hinzugefügt werden soll</param> /// <param name="workPiece">Entsprechende Arbeitseigenschaften</param> static public void JoinToDxF(string dxf_path, ref DxfDocument doc, ElementManager.workpiece workPiece) { foreach (LwPolyline item in doc.LwPolylines) { item.Layer = new netDxf.Tables.Layer(workPiece.werkzeugName); } netDxf.Entities.Point newPt = new netDxf.Entities.Point(workPiece.height, workPiece.width, workPiece.depth); doc.AddEntity(newPt); doc.Save(dxf_path); }
/// <summary> /// Fügt Entity Objekte in einer bereits vorhandenen DXF Datei hinzu. /// </summary> /// <param name="dxf_path">Pfad des DXF Documents, wo es hingespeichert werden soll</param> /// <param name="doc">DXF Document wo es hinzugefügt werden soll</param> /// <param name="workPiece">Entsprechende Arbeitseigenschaften</param> /// <param name="listObj">Liste der hinzuzufügenden Entity Objekte</param> static public void JoinToDxF(string dxf_path, ref DxfDocument doc, ElementManager.workpiece workPiece, params EntityObject[] listObj) { foreach (EntityObject item in listObj) { item.Layer = new netDxf.Tables.Layer(workPiece.werkzeugName); doc.AddEntity(item); } netDxf.Entities.Point newPt = new netDxf.Entities.Point(workPiece.height, workPiece.width, workPiece.depth); doc.AddEntity(newPt); doc.Save(dxf_path); }
public DXF_WriterOriginal(List <List <sh.Polyline> > ListPolylines, ElementManager.workpiece workPiece) { if ((ListPolylines != null && ListPolylines.Count != 0) && (workPiece != null)) { ListAddedElements_as_PL = ListPolylines; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; input = Inputs.AddedElements_asPL; Werkzeug = workPiece.werkzeugName; } else { throw new Exception("Error : NTB_DXF_100003 : No avalaible parameter"); } }
public DXF_WriterOriginal(List <LwPolyline> ListToLwPolyline, ElementManager.workpiece workPiece) { if ((ListToLwPolyline != null && ListToLwPolyline.Count != 0) && (workPiece != null)) { listToLwPolyline = ListToLwPolyline; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; input = Inputs.LwPolyline; Werkzeug = workPiece.werkzeugName; } else { throw new Exception("Error : NTB_DXF_100002 : No avalaible parameter"); } }
public DXF_WriterOriginal(List <List <System.Drawing.Point> > listPoint, ElementManager.workpiece workPiece) { if ((listPoint.Count != 0 && listPoint != null) && (workPiece != null)) { ListAddedElements_as_List_Of_Point = listPoint; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; input = Inputs.ListOfPoints; Werkzeug = workPiece.werkzeugName; } else { throw new Exception("Error : NTB_DXF_100004 : No avalaible parameter"); } //TryToLwPolyline(); }
public DXF_WriterOriginal(List <List <PolyLineSegment> > polyLineSegments, ElementManager.workpiece workPiece) { if ((polyLineSegments.Count != 0 && polyLineSegments != null) && (workPiece != null)) { ListAddedElements_as_PLS = polyLineSegments; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; input = Inputs.AddedElements_asPLS; Werkzeug = workPiece.werkzeugName; } else { throw new Exception("Error : NTB_DXF_100004 : No avalaible parameter"); } //TryToLwPolyline(); }
public DXF_WriterOriginal(PathGeometry newGeo, ElementManager.workpiece workPiece) { if (newGeo != null && workPiece != null) { pathGeo = newGeo; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; input = Inputs.Pathgeometry; Werkzeug = workPiece.werkzeugName; } else { throw new Exception("Error : NTB_DXF_100001 : No avalaible parameter"); } //TryParseToPolySegment(); //TryToLwPolyline(); }
public DXF_WriterOriginal(ObservableCollection <creativeElement> listAddedElements, ElementManager.workpiece workPiece) { if ((listAddedElements.Count == 0 || listAddedElements == null) || workPiece == null) { throw new Exception("Error : NTB_DXF_100000 : No avalaible parameter"); } else { Werkzeug = workPiece.werkzeugName; Height = workPiece.height; Width = workPiece.width; Depth = workPiece.depth; ListAddedElements = listAddedElements.ToList(); input = Inputs.AddedElements; } }
public static void writeDxfFile(ObservableCollection <creativeElement> elementCollection, workpiece myWorkpiece) { //startupPath += "GUI 4.0"; using (StreamWriter writer = new StreamWriter(startupPath + @"\DXF_testdatei.dxf")) { //layer schreiben - werkzeugname writer.WriteLine("AcDbLayerTableRecord"); writer.WriteLine("junk"); writer.WriteLine(myWorkpiece.werkzeugName); writer.WriteLine(myWorkpiece.height); writer.WriteLine(myWorkpiece.width); writer.WriteLine(myWorkpiece.depth); //z-Koordinate für alle Punkte //werkstück informationen schreiben //polylinien schreiben foreach (var creativeElement in elementCollection) { foreach (var polyLineSegment in Converter.PathGeometryToPlsList(creativeElement.pathGeometry)) { writer.WriteLine("AcDbPolyline"); //start jeder polylinie PointCollection pointCollection = polyLineSegment.Points; foreach (var point in pointCollection) { double xWert = point.X / myWorkpiece.scalingFactor; double yWert = point.Y / myWorkpiece.scalingFactor; //schreibe x writer.WriteLine(" 10"); writer.WriteLine(xWert.ToString()); //y-invertieren yWert = myWorkpiece.height - yWert; //schreibe y writer.WriteLine(" 20"); writer.WriteLine(yWert.ToString()); } writer.WriteLine("ENDSEC"); } } } }