budmiah Posted August 25, 2011 Posted August 25, 2011 Hi everyone, I am a fire alarm designer so I am laying out fire systems. So I insert a "smoke detector" from my tool palette over and over and over again. But I need a way that everytime I place a detector its given a number. I need it to increment by 1 every time I place it. for example I have 5 smoke detectors to put on a layout. The first detector is called "1D001" the second detector is 1D002... and so on. Attached is the drawing I use for a detector any help would be greatly appreciated. SDPHOTOE.dwg Quote
tzframpton Posted August 25, 2011 Posted August 25, 2011 Here is a LISP routine I got off this board a long time ago. Works like a charm. I have to do the same thing with tagging my HVAC diffusers for the air balance guys. (defun c:blkinc (/ atd blk cnt ech ipt next next_data osm tag) (setq osm (getvar "osmode")) (setq ech (getvar "cmdecho")) (setq atd (getvar "attdia")) (setvar "osmode" 0) (setvar "cmdecho" 0) (setvar "attdia" 1) (setq cnt (getint "\nEnter first number: ")) (if cnt (progn ;(setq tag (strcase (getstring "\nEnter attribute tag for numbering: "))) (setq tag "NUMBER"); (while (setq ipt (getpoint "\nPick insertion point")) (command "-insert" "vmi-airbal" ipt 1 1 0); (setq blk (entlast)) (setq next blk) (while (setq next (entnext next)) (setq next_data (entget next)) (if (= tag (cdr (assoc 2 next_data))) (progn (entmod (subst (cons 1 (itoa cnt)) (assoc 1 next_data) next_data)) (entupd blk) ) ) ) (setq cnt (1+ cnt)) ) ) ) (setvar "osmode" osm) (setvar "attdia" atd) (setvar "cmdecho" ech) (prin1) ) (prompt "\ntype blkinc to execute ...") (prin1) ;;;TesT : (c:blkinc) Quote
budmiah Posted August 25, 2011 Author Posted August 25, 2011 do you have the lisp file? i tried making that into a lisp file and it gives me an error Quote
tzframpton Posted August 25, 2011 Posted August 25, 2011 Just Copy/Paste into a TXT document, then rename the *.TXT extension to *.LSP and that's it. Quote
budmiah Posted August 25, 2011 Author Posted August 25, 2011 Ok I made the lisp file, when I enter the command it prompts me for the questions then error outs? It was telling me it couldn't find vmi-airbal. So i figured that was specific to your application, so I changed it to the name of my smoke detector file. Now all it does is inserts the smoke detector when I click but no text with numbers incrementing. Quote
tzframpton Posted August 25, 2011 Posted August 25, 2011 Ah, I forgot it's been so long. In the LISP file, change "VMI-AIRBAL" to the name of your block. Sorry about that. Quote
BIGAL Posted August 26, 2011 Posted August 26, 2011 Just a suggestion we have a lisp that is similar prior to (setq cnt (getint "\nEnter first number: ")) Do a search for the block and pull out the highest number add 1 and then ask do you want to use this number or a new one, if cnt = nil then number found else newnum . Quote
pmxcad Posted August 26, 2011 Posted August 26, 2011 Iàm doing the same job. I use Autocad electrical and jou can give also zone numbers and in electrical you export all the attributes to Excel, change it en import it in the drawing again. pmxcad Quote
budmiah Posted August 26, 2011 Author Posted August 26, 2011 yea i changed the name to my block. But now it just inserts the block for me, but it doesnt actually out the numbered text next to the detector. Ultimately when i go to insert the block i need the smoke detector to have a number next to it and it has to increase by 1 everytime I insert the drawing. Quote
tzframpton Posted August 26, 2011 Posted August 26, 2011 It only works when u copy it, not upon insertion. Just type the command in then follow the prompt. Quote
budmiah Posted August 26, 2011 Author Posted August 26, 2011 hmm I must be missing something. I type blkinc, and it prompts me for first number, than it asks me for the insertion point. Then I will just input the smoke detector not the number i told it to start with. Quote
tzframpton Posted August 26, 2011 Posted August 26, 2011 Ah, so sorry about this. Just realized one more thing I missed. In the LISP file, change the "NUMBER" to the name of the attribute in your block. That's the last part to it. Quote
tzframpton Posted August 26, 2011 Posted August 26, 2011 Sorry I have been doing all this from my Android phone so its made it quite difficult. Quote
budmiah Posted August 26, 2011 Author Posted August 26, 2011 man i don't know what in the world im doing wrong. Im gonna attach the lsp file and the dwg and maybe you can see what the heck im doing wrong. When it comes to this kind of stuff im lost. SDPHOTOE.dwg autonumber.lsp Quote
budmiah Posted August 26, 2011 Author Posted August 26, 2011 ahh check that... i got it to work! thanks so much Quote
tzframpton Posted August 26, 2011 Posted August 26, 2011 haha, no problem, sorry for the run-around on it. I kind of have this quick procedure with this program, I do a quick Tab+Spacebar action with my finger & thumb to "quickly" OK the Attribute Dialog Box, which helps speed up me placing the blocks. Just a little tip if you care. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.