![]() | DIAdem 2017 Help |
![]() | DIAdem 2018 Help |
![]() | DIAdem 2019 Help |
![]() | DIAdem 2020 Help |
![]() | DIAdem 2020 SP1 Help |
Converts in a polar axis system in DIAdem REPORT a page coordinate into a radius.
iConvertPageXYPositionToLength = Object.ConvertPageXYPositionToLength(X, Y)
Object | PolarSystem Object with this method |
X | Double Contains the x-page coordinate. |
Y | Double Contains the y-page coordinate. |
iConvertPageXYPositionToLength | Double Receives the converted radius. |
![]() |
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 creates an polar axis system and assigns the user command MyClickEvent to the OnAxisSystemPolar for ClickedWithKeyEvents property:
Dim oMyPolarSystem, oMyPos, oMyPolarCurve Call Report.NewLayout() Call Data.Root.Clear() Call DataFileLoad(DataReadPath & "Report_Data.tdm","TDM","") Set oMyPolarSystem = Report.ActiveSheet.Objects.Add(eReportObjectPolarSystem, "MyPolarSystem") Set oMyPos = oMyPolarSystem.Position.ByCoordinate oMyPos.X1 = 20 oMyPos.X2 = 80 oMyPos.Y1 = 20 oMyPos.Y2 = 80 Set oMyPolarCurve = oMyPolarSystem.CurvesPolar.Add(ePolarShapeLine, "MyPolarCurve") oMyPolarCurve.Shape.XChannel.Reference = "[5]/[1]" oMyPolarCurve.Shape.YChannel.Reference = "[5]/[4]" 'This event will be raised if you click a 2D axis system while you press a keyboard key Report.Events.ClickedWithKey.OnAxisSystemPolar = "MyClickEvent" Call Report.Refresh()
If you press the <C> key and click the axis system, the user command specifies the mouse position. The example calculates the radius and the angle from the mouse position and displays them in a message. The user command receives a parameter. The first parameter corresponds to a PolarAxisSystemClickedWithKeyContext object and provides information about the polar axis system in DIAdem REPORT.
Sub MyClickEvent(Context) Dim oSystem, oCurve, Lenght, Angle, oXAxis, oYAxis, oPoint, sgMessage, oChannel, oSubObject Context.DoProceed = False'True 'Check the key If Chr(Context.KeyValue) = "C" or Chr(Context.KeyValue) = "c" Then Context.DoProceed = True Set oSystem = Context.AxisSystemPolar 'Map cursor point to length and angle Lenght = oSystem.ConvertPageXYPositionToLength(Context.Position.X, Context.Position.Y) Angle = oSystem.ConvertPageXYPositionToAngle(Context.Position.X, Context.Position.Y) 'Build message text sgMessage = "Lenght: " & VBTab & Lenght & VBCrLf & "Angle: " & VBTab & Angle Call MsgBoxDisp(sgMessage,,,,5,True) End If End Sub
Helpful
Not Helpful