EEVblog Electronics Community Forum

Electronics => PCB/EDA/CAD => KiCad => Topic started by: firewalker on December 19, 2011, 10:00:59 am

Title: KiCad "undefined DRAW command #" error.
Post by: firewalker on December 19, 2011, 10:00:59 am
Does anyone faces the "undefined DRAW command #" error when importing converted libraries form EAGLE? It happens to the new versions o KiCad.

Alexander.
Title: Re: KiCad "undefined DRAW command #" error.
Post by: amspire on December 19, 2011, 11:19:12 am
I haven't tried it yet, but if you know the file with the problem, look at the line number in question.

The first character in the line sets the type of DRAW command. The latest KiCad eeschema allows for types "A" (Arc), "C" (Circle), "T" (Text), "S" (Square), "X" (Pin Description), "P" (Polyline), and "B" (Bezier Curve).

If it is none of these you get the error message.

Some builds lost the Bezier curve ("B") option, but I know the latest build I posted in the forum does have it.

Richard.

Title: Re: KiCad "undefined DRAW command #" error.
Post by: firewalker on December 19, 2011, 11:39:02 am
For example the relay library (http://library.oshec.org/compressed/relay.tar.gz (http://library.oshec.org/compressed/relay.tar.gz)).

Quote
#
# Dev Name: G2R
# Package Name: G2R
# Dev Tech: ''
# Dev Prefix: K
# Gate count = 2
#
DEF G2R K 0 40 Y Y 2 L N
# Gate Name: 1
# Symbol Name: K
F0 "K" 0 0 50 H V L B
F1 "G2R" 50 115 50 H V L B
F2 "relay-G2R" 0 150 50 H I C C
DRAW
P 2 1 0 0 -150 -75 -75 -75
P 2 1 0 0 150 -75 150 75
P 2 1 0 0 150 75 75 75
P 2 1 0 0 -150 75 -150 -75
P 2 1 0 0 0 -100 0 -75
P 2 1 0 0 0 -75 150 -75
P 2 1 0 0 0 100 0 75
P 2 1 0 0 0 75 -150 75
P 2 1 0 0 -75 -75 75 75
P 2 1 0 0 -75 -75 0 -75
P 2 1 0 0 75 75 0 75
T 0 225 235 70 0 1 0 >PART
X 1 1 0 200 100 D 40 40 1 1 P
X 2 2 0 -200 100 U 40 40 1 1 P
# Gate Name: 2
# Symbol Name: U

P 2 2 0 0 125 200 75 200
P 2 2 0 0 -125 200 -75 200
P 2 2 0 0 0 50 100 225
P 2 2 0 0 0 50 0 0
C 0 50 5 2 1 0 F
T 0 275 35 70 0 2 0 >PART
X O O 200 200 100 L 40 40 2 1 P
X P P 0 -100 100 U 40 40 2 1 P
X S S -200 200 100 R 40 40 2 1 P
ENDDRAW
ENDDEF

The as I can understand the problem occurs with multi part components like G2R.

(image from EAGLE)
(http://i.imgur.com/gjXSG.png)

There are hundreds of errors for the relay lib.

Deleting the two lines makes the component to appear in the lib browser but only the first part of it.

(http://i.imgur.com/dVxuqs.png) (http://i.imgur.com/dVxuq.png)
Title: Re: KiCad "undefined DRAW command #" error.
Post by: amspire on December 19, 2011, 12:26:07 pm
The eeschema library load does not allow for lines beginning with "#" between the DRAW and ENDRAW statements in the lib file.

It may need a change to the Eagle export script. I don't know enough about it to say if it is an easy fix or a difficult one.

I guess the thing to do would be to look at the lib format for another multipart component such as a LM324 quad opamp and see how multipart components should be handled.

Richard

Title: Re: KiCad "undefined DRAW command #" error.
Post by: amspire on December 19, 2011, 12:41:55 pm
I just discovered that this is how eeschema handles multipart components.

It always installs the first component part (Part A), which in the case of this relay is the coil.  So just add it twice.

Right click on the second one and go to Edit->Unit and change it from Unit 1A to Unit 2B

When you give the component a designation, it will add an "A" to the end of the part A item (the coil) and a "B" to the end of the part B item (the contacts).

So if you called it Rel01, you would end up with Rel01A and Rel01B.

It seems you can safely delete the stuff starting with "#" inside the DRAW section.

Richard
Title: Re: KiCad "undefined DRAW command #" error.
Post by: firewalker on December 19, 2011, 01:11:13 pm
Yep. That seams to do the trick. I will probably write a bash script converter.

My big complaint with KiCad is that there is no properly organized community in proper forum format. Maybe just here.

Alexander.
Title: Re: KiCad "undefined DRAW command #" error.
Post by: amspire on December 19, 2011, 01:17:57 pm
It would probably be better to change the Eagle Export script so it never puts lines beginning with "#" between DRAW and ENDDRAW.

I haven't really looked for KiCad forums. There is

http://tech.groups.yahoo.com/group/kicad-users/messages (http://tech.groups.yahoo.com/group/kicad-users/messages)


Title: Re: KiCad "undefined DRAW command #" error.
Post by: rennne on January 01, 2012, 01:31:53 pm
Use the script: eagle2kicad-0.9d.ulp to convert libs form eagle
it works fine .. you can download it under:
http://www.modulbot.com/download.html (http://www.modulbot.com/download.html)

If you want to modify it manualy use a "Regular Expression"-Editor:

"Find and Replace" ->

# Gate Name:.*$                     
and
# Symbol Name:.*$

Replace it with nothing

Empty lines are left instead .. kicad does not want that either

so again Find and Replace ..

\r\r

replace all with nothing ... then the empty lines where gone and kicad workes fine with it