.NET

Reply
Valued Contributor
Nawara17
Posts: 52
Registered: ‎03-27-2006
Message 1 of 2 (63 Views)

layers order

63 Views, 1 Replies
05-10-2006 06:34 AM
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 :smileyhappy:
Valued Contributor
Nawara17
Posts: 52
Registered: ‎03-27-2006
Message 2 of 2 (63 Views)

Re: layers order

05-10-2006 07:12 AM 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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community