Method: Item for AxisSystem2DCustomScalings

DIAdem 2018 Help

Edition Date: June 2018
Part Number: 370858P-01
View Product Info

DOWNLOAD (Windows Only)

DIAdem 2017 Help
DIAdem 2018 Help
DIAdem 2019 Help
DIAdem 2020 Help
DIAdem 2020 SP1 Help

Returns the user-defined axis scaling associated with a specific ID or a specific index in a 2D axis system in DIAdem REPORT.

Set oAxisSystem2DCustomScaling = Object.Item(IDOrIndex)
Object with this property
Specifies the ID or the index of the user-defined axis scaling.
Returned object
Note  You can always omit the Item method because it is the standard element of the collection.
Note   To test the following example scripts, first save the bottom script and select Settings»Extensions»User Commands to register it as a user command.

The following example creates a 2D axis system with a curve and assigns the user-defined axis scaling with the ID MotorWarmScaling to the y-axis. In addition the example outputs the ID of the user-defined axis scaling:

Dim oMy2DAxisSystem, oMyPos, oMyYScaling, oMy2DCurve, oMyCustomScalings, oMyCustomScalingObj
Call Report.NewLayout()
Call Data.Root.Clear()
Call DataFileLoad(DataReadPath & "Example.tdm","TDM","")
'Creating Axis System and Curve
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 oMy2DCurve = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "My2DDCurve")
oMy2DCurve.Shape.XChannel.Reference = "[1]/[1]"
oMy2DCurve.Shape.YChannel.Reference = "[1]/[2]"
'Creating Custom Scaling
Set oMyCustomScalings = Report.Settings.CustomScaling.AxisSystem2DList
Call MsgBoxDisp("ID: "& oMyCustomScalings.Item(1).ID)
Call oMyCustomScalings.RemoveAll
Set oMyCustomScalingObj = oMyCustomScalings.Add("MotorWarmScaling")
oMyCustomScalingObj.BaseScalingType = eAxisAutoScalingCompleteAutomatic
oMyCustomScalingObj.EventName = "MyCustomScalingEvent2D"
oMyCustomScalingObj.Label = "LabelForMotorWarmScaling"
'Assigning Custom Scaling to Axis
Set oMyYScaling = oMy2DAxisSystem.YAxis.Scaling
oMyYScaling.AutoScalingType = eAxisAutoScalingCustom
oMyYScaling.CustomScalingID = "MotorWarmScaling"
Call Report.Refresh()

The user command calculates the values for the axis scaling. The user command receives a parameter. This parameter is a CustomScalingAxisSystem2DContext object and provides information about the axis system and about the ID of the user-defined axis scaling.

Sub MyCustomScalingEvent2D(Context)
  Dim oMyAxisSystem, oMyAxis, MinMax
  Set oMyAxisSystem = Context.AxisSystem
  If Context.AxisType = e2DAxisTypeY Then
    Set oMyAxis = oMyAxisSystem.YAxisList(Context.AxisNumber)
    MinMax = ValMax(Abs(oMyAxis.Scaling.End),Abs(oMyAxis.Scaling.Begin))
    oMyAxis.Scaling.Origin = oMyAxis.Scaling.Begin
    oMyAxis.Scaling.Begin = -MinMax
    oMyAxis.Scaling.End = +MinMax
  End If
End Sub


Not Helpful