Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: Room Attribute Routine

  1. #1
    Member
    Join Date
    2013-01
    Posts
    28
    Login to Give a bone
    0

    Smile Room Attribute Routine

    Hi All, I have absolutely no idea how to do this but am hoping someone out there can help. I am using AutoCAD LT 2012 and use it to edit and create dwg files recording buildings and their condition (BIM ?). I have room attributes placed on the drawing which display room details from the dwg. What I was hoping for was to access other information based on the room number and show it in the drawing. So if I had say asbestos items recorded in a csv file then I could run a routine with options shown in the command line which would place a symbol in a room where the asbestos was located. Also perhaps render a colour in a room as well to highlight areas. This request hopefully will open discussion on how to tackle the problem as I say I don't know about programming CAD. Thanks in anticipation. Have a great day.

  2. #2
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    LT has no custmization abilities beyond simple macros, tool palettes, and the Action Recorder.

  3. #3
    Member
    Join Date
    2013-01
    Posts
    28
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Quote Originally Posted by dgorsman View Post
    LT has no custmization abilities beyond simple macros, tool palettes, and the Action Recorder.


    OK dgorsman, what about this in Revit or full AutoCAD then as i also have access to these apps.

  4. #4
    AUGI Addict
    Join Date
    2015-12
    Posts
    2,095
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Should be possible in AutoCAD through any number of means. In rough order of complexity: LISP, dotNET, or ARX. As for Revit, I don't know, its not a platform I use. Should be possible, and may even be possible without customization.

  5. #5
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Quote Originally Posted by doushkajs353099 View Post
    Hi All, I have absolutely no idea how to do this but am hoping someone out there can help. I am using AutoCAD LT 2012 and use it to edit and create dwg files recording buildings and their condition (BIM ?). I have room attributes placed on the drawing which display room details from the dwg. What I was hoping for was to access other information based on the room number and show it in the drawing. So if I had say asbestos items recorded in a csv file then I could run a routine with options shown in the command line which would place a symbol in a room where the asbestos was located. Also perhaps render a colour in a room as well to highlight areas. This request hopefully will open discussion on how to tackle the problem as I say I don't know about programming CAD. Thanks in anticipation. Have a great day.
    If you can rich at full AutoCAD version, it's easy to do what you need,
    say read csv into complex list, then select in the drawing room numbers
    or whathever you have, then retrieve from given list the record matched with this room
    number and place all info back from this record in the room block attributes or mtext, etc
    Upload here a small drawing with 1-3 rooms and .csv file too I will try to write this code
    I'm using A2010 btw

  6. #6
    Member
    Join Date
    2013-01
    Posts
    28
    Login to Give a bone
    0

    Thumbs up Re: Room Attribute Routine

    Quote Originally Posted by fixo View Post
    If you can rich at full AutoCAD version, it's easy to do what you need,
    say read csv into complex list, then select in the drawing room numbers
    or whathever you have, then retrieve from given list the record matched with this room
    number and place all info back from this record in the room block attributes or mtext, etc
    Upload here a small drawing with 1-3 rooms and .csv file too I will try to write this code
    I'm using A2010 btw
    Hi fixo, thanks for your reply and offer of help, greatly appreciated. Firstly I have been having some problems with saving the XL sheet as a CSV file so I have attached the XL workbook if this helps. I have aslo attached the dwg file saved back as A2010 hope this opens ok. Any assumptions you apply will be fine. Looking forward to working with you on this. Please let me know if you require anything else. Thanks again.
    Attached Files Attached Files

  7. #7
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Okay, I've dowloaded your files on my disk,
    will be back tomorrow only,
    Cheers

  8. #8
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Quote Originally Posted by doushkajs353099 View Post
    I would place a symbol in a room where the asbestos was located. Also perhaps render a colour in a room as well to highlight areas.
    Explain this moment a little more, what you want to retrieve from xls or csv
    and where to pass this, below the block ? Show me please a small picture,
    just a piece of screenshot as PNG or JPEG

  9. #9
    Member
    Join Date
    2013-01
    Posts
    28
    Login to Give a bone
    0

    Thumbs up Re: Room Attribute Routine

    Quote Originally Posted by fixo View Post
    Explain this moment a little more, what you want to retrieve from xls or csv
    and where to pass this, below the block ? Show me please a small picture,
    just a piece of screenshot as PNG or JPEG
    Hi fixo, thanks for your reply. Apologies for not responding quicker.
    I have been thinking about the procedure a bit more and make the following comments/opinions but will be guided by your superior knowledge of coding etc.

    Point One:
    After initially placing the room attribute block a user will need to make a decision as to whether asbestos is present or not and thus whether to place an asbestos attribute block. If asbestos is not present then they would proceed to place the next room attribute block. But, if asbestos is present then they would need to call a command to bring in the asbestos attribute block to populate. Data to enter in to the asbestos block could be entered via the command line or via screen pop up block. Not sure how this would be done.
    Point Two:
    After the asbestos attribute block has been populated it should become invisible and an asbestos symbol inserted above the room attribute. If there are multiple occurances of asbestos in a room then the asbestos symbol could be simply copied and pasted to a specific point in the room plan.
    Point Three:
    This could be a sticking point. There needs to be a way to click on the room number in the room block and bring up the asbestos block for viewing/editing. Maybe clicking on the asbestos symbol might be better i'm not sure.
    Point Four:
    It should be the room number in the room block that is the key field in the XL sheet or CSV. So clicking on any room number in the room block would typically query the XL sheet and return the records. The problem here might be that if there are a number of asbestos records in the XL sheet for the same room (due to different materials) then how would they best be displayed.
    Lastly:
    The asbestos information should of course be on it's own layer.

    I hope my explanation is clear enough but let me know. Screen shot attached.

    Many thanks, hope your weekend goes well. JS

  10. #10
    AUGI Addict fixo's Avatar
    Join Date
    2005-05
    Location
    Pietari, Venäjä
    Posts
    1,269
    Login to Give a bone
    0

    Default Re: Room Attribute Routine

    Hi JS, I just finished sample code to hatching rooms if these have asbestos
    Try it as is on your drawing you've sent me before, other parts of code
    I will be finish tomorrow,
    btw there is no asbestos block in there, where I can find it on my AutoCAD,
    perhaps in Architectural palette?
    tell me please

    Code:
    ;;--------------------------------------------------  code start   ----------------------------------------;;
    (defun C:RML (/ *error* asbindexed asbmatches asbtype blkobj dxf ents getattvalue file floorindexed floornum fname found i info
    	      listbounds objs p1 p2 pline plineobj pos plinepoints ptlist read-csv records rmset roominfo rooms room_ref sp sset tmpset x)
    
    (defun *error*  (msg)
        (if
          (vl-position
    	msg
    	'("console break"
    	  "Function cancelled"
    	  "quit / exit abort"
    	  )
    	)
           (princ "Error!")
           (princ msg)
           )
        (if (= (logand (getvar "UNDOCTL") 4) 4)
    (command "_UNDO" "_END")
    )
        (princ)
        )
      ;; local functions:
      
      ;; return element from association list entry 
      (defun dxf (key alist) (cdr (assoc key alist)))
      
      ;; get lwpolyline vertices
      (defun plinepoints (en)
      (vl-remove-if
        'not
        (mapcar '(lambda (x)
    	       (if (= 10 (car x))
    		 (cdr x)
    	       )
    	     )
    	    (entget en)
        )
      )
    )
      ;; read csv file to a list
      
      (defun read-csv (fname del / strtolst ptlist)
    
     ;; by gile
    (defun strtolst (str del)
     (if (setq pos (vl-string-search del str))
     (cons (substr str 1 pos)
     (strtolst (substr str (+ pos 1 (strlen del))) del)) (list str) 
    ) 
    )
    
      
       (if (setq file (open fname "r"))
            (progn
    	  (setq records nil)           
                (while (setq sp (read-line file))
    	      (setq records (cons (strtolst sp del)records))
    	      )
                (close file)
               )
         
            )
    (if records (reverse records) nil)
      )
    
      ;; retrieve single attribute value by tag
      (defun getattvalue  (blkobj atag / at atts attvalue)
      (setq atts (vlax-safearray->list
    		 (variant-value
    		   (vla-getattributes blkobj)
    		   )
    		 )
    	)
    
      (foreach at atts
        (if (eq atag (vla-get-tagstring at))
       (setq attvalue     (vla-get-textstring at)))
        )
      attvalue
      )
      
    
      ;; main part:
      ;(setq fname (getfiled "Select CSV:" "" "CSV" 4))
      
      (setq records (read-csv fname (chr 59)));<--- \tab = (chr 9)   ; = (chr 59)   , = (chr 44)
    
        (setq floornum (getstring (strcat "\nSpecify floor number <0>: ")))
      (if (eq "" floornum)(setq floornum "0"))
      ;; remove headers
      (setq records (vl-remove (car records) records))
      
      (setq floorindexed (mapcar '(lambda (x)(list (nth 2 x)(nth 4 x)(nth 12 x)))records))
      ;; extract records that matches to floor number 
      (setq asbindexed (mapcar 'cdr (vl-remove-if-not '(lambda(x)(eq floornum (car x))) floorindexed)))
      (setq asbmatches (mapcar '(lambda(x)(apply 'cons x)) asbindexed))
          (setvar "cmdecho" 0)
          (setvar "hpname" "SOLID")
      (if (= (logand (getvar "UNDOCTL") 4) 4)
    (command "_UNDO" "_GROUP")
    )
          (setq p1 (getpoint "\nSpecify first corner point of floor plan: ")
    	p2	(getcorner p1"\nSpecify opposite corner: "))
          (command "_.SELECT" "_W" p1 p2 "")
          (command "_zoom" "_w" p1 p2)
     (setq sset (ssget "_P" '((0 . "insert")(2 . "ROOM")(8 . "ROOMTEXT")(66 . 1))))
    	   (setq info (ssnamex sset)
    		 ents (vl-remove-if 'listp (mapcar 'cadr info))
    		 objs (mapcar 'vlax-ename->vla-object ents))
      ;; select specific room bounds on layer "NC_Attributes"
      (setq rmset (ssget "_X" (list (cons 0  "lwpolyline")(cons 8  "NC_Attributes"))))
      (setq roominfo (ssnamex rmset)
    	rooms (vl-remove-if 'listp (mapcar 'cadr roominfo)))
      ;; get all rooms boundary and associated points of them all
      (setq listBounds (mapcar '(lambda (x)(cons x (plinepoints x))) rooms))
      ;; set counter
        (setq i 0)
        (while (setq ptlist (cdr (nth i listBounds)))
          (if (setq tmpset (ssget "_wp" ptlist '((0 . "insert")(2 . "ROOM")(8 . "ROOMTEXT")(66 . 1))))
    	(progn
          (setq found (ssname tmpset 0))
          (setq blkobj(vlax-ename->vla-object found))
         (setq room_ref (getattvalue blkobj "ROOM_REF"))
          (setq asbtype (cdr (assoc room_ref asbmatches)))
          (setq pline (car (nth i listBounds))
    	    plineobj(vlax-ename->vla-object pline))
          (command "-bhatch" "_S" pline "" "")
          (command "_chprop" "_L" "" "_Color" asbtype "")))
          (setq i (1+ i))
        )
    (*error* nil)
          (princ)
          )
    (prompt "\n\t\t   ---   Start command with RML   ---\n")
    (prin1)
    (vl-load-com)
    (princ)
    
    ;;--------------------------------------------------  code end   -------------------------------------------;;

Page 1 of 3 123 LastLast

Similar Threads

  1. Attribute Definition Copying Routine
    By chris.harmon682006 in forum AutoLISP
    Replies: 12
    Last Post: 2022-05-06, 08:45 PM
  2. Room Attribute Routine
    By doushkajs353099 in forum AutoLISP
    Replies: 27
    Last Post: 2013-05-07, 06:58 PM
  3. Attribute extraction routine
    By draftsit in forum AutoLISP
    Replies: 1
    Last Post: 2009-03-04, 07:32 PM
  4. Replies: 2
    Last Post: 2007-05-11, 11:25 AM
  5. Attribute Extraction routine
    By isosa in forum AutoLISP
    Replies: 14
    Last Post: 2006-03-10, 04:37 PM

Tags for this Thread

Posting Permissions

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