Click here to Skip to main content
15,125,074 members
Please Sign up or sign in to vote.
1.71/5 (3 votes)
See more:
hi friends....can anyone give me ideas on how to implement "viewing autocad(3d file) in windows forms application using .net" without installing autocad software.
thanks in advance
Updated 11-Feb-15 23:03pm

Hi there, I wrote something in WPF a few months ago...
You can find it here: WpfDxfViewer
Kenneth Haugland 10-Feb-15 9:53am
That is very cool stuff, but what can and cant it read? Dxf version 2012 2014 etc?
Riyaz Mohammad 10-Feb-15 23:51pm
Hi Danilo Corallo,
Thanx for quick reply and solution. Can we develope same application in simple window forms in .net not using wpf?

Thanx advance
Danilo Corallo 11-Feb-15 10:01am
Hi Kenneth, I've done it with Windows Forms and GDI+ prior to move to WPF...
I need to look if I can find it back...
Kenneth Haugland 5-May-15 14:56pm
Hah, I didn't see this until now. You answered the ops comment instead of mine ;)
In any rate, I'm writing a SimpleCAD article, so I'd thought I include imports from Shape and DXF files. However its a lot of work...
I've been using DXFLib for DXF parsing (available here).

I think it can read correctly any DXF from 2007 to 2012...

The graphic part is incomplete, I've been handling the basic entities (line, polyline, arc, circle,...) but the list is quite long. I actually use it in my apps after cleaning and exploding my drawings (ACAD commands EXPLODE and PURGE)

Take it as a starting point, it's not a CAD neither is a complete project.
Kind Regards,
Riyaz Mohammad 11-Feb-15 0:10am
Hi Danilo Corallo,
I am trying to run your "WpfDxfViewer" application using WPF.But i am geeting error in "MainWindow.xaml" page.

Error 1 The tag 'ZoomableCanvas' does not exist in XML namespace ''. Line 43 Position 14.

Error 2 The type 'ZoomableCanvas' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

How can i resolve it?

Thanx Advance.
Danilo Corallo 11-Feb-15 10:00am
ZoomableCanvas is included in the solution. You may need to remove and add the reference from the project in order to fix it.
Riyaz Mohammad 12-Feb-15 0:33am
i tried same way but again same problem is coming. In order to add a "ZoomableCanvas" reference that reference dll not included in your project files. How could i solve this issue. One more thing i have to tell while starting the project i tried to open your project directly. but it's not opened some error came. So i make new WPF application and adding all your files. finally i am struck at this point.
Will you Please try to solve this issue? if need means i ll send full project.

Thanking you
Riyaz Mohammad 12-Feb-15 0:43am
One more thing..i checked in "Obect Browser" for "ZoomableCanvas" class. It's showing in "System.Windows.Controls.ZoomableCanvas". I add "System.Windows.Controls.dll" but showing error is 'Cannot resolve dependency to assembly 'System.Windows, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event' like that.
Danilo Corallo 12-Feb-15 3:57am
Hi, I've just downloaded the solution from GitHub as it is, and it compiles with no problem, no problem in references. I'm using VS2013 and project requires .NET Framework 4.5.1. ZoomableCanvas is correctly included in source code (no DLL), and while it uses a namespace which extends System.Windows.Controls, it's NOT included in System.Windows.Controls.dll. Finally ZoomableCanvas is an external component which I've taken from here.
Riyaz Mohammad 12-Feb-15 4:11am
Hi Danilo Corallo, But i am using "VS 2010" with '.NET Framework 4.0'.In Before i tried open as it is downloaded file but i am getting error "The specified file is solution file, but was created by new version of this application and can not be opened." So i need to install "VS 2013" along with '.NET Framework 4.5' then only it will come or else is there any way to develop by "VS 2010" along with '.NET Framework 4.0' software.

Thanks for giving valuable suggestions to me.
Danilo Corallo 12-Feb-15 4:22am
Hi, you need at least VS2012 in order to target framework 4.5. I think the project can be downgraded to framework 4 but it requires some work... Have you tried to change Target Framework (Project Options > Build) to 4.0?
Riyaz Mohammad 12-Feb-15 5:42am
No i didn't change target file like (Project Options > Build). I told you right While opening direct Application by VS2010 it's not opened. So i created a new WPF application and add all your file then try to run the application.Just now i removed entire "ZoomableCanvas" folder and add 'ZoomableCanvas.dll' download by "". Now it's working for 2D dxf files. But not work out for 3D dxf files. Is this "DxfViewer" for only 2D files or else we can display 3D dxf also. Actually i need to display 3D dxf file.could you help me to do it?
Riyaz Mohammad 13-Feb-15 1:19am
Hi Danilo Corallo, how are you? i analised your code in "WPFDXFViewer" Application.Now it's work out for 2D dxf files even though some entities are missing. How can i get those missing entities like 'DXFText','DXFMText','DXF3DFace'....My aim is view 3D dxf me to do it.
Thanx Advance
nltd 28-Apr-16 0:43am
Hello Everybody,
I am doing a project, which need too display a file dxf. And i downloaded a project of Danilo Corallo and it is vr useful, interesting. But i want to get and display color origin of file dxf. Can i? Thank you so much.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900