Danny 发表于 2022-7-6 12:45:58

 
 
只是开个玩笑,兄弟。我确实理解你的帖子,认为里面有有用的信息

devitg 发表于 2022-7-6 12:49:22

 
嗨,丹尼,因为英语不是我的母语,我没听懂你的话。
全部清除。

Astro 发表于 2022-7-6 12:56:17

 
我将其添加到代码中,但仍有一个错误
 
 
也许我做错了什么?

devitg 发表于 2022-7-6 12:58:31

 
 
请测试一下。
 

;;************************************************************

;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
;;;    Copyleft 1995-2009 by Gabriel Calos De Vit
;; DEVITG@GMAIL.COM



;;-*******************************************************************************************************************************
(DEFUN guarda-lista-csv-w(lista
                           /
                           ar
;;;                            nombre-archivo
                           )
(SETQ nombre-archivo
      (STRCAT (GETVAR "dwgprefix")
                (VL-FILENAME-BASE (GETVAR "dwgname"))
                ".csv"))
(SETQ ar (OPEN nombre-archivo "w"))
(FOREACH textolista
   (WRITE-LINE texto ar)
   )
(CLOSE ar)
)
;;-*******************************************************************************************************************************
;;;---------------------------------------------------------------------------------------------------------
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
;;;Juerg Menzi
;;;MENZI ENGINEERING GmbH, Switzerland
;;;http://www.menziengineering.ch
; == Function MeGetAtts
; Reads all attribute values from a block
; Arguments :
;   Obj = Object
; Return :
;   > Dotted pair list '(("Tag1" . "Val1")...)

; Notes:
;   None
;
(defun MeGetAtts (Obj)
(mapcar
'(lambda (Att)
   (cons
    (vla-get-TagString Att)
    (vla-get-TextString Att)
   )
)
(vlax-invoke Obj 'GetAttributes)
)
)

;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
;; TASK TO DO
;;;Export all the attributes
;;;+handle id of the blocks
;;;+visibility state
;;;+Real blockname
(defun GET-NAME+HANDLE+VISIBLE+ATTs ( /
               ACAD* ADOC ALL-INSERTED-CSV-LIST ALL-INSERTED-DATA-LIST ATT-PAIR-LIST CSV-LIST DATA-LIST DATA-LIST< HANDLE nombre-archivo INSERTED-CSV INSERTED-LIST INSERTED-SS NAME VISIBLE
               )
(vl-load-com)
(setq acad* (vlax-get-acad-object)) ;_ ACAD
(setq adoc (vla-get-activedocument acad*));_ DWG active
(setq insertED-SS (ssget "_X" '(( 0 . "insert"))));_ all inserted blocks
(setq inserted-list (mapcar 'vlax-ename->vla-object (vl-remove-if-not '(lambda(x)(= (type x) 'ENAME)) (mapcar 'cadr (ssnamex insertED-SS)))));_ a list of inserted

(setq all-inserted-csv-list nil)
(setq all-inserted-data-list nil)

(foreach inserted inserted-list
(setq data-list nil)
(setq csv-list nil)

(setq name (vla-get-EffectiveName inserted))
(setq data-list (cons (cons "NAME" name) data-list))

(setq handle (vla-get-Handleinserted))
(setq data-list (cons (CONS "HANDLE"handle) data-list))

(setq visible (if(vla-get-Visible inserted)
"visible"
"no visible"
   );_ if
   );_ visible
(setq data-list (cons (cons "VISIBLE"visible) data-list))

(setq csv-list (reverse(list namehandle visible ) ))
(if (vla-get-hasAttributes inserted )

(progn   
(setq att-pair-list(MeGetAtts inserted))
(foreach att-pair att-pair-list
(setq data-list ( cons att-pair data-list))
(setq csv-list (cons (Cdr att-pair) csv-list))
)
);_ progn
   );If has attribute



(setq inserted-csv (list$2cvs (reverse csv-list)))
(setq data-list<(reverse data-list))


(setq all-inserted-data-list (consdata-list< all-inserted-data-list))
(setq all-inserted-csv-list (consinserted-csv all-inserted-csv-list))
);_ foreach inserted

(setq blk-qty (length all-inserted-csv-list))

(guarda-lista-csv-w all-inserted-csv-list)
(alert (strcat "\n Data form: \n " (Itoa blk-qty) "   BLOCKS\n has been sent to .. \n" nombre-archivo ))
(princ)
);_ defun
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
(defun c:dyn-dat ()
(GET-NAME+HANDLE+VISIBLE+ATTs)


)
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/

(defun list$2cvs (#lst)
(if (not ( listp #lst))

(setq #lst (list #lst))
)


(apply 'strcat
(cons (car #lst)
(mapcar '(lambda (str) (strcat "," str))
(cdr #lst)
) ;_mapcar
) ;_cons
) ;_apply

) ;_ string-list2cvs
;;;usage(string-list2cvs '("One" "Two" "Three"))
;;;->"One,Two,Three"
;;*//*/*/*/*/*/*/*/*/*/*/*/*/**/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
(prompt "prompt DYN-DAT at the command line")




;|«Visual LISP© Format Options»(72 2 1 0 nil“end of”100 20 2 0 0 nil T nil T)
;*** 请勿在评论下方添加文字!***|;

Astro 发表于 2022-7-6 13:01:26

谢谢,现在可以了
 
我有几句话要说,
 
-是否可以将outputformat发送到标题上带有制表符分隔的制表符和标题的xls?
 
-当句柄id类似于48E8时,excel将其解释为4.80E+09,因此-->480000000
使用-attout命令,句柄为“48E8”,然后excel识别它
 
-最后一个是,我需要动态块的可见性状态。不管它是否可见。因此,我的动态块最多可以有20个可见性状态,例如,我需要它们在excel中。
 
再次感谢您的出色工作

devitg 发表于 2022-7-6 13:07:47

 
我的蓝色评论
页: 1 [2]
查看完整版本: 具有属性的动态块