Object: TransformDataContext
- Updated2024-09-12
- 2 minute(s) read
DIAdem REPORT > Objects > Context Objects > Object: TransformDataContext
Object: TransformDataContext
The TransformDataContext object provides the input and output channels and the the input and output constants as objects for the curve transformation in a user command in DIAdem REPORT. The user command receives the TransformDataContext 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.
The TransformDataContext object corresponds to one of the following objects:
| TransformDataContextConstantXY (IRepTransformDataContextConstantXYInt) | Coordinate and Constant display types in 2D axis systems |
| TransformDataContextConstantXYZ (IRepTransformDataContextConstantXYZInt) | Coordinate display type in 3D axis systems |
| TransformDataContextX (IRepTransformDataContextXInt) | 2D tables |
| TransformDataContextXY (IRepTransformDataContextXYInt) | x/y curves in 2D axis systems |
| TransformDataContextXYX1Y1 (IRepTransformDataContextXYX1Y1Int) | 4D vector display type in 3D axis systems |
| TransformDataContextXYY1 (IRepTransformDataContextXYY1Int) | x/y/y1-curves in 2D axis systems |
| TransformDataContextXYZ (IRepTransformDataContextXYZInt) | Display types with triplet structure in 3D axis systems, for example, Surface, 3D-curve, or Spikes |
| TransformDataContextXYZX1Y1Z1 (IRepTransformDataContextXYZX1Y1Z1Int) | 6D vector display type in 3D axis systems |
![]() | 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]" Call oMy2DCurveOrg.Shape.Settings.Line.Color.SetPredefinedColor(eColorIndexBlue) Call oMy2DCurveTrans.Shape.Settings.Line.Color.SetPredefinedColor(eColorIndexRed) oMy2DAxisSystem.Settings.UseCurveTransformation = TRUE oMy2DCurveTrans.OnCurveTransformation = "MyOnCurveTransformation" Call Report.Refresh()
The user command copies the x-values and smoothes the y-values:
Sub MyOnCurveTransformation(TransformDataContext) Dim oMyDataContext Set oMyDataContext = TransformDataContext.DataContext Select Case TransformDataContext.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
Returned From
D2CurveTransformingContext.DataContext | D3CurveTransformingContext.DataContext
