+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Forum Newbie
    Computer Details
    djguinan's Computer Details
    Operating System:
    XP SP3
    Discipline
    Civil
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Dublin, Ireland
    Posts
    5

    Default Convert from index colours to true colours

    Registered forum members do not see this ad.

    Does anyone have a lisp routine to globally convert entities from index colour to rgb(true colour)? I found a routine that does it the opposite way around.

  2. #2
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,124

    Default

    Welcome to the forum

    What do you mean by the rgb colour ? Does it mean ByLayer ?

  3. #3
    Forum Newbie
    Computer Details
    djguinan's Computer Details
    Operating System:
    XP SP3
    Discipline
    Civil
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Dublin, Ireland
    Posts
    5

    Default

    Thanks for the Welcome Tharwat

    I have solid hatch entities in a drawing that I want to be True Colour rather then Index Colour. When in the Select Colour Dialoge box its the middle tab.

  4. #4
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,124

    Default

    Hope my post in the following thread would help you with it ..

    http://www.cadtutor.net/forum/showth...l=1#post444444

  5. #5
    Forum Newbie
    Computer Details
    djguinan's Computer Details
    Operating System:
    XP SP3
    Discipline
    Civil
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Dublin, Ireland
    Posts
    5

    Default

    No Sorry, if it helps this lisp is the opposite of what I want to do.
    Attached Files

  6. #6
    Forum Newbie
    Computer Details
    djguinan's Computer Details
    Operating System:
    XP SP3
    Discipline
    Civil
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Dublin, Ireland
    Posts
    5

    Default

    Lee Mac

    I only spotted your reply as I subbmitted a reply to Tharwat. That is exactly what I'm looking for, thanks very much

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,455

    Default

    Try this:

    Code:
    ;; All to RGB  -  Lee Mac  -  www.lee-mac.com
    ;; Converts the ACI colours of all entities to the RGB TrueColor equivalent
    
    (defun c:AlltoRGB ( / accm c e i s )
        (if
            (and
                (setq s (ssget "_:L"))
                (setq accm
                    (vla-getinterfaceobject (vlax-get-acad-object)
                        (strcat "AutoCAD.AcCmColor." (substr (getvar 'ACADVER) 1 2))
                    )
                )
            )
            (progn
                (repeat (setq i (sslength s))
                    (setq e (entget (ssname s (setq i (1- i)))))
                    (if (setq c (cdr (assoc 62 e)))
                        (progn
                            (vla-put-colorindex accm c)
                            (entmod
                                (append e
                                    (list
                                        (cons 420
                                            (LM:RGB->True
                                                (vla-get-red   accm)
                                                (vla-get-green accm)
                                                (vla-get-blue  accm)
                                            )
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
                (vlax-release-object accm)
            )
        )
        (princ)
    )
    
    ;; RGB -> True - Lee Mac 2011
    ;; Args: r,g,b - Red,Green,Blue values
    
    (defun LM:RGB->True ( r g b )
        (+
            (lsh (fix r) 16)
            (lsh (fix g)  8)
            (fix b)
        )
    )
    
    (vl-load-com) (princ)
    It will change the colour of selected entities from the ACI colour to the RGB True Colour equivalent.

    Note that it will change only those entities whose colour is not set to ByLayer (though these may be included if necessary by changing the respective layer colours).

    More Colour Conversion functions.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,455

    Default

    Quote Originally Posted by djguinan View Post
    Lee Mac

    I only spotted your reply as I subbmitted a reply to Tharwat. That is exactly what I'm looking for, thanks very much
    I modified it slightly and re-posted, please use the updated version above ^^

    Thanks - glad it works for you.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Forum Newbie
    Computer Details
    djguinan's Computer Details
    Operating System:
    XP SP3
    Discipline
    Civil
    Using
    AutoCAD 2009
    Join Date
    Jan 2012
    Location
    Dublin, Ireland
    Posts
    5

    Default

    Thanks guys you've saved me alot of time. I'm a first time user of this site and I have to say I'm very impressed with the quick responses
    Happy New Year

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    19,455

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by djguinan View Post
    Thanks guys you've saved me alot of time. I'm a first time user of this site and I have to say I'm very impressed with the quick responses
    Happy New Year
    You're very welcome djguinan, hope to see you back soon
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Can Block colours correspond to different layer colours?
    By BenGoble in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 1
    Last Post: 18th Apr 2010, 02:04 pm
  2. Convert all layer colours to white - and back again
    By geo in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 28th Nov 2008, 01:59 am
  3. layer colours and screen colours
    By alec in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 13th Jun 2008, 12:49 pm
  4. Tab Colours
    By DODGE in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 26th Feb 2007, 01:19 am
  5. add more colours
    By Naser Parkar in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 8th Nov 2002, 11:48 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts