Importing AutoCAD/Solidworks drawings/objects into winforms?
Has anybody done anything like that?
I need to import 3d objects, done in either AutoCAD or Solidworks, and draw them into a windows form. I only need the object to be viewed in 3D and moved开发者_开发技巧 around - no manipulation required.
I am assuming I will need 2 libraries at least, one for a very simple 3D engine, and one to actually get what I need from the CAD/SW files. Autodesk has a SDK available for developing AutoCAD plugins using .NET, but I am not sure if you can use it the other way around - loading files into the .NET app.
Any help, links, and ideas are appreciated.
DXF files were the universal interop file format in the CAD world, last I looked. They are pretty easy to parse, it is a simple text format. And there is lots of info in the file you can simply skip and still get a recognizable model of the original drawing. The R12 format was especially easy.
Although you don't really want to write the code from scratch if you can avoid it. Shop around, there are plenty of programmers that have done this before. Be careful to avoid re-inventing a CAD program.
I believe there's an exposed ActiveX control packaged with Design Reviewer that you could embed with some trouble into a .NET app. Apparently, someone is doing it, so it probably works. That control only reads DWF files, though, so the CAD users would either have to publish their files to DWF (least work for you), or you might be able to convert to DWF using the DWF toolkit (not sure - looks like not).
Have you looked into eDrawings from SolidWorks, I think it is ActiveX and it can open DXF, and SolidWorks model. You can embed it into Winforms.
If you want to display AutoCAD DWG or DXF files, you can use Autodesk's free DWG Viewer, known as DWG Trueview (http://www.autodesk.com/dwgtrueview)
This can be embedded in a Windows form, as explained here
A more detailed explanation of the steps is here, but it uses AutoCAD as an example, so don't copy & paste verbatim. It shows you how to link the "OPEN" command to a button.
You can access vertex information of 3D objects in Solidworks by using tesselation objects. But this is very similar to saving the model as a STL file.
Have a look at CadLib, which supports DXF/DXF, and can render in a Win Forms Control.
精彩评论