geogiac Posted May 29, 2010 Share Posted May 29, 2010 Hi i am desperately trying to change the color of a line ...... i use visual studio and autocad 2009 in an out of process environment right now i use this code to create a line it works fine (i did not quote the code to assign the coordinates to the point) but now i can not seem to be able to change the color of the object (acadline) i created....... any help!!!!!?!?? '******* Imports Autodesk.AutoCAD.Interop.acaddocumentclass Imports autodesk.AutoCAD.Interop.Common Module CONNETTI_AUTOCAD Public acad As Autodesk.AutoCAD.Interop.AcadApplication Public acaddoc As Autodesk.AutoCAD.Interop.AcadDocument PublicSub CONNETTI_AUTOCAD_COM() Dim linea As AcadLine acad = GetObject(, "AUTOCAD.APPLICATION") acaddoc = acad.activeDocument linea = acaddoc.ModelSpace.AddLine(start, finish) '********** Quote Link to comment Share on other sites More sharing options...
gile Posted May 29, 2010 Share Posted May 29, 2010 Hi While you're using the COM API, you ca look at ACtiveX and VBA Reference in the AutoCAD Developer's Guide. For the index colors you can use the Color Property which value have to be an integer between 0 and 256 or one of the following constants: acByBlock(0) acByLayer (256) acRed (1) acYellow (2) acGreen (3) acCyan (4) acBlue (5) acMagenta (6) acWhite (7) I'm not very comfortable with VB syntax, but it should be something like this linea.Color = acRed or linea.Color = 1 For 'true colors' you have to use an AcadAcCmColor object : Dim col As New AcadAcCmColor col.Red = 28 col.Green = 111 col.Blue = 225 linea.TrueColor = col Quote Link to comment Share on other sites More sharing options...
geogiac Posted May 30, 2010 Author Share Posted May 30, 2010 thanks...the solution was far too easy once i understood.... thanks again Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.