Jump to content

Recommended Posts

Posted

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

Posted

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)

Posted

do you have the lisp file? i tried making that into a lisp file and it gives me an error

Posted

Just Copy/Paste into a TXT document, then rename the *.TXT extension to *.LSP and that's it. ;)

Posted

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.

Posted

Ah, I forgot it's been so long. In the LISP file, change "VMI-AIRBAL" to the name of your block. Sorry about that. :oops:

Posted

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 .

Posted

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

Posted

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.

Posted

It only works when u copy it, not upon insertion. Just type the command in then follow the prompt.

Posted

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.

Posted

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.

Posted

Sorry I have been doing all this from my Android phone so its made it quite difficult. ;)

Posted

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. :ouch:

SDPHOTOE.dwg

autonumber.lsp

Posted

ahh check that... i got it to work! thanks so much

Posted

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. :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...