Select to view content in your preferred language

setting default units to imperial for creating 3D Mesh objects

262
1
Jump to solution
10-29-2024 06:08 AM
InQiDev
Emerging Contributor

I'm trying to to to use Mesh.CreateCylinderParameters method.

I would like to use imperial units in my drawing.

Here it says that one needs to change units to do so:

https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Mesh.html#CreateCylinder...

I assume I'd need to load esri/core/units and then adjust the property values as shown here:
https://developers.arcgis.com/javascript/latest/api-reference/esri-core-units.html

Here is where I get confused. There is no example as to how this is done properly. Here is what I did but no luck. Drawings did not change. Please advise.


units.MeasurementSystem = "imperial"
units.LengthUnit = "us-feet"




0 Kudos
1 Solution

Accepted Solutions
JoelBennett
MVP Regular Contributor

Actually, esri/core/units is not involved when using the createCylinder method.  It is also not possible to specify a system of units (e.g. "imperial" or "metric") with this method.  Instead, your actual units must be known beforehand, and the value must be one of the constants defined for LengthUnit.  An example is below:

var cylinder = Mesh.createCylinder(point, {
	width: 5,
	depth: 4,
	height: 3,
	unit: "feet"
});

 

View solution in original post

1 Reply
JoelBennett
MVP Regular Contributor

Actually, esri/core/units is not involved when using the createCylinder method.  It is also not possible to specify a system of units (e.g. "imperial" or "metric") with this method.  Instead, your actual units must be known beforehand, and the value must be one of the constants defined for LengthUnit.  An example is below:

var cylinder = Mesh.createCylinder(point, {
	width: 5,
	depth: 4,
	height: 3,
	unit: "feet"
});