Would the data (text or polyline) gonna be replaced into the attribute text in a block ?
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.
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
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.
A few questions:
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.
- Is the text always inside the polyline it refers to?
- Is there various other possible texts which may per chance also be there?
- Is there some way to figure out which text is which, e.g. different layers?
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!
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.
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
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.
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 ...
TharwatCode:(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) )
- 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
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"
Registered forum members do not see this ad.
What is that selected ( lines , texts , polylines , ....... etc) ????
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
Bookmarks