Hello everyone.
Well I would like to state my question to friends who can help me, I shall be grateful.
I have a few variables, all of type string that is read from a txt file.
string name = "MyLayer";
string color = "7";
string linetype = "Continuous";
string lineweight = "ByLineWeightDefault";
string plotstyle = "Color_7";
With this data I create a new layer, but there are two variables that I'm not getting\r
make the necessary conversions.
linetype e lineweight.
Here is a snippet of code as an example.
LayerTableRecord registroLayer = new LayerTableRecord();
registroLayer.Name = name;
registroLayer.Color = Color.FromColorIndex(ColorMethod.ByAci, Convert.ToInt16(color));
registroLayer.LinetypeObjectId = Linetype;
registroLayer.LineWeight = lineweight;
registroLayer.PlotStyleName = plotstyle;
tabelaLayer.Add(registroLayer);
transacao.AddNewlyCreatedDBObject(registroLayer, true);
transacao.Commit();
Regards to all
Robson (Brazil)
Robson,
Lineweight is an Autodesk.AutoCAD.DatabaseServices.Lineweight Enum. You have to convert the string to an Enum. You can do this like:
System.Enum.Parse(GetType(Autodesk.AutoCAD.DatabaseServices.LineWeight), plotstyle)
The plotstyle is coming from a PlotStyle object that must exist in the drawing. If the PlotStyle does not exist or if your drawing is using CTB instead of STB, then this will not work.
HTH