Next: Macro 'OuterPlunger' Up: Using macros to model Previous: Using macros to model

Macro 'InnerPlunger'

Since the two plungers are at different angles, and their radial positions are to be changed, we parameterize our macro with arguments. We define a macro 'InnerPlunger' that expects two arguments: The first argument is the radius where the plunger shall be placed, and the second argument is the angle of the axis of the plunger:
 #
 # a plunger
 #
 macro InnerPlunger
    define(PlungerRadius0, @arg1               )  # Argument of the call
    define(PlungerAngle,   eval(@arg2*@pi/180) )  # Argument of the call
    define(PlungerInnerRadius, eval(100e-3/2) )
    define(PlungerCurvature, 16e-3)

    -gbor
        material= 10
        origin= (eval(cos(PlungerAngle)*PlungerRadius0),\
                 eval(sin(PlungerAngle)*PlungerRadius0),\
                 0)
        zprimedirection= (eval(-cos(PlungerAngle)*PlungerRadius0),\
                          eval(-sin(PlungerAngle)*PlungerRadius0),\
                          0)
        rprimedirection= (0,0,1)
        range= (0,360)

        clear
           # point= (z,r)
        point= (0,0)
        point= (0, eval(PlungerInnerRadius-PlungerCurvature) )
           arc, radius= PlungerCurvature, size= small, type= counterclockwise
        point= (eval(-PlungerCurvature), PlungerInnerRadius)
        point= (-170e-3, PlungerInnerRadius)
        point= (-170e-3, 0)
        doit
 endmacro # InnerPlunger