Jump to content

Recommended Posts

Posted

(setq ss2 (ssget '((0 . "insert"))))
    

(setq count(sslength ss2))    
    (while (< cnt (sslength ss2))
      (setq ss6 (ssname ss2 cnt))
      (setq BLK(cdr (assoc 2 (entget ss6))))
      (setq lst (cons (cons BLK lst2)lst2))
      (setq po1 (cdr(assoc 10 (entget ss6))))
      (if (setq itm (assoc BLK lst2))
    (setq lst2 (subst (consBLK (1+ (cdr itm)))itm lst2))
    (setq lst2 (cons (consBLK  1)lst2))
    )

(foreach itm lst2
     (vla-settext  mytabe row 4  (strcat "\n" (car itm) ":" (cdr itm)))

(setq cnt (+ 1 cnt))

 

I WANT TO INSERT EVERY  BLOCK NAME (BLK) AND COUNT IN ONE SINGLE CELL 

)2053800839_TABLE1.thumb.jpg.6d11d9449c5ea11216c880e1da589efd.jpg

Posted

 

hi

Attach an example drawing to illustrate

Posted

test this 

 

(SETQ ptLst '("BLK_1 : 12" "BLK_2 : 3" "BLK_3 : 5" "BLK_4 : 20" ))



(setq xs1R (LM:lst->str ptLst "\n "))



(vla-settext mytabe row 4 (strcat xs1R))







;; List to String  -  Lee Mac
;; Concatenates each string in a supplied list, separated by a given delimiter
;; lst - [lst] List of strings to concatenate
;; del - [str] Delimiter string to separate each item

(defun LM:lst->str ( lst del / str )
    (setq str (car lst))
    (foreach itm (cdr lst) (setq str (strcat str del itm)))
    str
)

 

Posted

HI

 

 



(defun C:testgarb(/ ADOC BASEPOINT BLK CNT COLLECTEDDATA COUNT ITM
		  JS LST LST2 L_RC PO1 PTLST ROW SS2 SS6
		  SUPPORTDRAWINGTABLE TXTSIZE Y)

( if (setq ss2 (ssget '((0 . "insert"))))
    (progn

(setq count(sslength ss2))
(setq cnt -1)


    (while (setq ss6 (ssname ss2 (setq cnt (1+ cnt))))
      
      (setq BLK (cdr (assoc 2 (entget ss6))))
      (setq lst (cons (cons BLK lst2)lst2))
      (setq po1 (cdr(assoc 10 (entget ss6))))
      (if (setq itm (assoc BLK lst2))
    (setq lst2 (subst (cons BLK (1+ (cdr itm))) itm lst2))
    (setq lst2 (cons (cons BLK  1)lst2))
    )
      
      )

 (SETQ ptLst (mapcar
            '(lambda (a)
               (strcat  (car a) "." (rtos(cdr a) 2 0))
             )
            lst2
          ))



(setq L_RC (LM:lst->str ptLst "\n "))


  
  (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))

   (and 	L_RC
                      	(setq CollectedData (list L_RC L_RC ))
					(setq basepoint (getpoint "\nPick point for Table:"))

     
					(setq txtsize (getvar 'textsize);|(variant-value (vla-getvariable 
                                  (vla-get-activedocument 
                                   (vlax-get-acad-object)) 
                                  "textsize"))|;;commented
      SupportDrawingTable     (vla-addtable (vla-get-block 
                                  (vla-get-activelayout
                                   (vla-get-activedocument 
                                    (vlax-get-acad-object))))
                                      (vlax-3d-point basepoint)
                                 2
                                 2
                                 1
                                 30))
     (setq js (entlast))
                      	(progn
						(vla-setcelltextheight SupportDrawingTable 0 0 3)
						(vla-settext SupportDrawingTable 0 0 " DATA BLOCKS TABLE")
			                	(vla-put-regeneratetablesuppressed SupportDrawingTable :vlax-false)
			                        (mapcar '(lambda (y)
					  	(vla-settext SupportDrawingTable 1 (car y) (cadr y))
					  		(vla-setcelltextheight SupportDrawingTable 1 (car y) txtsize))
						 	'((0 "block")(1 "block")))
			  (setq accol (vla-get-truecolor SupportDrawingTable))
 ;************************************************************************************
; Populate Title and set title

 (vla-setrgb accol 255 161 66)
 (vla-setcellcontentcolor SupportDrawingTable 0 0 accol)
 ;(vla-setrgb accol 0 64 255)
  (vla-setrgb accol 20 27 105)
(vla-SetCellBackgroundColor SupportDrawingTable 0 0 accol)

 (vla-setrgb accol 82 0 0)
			                         

						(vla-InsertRowsAndInherit SupportDrawingTable 2 1 1)
			                	(setq row 1)
			                      
(setq itm CollectedData)
						        ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

			                              (vla-settext SupportDrawingTable (setq row (1+ row)) 0 (nth 0 itm))
			  (vla-setcellalignment SupportDrawingTable row 0 acMiddleCenter)
;;;
;;;						      (vla-setrgb accol  255 245 235)
;;;						      (vla-SetCellBackgroundColor SupportDrawingTable row 0 accol)
;;;						      (vla-setrgb accol 44 44 55)
;;;                                                      (vla-setcellcontentcolor SupportDrawingTable row 0 accol)
			                              ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
						      (vla-settext SupportDrawingTable row 1 (strcat (nth 1 itm)))
(vla-setcellalignment SupportDrawingTable row 1 acMiddleCenter)
			  
;;;						   
;;;						      (vla-setrgb accol  255 245 235)
;;;						      (vla-SetCellBackgroundColor SupportDrawingTable row 1 accol)
;;;						      (vla-setrgb accol 44 44 55)
;;;                                                      (vla-setcellcontentcolor SupportDrawingTable row 1 accol)
						  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
						     
						  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



			  
			  (vla-put-regeneratetablesuppressed SupportDrawingTable :vlax-false)

   
 

			  
                              );PROGN
                      );AND 

)

)
)

;;       ;;

;; List to String  -  Lee Mac
;; Concatenates each string in a supplied list, separated by a given delimiter
;; lst - [lst] List of strings to concatenate
;; del - [str] Delimiter string to separate each item

(defun LM:lst->str ( lst del / str )
    (setq str (car lst))
    (foreach itm (cdr lst) (setq str (strcat str del itm)))
    str
)
 

 

ice_screenshot_٢٠٢٠٠٩١١-٠٠٠٤٢٣.png

bbbb.dwg

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