Jump to content

making a bom list from blocks with attributes

Recommended Posts



Watched this

at first I didn't want to go to excel but after watching that....it changed my mind a bit.




I am working on a project for automation of bom list.

I searched the web a bit and found this:

c# program for making a table of attributes:


Don't know how to run it :(

A lisp for creating a table of attributes.


Works pretty good but missing some pretty important stuff. See this image:



I used eattext

This very powerful autocad function is like other powerful autocad function and only works for 90% it is missing:

No balloon numbers added, can be done pretty easy be hand.

Can't be used in paperspace when blocks are in modelspace. Which is always...

Work around is using chspace, but then scale is screwed. aaaaargh :ouch:


So in conclusion the best way for me will be updating the lisp.

Or some one already did this and want to share :) or help?

I think merging the same block names will be hardest so if any one has any idea on how to do this?

Attributes to Table lisp from the second link:

(Defun c:attable (/ at>att at>item at>set atable cnt cw ena nc nr pt rh)
   (defun get_ATTS (EN / EL ATTS)
(setq EL (entget EN))
(setq ENA (cdr (assoc 2 EL))) ; wiz
(if (and (= (cdr (assoc 0 EL)) "INSERT")
	 (= (cdr (assoc 66 EL)) 1)
    ) ;_ end and
	(setq EN (entnext EN)
	      EL (entget EN)
	) ;_ end setq
	(while (= (cdr (assoc 0 EL)) "ATTRIB")
	    (setq ATTS (cons (list
				     (vlax-ename->vla-object EN)
				 ) ; wiz
				     (assoc 2 EL)
				 ) ;_ end_cdr
				 (cdr (assoc 1 EL))
			     ) ;_ end_list
		       ) ;_ end_cons
		  EN   (entnext EN)
		  EL   (entget EN)
	    ) ;_ end setq
	) ;_ end while
	(list ena (reverse ATTS)) ; wiz
    ) ;_ end progn
) ;_ end if
   ) ;_ end_defun
   (if	(setq at>set (ssget '((0 . "INSERT"))))
    (setq at>att
	     (mapcar 'get_atts
			 (mapcar 'cadr (ssnamex at>set))
		     ) ;_ end_vl-remove-if
	     ) ;_ end_mapcar
    ) ;_ end_setq
    (setq PT (getpoint "\nTable insertion point: ")
	  RH (* 2.0 (getvar "TEXTSIZE"))
	  CW (* 20.0 (getvar "TEXTSIZE"))
	  NR (+ 2 (length at>att))
	  NC (1+ (length (cadar at>att)))
    ) ;_ end_setq
	aTable (vla-addtable
		       ) ;_ end_vla-get-activedocument
		   ) ;_ end_vla-get-modelspace
		   (vlax-3d-point PT)
	       ) ;_ end_vla-addtable
    ) ;_ end_setq
    (vla-setcellvalue aTable 0 0 "B.O.M.")
    (vla-setcellvalue aTable 1 0 "Block Name")
    (vla-setcellvalue aTable 1 1 "Attributes")
    (vla-MergeCells aTable 1 1 1 (length (cadar at>att)))
    (setq CNT 2) ;_ end_setq
    (foreach Item at>att
	(vla-setcellvalue aTable CNT 0 (car Item))
	(setq at>item 1)
	(while (<= at>item (length (cadar at>att)))
		'(lambda ()
			     "%<\\AcObjProp Object(%<\\_ObjId "
			     (itoa (car (nth (1- at>item) (cadr Item))))
			 ) ;_ end_strcat
		     ) ;_ end_vla-setcellvalue
		 ) ;_ end_lambda
	    ) ;_ end_vl-catch-all-apply
	    (setq at>item (1+ at>item))
	) ;_ end_while
	(setq CNT (1+ CNT))
	;;ready next row
    ) ;_ end_foreach
) ;_ end_progn
   ) ;_ end_if
) ;_ end_Defun

Edit found lee mac code for counting blocks and it also merge same blocks:


Now to frankenbuild the 2 together :)

Edited by CADkitt

Share this post

Link to post
Share on other sites

Hjx, I have the same request! anybody help us, please!

Share this post

Link to post
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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