DIAdem Help

Object: TransformDataContextConstantXY

  • Updated2024-09-12
  • 2 minute(s) read

Object: TransformDataContextConstantXY

The TransformDataContextConstantXY object provides the input and output constants for the curve transformation of a curve with the Constant or Coordinate display type as an object in a 2D axis system in DIAdem REPORT. The user command receives the TransformDataContextConstantXY object as a parameter. Use the curve transformation user command only to manipulate the values of temporary copies of the input channels. REPORT objects such as the worksheet, the axis system, and the curves can only be accessed in read-only mode.

Note  To test the example script, you must first save the second script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands.

The following example generates an axis system with two constants and assigns the MyOnCurveTransformation user command to the second constant:

Dim oMy2DAxisSystem, oMyCurveLine, oMyCurveConstOrg, oMyCurveConstTrans, oMyPos, oMyLineShape, oMyXScaling, oMyYScaling
Call Report.NewLayout()
Set oMy2DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem, "My2DAxisSystem")
Set oMyPos = oMy2DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMyXScaling = oMy2DAxisSystem.XAxis.Scaling
oMyXScaling.AutoScalingType = eAxisAutoScalingBeginEndManual
oMyXScaling.Begin = 0
oMyXScaling.End = 70
Set oMyYScaling = oMy2DAxisSystem.YAxis.Scaling
oMyYScaling.AutoScalingType = eAxisAutoScalingBeginEndManual
oMyYScaling.Begin = 0
oMyYScaling.End = 70
Set oMyCurveConstOrg = oMy2DAxisSystem.Curves2D.Add(e2DShapeConstant, "MyOrgConstant")
oMyCurveConstOrg.Shape.XConstant.Reference = 10 
oMyCurveConstOrg.Shape.YConstant.Reference = 20 
Set oMyCurveConstTrans = oMy2DAxisSystem.Curves2D.Add(e2DShapeConstant, "MyTransConstant")
oMyCurveConstTrans.Shape.XConstant.Reference = 10 
oMyCurveConstTrans.Shape.YConstant.Reference = 20 
oMy2DAxisSystem.Settings.UseCurveTransformation = TRUE
oMyCurveConstTrans.OnCurveTransformation = "MyOnCurveTransformation"
Call Report.Refresh()

The user command adds the value 20 to the values of the constants:

Sub MyOnCurveTransformation(Context)
  Dim oMyDataContext
  Set oMyDataContext = Context.DataContext
  Select Case Context.DataType
    Case e2DCurveTransformDataTypeXY 
      Call ChnCopy  (oMyDataContext.XChannelNumberIn ,oMyDataContext.XChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnSmooth(oMyDataContext.YChannelNumberIn, oMyDataContext.YChannelNumberOut, 100, "symmetric") 'Smooth the input channel and save the result as output channel
    Case e2DCurveTransformDataTypeXYY1 
      Call ChnCopy  (oMyDataContext.XChannelNumberIn ,oMyDataContext.XChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnSmooth(oMyDataContext.YChannelNumberIn, oMyDataContext.YChannelNumberOut, 2, "symmetric") 'Smooth the input channel and save the result as output channel
      Call ChnSmooth(oMyDataContext.Y1ChannelNumberIn, oMyDataContext.Y1ChannelNumberOut, 2, "symmetric") 'Smooth the input channel and save the result as output channel
    Case e2DCurveTransformDataTypeCXCY 
      oMyDataContext.ConstXOut = oMyDataContext.ConstXIn + 20
      oMyDataContext.ConstYOut = oMyDataContext.ConstYIn + 20
  End Select 
End Sub