Jump to content

Recommended Posts

Posted (edited)

Steven-p just make each group list sorted and counted, then appended to a 2nd list, dont make a table till all groups are processed and use the 2nd list very easy.

Edited by BIGAL
  • Like 1
Posted

Never thought about sorting the list, maybe I should - will let the OP come back and ask for that

 

Yup, that's what it's doing now, making a list for each group and appending them all together, then making the table. The version before that was doing separate lists.

 

 

Was an interesting one to put together, it was all off the internet apart from making up the table itself, copy and paste everything, no thinking required (sort of) - just needed to work out the steps (OK there might have been a couple of small changes)

Posted

Hi Steven, thanks for the correction. So I do get a single generated table with all the groups and their quantitative, so that's perfect. But each element of the table is independent. The text, the lines etc... I don't have a single table element.

Posted

What I find strange is that this lisp does not exist... When you work on a project with several zones, or pieces, you have to define them, right? Apart from creating a group, there are no other tools on Autocad. 
 

And if you want to know the quantity of blocks of a drawing in its entirety, there are several lisp, but for those who want to know by piece, there was no tool before you put several lisp together to create one.

Posted
13 minutes ago, sofiane said:

Hi Steven, thanks for the correction. So I do get a single generated table with all the groups and their quantitative, so that's perfect. But each element of the table is independent. The text, the lines etc... I don't have a single table element.

 

No problem,

 

There are LISPs out there that will generate a table from a list of information - which would work OK in this case, except for displaying the block graphics - and the above code can be modified to do that... though there would be some extra work needed to line up the blocks into the relevant table cell.

 

If you look at the last part of my LISP, it calls a function "MakeTable" (the line is about 5 or 6 from the end of the code) which can be replaced with a call to a function to create a 'proper' table - maybe one to think about next week.

 

(for tables, my preference is still do them with lines and text, it is what CAD is good at, a spreadsheet is good at tables, and maybe I am wrong. Some of my automation won't work on tables - which is why I went the way I did)

 

The above LISP should however export the details to a CSV file.

 

 

There are LISPs out there that will do this if the blocks you want to count are surrounded by a boundary line or the whole drawing, but not much if the blocks are in a group... but the building blocks are all out there to put together which is what I mostly did. This could also be modified so that you select the blocks you want to count rather than grouping them.

Posted (edited)

For both of you here is a make table example you then use settext to add text.

 

Sofiane the reason you could not find an answer is the majority of users user a pline outline and look inside it for all the objects then count, the most common is a "ROOM" quantity output where it uses a room number as identifier then makes the table.

 

A side note I have a sort same blocks with attributes up to 5 attributes deep, think "Door" how many are white or black have a gold or silver handle that is 4 different for 1 block.

 

; make table example
; By Alan H info@alanh.com.au
; 2018

(defun c:ahmaketable (/ colwidth numcolumns numrows objtable rowheight sp vgad vgao vgms)
(vl-load-com)
(setq sp (vlax-3d-point (getpoint "pick a point for table")))


(Setq vgms (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) ;

(setq numrows 5)
(setq numcolumns 5)
(setq rowheight 2.5)
(setq colwidth 60)
(setq objtable (vla-addtable vgms sp numrows numcolumns rowheight colwidth))
(vla-settext objtable 0 0 "DRAWING REGISTER"); TABLE TITLE
(vla-settext objtable 1 0 "DRAWING NUMBER") 
(vla-settext objtable 1 1 "DRAWING TITLE") 
(vla-settext objtable 1 2 "C")
(vla-settext objtable 1 3 "D")
(vla-settext objtable 1 4 "E")
(vla-settext objtable 2 0 "1")
(vla-settext objtable 3 0 "2")
(vla-settext objtable 4 0 "3")
(command "_zoom" "e")

(princ)
)

 Oh yes make a csv by reading table for export to excel or just read table directly fill in matching cells in excel.

Edited by BIGAL
  • Like 1
  • 2 weeks later...
Posted

Hello everyone, sorry for my late reply, some personal problems that prevented me from being active.

 

Thank you for the information, I understand then that I did not find if the majority do the periphery of their room.

Thanks for the code, I will try to add it in Steve's code, if I can't, I will come back to you. 

  • Like 1
Posted (edited)

Steven P "for tables, my preference is still do them with lines and text", making tables is easy once you understand a few things like setting up a table style before making the table, you can override most settings in a table I use stuff like find longest string in a list so can set width of a table column, the alignments can be changed for text inside like MC, its a bit like dimensions it has so many variables, easiest way is make a table style at start as part of make a table.

 

A block can be added to a table cell.

 

Ok one little hiccup I have done big big tables and they can take forever to addrows, but there is a solution if you know its big you set the regen of table off then turn on when finished its almost instant then. 

 

Here is one example and some get & put examples for a table.

Tables various settings.lsp list of methods for a table.txt

 

I have some other examples as well PM me if you want.

Edited by BIGAL
  • Like 1
Posted

I know, it is something I -should- be doing, it is only this week I have been using big tables - 700 rows - mostly they are about 20 to 40 rows, but split over 2 columns I'll take a look at these in the morning, thanks

Posted

Ok for speed (vla-put-regeneratetablesuppressed Objtable :vlax-true) at code end :false

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