08-03-2012 05:04 AM
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
Solved! Go to Solution.
08-03-2012 05:30 AM
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
08-03-2012 10:17 AM
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!
04-29-2013 11:57 AM - edited 04-29-2013 11:58 AM
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)
04-29-2013 01:31 PM
.... 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!