‘Geographic Location’ & changing the Up direction (Z) using API

By Partha Sarkar

Using
"GEOGRAPHICLOCATION" command you could bring up the "Geographic
Location" window and there you will find the "Up direction"
drop-down to set the "Z" value. If you want to set / change the "Up direction" in GEOGRAPHICLOCATION settings through API, you can use
GeoLocationData.UpDirection

GeoLocation

 

GeoLocationData
Class is available in AutoCAD .NET API
Autodesk.AutoCAD.DatabaseServices.GeoLocationData 

 

Here is a C#
code snippet which demonstrates how to change "Up direction" using :

 

// Access GeoLocationData
 
ObjectId geoDataId = db.GeoDataObject;
 
//start a transaction 
using (Transaction trans = db.TransactionManager.StartTransaction())
{
 
  GeoLocationData geoLocdata = trans.GetObject(geoDataId, OpenMode.ForWrite) as GeoLocationData;
  // Set the UpDirection
  Vector3d vec3d = new Vector3d(0.0, 0.0, 1.00);
  geoLocdata.UpDirection = vec3d;
 
  trans.Commit();
 
}

 

Hope this is useful to you!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading