DIAdem Help

Object: TransformDataContextConstantXYZ

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

Object: TransformDataContextConstantXYZ

The TransformDataContextConstantXYZ object provides the input and output constants for the curve transformation of a curve with the Coordinate display type as an object in a 3D axis system in DIAdem REPORT. The user command receives the TransformDataContextConstantXYZ 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 a 3D axis system with three constants and assigns the user command MyOn3DCurveTransformation to the copy of these constants:

Dim oMy3DAxisSystem, oMyPos, oMy3DCurve, oMy3DCurveTrans, oMyShape, oMyShapeTrans
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","")
Call Report.NewLayout()
Set oMy3DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject3DAxisSystem,"My3DAxisSystem")
Set oMyPos = oMy3DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20 
oMyPos.Y2 = 80
Set oMy3DCurve = oMy3DAxisSystem.Curves3D.Add(e3DShapeCoordinate, "My3DCurve")
Set oMyShape = oMy3DCurve.Shape
oMyShape.XCoordinate.Reference = 10
oMyShape.YCoordinate.Reference = 20
oMyShape.ZCoordinate.Reference = 30
Set oMy3DCurveTrans = oMy3DAxisSystem.Curves3D.Add(e3DShapeCoordinate, "My3DCurveTrans")
Set oMyShapeTrans = oMy3DCurveTrans.Shape
oMyShapeTrans.XCoordinate.Reference = 10
oMyShapeTrans.YCoordinate.Reference = 20
oMyShapeTrans.ZCoordinate.Reference = 30
oMy3DAxisSystem.Settings.UseCurveTransformation = TRUE
oMy3DCurveTrans.OnCurveTransformation = "MyOn3DCurveTransformation"
Call Report.Refresh()

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

Sub MyOn3DCurveTransformation(TransformContext)
  Dim oMyDataContext
  Set oMyDataContext = TransformContext.DataContext
  Select Case TransformContext.DataType
    Case e3DCurveTransformDataTypeXYZ
      Call ChnCopy  (oMyDataContext.XChannelNumberIn, oMyDataContext.XChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnCopy  (oMyDataContext.YChannelNumberIn, oMyDataContext.YChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnSmooth(oMyDataContext.ZChannelNumberIn, oMyDataContext.ZChannelNumberOut, 100, "symmetric") 'Smooth the input channel and save the result as output channel
    Case e3DCurveTransformDataTypeXYX1Y1  
      Call ChnCopy  (oMyDataContext.XChannelNumberIn ,oMyDataContext.XChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnCopy  (oMyDataContext.YChannelNumberIn ,oMyDataContext.YChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnLinScale (oMyDataContext.X1ChannelNumberIn, oMyDataContext.X1ChannelNumberOut, 2, 0) 'Multiply the input channel with a value and save the result as output channel
      Call ChnLinScale (oMyDataContext.Y1ChannelNumberIn, oMyDataContext.Y1ChannelNumberOut, 2, 0) 'Multiply the input channel with a value and save the result as output channel
    Case e3DCurveTransformDataTypeXYZX1Y1Z1
      Call ChnCopy  (oMyDataContext.XChannelNumberIn, oMyDataContext.XChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnCopy  (oMyDataContext.YChannelNumberIn, oMyDataContext.YChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnCopy  (oMyDataContext.ZChannelNumberIn, oMyDataContext.ZChannelNumberOut) 'Copy the input channel into the output channel
      Call ChnLinScale (oMyDataContext.X1ChannelNumberIn, oMyDataContext.X1ChannelNumberOut, 2, 0) 'Multiply the input channel with a value and save the result as output channel
      Call ChnLinScale (oMyDataContext.Y1ChannelNumberIn, oMyDataContext.Y1ChannelNumberOut, 2, 0) 'Multiply the input channel with a value and save the result as output channel
      Call ChnLinScale (oMyDataContext.Z1ChannelNumberIn, oMyDataContext.Z1ChannelNumberOut, 2, 0) 'Multiply the input channel with a value and save the result as output channel
    Case e3DCurveTransformDataTypeCXCYCZ 
      oMyDataContext.ConstXOut = oMyDataContext.ConstXIn + 20 'Add value to input constant
      oMyDataContext.ConstYOut = oMyDataContext.ConstYIn + 20 'Add value to input constant
      oMyDataContext.ConstZOut = oMyDataContext.ConstZIn + 20 'Add value to input constant
  End Select
End Sub