procedure( m5321_sdMetStretch( info )
let((returnVal gateWidth minLength maxLength dataValue tgObjName tgObjeNameList
finger metList metPrint curBotY curTopY botY topY curLength botInc topInc minY maxY
(debugging nil)
)
gateWidth=cdfParseFloatString((info->stretchMaster)~>parameters~>fw)*1e6
minLength = 0.7
maxLength = gateWidth-0.3
minY = 0.15
maxY = gateWidth-minY
dataValue = info->paramVal
tgObjName = (info->rodObj)~>name
tgObjeNameList = parseString(tgObjName "_")
finger = evalstring(cadr(tgObjeNameList))
metList = evalstring(sprintf(nil "'( nil %s )", dataValue))
(if get(metList concat(finger)) then
curBotY = car(get(metList concat(finger)))
curTopY = cadr(get(metList concat(finger)))
(if curTopY>(gateWidth-0.15) then curTopY=gateWidth-0.15)
else curBotY=minY curTopY=maxY
)
curLength = curTopY-curBotY+info->increment
botInc = 0.0
topInc = 0.0
(case info->handleName
("lowerCenter" botInc = info->increment)
("upperCenter" topInc = info->increment)
)
(when debugging
m5321_StretchPrint( info )
fprintf(stdout "curbotY=%L\n", curBotY)
fprintf(stdout "curtopY=%L\n", curTopY)
fprintf(stdout "botInc=%L\n", botInc)
fprintf(stdout "topInc=%L\n", topInc)
fprintf(stdout "curLength=%L\n", curLength)
)
(when minLength-curLength>=0.0 || curLength - maxLength >=0.0
botInc=0.0
topInc=0.0
)
botY = curBotY-botInc
topY = curTopY+topInc
(when debugging
fprintf(stdout "metList=%L\n", metList)
fprintf(stdout "------botY=%L\n", botY)
fprintf(stdout "------topY=%L\n", topY)
)
putprop(metList list(botY topY) concat(finger))
metPrint=sprintf(nil "%L",metList)
returnVal=substring(metPrint 6 strlen(metPrint)-6)
(when debugging
fprintf(stdout "metList=%L\n", metList)
fprintf(stdout "returnVal=%L\n", returnVal)
)
returnVal
);end let
) ; ** procedure **
|