| Article | 60002131 |
| Type | Wish |
| Product | WebJS |
| Date Added | 1/27/2014 12:00:00 AM |
| Fixed | (1/28/2014 12:00:00 AM) |
| Submitted by | Steve Smith |
Summary
Is there a way to find the units of a drawing such as decimal or architectural?
Solution
In 6028 version a new property was exported from Vdraw to the vdWeb library files, the InsUnits property. This property is an enum value (can take 21 different values) that defines what a Drawing Unit represents. If for example you set this property to "Feet" in a vdraw application (SimpleCad, VDFCad), when you access the property inside the vdWeb library, you'll see a value of 2 (Integer). The value 2 represents the "Feet" unit system. This property exists for informational purposes only, changing it will have no effect on the drawing and its measurements. You can access this property from within the Document object found in vdcanvas (vdcanvas.GetDocument ().InsUnit). The various values InsUnit can have, are the following.
// Unit with no scale factor . vdConst.InsUnitUnspecified = 0; // Unit with no scale factor 0.0254 to meters. vdConst.InsUnitInches = 1; // Unit with no scale factor 0.3048 to meters. vdConst.InsUnitFeet = 2; // Unit with no scale factor 1609.3440 to meters. vdConst.InsUnitMiles = 3; // Unit with no scale factor 0.001 to meters. vdConst.InsUnitMillimeters = 4; // Unit with no scale factor 0.01 to meters. vdConst.InsUnitCentimeters = 5; // Unit with no scale factor 1 to meters. vdConst.InsUnitMeters = 6; // Unit with no scale factor 1000 to meters. vdConst.InsUnitKilometers = 7; // Unit with no scale factor 25.4e-9 to meters. vdConst.InsUnitMicroinches = 8; // Unit with no scale factor 25.4e-6 to meters. vdConst.InsUnitMils = 9; // Unit with no scale factor 0.9144 to meters. vdConst.InsUnitYards = 10; // Unit with no scale factor 1.0e-10 to meters. vdConst.InsUnitAngstroms = 11; // Unit with no scale factor 1.0e-9 to meters. vdConst.InsUnitNanometers = 12; // Unit with no scale factor 1.0e-6 to meters. vdConst.InsUnitMicrons = 13; // Unit with no scale factor 0.1 to meters. vdConst.InsUnitDecimeters = 14; // Unit with no scale factor 10 to meters. vdConst.InsUnitDekameters = 15; // Unit with no scale factor 100 to meters. vdConst.InsUnitHectometers = 16; // Unit with no scale factor 1.0e+10 to meters. vdConst.InsUnitGigameters = 17; // Unit with no scale factor 149.597871e+9 to meters. vdConst.InsUnitAstronomical_Units = 18; // Unit with no scale factor 9.460730e+15 to meters. vdConst.InsUnitLight_Years = 19; // Unit with no scale factor 3.0856776e+16 to meters. vdConst.InsUnitParsecs = 20;Javascript example
var vdcanvas = vdmanager.vdrawObject('canvas');
var vddoc = vdcanvas.GetDocument();
if (!vddoc) return;
if (vddoc.InsUnit == vdConst.InsUnitFeet)
alert("The drawing is in inches");
