Just to specify i am using the following code to create the layer:
static ObjectId CreateLayer()
{
ObjectId layerId; //the return value for this function
Database db = HostApplicationServices.WorkingDatabase;
Transaction trans = db.TransactionManager.StartTransaction();
LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite);
if (lt.Has("test"))
{
layerId = lt["test"];
}
else
{
//if not, create the layer here.
LayerTableRecord ltr = new LayerTableRecord();
ltr.Name = "test"; // Set the layer name
ltr.Color = Autodesk.AutoCAD.Colors.Color.FromColorIndex(ColorMethod.ByAci, 2);
layerId = lt.Add(ltr);
trans.AddNewlyCreatedDBObject(ltr, true);
}
trans.Commit();
trans.Dispose();
return layerId;
}
and it works. i copied it form other discussions, but when the layer created in the autoCAD it will be in the following order
0
test
what i want is to be in the reverse order
test
0
Message was edited by: Nawara17