This project is read-only.

Interactive CAD like application

Apr 4, 2012 at 5:16 AM

I am trying to build CAD like application using sharpgl in c#

i want to save files in such a way that next time when i open same file i must be able to reuse the polygons drawn (re size),

i think DXF or DWG formats are suitable for such purpose,"so can any one help me out in saving files in such format.?"

Apr 19, 2012 at 12:16 AM

Hi Mahantesh,

I am currently working with STL(stereolithography) files in binary format. I can help you in it.

Apr 21, 2012 at 6:08 AM

so how do i save what ever i draw on a form application in to DXF or DWG formats using c#?i am interactively drawing lines and some basic polygons  on forms,so is there a method to convert that opengl rendering functions into a format such that next time i open the same file i could be able to reuse the drawings on the form to resize for example... 

Apr 25, 2012 at 4:38 AM
mahantesh wrote:

so how do i save what ever i draw on a form application in to DXF or DWG formats using c#?i am interactively drawing lines and some basic polygons  on forms,so is there a method to convert that opengl rendering functions into a format such that next time i open the same file i could be able to reuse the drawings on the form to resize for example... 

That's both a very simple and very complex question.  Fundamentally, you need to be storing in memory what lines, polygons, etc. you are drawing. Then you need to be able to write them to a file.  Then you need to be able to load them back into memory and redraw them.  The SharpGL is able to handle some of that for you. The SharpGL SceneGraph can store a representation of some (all?) of the primitives you are drawing.  The Serialization classes can read and write an XML file representing the SceneGraph.  There are also some classes for importing models from some common formats (e.g. .cob, .3ds, .obj).

If you want to read and write AutoCAD DWG format, there is an expensive library (TrueDWG) and a semi-open library (from the OpenDesignAlliance).  You would still need to write your own code to translate what you're reading from DWG into something SharpGL can display, and for writing your in-memory representation of the objects back to DWG.

DXF is easier in that it is an ASCII-based format with documentation, but even if you can find a convenient library that reads and writes DXF, you'll still need to write your own code to transfer it to/from SharpGL.

May 6, 2012 at 9:48 AM

Also have a look at CadLib, which can read/write/render DXF and DWG files. This is a 100% .NET library. The OpenGL support is quite basic though, SharpGL's support is far more complete.

- Wout