I need to edit a LISP to automatically number multiple blocks in the same sequence

I need to edit a LISP to automatically number multiple blocks in the same sequence

MaxandrewsHZ3UD
Explorer Explorer
2,399 Views
12 Replies
Message 1 of 13

I need to edit a LISP to automatically number multiple blocks in the same sequence

MaxandrewsHZ3UD
Explorer
Explorer

I have used one of Lee Macs autonumbering attribute programs however, I need to have the program involve 6 attributes to number all of them together sequentially rather than just one attribute at a time. This is for a door block I made and my aim is that they are all involved in the same numbering sequence when in a floor plan.

 

If anyone can help me find a way to do so that would be amazing

0 Likes
2,400 Views
12 Replies
Replies (12)
Message 2 of 13

Moshe-A
Mentor
Mentor

@MaxandrewsHZ3UD  hi,

 

Does the attached lisp work with your blocks?

Post a sample dwg with your doors after involving 6 attributes to a number so we understand what you are requesting.

 

Moshe

 

0 Likes
Message 3 of 13

MaxandrewsHZ3UD
Explorer
Explorer

Yeah the lisps work with the current set of blocks.

 

I am planning to make 3 double door versions of each door type with imperial measurements and would like them all to continue the number count no matter what door type it is, rather than having 6 sequences.  Currently they have a sperate lisp to allow them to function separately.

 

Thank you for the response!

0 Likes
Message 4 of 13

Moshe-A
Mentor
Mentor

@MaxandrewsHZ3UD 

 

sorry i still do not understand

I opened your dwg, load the lisp, drag a door from blocks palette (INSERT command) and noting happen.

 

the normal way that such a program works is one by one (to increment by 1 the next insert)

what you want is to tag all blocks in one shoot?

do you mind the order?

how do you expect the lisp will know the order?

do each door type have a different number sequence?

 

Moshe

 

 

 

 

 

0 Likes
Message 5 of 13

MaxandrewsHZ3UD
Explorer
Explorer
Sorry if I'm being confusing, I just wanted to see if there was a possibility to have all the blocks be in the same number sequence and still go up by 1 each time. So upon insertion, despite the block, they +1 after the last block was inserted. I just need an automatic count for all the doors rather than a separate count for each type of door block.
0 Likes
Message 6 of 13

Moshe-A
Mentor
Mentor

@MaxandrewsHZ3UD ,

 

well...

Lee's program won't help you here cause it works with one specific block\tag name and you have 3 single door types and you are planning to add double door types? 

 

so i am thinking on another solution - stay tune 😀

 

Moshe

 

 

 

 

0 Likes
Message 7 of 13

MaxandrewsHZ3UD
Explorer
Explorer
Yeah I still have yet to add more door types.

Thank you! super excited 😁
0 Likes
Message 8 of 13

Sea-Haven
Mentor
Mentor

One way may be to insert 1st block and fill in the attributes doortype doorwidth doorht doornum.

 

Then select that block and insert the same block but an interim step is that you have found all door blocks with that name and found last number. Then re-fill in the attributes. 

 

This way you can have multiple blocks single and double doors. 

 

Last comment can have a dynamic block with visibility states so one block has all door styles, but with the 4 attributes. Google for block.

0 Likes
Message 9 of 13

Moshe-A
Mentor
Mentor

@MaxandrewsHZ3UD ,

 

After more exploring the issue last night i came to conclusion that we have to define some rules to agree on

since we have 3 types doors (and in future we will have more doors and maybe windows)

 

each door type tag have a prefix of 'D' character

concrete door type will start numerating with 10  => (D10, D11, D12....)

Timber door type will start numerating with 20     => (D20, D21, D22 ....)

Metal door type will start numerating with 30      =>  (D30, D31, D32...)

 

future types will take 40, 50, 60 ....

 

and windows will have 'W' prefix

 

but this numeration limits you only to 10 doors to a type in a project.

if this not enough? we will have to add 1 more digit as D101, D102....

 

what do you think?

 

Moshe

 

 

 

 

 

 

 

 

 

 

 

 

0 Likes
Message 10 of 13

MaxandrewsHZ3UD
Explorer
Explorer
That would be great to have the prefix changeable, and I can always change the attribute tag so it is same in both a window block and door block so it makes referencing easier

The aim I had was to find out if there was a way to get all the door types to go up by:

D01, D02, D03, D04, ..., D10, D11 etc.

and count the total amount of doors in the drawing rather than a set number range for each door type.
0 Likes
Message 11 of 13

Moshe-A
Mentor
Mentor

@MaxandrewsHZ3UD ,

 

i think you are wrong, eventually you'll end up with my conclusion.

the fact each type has it own scope, does not limit you to count the total amount.

 

Moshe

0 Likes
Message 12 of 13

Moshe-A
Mentor
Mentor

and more...

the door blocks are not always inserted at rotation 0, so if you insert one at 90 degrees, the tag must be rotate to be at readable angle also the tag may interfere with other graphic elements like annotations which require you to move the tag.

 

So the best way to deal with door\windows tags is to create separate blocks tag for each type. this let you move/rotate doors and tags freely.

 

sounds logic?

 

Moshe

 

 

 

 

 

 

0 Likes
Message 13 of 13

Sea-Haven
Mentor
Mentor

Just a side comment I have played with this task and produce quantity of doors by type size color etc, it allows counting by up to 5 attributes. 

eg

Black Goldhandle 24

Silver Blackhandle 34

Silver Silverhandle 12

Not free but small cost.

 

Based on your Drawing 1 if you get a selection set = 18 objects, you can check, EffectiveName (RO) = "Timber Stud_Imperial Door_Single" then look at attribute DREF and get highest value, the example dwg is a bad one as the last door should be D18, option 1 is renumber all doors, starting at X, option 2 is number last door +1 highest which is what you want.

 

Just a start get highest door number, so long as "Effectivename" contains "Door" in its name. Change a couple of the door numbers I made last door D18 for testing. 

(defun c:test ( / blk blkname bname ss x val dnum)

;;-------------------=={ Parse Numbers }==--------------------;;
;;                                                            ;;
;;  Parses a list of numerical values from a supplied string. ;;
;;------------------------------------------------------------;;
;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  s - String to process                                     ;;
;;------------------------------------------------------------;;
;;  Returns:  List of numerical values found in string.       ;;
;;------------------------------------------------------------;;

(defun LM:ParseNumbers ( s )
  (
    (lambda ( l )
      (read
        (strcat "("
          (vl-list->string
            (mapcar
              (function
                (lambda ( a b c )
                  (if
                    (or
                      (< 47 b 58)
                      (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
                      (and (= 46 b) (< 47 a 58) (< 47 c 58))
                    )
                    b 32
                  )
                )
              )
              (cons nil l) l (append (cdr l) (list nil))
            )
          )
          ")"
        )
      )
    )
    (vl-string->list s)
  )
)

(prompt "select door blocks. ")
(setq ss (ssget '((0 . "INSERT"))))

(if (= ss nil)
(progn (alert "You have not selected any blocks \nWill now exit \nPlease check dwg ")(exit))
)

(setq dnum 0)
(repeat (setq x (sslength ss))
 (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
 (setq bname (vlax-get obj 'effectivename))
 (if (wcmatch bname "*Door*")
 (progn
  (setq atts (vlax-invoke obj 'Getattributes))
  (foreach att atts
   (setq tag (vlax-get att 'tagstring))
   (if (= tag "DREF")
   (progn
    (setq val (car (LM:ParseNumbers (vlax-get att 'textstring))))
    (princ (strcat (rtos val 2 0) "\n"))
    (if (> val dnum)(setq dnum val))
   )
   )
  )
 )
 )
)

(princ (strcat "\nHighest door number is " (rtos dnum 2 0)))

(princ)
)

What needs to be considered is best way to approach task just insert windows and later number, it will be by creation order. 

 

This is something I have.

SeaHaven_0-1720677119363.png

 

 

0 Likes