Create a layer with proper linetype and lineweight

Hi,
I'm trying to setup (with c#) some layers in a doc and I'm struggling to enable a linetype and a lineweight by their name/value.

For LightWeight I was happy to find some two functions:

bool Database.IsValidLineWeight(short weight)
LineWeight Database.GetNearestLineWeight(short weight)

but both are raising a Not Implemented yet exception :/

Concerning the LineType I'm trying to set it by the linetype name, I'd expect something like:

ObjectID Database.GetLinetype("BORDER")

But I have no Idea about how it should be done

I really dont' get how such simple tasks can be so complicated, I hope someone can provide some proper samples.
Thanks

Comments

  • Dear MArnold,

    those 2 functions
    > bool Database.IsValidLineWeight(short weight)
    > LineWeight Database.GetNearestLineWeight(short weight)

    are actually not implemented; we have an internal task to add this.

    In generally, it might help, to first add the newly created LayerTableRecord to the LayerTable - and afterwards assign more properties;
    reason is, that several properties have a database correlation, but without being added to the LayerTable, there is no database relation.

    hope this helps ?
    many greetings !
  • Yes it helped thanks. Changing the order for some items solved part of my problems, and Autodesk forums helped a lot too.