; Nombre de bloc

(defun c:NbreBlocs ()

  (setq ResultatDesBlocs "")

(setq ListeDesBlocs (tblnext "BLOCK" T))

  (if (/= ListeDesBlocs nil)
    (progn
  
  (setq ObjSelection (ssget "x" (list (cons 0 "INSERT") (assoc 2 ListeDesBlocs))))

    (setq ResultatDesBlocs (strcat (cdr (assoc 2 ListeDesBlocs)) " = " (itoa (sslength ObjSelection))))

    (setq ListeDesBlocs (tblnext "BLOCK"))
  )
    )
  
    
    (while (/= ListeDesBlocs nil)

      (setq ObjSelection (ssget "x" (list (cons 0 "INSERT") (assoc 2 ListeDesBlocs))))

    (setq ResultatDesBlocs (strcat "\nBloc " (cdr (assoc 2 ListeDesBlocs)) " = " (itoa (sslength ObjSelection))))

      (setq ListeDesBlocs (tblnext "BLOCK"))

      )

    (princ ResultatDesBlocs)

  (princ)

  )