DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check DIAdem General unit setting and switch it programmatically between cm and inch?

Hi Team, I have a question and it would be great if you have any solution for this, I am trying to automate DIAdem report unit handling in a VBScript that runs from the DIAdem Script Panel.

Goal:

  • Read the current value from Settings -> DIAdem Settings -> General -> Unit
  • If unit is cm, change it to Inch
  • If unit is already Inch, do nothing

What I tried:

  1. COM-based approach (GetObject("DIAdem.Application") / CreateObject("DIAdem.Application"))
  • This failed in script execution context with ActiveX creation/connection issues.
  1. Direct object approach (DiAdem.Settings.Unit)
  • This raised: Object doesn't support this property or method (DiAdem.Settings).
  1. Alternate guesses (Data.Root.Unit, Report.DefaultUnit, DiAdem.GetUnit(), DiAdem.SetUnit())
  • These did not reliably expose or update the global General unit setting.

Known working command:

  • Call UpdateLengthUnit("cm")
    This changes the unit, but I still need a reliable way to first read the current unit before deciding whether to switch.

Question:

  • What is the correct DIAdem VBScript API (or command/variable) to read the current General length unit (cm/inch)?
  • Is this setting only accessible via internal command/registry/config file rather than object model?
  • If reading it is not supported directly, what is the recommended best-practice workflow to conditionally call UpdateLengthUnit(...) safely?
0 Kudos
Message 1 of 3
(1,383 Views)

Set LengthDefUnit = UnitCatalog.ActiveSet.UsedQuantities("Length").DefaultUnit
MsgBox LengthDefUnit.DisplayName & vbCRLF & LengthDefUnit.Symbol

0 Kudos
Message 2 of 3
(1,347 Views)

Hi Brad,

 

Thank you so much, that was really helpfull.

0 Kudos
Message 3 of 3
(1,253 Views)