Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

adding LayerTableRecord

I have this code to create a new layer:

            LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForWrite);

            if (lt.Has(layerName))

            LayerTableRecord x = new LayerTableRecord();

            x.Name = layerName;

            x.LineWeight = LineWeight.ByLineWeightDefault;
            x.IsOff = false;
            x.IsFrozen = false;
            x.IsLocked = false;
            x.Color = c;
            x.IsPlottable = true;

            x.Description = layerDescription;

            tr.AddNewlyCreatedDBObject(x, true);

When the line
x.Description = layerDescription;
is executed I have an eNotDatabase exception.
This sounds very strange for me and I don't understand where the problem is.

Thank you very much


  • Hello Andrea,

    Some properties require the object be added to the database, try moving :

    x.Description = layerDescription;

    to after :

    tr.AddNewlyCreatedDBObject(x, true);

    cheers :)

  • Yes, it works

    Thank you

Sign In or Register to comment.
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam