Casting LWPolylines to DxfPolylines in IxMilia
Now, it will be complicated, i'm not used to write issues, so please be patient, I will elaborate it. Issue is coneccted to feel88 DeepNestPort and 9swampy DeepNestPort repositories, they all have same problem with export.
NOW I am aware that in DeepNestSharp (current one, this repository) exception is handled, that is why I mention both upper ones, but with context, I was able to dig into problem deeper.
- Runtime Exception text: (from author feel-88 and 9swampy DeepNestPort)
(Bold text in block of this text translated by me, unnecessary paths removed)
System.InvalidCastException: **You can't cast object of type** 'IxMilia.Dxf.Entities.DxfLwPolyline' **to type** 'IxMilia.Dxf.Entities.DxfPolyline'.
w DeepNestLib.DxfParser.OffsetToNest(IList`1 dxfEntities, DxfPoint pivot, DxfPoint offset, Double rotationAngle) in [...]\DeepNestPort-master\Framework\DeepNestLib\DxfParser.cs:line 362
w DeepNestLib.DxfParser.Export(String path, IEnumerable`1 polygons, IEnumerable`1 sheets) w [...]\DeepNestPort-master\Framework\DeepNestLib\DxfParser.cs:line 217
w DeepNestPort.Form1.toolStripButton2_Click_1(Object sender, EventArgs e) in [...]\DeepNestPort-master\Framework\DeepNestPort\Form1.cs:line 1360
Now, in this repo there is added DxfExporter.cs, in DeepNestLib.Core, probably to solve problem, to substract and differ input and output. I tested it myself and found a reason, in a moment function OffsetToNest( receives LwPolyline object it cannot cast it to DxfPolyline, so maybe it should get this type at export.
I "solved" it temporaly by removing case LwPolyline in OffsetToNest function, cause this needs to be resolved by writing external module outside IxMillia lib,, which perform the cast (you cannot offset LWPolyline vertices), or by externing IxMilia by yourself.
Or I am blind, and don't see some easy solution, hah.
@fel88 forwarded, to information.
@fel88 forwarded, to information.
Hi! Can you provide the dxf file you are trying to load?
FAKEPARTS.zip @fel88
I've tried to nest you parts, and I've not faced any errors or exceptions. It seems works well. The resulting files (sheet1.dxf, sheet2.dxf) can be opened in LibreCAD without any problems. So, could you please be more specific how to reproduce the exception you mentioned before? Maybe you can provide particular STR (steps to reproduce) or a video? nests.zip
yes, I will try reproduce it in this week and feed a result to you!