DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Change X-axis end only plots when diadem is frontmost

I have a report with several pages that have 4 2d-graphs and one 3d-graph. The 3d-graph has a different x-scale than the autoscale on the 2d-graph so I created a script that reads the x-end for the 3d graph and apply that to the 2d-graph x-axis.

 

This works when I call the code form the SCRIPT window, it also works when I call the scrip from the ActiveX interface in LabVIEW if diadem is the front most window.

 

After updating the x-axis I export all the sheets to PNGs, in those PNGs I see that the X-axis is only changed when I open DIADem as frontmost (note that I open the DIADem window via ActiveX).

 

Here's the code for the x-axis scaling:

 


 

'-------------------------------------------------------------------------------
'-- VBS script file
'-- Created on 12/16/2010 09:37:26
'-- Author: Ton Plomp
'-- Comment: Sets the X-axis of 2D graphs to the X-axis of a 3D graph
'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.
Dim iObjNo
Dim sObjectName
Dim objName
dim max
Dim intSheetNo
For intSheetNo = 1 To GraphSheetCount-1 'voor elke pagina

    For iObjNo = 1 To ObjectNoMax         'Loop over all objects in DIAdem REPORT sheet
        sObjectName = ReportObj(iObjNo)     'Gets the object name
        If sObjectName <> "" Then           'Ensures that the object is not deleted
            Select Case ReportObjType(iObjNo) 'Gets the object type
                Case "3D-Axis"
                    Call GraphObjOpen(ReportObj(iObjNo))
                        D3AxisAutoScal(1) = 0
                        max = D3AxisEnd (1) 'get the maximum value of the X-axis
                        D3AxisAutoScal(1) = 1
                    Call GraphObjClose(ReportObj(iObjNo))
                Case Else
                'Not a 3D axis plot
            End Select
        End If
    Next

    'get all 2D-axis
    For iObjNo = 1 To ObjectNoMax         'Loop over all objects in DIAdem REPORT in a sheet
        sObjectName = ReportObj(iObjNo)     'Gets the object name
        If sObjectName <> "" Then           'Ensures that the object is not deleted
            Select Case ReportObjType(iObjNo) 'Gets the object type
                Case "2D-Axis"
                Call GraphObjOpen(ReportObj(iObjNo))
                    Call GraphObjOpen(D2AxisXObj(1)) 'x-as
                        D2AxisXScaleType="begin/end manual" 'verander schaling
                        D2AxisXEnd = max 'zet maximum van schaal
                    Call GraphObjClose(D2AxisXObj(1))
                Call GraphObjClose(ReportObj(iObjNo))
            Case Else
            End Select 'Case ReportObjType(iObjNo
        End If 'sObjectName <> "" Then
    Next

Next 'sheet

 


 

 

Placing a Picupdate doesn't help either.

 

I run this code with DIADem 2010.2 and I call the ActiveX interface from a LabVIEW 8.2 executable.

 

Does anybody have an idea how to fix this?

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 1 of 2
(3,750 Views)

Hi Ton,

 

See if this helps.  The GraphSheetCount variable is filled on demand by the GraphSheetInfos() function, the function GraphSheetNGet() fills the GraphSheetName variable(), and the GraphSheetRefSet() command switches the global "ReportObj..." variables and "GraphObj..." commands to operate on that particular sheet.  Your script below is set up to apply the 3D axis scaling from sheet 1 to all 2D axes on sheet 1.  Adding these commands should enable it to apply the 3D axis scaling from sheet N to all 2D axes on sheet N.

Option Explicit  'Forces the explicit declaration of all the variables in a script.
Dim iObjNo
Dim sObjectName
Dim objName
dim max
Dim intSheetNo
Call GraphSheetInfos()

For intSheetNo = 1 To GraphSheetCount-1 'voor elke pagina
    Call GraphSheetNGet(intSheetNo)
    Call GraphSheetRefSet(GraphSheetName)

    For iObjNo = 1 To ObjectNoMax         'Loop over all objects in DIAdem REPORT sheet

I did no testing from LabVIEW,

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 2
(3,745 Views)