Skip to content
Permalink
Browse files

Modified script set for Eagle to Altium files conversion.

SCH - fixed non-editable lines on sheet
PCB - fixed text output to PCB document by Chris Ergaenzung
  • Loading branch information...
retry.var
retry.var committed Apr 12, 2011
1 parent ab61846 commit 7d125a78e68d0134ecffe1042c8ce0fbbf4fdbb4
@@ -14,6 +14,7 @@
/*
* CHANGELOG================================================
*
* 10.11.2010: Version 1.4: changed lines (Record=13) to be accessable
* 29.12.2009: Version 1.3: fixed another linefeed bug
* 08.12.2009: Version 1.2: fixed further '%' issues
* 08.12.2009: Version 1.1:
@@ -298,7 +299,7 @@ string ArcRecord (UL_CIRCLE C, int Record, int Index, int Owner){
y=int(u2mil(C.y)/10);
r=int(u2mil(C.radius)/10);

sprintf (s, "|RECORD=12|INDEXINSHEET=%d|OWNERINDEX=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|RADIUS=%d|RADIUS_FRAC=0|LINEWIDTH=1|STARTANGLE=0|ENDANGLE=0|COLOR=16711680\n",Record, Index,Owner,x,y,r );
sprintf (s, "|RECORD=12|INDEXINSHEET=%d|ISNOTACCESIBLE=F|OWNERINDEX=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|RADIUS=%d|RADIUS_FRAC=0|LINEWIDTH=1|STARTANGLE=0|ENDANGLE=0|COLOR=16711680\n",Record, Index,Owner,x,y,r );
return s;
}

@@ -320,7 +321,7 @@ string LineRecord (UL_WIRE W,int Records,int Owner, int ownerpartid)
y2=int(u2mil(W.y2)/10);

if (W.curve==0)
sprintf (s, "|RECORD=13|OWNERINDEX=%d|ISNOTACCESIBLE=T|INDEXINSHEET=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|CORNER.X=%d|CORNER.Y=%d|LINEWIDTH=1|COLOR=128\n",Owner,Records,ownerpartid, x1,y1,x2,y2);
sprintf (s, "|RECORD=13|OWNERINDEX=%d|ISNOTACCESIBLE=F|INDEXINSHEET=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|CORNER.X=%d|CORNER.Y=%d|LINEWIDTH=1|COLOR=128\n",Owner,Records,ownerpartid, x1,y1,x2,y2);

else{
x1=int(u2mil(W.arc.xc)/10);
@@ -333,6 +334,35 @@ string LineRecord (UL_WIRE W,int Records,int Owner, int ownerpartid)
return s;
}

//------------------------------------------------------
string PartLineRecord (UL_WIRE W,int Records,int Owner, int ownerpartid)
{
int x1;
int y1;
int x2;
int y2;
int r;

string s;

x1=int(u2mil(W.x1)/10);
y1=int(u2mil(W.y1)/10);
x2=int(u2mil(W.x2)/10);
y2=int(u2mil(W.y2)/10);

if (W.curve==0)
sprintf (s, "|RECORD=13|OWNERINDEX=%d|ISNOTACCESIBLE=T|INDEXINSHEET=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|CORNER.X=%d|CORNER.Y=%d|LINEWIDTH=1|COLOR=128\n",Owner,Records,ownerpartid, x1,y1,x2,y2);

else{
x1=int(u2mil(W.arc.xc)/10);
y1=int(u2mil(W.arc.yc)/10);
r=int(u2mil(W.arc.radius)/10);

sprintf (s, "|RECORD=12|OWNERINDEX=%d|INDEXINSHEET=%d|OWNERPARTID=%d|LOCATION.X=%d|LOCATION.Y=%d|RADIUS=%d|RADIUS_FRAC=0|LINEWIDTH=1|STARTANGLE=%f|ENDANGLE=%f|COLOR=128\n",Owner,Records,ownerpartid,x1,y1,r, W.arc.angle1, W.arc.angle2 );
}

return s;
}

//------------------------------------------------------
string RectangleRecord (UL_RECTANGLE R,int Records,int Owner)
@@ -572,13 +602,11 @@ int MakePart(UL_SYMBOL S, UL_PART P, int OwnerPart, int Records, int partcount){


S.wires(W){
printf(LineRecord(W,Records,OwnerPart-2,partcount));
printf(PartLineRecord(W,Records,OwnerPart-2,partcount));
Records+=1;
}




S.texts(T){

if ((T.layer != LAYER_NAMES) && (T.layer != LAYER_VALUES)){
@@ -38,6 +38,33 @@ int x0, y0;
int usedunits;
string units [] = { "mil", "mm" };



//------------------------------------------------------
//convert string
//------------------------------------------------------
string ConvString(string text)
{
int i;
int Felder;
string helper;

helper="";


for (i=0;i<strlen(text);i++){
if (text[i]=='%')
helper=helper+"%%";
else
helper=helper+text[i];
}

return helper;
}




// PCB record handling functions

string record (string name)
@@ -483,14 +510,14 @@ board (B)
layer [LAYER_BORIGINS] = "";
layer [LAYER_TNAMES] = "TOPOVERLAY";
layer [LAYER_BNAMES] = "BOTTOMOVERLAY";
layer [LAYER_TVALUES] = "MECHANICAL3";
layer [LAYER_BVALUES] = "MECHANICAL4";
layer [LAYER_TSTOP] = "";
layer [LAYER_BSTOP] = "";
layer [LAYER_TCREAM] = "TOPPASTE";
layer [LAYER_BCREAM] = "BOTTOMPASTE";
layer [LAYER_TFINISH] = "";
layer [LAYER_BFINISH] = "";
layer [LAYER_TVALUES] = "TOPOVERLAY";
layer [LAYER_BVALUES] = "BOTTOMOVERLAY";
layer [LAYER_TSTOP] = "MECHANICAL3";
layer [LAYER_BSTOP] = "MECHANICAL4";
layer [LAYER_TCREAM] = "MECHANICAL5";
layer [LAYER_BCREAM] = "MECHANICAL6";
layer [LAYER_TFINISH] = "MECHANICAL7";
layer [LAYER_BFINISH] = "MECHANICAL8";
layer [LAYER_TGLUE] = "MECHANICAL9";
layer [LAYER_BGLUE] = "MECHANICAL10";
layer [LAYER_TTEST] = "TOPOVERLAY"; //?
@@ -554,7 +581,7 @@ board (B)

B.signals (S)
{
S.polygons (P) out_polygon (P, nets_c, -1); //
S.polygons (P) out_polygon (P, nets_c, -1);
S.wires (W) out_track (W, nets_c, -1);
S.vias (V) out_via (V, nets_c, -1);
out_net (S);
@@ -590,6 +617,37 @@ board (B)
int isComm = 0; if ((T.value == E.value) && (! hasComment)) hasComment = isComm = 1;
out_text (T, comps_c, isDes, isComm);
}




//Ergänzung Chris
if (hasDesignator==0){

//void out_text (UL_TEXT t, int c, int isDes, int isComm)


texts += record ("Text") + ra_comp (comps_c)
+ r_i ("INDEXFORSAVE", texts_c) + r_b ("SELECTION", 0)
+ r_layer ("LAYER", LAYER_TDOCU) + r_b ("LOCKED", 0) + r_b ("POLYGONOUTLINE", 0) + r_b ("USERROUTED", 1)
+ r_l ("X", E.x, x0) + r_l ("Y", E.y, y0) + r_f ("ROTATION", E.angle) + r_l ("HEIGHT", 10, 0)
+ r_s ("TEXT", E.name)
+ r_s ("DESIGNATOR", "True")
+ endr ();
texts_c ++;


}


// out_text (E.name, comps_c, 1, 0);







out_component (E, hasDesignator, hasComment);
}

@@ -623,7 +681,7 @@ board (B)
printf (pads);
printf (vias);
printf (tracks);
printf (texts);
printf (ConvString(texts));
printf (fills);
printf (polygons);
}
Binary file not shown.
BIN -776 KB (50%) downloads/EagleToAD.zip
Binary file not shown.
Binary file not shown.

0 comments on commit 7d125a7

Please sign in to comment.
You can’t perform that action at this time.