To make the entity line weight visible in model space, you have to make the Database property “LineWeightDisplay” true. Below code shows a simple sample which modifies the curves line type and enables the diaply of line weight by setting “LineWeightDisplay = true”.
[CommandMethod("changeLineWeight")]
public void changeLineWeight()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
PromptEntityOptions options =
new PromptEntityOptions("\nSelect curve : ");
options.SetRejectMessage("\nSelect only curves");
options.AddAllowedClass(typeof(Curve), false);
PromptEntityResult acSSPrompt = ed.GetEntity(options);
if (acSSPrompt.Status != PromptStatus.OK)
return;
using (Transaction tx = db.TransactionManager.StartTransaction())
{
Curve ent = tx.GetObject(acSSPrompt.ObjectId,
OpenMode.ForWrite) as Curve;
ent.LineWeight = LineWeight.LineWeight035;
tx.Commit();
}
//make sure you set the LineWeightDisplay flag as true
db.LineWeightDisplay = true;
}
