+ Reply to Thread
Page 1 of 4 1 2 3 ... LastLast
Results 1 to 10 of 35
  1. #1
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Posts
    20

    Default Room Tag LISP Routine

    Registered forum members do not see this ad.

    I would like to know if there exists a LISP Routine that will allow the user to click on data(text and a polyline) in a drawing and have it inserted into a pre made block with attributes? For example, if an architect sends me a DWG with room tags, employees names (seating), and I create a poly line for each room, and I have a block already made with those 3 attributes, can I select the data and have it inserted into the block? I would like to generate excel spread sheets with columns for the RM#, Employee seating, and SF as the end result. Thank you in advance.

  2. #2
    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,664

    Default

    Would the data (text or polyline) gonna be replaced into the attribute text in a block ?
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  3. #3
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Posts
    20

    Default

    Yes. basically it would be the text in the existing drawing. I would then insert my block into each room and take the text(from the existing drawing) and copy it into the block as a field. This way the data is linked and if changes are made to the original text, the attributes would reflect this change.

  4. #4
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,666

    Default

    A few questions:
    1. Is the text always inside the polyline it refers to?
    2. Is there various other possible texts which may per chance also be there?
    3. Is there some way to figure out which text is which, e.g. different layers?
    If all = Yes then it's possible to write something where you simply have to pick the polyline. Otherwise you'd need to pick each text as well.

    I have an old routine, but it's made specifically for our office, so it might need a lot of modification to suit your needs.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  5. #5
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Posts
    20

    Default

    1. Yes
    2. Yes (but I can hide them during task)
    3. Yes
    -I can put employee names on own layer
    -I can put room number tag on its own layer
    -I can make the polylines on there own layer
    Another note, I am not opposed to making multiple selections, however if I understand what you are suggesting is to just replace all three by selecting the polyline, which would be amazing.

  6. #6
    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,664

    Default

    I guess you need a routine to add objects to block .

    If yes ?

    check this out ...

    http://lee-mac.com/addobjectstoblock.html
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  7. #7
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Posts
    20

    Default

    I dont think this will work for me because I am trying to add txt to attributes within a block. This way I can extract later and all 3 attributes will be represented together in the spreadsheet. For example, I could extract data that tells me "John Doe"(employee) is in room 201 that is 150sf.

  8. #8
    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,664

    Default

    Would this help you with it .. ?
    Select the texts which they are three text as you have mentioned and after that select a block which has attributes which are also three to contain texts in atts.

    This is if I understood your needs well ...
    Code:
    (defun c:TesT (/ acdoc ss blk e n sset str)
      ;; Tharwat 30. Sep. 2011 ;;
      (vl-load-com)
      (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object)))
      (if (and
            (setq ss (ssget '((0 . "*TEXT"))))
            (setq blk (car (entsel "\n Select Attributes in Block :")))
            (eq (cdr (assoc 0 (setq e (entget blk)))) "INSERT")
          )
        (progn
          (setq n -1)
          (repeat (setq i (sslength ss))
            (setq sset (ssname ss (setq i (1- i))))
            (setq str (cons (cdr (assoc 1 (entget sset))) str))
          )
          (setq str (reverse str))
          (vlax-for x (vla-item (vla-get-blocks acdoc) (cdr (assoc 2 e)))
            (if (eq (vla-get-objectname x) "AcDbAttributeDefinition")
              (vla-put-textstring x (nth (setq n (1+ n)) str))
            )
          )
          (vla-regen acdoc AcAllViewports)
        )
        (princ)
      )
      (princ)
    )
    Tharwat
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

  9. #9
    Junior Member
    Using
    AutoCAD 2012
    Join Date
    Sep 2011
    Posts
    20

    Default

    It does not insert the selected into the block. I get this error "Select Attributes in Block :; error: ActiveX Server returned an error:
    Parameter not optional"

  10. #10
    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,664

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by rmjcorp View Post
    It does not insert the selected into the block. "
    What is that selected ( lines , texts , polylines , ....... etc) ????


    Quote Originally Posted by rmjcorp View Post
    I get this error "Select Attributes in Block :; error: ActiveX Server returned an error:
    Parameter not optional"
    That's odd ,

    the required things for the routine :

    1- should have attributed block which should have 3 attributes in it .
    2- when invoking the routine , you should select texts to be inserted in the attributed block and which is going to be replaced with the attributes (texts).
    - When aim is being settled in my mind , I have to reach it and get it in hand whatever it costs and wherever it is and will never give up . Tharwat said

Similar Threads

  1. Looking for a Room Dimension tag routine
    By Grigs in forum AutoCAD General
    Replies: 20
    Last Post: 10th May 2011, 01:24 am
  2. Room Tag / Room Finish Schedule
    By Marc5 in forum AutoCAD General
    Replies: 7
    Last Post: 2nd Sep 2010, 01:12 pm
  3. Replies: 1
    Last Post: 30th Aug 2010, 06:00 pm
  4. Replies: 3
    Last Post: 10th Aug 2010, 04:39 am

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