DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Add Unit with VBS

Solved!
Go to solution

Hi, does someone know how to add units using VBS? I am adding some new Channels, it will be great if I could add units with VBS directly rather than uns dialog box afterwards. Thanks!

 

Andi

0 Kudos
Message 1 of 5
(4,926 Views)

Hi Andy,

 

if you would like to add a new quantity to the UnitCatalog in DIAdem use this:

 

dim oQuantities, oMyQuantity
set oQuantities = UnitCatalog.Quantities
Set oQuantity = oQuantities.Add(Name, LengthExp, MassExp, TimeExp, CurrentExp, TemperatureExp, MolarAmountExp, LuminousIntensityExp)

 

If you mean to add a unit to a channel use this:

 

dim oChn
set oChn = Data.Root.ChannelGroups("MyGroup").Channels("MyChannel")
oChn.Properties("unit_string").Value = "MyUnit"

Greetings

Walter

Message 2 of 5
(4,923 Views)
Solution
Accepted by topic author A._Baumann

thanks, I was looking a solution for the 2. case. But it´s great to kill two birds with one stone. Have a nice weekend!

0 Kudos
Message 3 of 5
(4,914 Views)

I added this code to get in-ozf as a unit.  It says it was added to the collection but I do not see it when I go to the units cell.

 

When using this code, is it a one shot deal and the units are now a part of the catalog or does the VBS need to be rerun.

 

Sure would have been nice if in-ozf would just be a standard value for torque.

 

dim oQuantities, oMyQuantity

set oQuantities = UnitCatalog.Quantities

Set oQuantity = oQuantities.Add("ozinf", 1,0,0,0,0,0,0)

0 Kudos
Message 4 of 5
(4,709 Views)

.... So of course after I made my initial post I find in HELP that adding a new unit can be done right in the unit cell in the properties display.  Problem is I don't get asked to add and thus get the Add Symbol dialog.  I'm using DIADEM 2012 Trial.

 

So I did this to make sure what I supposedly added in my previous post would be gone.

   dim oQuantities, oMyQuantity

   set oQuantities = UnitCatalog.Quantities

   Set oQuantity = oQuantities.Remove("ozinf")

 

I still don't get the Add Symbol dialog BUT I did find out that under Settings | Options | Units I could add what I needed.  I'm learning!

0 Kudos
Message 5 of 5
(4,706 Views)