Thread Previous • Date Previous • Date Next • Thread Next |
Vesa Solonen wrote:
On Wed, 17 Jun 2009, cfdev wrote:Anybody have made (or work) an fonction to import an image(bmp,jpeg,png) or an vectoriel SVG or directly an dxf for pcb board and drawings ?Just thinking yet. I've been searching simple SVG-parser for decomposing SVG files to primitives. Then those primitives would be mapped to eeschema or pcbnew internal vector format. That's not too complicated at all, but my limited coding skills would require several days anyway. Espcially if svg parser had to be developed from scratch. I think SVG would be best format to support with just basic primitives and operations (scaling, translation, and rotate). Bezier etc. would be left out in the beginning, ellipse support would be nice though. SVG import would also allow convenient complex symbol generation with advanced graphics editors.It may not allow calling our implementation SVG compliant, but would be of value anyway. http://www.w3.org/Graphics/SVG-Vesa
Vesa,This is a good idea. SVG is simply XML, so a person can use libxml2, which is standard on most linux systems. A person can read the whole file into a DOM tree in about 5 lines of code. Then you simply have to walk the tree, and generate PCBNEW graphic constructs from them. However, I do not believe that PCBNEW's graphic constructs, nor graphics environment, are currently general or rich enough to support anywhere near 30% of what you might find in the SVG spec.
However, were we to switch over to wxGraphicsContext first, then I think adding SVG support could actually lead to something worthwhile. In fact, one might argue that if we were to switch to wxGraphicsContext, that as we do so, we re-invent our graphic primitives to match those found typically in an SVG file, FIRST. Then add the domain specific attributes to those graphic primitives, such as netcode, etc. This is near full rewrite of PCBNEW now. But it would be like building a car standing next to a junk yard. It can go pretty quick when you have all the parts. The trick I think is build it from the ground up. (Don't try and *swap* out a fender or bumper at a time.)
Jean-Pierre, have you had time to consider wxGraphicsContext's use in pcbnew?
Dick
Thread Previous • Date Previous • Date Next • Thread Next |