public bool Init() { try { settings = new XmlReaderSettings() { ValidationType = ValidationType.None, ProhibitDtd = false, XmlResolver = null }; DP = new DynamicPowder((int)PrinterSetting.PrintAreaWidth, (int)PrinterSetting.PrintAreaDepth); gCode = new GCode(gcodePath); //dxf = new DXF(Main.printerSettings.PrintAreaWidth, Main.printerSettings.PrintAreaDepth, dxfPath, encryptDXF); dxf = new DXF(230, 230, dxfPath, encryptDXF); layerAmount = GetLayerAmount(); return(true); } catch (Exception ex) { //Main.main.LogMessage("3WL Data", "Error encountered: Init"); //Main.main.LogMessage("3WL Data", ex.Message); //Main.main.LogMessage("3WL Data", ex.ToString()); Console.WriteLine("3WL Data, Error encountered: Init"); Console.WriteLine("3WL Data", ex.ToString()); SVGTo3WL.logFile.writer.WriteLine("3WL Data, Error encountered: Init"); SVGTo3WL.logFile.writer.WriteLine("3WL Data", ex.ToString()); return(false); } }
public void DXFの最小構成を構築() { StreamReader sr = new StreamReader("Resource/DXF/DxfMin.dxf"); string except = sr.ReadToEnd(); string actual = DXF.Construct(new List <KeyValuePair <int, string> >()); sr.Close(); Assert.AreEqual(except, actual, true); }
private void backgroundWorkerProcess_DoWork(object sender, DoWorkEventArgs e) { var lt = (LayType)e.Argument; if (lt.IsTin) { e.Result = DXF.ReadDXFTin(Properties.Settings.Default.is3D, this.dxfFile, lt.Layer, Properties.Settings.Default.minDistance, st, st); } else { e.Result = DXF.ReadDXFIndPoly(Properties.Settings.Default.is3D, this.dxfFile, lt.Layer, Properties.Settings.Default.minDistance, st, st); } }
/// <summary> /// 円のDXF情報を出力 /// </summary> public override string Print() { var content = new List <KeyValuePair <int, string> >(); content.Add(new KeyValuePair <int, string>(0, "CIRCLE")); content.Add(new KeyValuePair <int, string>(8, "0")); content.Add(new KeyValuePair <int, string>(10, Center.x.ToString())); content.Add(new KeyValuePair <int, string>(20, Center.y.ToString())); content.Add(new KeyValuePair <int, string>(30, Center.z.ToString())); content.Add(new KeyValuePair <int, string>(40, Radius.ToString())); return(DXF.ParamToString(content)); }
public void Circleの出力_円を構築() { Circle circle = new Circle(); circle.Center = new Pos(0, 0, 0); circle.Radius = 1; TestPrintable testPrintable = new TestPrintable(); testPrintable.Shapes.Add(circle); StreamReader sr = new StreamReader("Resource/DXF/Circle.dxf"); string expect = sr.ReadToEnd(); sr.Close(); string actual = DXF.Content(testPrintable); Assert.AreEqual(expect, actual, true); }
private void BinaryToDxfFile(byte[] inputBinary, string fileName, string directory) { string path = DXF.DxfNameBuild(fileName, ""); try { path = Path.Combine(directory, $"{fileName}.dxf"); } catch (Exception ex) { MessageObserver.Instance.SetMessage("BinaryToDxfFile failed to create path.\nfileName " + fileName + "; directory: " + directory); throw ex; } if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } File.WriteAllBytes(path, inputBinary); }
public void パラメーターを渡してDXF形式になっているか() { var param = new List <KeyValuePair <int, string> >(); param.Add(new KeyValuePair <int, string>(0, "SECTION")); param.Add(new KeyValuePair <int, string>(2, "HEADER")); param.Add(new KeyValuePair <int, string>(0, "ENDSEC")); param.Add(new KeyValuePair <int, string>(0, "SECTION")); param.Add(new KeyValuePair <int, string>(2, "ENTITIES")); param.Add(new KeyValuePair <int, string>(0, "ENDSEC")); param.Add(new KeyValuePair <int, string>(0, "EOF")); StreamReader sr = new StreamReader("Resource/DXF/DxfMin.dxf"); string except = sr.ReadToEnd(); string actual = DXF.ParamToString(param); sr.Close(); Assert.AreEqual(except, actual, true); }
public override string Print() { var content = new List <KeyValuePair <int, string> >(); content.Add(new KeyValuePair <int, string>(0, "POLYLINE")); content.Add(new KeyValuePair <int, string>(8, "0")); content.Add(new KeyValuePair <int, string>(66, "1")); content.Add(new KeyValuePair <int, string>(70, "1")); Points.ForEach(pos => { content.Add(new KeyValuePair <int, string>(0, "VERTEX")); content.Add(new KeyValuePair <int, string>(8, "0")); content.Add(new KeyValuePair <int, string>(10, pos.x.ToString())); content.Add(new KeyValuePair <int, string>(20, pos.y.ToString())); content.Add(new KeyValuePair <int, string>(30, pos.z.ToString())); }); content.Add(new KeyValuePair <int, string>(0, "SEQEND")); content.Add(new KeyValuePair <int, string>(8, "0")); return(DXF.ParamToString(content)); }
public void Coordinateの出力_ボックスを構築() { Coordinate coordinate = new Coordinate(); coordinate.Points = new List <Pos>() { new Pos(0, 0, 0), new Pos(1, 0, 0), new Pos(1, 1, 0), new Pos(0, 1, 0) }; TestPrintable testPrintable = new TestPrintable(); testPrintable.Shapes.Add(coordinate); StreamReader sr = new StreamReader("Resource/DXF/Box.dxf"); string expect = sr.ReadToEnd(); sr.Close(); string actual = DXF.Content(testPrintable); Assert.AreEqual(expect, actual, true); }
//siteplacement-argument? public void mapProcess(JsonSettings jSettings, double?breakDist = null, double?refLatitude = null, double?refLongitude = null, double?refElevation = null) { var logger = LogManager.GetCurrentClassLogger(); logger.Info("----------------------------------------------"); // //Read // var result = new Result(); string[] fileNames = new string[1]; fileNames[0] = jSettings.fileName; switch (jSettings.fileType) { case "LandXML": result = LandXml.ReadTIN(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "CityGML": result = CityGml.ReadTIN(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "DXF": DXF.ReadFile(jSettings.fileName, out this.dxfFile); if (jSettings.isTin) { result = DXF.ReadDXFTin(jSettings.is3D, this.dxfFile, jSettings.layer, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); } else { result = DXF.ReadDXFIndPoly(jSettings.is3D, this.dxfFile, jSettings.layer, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); } break; case "REB": this.rebData = RebDa.ReadREB(fileNames); result = RebDa.ConvertReb(jSettings.is3D, this.rebData, jSettings.horizon, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "Grid": result = ElevationGrid.ReadGrid(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.gridSize, jSettings.bBox, jSettings.bbNorth, jSettings.bbEast, jSettings.bbSouth, jSettings.bbWest); break; } this.Mesh = result.Mesh; try { logger.Debug("Mesh created with: " + this.Mesh.Points.Count + " Points; " + this.Mesh.FixedEdges + " Lines; " + this.Mesh.FaceEdges + " Faces"); } catch { logger.Debug("No Faces or Points found"); } // //Write // if (jSettings.projectName is null) { jSettings.projectName = "Name of project"; } var writeInput = new WriteInput(); writeInput.Placement = Axis2Placement3D.Standard; if (jSettings.customOrigin) { writeInput.Placement.Location = Vector3.Create(jSettings.xOrigin, jSettings.yOrigin, jSettings.zOrigin); } else { double midX = (this.Mesh.MaxX + this.Mesh.MinX) / 2; double midY = (this.Mesh.MaxY + this.Mesh.MinY) / 2; double midZ = (this.Mesh.MaxZ + this.Mesh.MinZ) / 2; writeInput.Placement.Location = Vector3.Create(midX, midY, midZ); } // Placement verschieben? writeInput.SurfaceType = SurfaceType.TFS; if (jSettings.surfaceType == "GCS") { writeInput.SurfaceType = SurfaceType.GCS; } else if (jSettings.surfaceType == "SBSM") { writeInput.SurfaceType = SurfaceType.SBSM; } writeInput.FileType = FileType.Step; if (jSettings.outFileType == "XML") { writeInput.FileType = FileType.XML; } logger.Debug("Writing IFC with:"); logger.Debug("IFC Version: " + jSettings.outIFCType); logger.Debug("Surfacetype: " + jSettings.surfaceType); logger.Debug("Filetype: " + jSettings.fileType); if (jSettings.outIFCType == "IFC2x3") { var model = WriteIfc2.CreateSite(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist); logger.Debug("IFC Site created"); WriteIfc2.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); logger.Info("IFC file writen: " + jSettings.destFileName); } else { logger.Debug("Geographical Element: " + jSettings.geoElement); var model = jSettings.geoElement ? WriteIfc4.CreateSiteWithGeo(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist) : WriteIfc4.CreateSite(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist); logger.Debug("IFC Site created"); WriteIfc4.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); logger.Info("IFC file writen: " + jSettings.destFileName); } logger.Info("----------------------------------------------"); }
private double ObtieneDistancia(DXF.Objetos.Vector3d puntoActual, DXF.Objetos.Vector3d puntoInicioFigura) { double distancia; distancia = Math.Sqrt(Math.Pow((puntoActual.X - puntoInicioFigura.X), 2) + Math.Pow((puntoActual.Y - puntoInicioFigura.Y), 2) + Math.Pow((puntoActual.Z - puntoInicioFigura.Z), 2)); return distancia; }
private void backgroundWorkerDXF_DoWork_1(object sender, DoWorkEventArgs e) { e.Result = DXF.ReadFile((string)e.Argument, out this.dxfFile) ? (string)e.Argument : ""; }
public void Ribの出力_リブ外形を構築() { WingSection partWing = new WingSection(null); Plank plank = new Plank(partWing); plank.PlankThin.Value = 2; plank.PlankUpperPos.Value = 0.4; plank.PlankDownerPos.Value = 0.2; Stringer stringer1 = new Stringer(partWing); stringer1.AirfoilSide.Value = AirfoilSide.Upper; stringer1.StringerPos.Value = 0.4; stringer1.StringerHeight.Value = 4; stringer1.StringerWidth.Value = 2; Stringer stringer2 = new Stringer(partWing); stringer2.AirfoilSide.Value = AirfoilSide.Upper; stringer2.StringerPos.Value = 0.2; stringer2.StringerHeight.Value = 4; stringer2.StringerWidth.Value = 2; Stringer stringer3 = new Stringer(partWing); stringer3.AirfoilSide.Value = AirfoilSide.Downer; stringer3.StringerPos.Value = 0.2; stringer3.StringerHeight.Value = 4; stringer3.StringerWidth.Value = 2; Rib rib = new Rib(partWing); rib.Chord.Value = 1000; rib.RibCap.Value.RibCapThin.Value = 1; rib.Airfoil.Coordinate.Points = new List <Pos>() { { new Pos(1.00000, 0.00060) }, { new Pos(0.99344, 0.00216) }, { new Pos(0.98165, 0.00494) }, { new Pos(0.96782, 0.00820) }, { new Pos(0.95254, 0.01174) }, { new Pos(0.93656, 0.01540) }, { new Pos(0.92034, 0.01904) }, { new Pos(0.90394, 0.02264) }, { new Pos(0.88745, 0.02620) }, { new Pos(0.87096, 0.02969) }, { new Pos(0.85444, 0.03311) }, { new Pos(0.83791, 0.03647) }, { new Pos(0.82138, 0.03975) }, { new Pos(0.80484, 0.04296) }, { new Pos(0.78829, 0.04609) }, { new Pos(0.77175, 0.04914) }, { new Pos(0.75520, 0.05211) }, { new Pos(0.73864, 0.05500) }, { new Pos(0.72207, 0.05782) }, { new Pos(0.70549, 0.06054) }, { new Pos(0.68890, 0.06319) }, { new Pos(0.67234, 0.06575) }, { new Pos(0.65579, 0.06822) }, { new Pos(0.63925, 0.07058) }, { new Pos(0.62277, 0.07284) }, { new Pos(0.60630, 0.07497) }, { new Pos(0.58980, 0.07700) }, { new Pos(0.57336, 0.07890) }, { new Pos(0.55689, 0.08068) }, { new Pos(0.54041, 0.08233) }, { new Pos(0.52391, 0.08386) }, { new Pos(0.50740, 0.08528) }, { new Pos(0.49093, 0.08658) }, { new Pos(0.47448, 0.08773) }, { new Pos(0.45804, 0.08876) }, { new Pos(0.44164, 0.08964) }, { new Pos(0.42531, 0.09037) }, { new Pos(0.40900, 0.09093) }, { new Pos(0.39270, 0.09133) }, { new Pos(0.37637, 0.09156) }, { new Pos(0.36001, 0.09163) }, { new Pos(0.34360, 0.09155) }, { new Pos(0.32714, 0.09133) }, { new Pos(0.31066, 0.09097) }, { new Pos(0.29417, 0.09050) }, { new Pos(0.27783, 0.08991) }, { new Pos(0.26173, 0.08917) }, { new Pos(0.24588, 0.08824) }, { new Pos(0.23032, 0.08707) }, { new Pos(0.21499, 0.08564) }, { new Pos(0.19990, 0.08391) }, { new Pos(0.18499, 0.08184) }, { new Pos(0.17016, 0.07943) }, { new Pos(0.15538, 0.07667) }, { new Pos(0.14076, 0.07361) }, { new Pos(0.12636, 0.07023) }, { new Pos(0.11227, 0.06655) }, { new Pos(0.09860, 0.06257) }, { new Pos(0.08537, 0.05829) }, { new Pos(0.07278, 0.05382) }, { new Pos(0.06126, 0.04929) }, { new Pos(0.05105, 0.04478) }, { new Pos(0.04218, 0.04032) }, { new Pos(0.03460, 0.03598) }, { new Pos(0.02824, 0.03180) }, { new Pos(0.02293, 0.02781) }, { new Pos(0.01848, 0.02403) }, { new Pos(0.01473, 0.02054) }, { new Pos(0.01155, 0.01741) }, { new Pos(0.00885, 0.01465) }, { new Pos(0.00660, 0.01217) }, { new Pos(0.00472, 0.00989) }, { new Pos(0.00318, 0.00774) }, { new Pos(0.00194, 0.00569) }, { new Pos(0.00100, 0.00372) }, { new Pos(0.00035, 0.00181) }, { new Pos(-0.00000, -0.00003) }, { new Pos(-0.00004, -0.00185) }, { new Pos(0.00022, -0.00368) }, { new Pos(0.00082, -0.00552) }, { new Pos(0.00173, -0.00735) }, { new Pos(0.00293, -0.00918) }, { new Pos(0.00443, -0.01100) }, { new Pos(0.00623, -0.01280) }, { new Pos(0.00837, -0.01457) }, { new Pos(0.01086, -0.01630) }, { new Pos(0.01379, -0.01790) }, { new Pos(0.01726, -0.01936) }, { new Pos(0.02137, -0.02066) }, { new Pos(0.02632, -0.02186) }, { new Pos(0.03239, -0.02309) }, { new Pos(0.03973, -0.02447) }, { new Pos(0.04842, -0.02584) }, { new Pos(0.05871, -0.02701) }, { new Pos(0.07083, -0.02794) }, { new Pos(0.08476, -0.02870) }, { new Pos(0.09979, -0.02937) }, { new Pos(0.11534, -0.02985) }, { new Pos(0.13129, -0.03015) }, { new Pos(0.14744, -0.03027) }, { new Pos(0.16378, -0.03023) }, { new Pos(0.18028, -0.03005) }, { new Pos(0.19687, -0.02974) }, { new Pos(0.21359, -0.02932) }, { new Pos(0.23047, -0.02883) }, { new Pos(0.24741, -0.02827) }, { new Pos(0.26443, -0.02766) }, { new Pos(0.28157, -0.02701) }, { new Pos(0.29876, -0.02636) }, { new Pos(0.31597, -0.02571) }, { new Pos(0.33319, -0.02507) }, { new Pos(0.35042, -0.02444) }, { new Pos(0.36766, -0.02381) }, { new Pos(0.38492, -0.02318) }, { new Pos(0.40218, -0.02255) }, { new Pos(0.41944, -0.02192) }, { new Pos(0.43669, -0.02129) }, { new Pos(0.45393, -0.02066) }, { new Pos(0.47116, -0.02003) }, { new Pos(0.48838, -0.01939) }, { new Pos(0.50557, -0.01876) }, { new Pos(0.52274, -0.01813) }, { new Pos(0.53990, -0.01749) }, { new Pos(0.55706, -0.01687) }, { new Pos(0.57423, -0.01623) }, { new Pos(0.59142, -0.01560) }, { new Pos(0.60864, -0.01498) }, { new Pos(0.62583, -0.01434) }, { new Pos(0.64299, -0.01371) }, { new Pos(0.66015, -0.01308) }, { new Pos(0.67729, -0.01245) }, { new Pos(0.69444, -0.01182) }, { new Pos(0.71158, -0.01119) }, { new Pos(0.72873, -0.01056) }, { new Pos(0.74587, -0.00993) }, { new Pos(0.76302, -0.00930) }, { new Pos(0.78018, -0.00867) }, { new Pos(0.79735, -0.00804) }, { new Pos(0.81454, -0.00741) }, { new Pos(0.83176, -0.00678) }, { new Pos(0.84894, -0.00615) }, { new Pos(0.86610, -0.00552) }, { new Pos(0.88324, -0.00489) }, { new Pos(0.90035, -0.00426) }, { new Pos(0.91741, -0.00364) }, { new Pos(0.93432, -0.00301) }, { new Pos(0.95093, -0.00240) }, { new Pos(0.96680, -0.00182) }, { new Pos(0.98113, -0.00129) }, { new Pos(0.99325, -0.00085) }, { new Pos(1.00000, -0.00060) } }; partWing.TrainingEdge.Value.TrainlingEdgeLength.Value = 25; string actual = DXF.Content(rib); StreamReader sr = new StreamReader("Resource/DXF/Rib.dxf"); string expect = sr.ReadToEnd(); sr.Close(); Assert.AreEqual(actual, expect); }
public static List<string> IrAL(DXF.Objetos.Vector3f p) { List<string> s = new List<string>(); //levantar la punta hasta el nivel de Z que hay que ir s.Add("G00 Z" + altoAscenso); //crear el mov de avance s.Add("G00 X" + p.X.ToString() + " Y" + p.Y.ToString()); //bajamos la punta s.Add("G00 Z" + p.Z.ToString()); return s; }
//siteplacement-argument? public void mapProcess(JsonSettings jSettings, double?breakDist = null, double?refLatitude = null, double?refLongitude = null, double?refElevation = null) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Info("----------------------------------------------"); #region Reader // //Read // var result = new Result(); string[] fileNames = new string[1]; fileNames[0] = jSettings.fileName; #region import data typ selection switch (jSettings.fileType) { case "LandXML": result = LandXml.ReadTIN(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "CityGML": result = CityGml.ReadTIN(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "DXF": DXF.ReadFile(jSettings.fileName, out dxfFile); if (jSettings.isTin) { //READING as TIN result = DXF.ReadDXFTin(jSettings.is3D, dxfFile, jSettings.layer, jSettings.breakline_layer, jSettings.minDist, jSettings.breakline); } else { //READING as MESH --> have to be changed into TIN result = DXF.ReadDXFIndPoly(jSettings.is3D, dxfFile, jSettings.layer, jSettings.breakline_layer, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel, jSettings.breakline); } break; case "REB": this.rebData = RebDa.ReadREB(fileNames); result = RebDa.ConvertReb(jSettings.is3D, this.rebData, jSettings.horizon, jSettings.minDist, jSettings.logFilePath, jSettings.verbosityLevel); break; case "Grid": result = ElevationGrid.ReadGrid(jSettings.is3D, jSettings.fileName, jSettings.minDist, jSettings.gridSize, jSettings.bBox, jSettings.bbNorth, jSettings.bbEast, jSettings.bbSouth, jSettings.bbWest); break; case "OUT": if (jSettings.isTin) { //result = Out.ReadOUTTin(jSettings.is3D, jSettings.fileName,jSettings.onlyTypes, jSettings.layer, jSettings.minDist, jSettings.ignPos, jSettings.ignHeight, jSettings.onlyHorizon, jSettings.horizonFilter, jSettings.breakline, jSettings.breakline_layer); //reworking result = ReadOUT.ReadOutData(jSettings.fileName, out pointIndex2NumberMap, out triangleIndex2NumberMap); //pointIndex2NumberMap & triangleIndex2NumberMap ggf. entfernen } /* ENTFERNT, da derzeit nur über FACES verarbeitet wird * else * { * * //result = Out.ReadOUT_Points_Lines(jSettings.is3D, jSettings.fileName, jSettings.layer, jSettings.minDist, jSettings.ignPos, jSettings.ignHeight, jSettings.breakline, jSettings.breakline_layer); * }*/ break; case "PostGIS": result = PostGIS.ReadPostGIS(jSettings.is3D, jSettings.minDist, jSettings.host, jSettings.port, jSettings.user, jSettings.password, jSettings.database, jSettings.schema, jSettings.tin_table, jSettings.tin_column, jSettings.tinid_column, jSettings.tin_id, jSettings.breakline, jSettings.breakline_table, jSettings.breakline_column, jSettings.breakline_tin_id); break; } this.Tin = result.Tin; this.Mesh = result.Mesh; this.Breaklines = result.Breaklines; #endregion #region Mesh-Checker if (Mesh != null) { try { logger.Debug("Mesh created with: " + Mesh.Points.Count + " Points; " + Mesh.FixedEdges.Count + " Lines; " + Mesh.FaceEdges.Count + " Faces"); } catch { logger.Debug("No Faces or Points found!"); } } /* * else * { * * try * { * //Removed --> relocate in reader * //logger.Debug("Tin created with: " + Tin.Points.Count + " Points; " + Tin.NumTriangles + " Triangels"); * } * catch * { * //logger.Debug("No Triangels or Points found!"); * } * } */ #endregion #endregion #region Writer // //Write // #region project Name if (jSettings.projectName is null) { jSettings.projectName = "Name of project"; } #endregion var writeInput = new WriteInput(); #region Placement writeInput.Placement = Axis2Placement3D.Standard; if (jSettings.customOrigin) { writeInput.Placement.Location = Vector3.Create(jSettings.xOrigin, jSettings.yOrigin, jSettings.zOrigin); } else { double MinX = 0; double MinY = 0; double MinZ = 0; double MaxX = 0; double MaxY = 0; double MaxZ = 0; if (Mesh != null) { double midX = (this.Mesh.MaxX + this.Mesh.MinX) / 2; double midY = (this.Mesh.MaxY + this.Mesh.MinY) / 2; double midZ = (this.Mesh.MaxZ + this.Mesh.MinZ) / 2; writeInput.Placement.Location = Vector3.Create(midX, midY, midZ); } //Vorschlag für BimGisCad.Composed (in MESH ist dies bereits vorhanden) else { int i = 0; foreach (Point3 point in Tin.Points) { //initalisierung durch ersten Punkt if (i > 0) { if (point.X < MinX) { MinX = point.X; } if (point.X > MaxX) { MaxX = point.X; } if (point.Y < MinY) { MinY = point.Y; } if (point.Y > MaxY) { MaxY = point.Y; } if (point.Z < MinZ) { MinZ = point.Z; } if (point.Z > MaxZ) { MaxZ = point.Z; } } else { MinX = point.X; MinY = point.Y; MinZ = point.Z; MaxX = point.X; MaxY = point.Y; MaxZ = point.Z; } i++; } double MidX = (MaxX + MinX) / 2; double MidY = (MaxY + MinY) / 2; double MidZ = (MaxZ + MinZ) / 2; writeInput.Placement.Location = Vector3.Create(MidX, MidY, MidZ); } } #endregion #region IFC Version writeInput.SurfaceType = SurfaceType.TFS; if (jSettings.surfaceType == "GCS") { writeInput.SurfaceType = SurfaceType.GCS; } else if (jSettings.surfaceType == "SBSM") { writeInput.SurfaceType = SurfaceType.SBSM; } else if (jSettings.surfaceType == "TIN") { writeInput.SurfaceType = SurfaceType.TIN; } #endregion #region IFC Version Filetyp writeInput.FileType = FileType.Step; if (jSettings.outFileType == "XML") { writeInput.FileType = FileType.XML; } logger.Debug("Writing IFC with:"); logger.Debug("IFC Version: " + jSettings.outIFCType); logger.Debug("Surfacetype: " + jSettings.surfaceType); logger.Debug("Filetype: " + jSettings.fileType); #endregion #region IFC2x3 if (jSettings.outIFCType == "IFC2x3") { var model = WriteIfc2.CreateSite(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist); logger.Debug("IFC Site created"); WriteIfc2.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); logger.Info("IFC file writen: " + jSettings.destFileName); } #endregion #region IFC4 - MESH else if (jSettings.outIFCType == "IFC4") { logger.Debug("Geographical Element: " + jSettings.geoElement); var model = jSettings.geoElement ? WriteIfc4.CreateSiteWithGeo(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist) : WriteIfc4.CreateSite(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Mesh, writeInput.SurfaceType, breakDist); logger.Debug("IFC Site created"); WriteIfc4.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); logger.Info("IFC file writen: " + jSettings.destFileName); } #endregion //DRAFT VERSION BELOW #region IFC4 - TIN if (jSettings.outIFCType == "IFC4TIN") { var model = jSettings.geoElement ? WriteIfc4Tin.CreateSiteWithGeo(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, //jSettings.minDist, "Site with Terrain", writeInput.Placement, this.Tin, this.Breaklines, writeInput.SurfaceType, breakDist) : WriteIfc4Tin.CreateSite(jSettings.projectName, jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, //jSettings.minDist, "Site with Terrain", writeInput.Placement, this.Tin, this.Breaklines, writeInput.SurfaceType, breakDist);; WriteIfc4Tin.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); } #endregion #region IFC2x3 TIN if (jSettings.outIFCType == "IFC2x3TIN") { var model = WriteIfc2TIN.CreateSite(jSettings.projectName, jSettings.editorsFamilyName, jSettings.editorsGivenName, jSettings.editorsOrganisationName, "Site with Terrain", writeInput.Placement, this.Tin, writeInput.SurfaceType, breakDist); logger.Debug("IFC Site created"); WriteIfc2TIN.WriteFile(model, jSettings.destFileName, writeInput.FileType == FileType.XML); logger.Info("IFC file writen: " + jSettings.destFileName); } #endregion #endregion logger.Info("----------------------------------------------"); }
public static List<string> Punto(DXF.Entidades.Punto p) { G01_Lineal mov; List<string> movs = new List<string>(); mov = new G01_Lineal(); mov.Inicio.X = p.Ubicacion.X; mov.Inicio.Y = p.Ubicacion.Y; mov.Inicio.Z = p.Ubicacion.Z; mov.Fin.X = p.Ubicacion.X; mov.Fin.Y = p.Ubicacion.Y; mov.Fin.Z = p.Ubicacion.Z; movs.Add(mov.ToString()); return movs; }
public string LocalPrint() { return(DXF.Content(this)); }
public RibViewModel(Rib rib) { model = rib; rib.Airfoil = new Airfoil(); Chord = rib.Chord.ToReactiveProperty(); Lrho = rib.Chord.CombineLatest(rib.Airfoil.AirfoilPerformance.CL, (x, y) => x * y).ToReactiveProperty(); Airfoil = ReactiveProperty.FromObject(rib, x => x.Airfoil); Airfoils = Project.Airfoil.ToReadOnlyReactiveCollection(); ExportDXF.Subscribe(async _ => { // TODO // 本来ここは入らない WingSection partWing = model.Parent.Value as WingSection; Plank plank = new Plank(partWing); plank.PlankThin.Value = 2; plank.PlankUpperPos.Value = 0.4; plank.PlankDownerPos.Value = 0.2; Stringer stringer1 = new Stringer(partWing); stringer1.AirfoilSide.Value = AirfoilSide.Upper; stringer1.StringerPos.Value = 0.4; stringer1.StringerHeight.Value = 4; stringer1.StringerWidth.Value = 2; Stringer stringer2 = new Stringer(partWing); stringer2.AirfoilSide.Value = AirfoilSide.Upper; stringer2.StringerPos.Value = 0.2; stringer2.StringerHeight.Value = 4; stringer2.StringerWidth.Value = 2; Stringer stringer3 = new Stringer(partWing); stringer3.AirfoilSide.Value = AirfoilSide.Downer; stringer3.StringerPos.Value = 0.2; stringer3.StringerHeight.Value = 4; stringer3.StringerWidth.Value = 2; partWing.Plank.Value = plank; partWing.Stringers.Add(stringer1); partWing.Stringers.Add(stringer2); partWing.Stringers.Add(stringer3); partWing.TrainingEdge.Value.TrainlingEdgeLength.Value = 25; //ここまで string content = DXF.Content(model); var savePicker = new FileSavePicker(); savePicker.FileTypeChoices.Add("DXF図面交換ファイル", new List <string>() { ".dxf" }); StorageFile file = await savePicker.PickSaveFileAsync(); if (file != null) { await FileIO.WriteTextAsync(file, content); } }); }
private void SaveToStream(IDataStream DataStream, TSaveData SaveData, int SheetIndex) { if ((sBOF == null) || (sEOF == null)) { XlsMessages.ThrowException(XlsErr.ErrSectionNotLoaded); } sBOF.SaveToStream(DataStream, SaveData, 0); FileEncryption.SaveFirstPart(DataStream, SaveData); //WriteProt if (DataStream.Encryption.Engine != null) //FilePass { byte[] Fp = DataStream.Encryption.Engine.GetFilePassRecord(); DataStream.WriteRaw(Fp, Fp.Length); } if (IsXltTemplate) { TTemplateRecord.SaveNewRecord(DataStream); } FileEncryption.SaveSecondPart(DataStream, SaveData); TGlobalRecordSaver g = new TGlobalRecordSaver(DataStream, SaveData); g.SaveRecord(CodePage); FLel.SaveToStream(DataStream, SaveData, 0); TDSFRecord.SaveDSF(DataStream); g.SaveRecord(Excel9File); if (SheetIndex < 0) { FBoundSheets.SaveTabIds(DataStream); } g.SaveRecord(GetMacroRec(ObjProj)); g.SaveRecord(GetMacroRec(ObNoMacros)); g.SaveRecord(CodeNameRecord); FFnGroups.SaveToStream(DataStream, SaveData, 0); g.SaveRecord(OleObjectSize); FWorkbookProtection.SaveToStream(DataStream, SaveData); foreach (TWindow1Record w1 in Window1) { g.SaveRecord(w1); } TBackupRecord.SaveRecord(DataStream, Backup); THideObjRecord.SaveRecord(DataStream, HideObj); T1904Record.SaveRecord(DataStream, Dates1904); TPrecisionRecord.SaveRecord(DataStream, PrecisionAsDisplayed); TRefreshAllRecord.SaveRecord(DataStream, RefreshAll); g.SaveRecord(BookBool); Fonts.SaveToStream(DataStream, SaveData, 0); Formats.SaveToStream(DataStream, SaveData, 0); StyleXF.SaveAllToStream(DataStream, ref SaveData, CellXF); DXF.SaveToStream(DataStream, SaveData, 0); Styles.SaveToStream(DataStream, SaveData, 0); TableStyles.SaveToStream(DataStream, SaveData, 0); g.SaveRecord(Palette); g.SaveRecord(ClrtClient); PivotCache.SaveToStream(DataStream, SaveData, 0); DocRoute.SaveToStream(DataStream, SaveData, 0); UserBView.SaveToStream(DataStream, SaveData, 0); TUsesELFsRecord.SaveRecord(DataStream, UsesELFs); if (SheetIndex < 0) { FBoundSheets.SaveToStream(DataStream, SaveData); MetaData.SaveToStream(DataStream, SaveData, 0); } else { FBoundSheets.SaveRangeToStream(DataStream, SaveData, SheetIndex); } g.SaveRecord(MTRSettings); g.SaveRecord(ForceFullCalculation); g.SaveRecord(Country); FReferences.SaveToStream(DataStream, SaveData); FNames.SaveToStream(DataStream, SaveData, 0); //Should be after FBoundSheets.SaveToStream RealTimeData.SaveToStream(DataStream, SaveData, 0); g.SaveRecord(RecalcId); if (SheetIndex < 0) { FHeaderImages.SaveToStream(DataStream, SaveData); FDrawingGroup.SaveToStream(DataStream, SaveData); } FSST.SaveToStream(DataStream, SaveData); WebPub.SaveToStream(DataStream, SaveData, 0); g.SaveRecord(WOpt); //CrErr is ignored g.SaveRecord(BookExt); FeatHdr.SaveToStream(DataStream, SaveData, 0); DConn.SaveToStream(DataStream, SaveData, 0); ThemeRecord.SaveToStream(DataStream, SaveData, 0); g.SaveRecord(CompressPictures); g.SaveRecord(Compat12); g.SaveRecord(GUIDTypeLib); FFutureRecords.SaveToStream(DataStream, SaveData, 0); sEOF.SaveToStream(DataStream, SaveData, 0); }
public void UpLoadDxf(Specification[] specifications) { DxfBulder dxfBulder = DxfBulder.Instance; string tempDxfFolder = tempAppFolder; int countIterations = 0; tempDxfFolder = Path.Combine(tempDxfFolder, "DXF"); dxfBulder.DxfFolder = tempDxfFolder; dxfBulder.FinishedBuilding += DxfBulder_FinishedBuilding; //MessageBox.Show("Статус: Получение файлов"); SolidWorksPdmAdapter.Instance.DownLoadFile(specifications); //IEnumerable<FileModelPdm> fileModelsOfSpecification = Specification.ConvertToFileModels(specifications); //MessageBox.Show("Статус: Выгрузка DXF файлов"); if (specifications != null) { specifications = specifications.GroupBy(each => each.FilePath).Select(each => new Specification { Description = each.First().Description, PartNumber = each.First().PartNumber, Version = each.First().Version, Configuration = each.First().Configuration, Idpdm = each.First().Idpdm, Bend = each.First().Bend, PaintX = each.First().PaintX, PaintY = each.First().PaintY, WorkpieceX = each.First().WorkpieceX, PaintZ = each.First().PaintZ, WorkpieceY = each.First().WorkpieceY, SurfaceArea = each.First().SurfaceArea, IsDxf = each.First().IsDxf, FileName = each.First().FileName, FilePath = each.First().FilePath, Thickness = each.First().Thickness, }).ToArray(); foreach (var eachSpec in specifications) { if (!eachSpec.IsDxf && Path.GetExtension(eachSpec.FileName).ToUpper() == ".SLDPRT") { //MessageBox.Show("Статус: Выгрузка DXF файла " + eachSpec.FileName + "-" + eachSpec.Configuration); dxfBulder.Build(eachSpec.FilePath, eachSpec.Idpdm, eachSpec.Version, eachSpec.Configuration); try { //MessageBox.Show("Статус: Выгрузка XML файлов"); Export export = new Export(eachSpec.FilePath); export.XML(); MessageObserver.Instance.SetMessage("XML no EX."); } catch (Exception ex) { MessageObserver.Instance.SetMessage("XML EX: " + ex.StackTrace); MessageObserver.Instance.SetMessage("Failed to upload XML with exception: " + Environment.NewLine + ex.Message); } countIterations++; MessageObserver.Instance.SetMessage($"Created {countIterations} new dxf files to temp folder"); } } } countIterations = 0; #region load dxf as binary from database and save as dxf file foreach (var item in specificationsQuery) { try { if (AdapterPdmDB.Instance.IsDxf(item.Idpdm, item.Configuration, item.Version)) { byte[] binary = AdapterPdmDB.Instance.GetDXF(item.Idpdm, item.Configuration, item.Version); string fileName = Path.GetFileNameWithoutExtension(item.FileName).Replace("ВНС-", ""); fileName = DXF.DxfNameBuild(fileName, item.Configuration) + "-" + item.Thickness.ToString().Replace(",", "."); if (Path.GetExtension(item.FileName.ToUpper()) == ".SLDPRT") { BinaryToDxfFile(binary, fileName, Path.Combine(tempDxfFolder)); } else { BinaryToDxfFile(binary, fileName, Path.Combine(tempDxfFolder, Path.GetFileNameWithoutExtension(item.FileName))); } countIterations++; } } catch (Exception ex) { MessageObserver.Instance.SetMessage($"Failed to save new dxf files to destination folder.\t" + item.FilePath + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); throw ex; } } #endregion #region clear temp dxf directory var files = Directory.GetFiles(tempDxfFolder); foreach (var file in files) { File.Delete(file); } #endregion //MessageBox.Show("Статус: Выгрузка DXF файлов завершена. Количество выгруженых файлов " + countIterations); //countIterations = 0; }