DIAdem Help

Object: TransformDataContextXY

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

Object: TransformDataContextXY

The TransformDataContextXY object provides the input and output channels for the curve transformation as an object in a 2D axis system in DIAdem REPORT. Use the TransformDataContextXY object for all 2D display types in which the data originates from an x-channel and a y-channel. The user command receives the TransformDataContextXY 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 curves and assigns the user command MyOnCurveTransformation to the second curve:

Dim oMy2DAxisSystem, oMyPos, oMy2DCurveOrg, oMy2DCurveTrans
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")
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 oMy2DCurveOrg = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "MyOrgDCurve")
oMy2DCurveOrg.Shape.XChannel.Reference = "[1]/[1]"
oMy2DCurveOrg.Shape.YChannel.Reference = "[1]/[2]" 
Set oMy2DCurveTrans = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "MyTransCurve")
oMy2DCurveTrans.Shape.XChannel.Reference = "[1]/[1]"
oMy2DCurveTrans.Shape.YChannel.Reference = "[1]/[2]" 
oMy2DAxisSystem.Settings.UseCurveTransformation = TRUE
oMy2DCurveTrans.OnCurveTransformation = "MyOnCurveTransformation"
Call Report.Refresh()

The user command copies the x-values and smoothes the y-values:

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 + 2
      oMyDataContext.ConstYOut = oMyDataContext.ConstYIn + 2
  End Select 
End Sub