Re: [Pythoncad-developer] PythonCAD elements and the xml schema.
CAD Application entire developed in Python
Status: Beta
Brought to you by:
matteoboscolo
From: <ger...@gm...> - 2010-01-14 20:57:52
|
Hi Matteo, Thank you for the link I didn't knew this, it is interesting. What do you mean with: > I .net i strongly use serialization, and I use to load very > huge xml file and this file will be loaded in a very short > time .. I did not want to use oracle, I was looking for a generic way to describe geometric primitives. If we have a generic way to describe a geometric primitives we can create new entities that are based on or use a compound of standard geometric primitives. My idea was to define a way to describe geometric primitives based on the oracle sdo_geometry datatype, not use oracle itself. Here is a short description of the sdo_geometry datatype and what I had in mind We can adjust the sdo_geometry datatype so that it suits us well. I think this is a condensed way to describe a geometry, it is used for very large amounts of spatial data in databases Maybe this can help us to keep our files as small as possible meaning less time to load or save them. In the beginning the sdo_geometric datatype looks a little bit difficult but it is very easy to write functions that (for instance) split the geometry in multiple parts or reverse the geometry. This is how current points are described in PythonCAD xml. I don't want to change it, it is file. <image:Points> <image:Point id="0" x="200.51097480092585" y="261.42252735360762"/> <image:Point id="1" x="554.89312420833494" y="115.73893005580049"/> <image:Point id="2" x="516.37339427737993" y="151.8821720888912"/> <image:Point id="3" x="863.48937127348472" y="234.35641810861949"/> <image:Point id="4" x="254.3827367855306" y="351.33464277268638"/> </image:Points> <Geometry> <GType>03</GType> <ElemInfo> <Number>1</Number> <Number>1003</Number> <Number>2</Number> </ElemInfo> <Points> <Point id="0"/> <= reference to the point in the list above. <Point id="1"/> <Point id="2"/> <Point id="3"/> <Point id="4"/> </Points> </Geometry> The <GType>03</GType> describes the geometry type which is used. It can be: 01 POINT (we do not need this). 02 LINE or CURVE Geometry contains one line string that can contain straight or circular arc segments, or both. (LINE and CURVE are synonymous in this context.) 03 POLYGON Geometry contains one polygon with or without holes. 04 COLLECTION Geometry is a heterogeneous collection of elements. 05 MULTIPOINT Geometry has one or more points. (MULTIPOINT is a superset of POINT.) 06 MULTILINE or MULTICURVE Geometry has one or more line strings. 07 MULTIPOLYGON Geometry can have multiple, disjoint polygons (more than one exterior boundary). A ElemInfo is a series of triplets (tuples with 3 values) which describes how the points are interpreted: <ElemInfo> <Number>1</Number> <Number>1003</Number> <Number>2</Number> </ElemInfo> The first number (1) indicates the index of the first point this ElemInfo describes. The second number (1003) indicates this is a exterior polygon ring. Possible values are: 1= point, we do not need the, point is already there. 2= line string, is used for circular and linear connections. 1003= exterior polygon ring. 2003= interior polygon ring. The third number (2) indicates that the points are connected by circular arcs. Example ElemInfo triplets which descibes a exterior and a interior ring (hole): (1,1003,1)(9,2003,2) The first (1,1003,1) describes a exterior ring which starts at point 1 and has linear connections between points. The second (9.2003,2) describes the interior ring which starts at point 9 and has circular connections between points. There can be any number of triplets. The list of points are references to the point list as it current exist in the PythonCAD xml file. This way we can also describe the boundary of a hatch which can exist of multiple exterior and interior rings. We can not describe ellipses or splines with this standard sdo_geometry construct but we can think how to extend it. My goal with this is to find a generic way to describe element geometry. All the other tags and attributes that describes entities stays as it is now. Regards, Gertwin Op schreef "mat...@bo..." <mat...@bo...>: > Hi Gertwin, > We can create object structure starting from an xsd schema. > I .net i strongly use serialization, and I use to load very > huge xml file and this file will be loaded in a very short > time .. > In this link there is a proget that create some classes > starting from xml schema: > http://www.rexx.com/~dkuhlman/generateDS.html > I know that in python thare is the abiliti to load and write > object directly from file. > I don't whant to use the oracle db (It's not open source). > In the following days i will do some test and let you know > if we can do some improvments in this direction. > Regards, > Matteo > ----- Original Message ----- > Da : Gertwin Groen ger...@gm...> > A : pythoncad-developer > Pyt...@li...>, Matteo Boscolo > mat...@bo...>, Yagnesh Desai > yn...@ln...> > Oggetto : PythonCAD elements and the xml schema. > Data : Wed, 13 Jan 2010 22:55:35 +0100 > > Hello all, > > > > I want to define a list of elements (entities) and their > > geometry primitives we want to provide in PythonCAD that > > are not yet supported. The file format of PythonCAD is > > described in the pythoncad.xsd schema, this the base of > > what a PythonCAD drawing can contain. > > > > I think it is time to review this schema because it has an > > influence on everything we want to do with PythonCAD. > > This is very necessary because changes in the > > schema/drawing format are time consuming to implement in > > PythonCAD. > > > > What we have: > > Current supported list of elements (from the pythoncad.xsd > > schema): - Points > > - Segments > > - Circles > > - Arcs > > - HCLines > > - VCLines > > - ACLines > > - CLines > > - CCircles > > - LDims > > - HDims > > - VDims > > - RDims > > - ADims > > > > In PythonCAD there are more elements which are not > > described in the schema: > > > > - TextBlock > > - Polyline > > - Fillets? > > - Chamfer? > > > > What we want: > > Current unsupported list of elements/entities: > > - polylines with arcs > > - block definition and reference > > - ellipse arc > > - ellipse > > - hatch > > - polygon (as AutoCAD MPolygon, very similar to hatch) > > - ... > > > > In the current schema all the elements are described and > > each of them has his own description of its geometry. > > If you give the schema a second look you see that multiple > > elements have a similar geometric primitive. > > For instance: > > A segment is a polyline with 2 points. > > A circle is a arc with the start angle == end angle > > etc. > > > > It would be better to have one geometric primitive where > > all the entities make use of it (if possible). > > Future elements can also make use of this geometric > > primitive or a group of primitives. > > If we have only one geometric datatype the drawing of the > > entities is much simpler (to maintain and for new > > elements). > > > > Maybe a candidate for a geometric datatype is the oracle > > SDO_GEOMETRY datatype (I have a GIS background thats why I > > chose this). The only thing that is not directly supported > > is a ellipse. > > > > The supported geometric types by the SDO_GEOMETRY datatype > > are (from the oracle documentation): > > > > POINT > > Geometry contains one point. > > * PythonCAD element Point > > > > LINE or CURVE > > Geometry contains one line string that can contain > > straight or circular arc segments, or both. (LINE and > > CURVE are synonymous in this context.) > > * PythonCAD element Segment, Polyline (with and without > > arcs) > > > > POLYGON > > Geometry contains one polygon with or without holes. > > * PythonCAD element Hatch and Polygon > > > > COLLECTION > > Geometry is a heterogeneous collection of elements. > > COLLECTION is a superset that includes all other types. > > > > MULTIPOINT > > Geometry has one or more points. (MULTIPOINT is a superset > > of POINT.) > > > > MULTILINE or MULTICURVE > > Geometry has one or more line strings. (MULTILINE and > > MULTICURVE are synonymous in this context, and each is a > > superset of both LINE and CURVE.) > > * PythonCAD element ellipse can be presented as a > > collection of arcs > > > > MULTIPOLYGON > > Geometry can have multiple, disjoint polygons (more than > > one exterior boundary). (MULTIPOLYGON is a superset of > > POLYGON.) * PythonCAD element Hatch and Polygon > > > > I think this datatype is not suited for describing 3D > > elements but I have no/very limited knowledge of 3D > > > > Any thoughts on this? > > Better, other ideas? > > > > Regards, > > Gertwin |