.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Reply
Message 1 of 2
Nawara17
247 Views, 1 Reply

layers order

Hi there,
Please can somebody help. I really didn't find solution to this problem.

problem specification:
I am using AutoCAD 2006 and C# as a programing language. in my C# code there is a new layer will be created and new blocks also. this is not the problem i found the solution for that in another discussion but the problem is when i am creating a new layer i couldn't put that layer between other layer which are already exist in the acad document. i have to append it to the existed layers that means it will be the lower layer.
i want the layers be in a specific order. specially layer 0 i want that layer to be the lowest.
Can i do that using C#??
thanks in advanced.
and sorry for bad english 🙂
1 REPLY 1
Message 2 of 2
Nawara17
in reply to: Nawara17

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost