next up previous contents
Next: Macro 'OuterPlunger' Up: Using macros to model Previous: Using macros to model   Contents

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,   @arg2*@pi/180 )  # Argument of the call
    define(PlungerInnerRadius, 100e-3/2  )
    define(PlungerCurvature, 16e-3)

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

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