You can set the database line weight using API “Database.Celweight” in .NET API and using “AcDbDatabase::setCelweight()” api in ObjectARX as shown in below code.
.NET
Database db = doc.Database;
db.Celweight = LineWeight.ByBlock;
db.LineWeightDisplay = true;
ObjectARX
AcDbDatabase *pDb =
acdbHostApplicationServices()->workingDatabase();
pDb->setCelweight(AcDb::kLnWt020);
pDb->setLineWeightDisplay(true);