Jump to content

Recommended Posts

Posted

Hi I would like to know if you can automatically answer the following two questions ...

 

How to get the total length of lines or layers differentiated by style.

By using acadiso.lin I have created various styles of lines, the idea would be to know the total length of each custom line existing in a drawing.

 

How to know the number of blocks that are in a drawing automatically. Would I know the amount automatically if I remove or copy a block?

Is there any way to find this out if it is not possible to do this automatically?

Posted

Re: Block count. Have you looked at the BCOUNT command in Express Tools?

 

BCOUNT

Counts, itemizes, and displays in tabular form, the number of insertions of each block in the selected objects or in the entire drawing.

 

By the way, it is not necessary, nor is it recommended that forum members double post. It just confuses things down the road. Thanks.

Posted

For the line lengths, I'd try something like this:

 

[b][color=BLACK]([/color][/b]defun c:llen [b][color=FUCHSIA]([/color][/b]/ lay lin i dt ss en ed di dt[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]or [b][color=MAROON]([/color][/b]not lay[b][color=MAROON])[/color][/b]
            [b][color=MAROON]([/color][/b]not [b][color=GREEN]([/color][/b]or [b][color=BLUE]([/color][/b]wcmatch lay [color=#2f4f4f]"*`**"[/color][b][color=BLUE])[/color][/b]
                     [b][color=BLUE]([/color][/b]wcmatch lay [color=#2f4f4f]"*`,*"[/color][b][color=BLUE])[/color][/b]
                     [b][color=BLUE]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] lay[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq lay [b][color=MAROON]([/color][/b]strcase [b][color=GREEN]([/color][/b]getstring [color=#2f4f4f]"\nLAyer To Calulate:   "[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

 [b][color=FUCHSIA]([/color][/b]while [b][color=NAVY]([/color][/b]or [b][color=MAROON]([/color][/b]not lin[b][color=MAROON])[/color][/b]
            [b][color=MAROON]([/color][/b]not [b][color=GREEN]([/color][/b]or [b][color=BLUE]([/color][/b]wcmatch lin [color=#2f4f4f]"*`**"[/color][b][color=BLUE])[/color][/b]
                     [b][color=BLUE]([/color][/b]wcmatch lin [color=#2f4f4f]"*`,*"[/color][b][color=BLUE])[/color][/b]
                     [b][color=BLUE]([/color][/b]tblsearch [color=#2f4f4f]"LTYPE"[/color] lin[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
        [b][color=NAVY]([/color][/b]setq lin [b][color=MAROON]([/color][/b]strcase [b][color=GREEN]([/color][/b]getstring [color=#2f4f4f]"\nLType To Calulate:   "[/color][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

  [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq i -1
            dt 0
            ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"LINE"[/color][b][color=BLUE])[/color][/b]
                                [b][color=BLUE]([/color][/b]cons 6 lin[b][color=BLUE])[/color][/b]
                                [b][color=BLUE]([/color][/b]cons 8 lay[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss [b][color=BLUE]([/color][/b]setq i [b][color=RED]([/color][/b]1+ i[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                    di [b][color=GREEN]([/color][/b]distance [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 10 ed[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                                 [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 11 ed[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                    dt [b][color=GREEN]([/color][/b]+ di dt[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]princ [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"\nTotal Length Of LINEs on LAyer "[/color] lay
                      [color=#2f4f4f]" With LType "[/color] lin [color=#2f4f4f]" = "[/color] [b][color=GREEN]([/color][/b]rtos dt 2 4[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

  [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]zerop dt[b][color=NAVY])[/color][/b]
      [b][color=NAVY]([/color][/b]alert [b][color=MAROON]([/color][/b]strcat [color=#2f4f4f]"No Entities Match The Criteria\n"[/color]
                      [color=#2f4f4f]"LAyer "[/color] lay [color=#2f4f4f]" - "[/color] [color=#2f4f4f]"LTYPE "[/color] lin[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]

  [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

-David

Posted

OK..now we have two threads with the exact same question going which is what we try to avoid here.

 

migs: I suggested BCOUNT in the other post by the OP.

Posted

Ok, sorry.

I know the command Bcount, but my question is whether it is possible to count blocks automatically, either by using a table, Reactor, etc..

Posted

Here is mine for counting Blocks in a drawing , I have just made it for you. :)

 

(defun c:THblk (/ ss ents) 
;Tharwat 09.Septmber.2010  
(if
 (and
   (setq ss
       (ssget "_x" '((0 . "INSERT"))
	)) 
           (setq ents (sslength ss)))	        
 (if
    (cond (
     (= ents 1)
        (alert (strcat " You have only" " " (itoa ents) " " " Block ...")
	       )
    )
            (
	     (> ents 1)
	     (alert (strcat " You have" " " (itoa ents) " " " Blocks ..."))
	     )
   )
   (princ)
   )	
   (alert " *** NO BLOCKS FOUND *** ")
 )
 (princ)
 )
 

 

Regards,

 

Tharwat

Posted

ReMark: I never noticed your other post regarding the BCOUNT command or else i would have referred him there instead

Posted

Well it looks like this will become the defacto main post so I guess my argument is mute. My apologies.

Posted

I merged the two threads into this one.

Titoprax, please post a question only once.

Posted

Search for Upgraded BCount, and Line Length Calculator, I believe someone has already provided a link for the latter.

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