.NET
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Those are controlled by the drawing's Current sysvars.
CECOLOR
CELTYPE
CELWEIGHT
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Can you guide me, to use this in .net code
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
class keyThumper<T> : Lazy<T>; another Swamper
I do not endorse the social media app links below![]()
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Works for me. ... see attached piccy.
class keyThumper<T> : Lazy<T>; another Swamper
I do not endorse the social media app links below![]()
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.D
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
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
But the Only Issue in above code is we can't reback to "ByLayer"
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
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.
class keyThumper<T> : Lazy<T>; another Swamper
I do not endorse the social media app links below![]()
Re: Change Color, Line Type and Line weight without selecting any objects
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi,
>> we can't reback to "ByLayer"
Why not, this code does not Work?
acDoc.Database.Celtype = "byLayer"
- alfred -
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at
-------------------------------------------------------------------------


