Author Message
 Post subject: Better / More Defined Library Export - XML conversion
PostPosted: 16 Apr 2017, 20:14 
Offline

Joined: 18 Apr 2014, 03:30
Posts: 14
So for the last while I have been working with the .asc format for Patterns and Components to at least partially generate some sets of custom header patterns in a range of sizes.

In the end I actually went so far as to write a bare-bones XML conversion to/from asc format so that I could manipulate a little bit easier, but still a lot of guesswork.

I would like to suggest that in future DipTrace move towards an XML format for the library import/export, with proper named attributes, more consistent structure ( Point in component patterns vs. Points in pattern patterns ), and a more sane and consistent coordinates system. It really wouldn't take that much work to accomplish, you could even do it just as an official converter to/from asc, the only thing that is needed to do that is a better knowledge of what each attribute on an element means, and preferably remapping the coordinates system.

Anyway, here are some notes which might help others also trying to generate libraries programatically...

* The general format is something like...

Code:
  (Element [attributes]
     (Subelement [attributes] )
  )


You would imagine that if an element had no arguments and no child elements, that it could be written "(Element )", but no, the ")" must be on it's own line in those cases - so whitespace is sometimes important. I suspect that these cases are when child elements are possible, but not required. Or it could be when there are no attributes and no child elements.

* Line ending is important, <cr><lf> only and always
* The attributes to an element are not named, they are just a space separated list of things, some quoted, some not
* The library export has an extra closing parenthesis, if the export contains 123 opening parenthesis, it has 124 closing ones, the import doesn't care if you omit the extra
* Units in most things appear to be in "thirds of a millimeter", if a unit is written as "3" then it means 1 mm
* Positioning of pads/pins/shapes is very confusing, I could never work out what was going on with shape position/dimension in the pattern exports.

Here is a rectangle surrounding a 2x31 in a pattern
(Shape 2 "N" 0 -0.5 -0.5 0.5 0.5 -4.471 -0.45 "" "" "N" 0 0 0 0 0.457 0)

Here is a rectangle surrounding a 2x1 in a pattern
(Shape 2 "N" 0 -0.5 -0.5 0.5 0.5 -4.471 0.889 "" "" "N" 0 0 0 0 0.457 0)

The first one should be about 81mm long, the second one about 5mm long, but the elements are virtually identical :-/

Component shapes are somewhat easier to figure out, they appear based around the center point of the bounding box, still very awkward to have to use negative coordinates but at least it makes sense.

* Numbering of pads/pins/shapes is all over the show, there's lots of confusing duplication, for example, a component pin has an ID number of some sort (the first number in it's attributes), then sub elements called "Name" which is a number, "StringNumber" which is a number and "Number" which is a number, ideally these are the same number, except when they are not because changing pin numbering in the GUI doesn't necessarily do what you would expect with these numbers. Pad numbers in patterns are similarly afflicted, they for example Pad 1 is "(Pad 1 "1" .... (Number 1)" except when it's not and you wind up with "(Pad 37 "1" ... )" or similar.

* We know that components include the pattern, but it's not a direct incorporation, there are some subtle differences, namely in a pattern library each "(Pattern...)" has a "(Value...)" but this does not get brought into the component's Pattern, and more curiously, the "(Points ...)" in a pattern library becomes "(Point...)" in a component library.

* A pattern when brought into a component library MUST have a "Pad 0" which is disabled, and SOMETIMES must have a "Pad N" (where N is one more than the last pad) which is also disabled, otherwise you will get no pads, or no last pad when it's in the component. In the pattern library, there is no Pad 0, and sometimes no Pad N.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group