+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 30
  1. #1
    Junior Member
    Using
    AutoCAD 2011
    Join Date
    Nov 2010
    Posts
    17

    Exclamation How to extract the selection set for w block and modify it

    Registered forum members do not see this ad.

    hi,

    LISP ROUTINE

    i am working on block i want my blocks to change their color as per the user defenition

    like a block with if users option is 5 10 15 20 25
    i need to assign the colour red ----5 green------10 blue---15 and so on for the same block which i assigned

    how can i do this i am woking on lisp rotines

  2. #2
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2013
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    33,471

    Default

    raj: Please do not double post. We heard you the first time. Try to have a little patience.

    Double posting wastes space and can be confusing as people respond to the same question is both posts. That just makes it more difficult to follow the course of the conversation.

    Thanks you.
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

  3. #3
    Full Member
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    30

    Default

    Quote Originally Posted by raj View Post
    hi,

    LISP ROUTINE

    i am working on block i want my blocks to change their color as per the user defenition

    like a block with if users option is 5 10 15 20 25
    i need to assign the colour red ----5 green------10 blue---15 and so on for the same block which i assigned

    how can i do this i am woking on lisp rotines

    The Block on which you are working needs to be assigned BYBLOCK Color.... Only then can one apply the color codes to the said blocks even through a LISP Routine

  4. #4
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,667

    Default

    Here is mine ......
    Code:
    (defun c:THcool (/ TH:CAD ss obj Bs)
      ;Tharwat Nov .09.2010
      (vl-load-com)
      (if (and (setq ss (car (entsel "\n Select Block :")))
    	   (eq (cdr (assoc 0 (entget ss))) "INSERT")
    	   )
         (progn
             (setq TH:CAD (vla-get-activedocument (vlax-get-acad-object)))
              (setq obj (vlax-ename->vla-object ss))
                (vlax-for Bs (vla-get-Blocks TH:CAD)
                   (vlax-for Obj Bs
                       (vlax-property-available-p Obj 'Color)
                       (vla-put-Color Obj 1)
                     )
                 )
           )
        (princ (strcat "\n *** Select a BLOCK not a :"(cdr (assoc 0 (entget ss))) " *** "))
        )
      (princ)
      )
    Tharwat

  5. #5
    Full Member
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    30

    Default

    Tharwat, Your program works great.... I tried and tested it... The only problem as I see it that Raj wants the color to be inputted at the prompt and the color which he assigns for e.g. 1 i.e. red to selected block entities they should transform their color to red...

    This is my interpretation of the matter posted by Raj....

  6. #6
    Junior Member
    Using
    AutoCAD 2011
    Join Date
    Nov 2010
    Posts
    17

    Wink Thank u

    i would like to ask my user for a colour and then change the color

  7. #7
    Full Member
    Using
    AutoCAD 2006
    Join Date
    Nov 2009
    Posts
    30

    Default

    But you did not reply to the question asked earlier.... whether your blocks whose color transformation you intend to do are assigned BYBLOCK or some other color... This is some necessary inputs required from your end for me to enable me to write a code accordingly

  8. #8
    Junior Member
    Using
    AutoCAD 2011
    Join Date
    Nov 2010
    Posts
    17

    Default

    they are assigned by block
    my need : i have a bolt and for different size i need different colors to b added as per the users input of size so they can be sorted
    can u please addon some comment to the code for my understanding

  9. #9
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2011
    Join Date
    Apr 2008
    Posts
    6,050

    Default

    So each size has a defined color? If so, you need to have a list of sizes with corresponding color.
    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  10. #10
    Junior Member
    Using
    AutoCAD 2011
    Join Date
    Nov 2010
    Posts
    17

    Default

    Registered forum members do not see this ad.

    ya ur right

Similar Threads

  1. Lisp for attribute extract from block
    By sadhu in forum AutoLISP, Visual LISP & DCL
    Replies: 16
    Last Post: 15th Nov 2012, 07:23 pm
  2. How to extract the selection set for w block and modify it
    By raj in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 9th Nov 2010, 12:59 pm
  3. Extract block & attributes to Excel
    By stevesfr in forum AutoLISP, Visual LISP & DCL
    Replies: 18
    Last Post: 5th Oct 2010, 07:52 am
  4. extract block attributes to excel
    By silviu30 in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 19th Feb 2009, 04:31 pm
  5. Explode/extract out only part of a block?
    By Vigilante in forum AutoCAD Drawing Management & Output
    Replies: 11
    Last Post: 6th Apr 2007, 08:45 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