r>
This first file does just the pad and lead geometry, without any solder.
As a result, there is no energy to optimize. The geometry set up
in this file will serve just as display in the later files, so one
can see the pad and lead. This is the time to get various
geometry decisions made before things get too complicated.
parameter padtoe = -36 // x coordinate of pad toe end. parameter padheel = 15 // x coordinate of pad heel end. parameter padwidth = 14 // full y width of pad.
no_refine
, since there is no
point in refining a fixed flat triangle. The face is colored green
for display purposes.
read
section
of the datafile, along with the other display facets, since these
facets are purely for display and have nothing to do with energy
calculations.
parameter thick = 6 //Thickness of lead in the z direction. parameter width = 10 // Width of lead in y direction parameter leadtoe = -30 // Toe of lead, relative to heel parameter bend = 90*pi/180 // bending angle of a curved section, radians parameter rad = 10 // inside radius of bends parameter orad = rad+thick // outside radius of bendsNote that the bend angle is expressed as degrees converted to radians, since Evolver uses radians in trig functions.
Leadtoe
is
actually the negative length of the horizontal part of the lead.
parameter gap = 5 // Height of the bottom of the gull foot above the pad parameter leadheel = 0 // y coord of flat-curve junction of lead parameter leadshift = 0 // x offset of centerline of leadThese are the only parameters that should be changed at runtime to move the lead, and even then the changing should only be done by the carefully defined movement commands discussed below.
constraint 1 // lower side of lower curve formula: (z-(gap+orad))^2 + (y-leadheel)^2 = orad^2 constraint 2 // upper side of lower curve formula: (z-(gap+orad))^2 + (y-leadheel)^2 = rad^2 constraint 3 // lower side of upper curve formula: (z-(gap+(rad+orad)*(1-cos(bend))-rad))^2 + (y-leadheel-(rad+orad)*sin(bend))^2 = rad^2 constraint 4 // upper side of upper curve formula: (z-(gap+(rad+orad)*(1-cos(bend))-rad))^2 + (y-leadheel-(rad+orad)*sin(bend))^2 = orad^2Constraints 1 and 3 could have been combined into one constraint using conditional expressions, as could 2 and 4, but there is no real point in getting that fancy here.
no_refine
since
at least the curved surfaces must refine in order to follow the circular
arcs.
read
section: .
// Subdivide some curve edges for better display refine edge where (id >= 17 and id <= 20) or (id >= 23 and id <= 26) // Get rid of pesky vertices in middle of curved sides. delete edge ee where sum(ee.facet,color==yellow)==2 and ee.length < thick/3 foreach facet ff where color==yellow do { fix ff.edge; fix ff.vertex; fix ff}The problem is that the original triangulation upon loading can put a vertex too near the inside arc, and later refining creates facets that cut across the arc. Try commenting out the
refine
line and see what refining does. The use of hardwired edge numbers
might be considered poor programming style, but it is the easiest way
to identify these particular edges, and the numbers are not likely to
change in the later datafiles of this series. The delete
command
gets rid of a couple of short edges. Since delete
won't delete
fixed edges, the side faces were left unfixed in the Faces
section.
The last command takes care of that.
delta_x := 0 move_x := { leadshift := leadshift + delta_x; // do parameters first set vertex x x+delta_x where z > 0; }The movement is relative, of magnitude
delta_x
. Note that
delta_x
is used in an immediately executed assignment statement
so the parser has a declaration of it before its use in move_x
and the user can set delta_x
before invoking move_x
.
In move_x
, the leadshift
parameter is changed first,
because setting a vertex coordinate value causes immediate projection
to any constraints it is on, and we want those constraints to be in
the new position.
outline
:
outline := { dissolve facet where color==yellow or color==green; foreach edge ee where original == -1 and valence == 0 do { unfix ee; dissolve ee } }The
dissolve
command simply eliminates objects without
collapsing them (as delete
does). It will not dissolve
vertices still used by edges, or edges still used by facets. It
will (as of version 2.14) dissolve facets used by bodies. An
original
number of -1 is assigned to edges that are
produced by subdividing facets; the condition is used to prevent
dissolving the edges descended from those originally in the datafile.
The unfix
is necessary since fixed edges will not be dissolved.
vanish
:
vanish := { outline; dissolve edges; dissolve vertices; }
slats
. This command refines the curved edges
and faces in such a way as to create a lot of thin, horizontal
triangles, and then fixes the display facets so refining won't
affect them.