cart: empty [ Login ]

DxfWriter.Write issue in ww.cad.netstandard library

1 
Treta infotech
6/10/2019 5:35 AM
I have written code to create autocad drawing in web api in asp.net core 2.0. My code is written as below:
C# Code:
[HttpPost] public IActionResult GetAutocadFile([FromBody]AutocadObjectsModel autocadObjectsModel) { string Filename = DateTime.Now.ToString("ddMMyyyyhhmmss") + ".dxf"; DxfModel model = new DxfModel(); model.Header.InsUnits = DrawingUnits.Centimeters; //GraphicsConfig config = new GraphicsConfig(); //config.FixedForegroundColor = new WW.Drawing.ArgbColor(0, 240, 0); Double prevContainerWidth = 0; if(autocadObjectsModel!=null && autocadObjectsModel.Sheets!=null && autocadObjectsModel.Sheets.Count > 0) { AddCommonTexts(ref model, autocadObjectsModel.DesignId, autocadObjectsModel.DesignName, autocadObjectsModel.DesignType, autocadObjectsModel.DesignSubType, autocadObjectsModel.Base, autocadObjectsModel.NoofPlanes); Log.FileLog("Common information added..",LogPath); foreach (var sheet in autocadObjectsModel.Sheets) { GetContainer(Convert.ToDouble(sheet.Width), Convert.ToDouble(sheet.Length), prevContainerWidth, ref model); //GetPolylineContainer(Convert.ToDouble(sheet.Width), Convert.ToDouble(sheet.Length), prevContainerWidth, ref model); Log.FileLog("Container created for "+sheet.SheetNo, LogPath); Double prevWidth = 0; foreach (var item in sheet.Datas) { //AddPolylineObjectInDrawing(item, ref model, prevWidth, prevContainerWidth, Convert.ToDouble(autocadObjectsModel.Sheets[0].Width), Convert.ToDouble(autocadObjectsModel.Sheets[0].Length)); AddObjectInDrawing(item, ref model, prevWidth, prevContainerWidth, Convert.ToDouble(autocadObjectsModel.Sheets[0].Width), Convert.ToDouble(autocadObjectsModel.Sheets[0].Length)); prevWidth = prevWidth + Convert.ToDouble(item.Measures.Width) + 1; } Log.FileLog("Objects added in " + sheet.SheetNo, LogPath); prevContainerWidth = prevContainerWidth + Convert.ToDouble(sheet.Width) + 60; } Log.FileLog("File write started..", LogPath); DxfWriter.Write(FilePath + Filename, model); Log.FileLog("File write done..", LogPath); var content = System.IO.File.ReadAllBytes(Path.Combine(FilePath, Filename)); Log.FileLog("File reading done for export..", LogPath); return File(content, "application/dxf", Filename); } else { return BadRequest(); } }
Everything is working fine on localhost. Once I have hosted the code on test server, sometimes it is taking too much time in file generation. So I have put log and come to know that it stuck on the line:
C# Code:
DxfWriter.Write(FilePath + Filename, model);
So there is some issue in this function. Could you please check?
1