Hi,
I am trying to Change the Color, Line Type and Line weight in Properties Pallete without selecting any objects, but i don't know how to do this.
Solved! Go to Solution.
Solved by kdub_nz. Go to Solution.
Solved by Alfred.NESWADBA. Go to Solution.
Untested
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; // AcadApp.SetSystemVariable(string name, object value) AcadApp.SetSystemVariable("CECOLOR", "BYLAYER") AcadApp.SetSystemVariable("CELTYPE", "ByLayer") AcadApp.SetSystemVariable("CELWEIGHT", -1)
Regards
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper
On using the above code,
AcadApp.SetSystemVariable("CECOLOR", "BYLAYER")- Results No Change
AcadApp.SetSystemVariable("CELTYPE", "ByLayer")- Results in "eInvalidInput" error
AcadApp.SetSystemVariable("CELWEIGHT", -1)- Results in "eInvalidInput" error
I don't know why it is not working for me.....
But i got the solution in another way, my solution code follows,
Using lock As DocumentLock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Using acTrans As Transaction = acDoc.Database.TransactionManager.StartTransaction()
acDoc.Database.Celweight = LineWeight.LineWeight015
acDoc.Database.Cecolor = Autodesk.AutoCAD.Colors.Color.FromColor(Color.Red)
Dim acLineTypTbl As LinetypeTable
acLineTypTbl = acTrans.GetObject(acDoc.Database.LinetypeTableId, OpenMode.ForRead)
Dim sLineTypName As String = "Continuous"
If acLineTypTbl.Has(sLineTypName) = True Then
'' Set the linetype Center current
acDoc.Database.Celtype = acLineTypTbl(sLineTypName)
'' Save the changes
End If
acTrans.Commit()
End Using
End Using
Please clarify your last post. ??
//--------
And the code you posted is different to your initial question ... but I see how I could confuse your intent.
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper
Hi,
>> we can't reback to "ByLayer"
Why not, this code does not Work?
acDoc.Database.Celtype = "byLayer"
- alfred -
Alfred,
db.Celtype is an ObjectId
But this works for me too.
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; using AcadColor = Autodesk.AutoCAD.Colors; Document doc = AcadApp.DocumentManager.MdiActiveDocument; Database db = doc.Database; db.Celweight = LineWeight.LineWeight015; db.Cecolor = AcadColor.Color.FromColorIndex(ColorMethod.ByAci, 1); db.Celtype = db.ContinuousLinetype; AcadApp.ShowAlertDialog("NOW WE'LL CHANGE THEM BACK."); db.Celweight = LineWeight.ByLayer; db.Cecolor = AcadColor.Color.FromColorIndex(ColorMethod.ByAci,256); db.Celtype = db.ByLayerLinetype;
Regards,
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
class keyThumper<T> : Lazy<T>; another Swamper
Hi,
>> Alfred, db.Celtype is an ObjectId
Ooops .... thank you (looked at the wrong place).
Nice weekend, - alfred -