This incomplete but practical tutorial will show you how to design a new part step-by-step. It will not use all the functionalities of Eagle3D, but it will work.
We assume that the component already exists in Eagle (it is in a standard library, or you created it).
Open the file ulp/3dusrpac.dat in your favorite editor and add this line :
EAGLEPACKAGE:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:EAGLE3DMACRO(::
Replace EAGLEPACKAGE by the package name as known by Eagle. To know this name, open Eagle, place the component on a board or a schematic, select the Info icon (i) and click on the component. You can now see the package name on the line "PACKAGE = …" For this tutorial, we will use the existing HDSP-R, that is a double 7-segments display.
Replace EAGLE3DMACRO with the name you will use for the macro. We will name it DIODE_LED_DOUBLE_7SEG.
Now the line should read :
HDSP-R:0:1:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:DIODE_LED_DOUBLE_7SEG(::
Open the file povray/user.inc and add these lines just before the last #end :
#macro DIODE_LED_DOUBLE_7SEG(value)
//your local definitions here
union{
//your povray code here
}
#end
From now, when we run the Eagle3D ulp script on a board containing the HDSP-R package, the generated pov file will refer to the DIODE_LED_DOUBLE_7SEG macro in user.inc.
I will not explain how to code with povray here. You can find an excellent tutorial here. This scheme presents the coordinates system. Note that in Eagle, the coordinates are in milli-inches by default, but in Eagle3D, you must enter the coordinates in mm.
Here is the code to draw a double 7-segments display :
#macro DIODE_LED_DOUBLE_7SEG(value)
//First, we make a leg. We will use this object many times, so we define it once here as a local definition.
#local leg = object{
cylinder {<0,-3,0>,<0,1,0>,0.25 texture{col_silver}}}
//Then we make a corner (the corners support the part)
#local corner = object{
box {<0,0,0><2.5,1,2.5> pigment{White}}}
union{
//Now, we put all legs in place
object{ leg translate<-10.16,0,7.935>}
object{ leg translate< -7.62,0,7.935>}
object{ leg translate< -5.08,0,7.935>}
object{ leg translate< -2.54,0,7.935>}
object{ leg translate< 0,0,7.935>}
object{ leg translate< 2.54,0,7.935>}
object{ leg translate< 5.08,0,7.935>}
object{ leg translate< 7.62,0,7.935>}
object{ leg translate< 10.16,0,7.935>}
object{ leg translate<-10.16,0,-7.935>}
object{ leg translate< -7.62,0,-7.935>}
object{ leg translate< -5.08,0,-7.935>}
object{ leg translate< -2.54,0,-7.935>}
object{ leg translate< 0,0,-7.935>}
object{ leg translate< 2.54,0,-7.935>}
object{ leg translate< 5.08,0,-7.935>}
object{ leg translate< 7.62,0,-7.935>}
object{ leg translate< 10.16,0,-7.935>}
//Then we make the box
box {<-12.5,1,-9.5>,<12.5,8,9.5> pigment{White}}
//We put the four corners in place
object{ corner translate<-12.5,0,-9.5>}
object{ corner rotate<0,90,0> translate<-12.5,0,9.5>}
object{ corner rotate<0,180,0> translate<12.5,0,9.5>}
object{ corner rotate<0,270,0> translate<12.5,0,-9.5>}
//Finally we put the top, that will include the 7-segments image.
box {<-12.5,8,-9.5>,<12.5,8.1,9.5> pigment{image_map{"tex_double_7seg.png" once} rotate<90,0,0> scale<25,0,19>
//Since we built it from the lower front left corner, we translate all the object to put the center at <0,0,0>
translate<-12.5,0,-9.5>}}
}
#end
To use this macro, you will need this texture (named tex_double_7seg.png) in your povray directory :
Here's the final result, on a board I made (click on the image to get full size) :