cart: empty [ Login ]

Null exception when loading DWG model

1 
Emilsson
6/8/2018 12:01 PM
Hi When I'm loading the attached DWG file DwgReader.Read throws a NullReferenceException. From the stack trace it looks that this happens when it tries to resolve the path to an SHX font file.
Code:
vid WW.Cad.Model.Entities.ShxFile.GetShxFile(String filename, IList`1 path) vid WW.Cad.Model.DxfModel.GetShxFile(String shxFileName) vid WW.Cad.Model.Tables.DxfTextStyle.GetShxFile() vid WW.Cad.Model.Tables.DxfLineType.Element.(DxfModel model) vid WW.Cad.IO.ModelBuilder.ResolveReferences(ICollection`1 builders) vid WW.Cad.IO.ModelBuilder.ResolveReferences() vid WW.Cad.IO.DwgReader.Read(DxfModel model) vid WW.Cad.IO.DwgReader.Read()
This was caught by a unit test when I upgraded from 4.0.38.51 to 4.0.38.69. Code to reproduce the error:
C# Code:
static void Main(string[] args) { using (FileStream inputStream = File.OpenRead(@"C:\Temp\test.dwg")) { var model = new DwgReader(inputStream).Read(); } }
/Tomas
Wout
6/8/2018 12:37 PM
Oops, hadn't thoroughly tested the new font loading yet, sorry about that. I've just fixed it, please download the latest CadLib 4.0 version. - Wout
Emilsson
6/8/2018 1:09 PM
Thanks, that fixed it!
1