Comments (11)
Thanks. Any chance the Load method can throw System.NotSupportedException in future versions?
from netdxf.
There are two methods in the class DxfDocument exactly for this purpose, called:
public static DxfVersion CheckDxfFileVersion(Stream stream, out bool isBinary)
and
public static DxfVersion CheckDxfFileVersion(string file, out bool isBinary)
In your case it will return AutoCad14. netDxf is compatible with dxf versions AutoCad2000 and upwards, anything lower and it will not be able to read it. You can use the Debug build if you want the library to throw any exception that might occur during the reading process. The thing is that, if the file is one of the compatible dxf versions, and the Load method still returns null there is nothing you can do. It might be a bad formatted file or a bug, in that case I will need to take a look at it to find a fix.
Daniel
from netdxf.
You can copy all elements to to a compatible dxf file which you can load successfully, then save as it.The new file can be loaded successfully too.
from netdxf.
The "Load" method will return null if the file has not been able to load.
Please verify that the "BICYCLE.dxf" in in the correct place and that your code can see it by using something like this first: Console.WriteLine("File exists: " + File.Exists("BICYCLE.dxf"))
.
This is almost always a local issue involving an incorrect path. I suggest using an exact file path while testing your code so that you know 100% that it works first.
Note:
Loading dxf files prior to AutoCad 2000 is not supported.
from netdxf.
The file exists and I am able to use the library with many other DXF files but not with bycicle.dxf. Also, the Load method should throw a FileNotFoundException if the file does not exist but it is not the case. Had you the chance to test the file I attached?
from netdxf.
Ahh, I receive a System.NotSupportedException
.
Your issue is that Loading dxf files prior to AutoCad 2000 is not supported.
I opened the file with CAD and resaved it as AutoCAD 2007 format, and the 'DxfDocument.Load()' worked perfectly.
Alternately you are using another unsupported format (Too new?, or from some odd program with bad heders?)
from netdxf.
That is a question best asked of the developer haplokuon, but I imagine that there are so many things that can cause the file not to load, and there is very little way to tell between something being unsupported verses something being corrupt etc.
You are welcome to investigate and submit a pull request to add the feature, but its easy enough to catch a generic exception or show a generic error to a user whenever the return is null, and just state that it is an unsupported file, and that they should manually resave the file in a newer format (AutoCAD 2007 in my case).
Source of the dxf loading (DxfDocument Read(Stream stream)
) is here if you want to take a look: https://github.com/haplokuon/netDxf/blob/master/netDxf/IO/DxfReader.cs
from netdxf.
You can copy all elements to to a compatible dxf file which you can load successfully, then save as it.The new file can be loaded successfully too.
Thx, it work for me too. File that was saved from autocad was not opened. but show version DXF.
When i save els at new file - document start to reading.
Besides file after copy become from 30MB - 10MB
Thx.
from netdxf.
I got your file " MKM_HdM_EP_100_GR_G00_x_x_01_Grundriss.dxf" and you need to update the library using the latest source code. It seems that the problem you have loading the file is related with a bug while reading the layer states, that has already been fixed.
Regarding the reduction in file size that may happen. Overtime the drawing can accumulate a lot of stuff that is not in use anymore like blocks, styles, layers,... If you use AutoCad that exactly the purpose of the "purge" command clean the drawing of unreferenced objects.
from netdxf.
Hi haplokuon.
Here is a sample dxf file(cad 2000) still have null issue. could you check this file?
test.zip
from netdxf.
@yoonsungkim76
If you have a new problem open a new Issue, do not hijack unrelated old posts.
First make sure you use the latest available source code. I found a small problem with your DXF, there are several 1071 codes out of place in the Layer data. If you use the Debug build an assertion (not an exception) will be raised showing that there is something abnormal with your file but will allow you to continue loading it. If you use the Release build the problematic lines will be skipped and the loading process will continue normally without returning null.
from netdxf.
Related Issues (20)
- Cad Entitites Viewer HOT 2
- dxf file opening error HOT 3
- Fusion 360 DXF Export R14 HOT 2
- dxf load is empty HOT 2
- Finding the Center of a Circle HOT 2
- StackOverFlowException on exploding blocks HOT 1
- DxfDocument.Load returns null on AutoCad2000 file HOT 1
- Compatibility issue upgrading from version 2 to 3 HOT 1
- How to implement automatic layout algorithm? HOT 4
- How can I add new point to Spline.ControlPoints? HOT 2
- FontFamilyName getting overwritten HOT 6
- Creating multiple row Text entity corrupts output file HOT 3
- Unsupported types HOT 1
- Getting lines vertices HOT 3
- Insert exploding issue. (Reading issue or unsupported type) HOT 1
- Why are spline entities limited to degree 10? HOT 13
- Doesn't list the Attributes of the file HOT 1
- Important notice HOT 5
- Error when loading a file created with netDxf HOT 3
- is possible working this library with IronPython? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netdxf.