Sorry to re-post this, but i've done some more work on the library functions of EE-Draw, the data structures are done now and look promising, small enough to be included in the main .exe file. :o) I'm just about to do the compiler, it would be great if someone could look over the rough format i've posted below before I start coding it. :o) This will allow anyone to add parts in the EE-Draw library, new PICs, even non-EE things like flowchart boxes or pnuematic symbols etc. --------------------------------------------------------------- I drafted up a rough library file that has some parts declared and comments explaining why/what it does. Here it is: (sorry for the long post!) --------------------------------------------------------------- ** sample EE-Draw library file ** Suggested format for the EE-Draw parts library files. There will be 8 library "boxes", each can contain up to 32 parts or "items". This gives a total of 256 different items. More libs can be added to take it to 16 or 32 libs later etc. The 8 lib files are to be named: EEDRAW.L00 to EEDRAW.L07 and will be loaded automatically when the program starts. ** syntax ** Lib compiler is line based. Any line starting with a SPACE (like these lines) is ignored and can be used as a comment. Blank lines and all other whitespace are ignored. There are 2 control characters, that MUST be at the very start of the line: # this is a command char (must be followed by a command) \ this is a map char (must be followed by image,wire,place map) Note they are ignored above as they are not at the start of the line. ** lets try some real code ** Here is a real command char: =================================================================== # LIBNAME Standard =================================================================== This must be the first command in the file, and LIBNAME is the name of this lib and will appear on the lib menu in EE-Draw. This library will appear with the name "Standard". =================================================================== # ITEM 00 =================================================================== This is the first of 32 possible items in this lib file. Items are numbered 00 to 31. It MUST be 2 digits. NOTE! After an ITEM command, any following command codes will now relate to that item. # ITEMNAME Tran NPN 1 Note that any text string after ITEMNAME is kept intact, so the item name will appear as "Tran NPN 1" including the spaces. Maximum of 15 characters like all names in EE-Draw. # ITEMSHOW This is off by default! The ITEMSHOW command draws the actual item in the lib box. This is ok for smaller items. As the lib box is only 18 x 28 it will not be possible to show many large items. If the ITEMSHOW command is left out, the item will appear in the lib box as a name only! As this item is only 3x3 we can show it in the lib box. # LIBXY 01 01 This command gives the X and Y coords where the item is to be displayed in the lib box on screen. The lib box is 18 x 28 size. X and Y must be 2 digits. Reference is top left corner of the item maps. (All coords referenced to any item are always top left corner) ------------------------------------------------------------------- Now we can do the maps for this item. # PLACEMAP The place map must come first. The place map determines height in lines, and width is determined by the "X" char that is furthest to the right, (ie simple max width.) The next control chars must be \ chars. The lines starting with \ denote the map. The \ lines must have no lines between, and total map height is counted in lines. Note! The IMAGE, WIRE and PLACE maps must have same height. Basic format, this is the map that will be used to click on the item to place, move or delete it. The "X" character is the only one recognised. The layout denotes the size and shape of the item. (This item is 3 x 3 in total size.) \ XX \XXX \ XX # IMAGEMAP The IMAGEMAP command tells the compiler to get the image map. This is the "text" image that will be displayed. The image map may contain any ascii text char from space (32) up to ~ (126). Any chars outside that range will be converted to spaces. Here is the image map for a simple NPN; \ C \B \ E # WIREMAP Must again have same number of lines as image and place maps. The "W" char is the only char that will be recognised. Anywhere a "W" is placed will have the "wire" attribute and all wires attached to that point will autocorrect properly. \ W \W \ W Note! for convenience you can cut and paste one map into all 3 positions and then edit it. Handy with large item maps like a PIC etc. It is also legal to show a wire map like this: \ .W \W.. \ .W (using any char that is not "W" may be handy so you can see the general size and shape of the item) Those are the minimum commands needed by EE-Draw to place and wire items. I'm pretty happy with these so far. ----------------------------------------------- Other commands are possible, and can be added at later date for things like: # BOM (text string here) Will allow for a standard description or part number to be added for each item when BOM list is generated. # NUMBERXY ?? ?? A map used to show a position relative to the item where an auto-number can be added as parts are placed. ie; R1, R2, R17 etc. # VALUEXY ?? ?? Likewise is the position where the part value can be added by the user, ie; 100, 2k2, 120k etc. These enable something like this: (assuming NUMBERXY 01 00, and VALUEXY 02 01) | | R becomes: R17 | | 120k Or another example: (assuming NUMBERXY 01 00, and VALUEXY 04 00) | | R becomes: R17 120k | | I hope that makes sense. I'm sure people will want other commands, :o) so for now the compiler will simply ignore any command starting with # (command) that is not currently recognised. This is so people can play with different command ideas without crashing the lib compiler, and then when everyone is happy I can add the new command to the compiler. Here is a neater example for a PNP transistor: =================================================================== # ITEM 01 # ITEMNAME Tran PNP 1 =================================================================== # ITEMSHOW (yes we do want to show it) # LIBXY 05 01 (places it to the right of item 00 in lib box) ------------------------------------------------------------------- # PLACEMAP \ XX \XXX \ XX # IMAGEMAP \ E \B \ C # WIREMAP \ W \W \ W ------------------------------------------------------------------- That wasn't too hard?? How about a PIC?? :o) =================================================================== # ITEM 02 # ITEMNAME PIC 16F628 =================================================================== no ITEMSHOW (no we do NOT want to show it in lib box, just its name) (it is disabled because there is no # at start of line) # LIBXY 01 05 (places it underneath item 00 in lib box) ------------------------------------------------------------------- # PLACEMAP \ XXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \XXXXXXXXXXXX \ XXXXXXXXXX # IMAGEMAP \ ,---v----, \-|1 18|- \-|2 1 17|- \-|3 6 16|- \-|4 F 15|- \-|5 6 14|- \-|6 2 13|- \-|7 8 12|- \-|8 11|- \-|9 10|- \ '--------' # WIREMAP \ ,---v----, \W|1 18|W \W|2 1 17|W \W|3 6 16|W \W|4 F 15|W \W|5 6 14|W \W|6 2 13|W \W|7 8 12|W \W|8 11|W \W|9 10|W \ '--------' (Note! wire map only sees the "W" chars) ------------------------------------------------------------------- (end of lib file here) ------------------------------------------------------------------- -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.