MarcoW 发表于 2022-7-6 10:58:13

创建绘图列表,但是

大家好,
 
我到处搜索,问,但从来没有真正找到我要找的东西。(嗯,听起来像Whitesnake….?)无论如何,以一种简单的方式创建drawinglist似乎是一个问题。我读过有关将MS acces连接到Autocad以及将MS acces连接到Autocad的文章。或使用excel。。。
 
这不一定很复杂,因为我只想在单向方向上创建列表。在AutoCad编辑图形后,我不需要编辑列表本身。(那是蹩脚的英语吗?)
 
最重要的是:我太新手了,自己都想不出来,但也许有你的一些好意见,我可能会想出一些办法。
 
我试过两件事:Expresstools中的attout函数和AutoCad中的eattext。尽管如此,两者都不是很令人满意
如果我能正确使用它,“-eattext”会有一些意义。
 
应该发生什么:在我的示例中有1。包含5个布局的dwg文件。每个版面都有一个标题栏(或邮票,如果你喜欢),称为“标题栏”。我需要读出每个标题栏的一些(不是全部)属性值,并将其放入列表/表格/记事本文件/excel表/打印机输出的任何内容中。甚至可能是第六个布局,称为“drawinglist”。
 
例如,“标题栏”有3个属性我需要读出:
-名称
-日期
-编号
 
在5种布局的情况下,必须创建如下表格:
 
编号日期名称
01 01-06-2009房屋A
02 11-06-2009房屋B
03 16-06-2009建筑
(标题栏或属性标记的名称始终保持不变…)
 
通过“-eattext”+“更新字段”,可以更新绘图列表。AutoCad本身甚至显示了“重新加载表格”的气球提示。
 
总之,我想有足够的选择。但是如何把它放在一起,这样“只需轻轻点击鼠标左键”就可以生成一个实际且正确的绘图列表。
 
欢迎提供任何帮助或提示!
 
哦,我知道当使用Excel时,可以制作出好看的表格,但我对这种事情不感兴趣。首先达到目标,然后追求外观。
 
也许可以创建一个文本文件(通过写行),Excel可以导入该文件?

CAB 发表于 2022-7-6 11:01:35

这可以根据您的需要进行修改。
http://www.cadtutor.net/forum/showpost.php?p=222246&postcount=7

Lee Mac 发表于 2022-7-6 11:07:36

我试图创建一个程序,在Excel中创建一个图纸列表,其中包含您指定的属性值。
 
让我知道你进展如何。
 
在提示下,您可以选择现有Excel文件,在这种情况下,数据将附加到文件中的现有数据。
 
或者,单击“取消”弹出提示后,将创建一个新的Excel文件。
 

 

; ** ============[ DwgLst.lsp ]============== **;
; **                                          **;
; **FUNCTION:                               **;
; **Will Automatically Create a Drawing   **;
; **List based on TitleBlock Attribute      **;
; **Values.                                 **;
; **                                          **;
; ** ======================================== **;
; **                                          **;
; **SYNTAX: DWGLST                        **;
; **                                          **;
; **AUTHOR:                                 **;
; **Copyright (c) 2009, Lee McDonnell       **;
; **Contact Lee Mac:   CADTutor.net         **;
; **                     TheSwamp.org         **;
; **                                          **;
; ** ======================================== **;
; **                                          **;
; **RESTRICTIONS:                           **;
; **Machine must be able to run             **;
; **Microsoft Excel.                        **;
; **                                          **;
; ** ======================================== **;
; **                                          **;
; **USAGE:                                  **;
; **Attributes from every instance of a   **;
; **Specified Block are Extracted to      **;
; **Excel.                                  **;
; **                                          **;
; **An Excel file may be selected or      **;
; **upon the user hitting Cancel at         **;
; **the prompt, a new Excel file is         **;
; **created.                              **;
; **                                          **;
; ** ======================================== **;
; **                                          **;
; **VERSION:                              **;
; **1.0~01.07.2009                      **;
; **                                          **;
; ** ======================================== **;
; =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;


(defun c:DwgLst(/ *error* ss cAtt attlst
                   oLst xlApp file xlshe
                   UCells xlCells Col row
                   blkName ValLst)

(vl-load-com)

(defun *error* (msg)
   (mapcar 'ObjRel
   (list xlApp xlShe UCells xlCells))
   (if
   (not
       (wcmatch
         (strcase msg)
         "*BREAK,*CANCEL*,*EXIT*"))
   (princ
       (strcat
         "\n<< Error: " msg " >>"))
   (princ "\n*Cancel*"))
   (princ))

(setq blkName "titleblock")
(setq ValLst '("NAME" "DATE" "NUMBER"))

(if (setq ss
       (ssget "_X"
         (list (cons 0 "INSERT")
               (cons 2 blkName) (cons 66 1))))         
   (progn
   (foreach Obj
       (mapcar 'vlax-ename->vla-object
         (mapcar 'cadr (ssnamex ss)))
   (foreach Att
       (append
         (vlax-safearray->list
         (vlax-variant-value
             (vla-GetAttributes Obj)))
         (if
         (not
             (vl-catch-all-error-p
               (setq cAtt
               (vl-catch-all-apply
                   'vlax-safearray->list
                     (list
                     (vlax-variant-value
                         (vla-getConstantAttributes Obj)))))))
         cAtt))
       (if (vl-position
             (strcase
               (vla-get-TagString Att)) ValLst)
         (setq attlst
         (cons
             (cons
               (vla-get-TagString Att)
               (vla-get-TextString Att)) attlst))))
       (setq olst
         (cons
         (vl-sort attlst
             (function
               (lambda (a b)
               (< (car a) (car b))))) olst) attlst nil))

   (if (setq file (getfiled "Select Excel File" "" "xls" )
       (progn
         (setq xlApp (vlax-get-or-create-object "Excel.Application")
               xlshe (vlax-get-property
                     (vlax-get
                         (vla-open
                           (vlax-get xlApp "Workbooks")
                           file)
                         "Sheets")
                     "Item" 1)
               Ucells(vlax-get xlshe "Usedrange")
               xlCells (vlax-get xlshe "Cells"))
         (setq Col (- (vlax-get
                        (vlax-get ucells "Columns")
                        "Count")
                      2)
               row   (1+
                         (vlax-get
                           (vlax-get ucells "Rows")
                           "Count"))))
       (progn
         (setq xlApp (vlax-get-or-create-object "Excel.Application")
               xlshe (vlax-get-property
                     (vlax-get
                         (vlax-invoke-method
                           (vlax-get xlApp "Workbooks")
                           "Add")
                         "Sheets")
                     "Item" 1)
               xlCells (vlax-get xlshe "Cells") Col 1 row 1)))
   (vla-put-visible xlApp :vlax-true)
   (foreach Sht (reverse oLst)
       (if (< 65536 row)
         (setq Col 4))
       (vlax-put-property xlCells "Item"
         row Col (cdaddr Sht))
         (vlax-put-property xlCells "Item"
         row (1+ Col) (cdar Sht))
         (vlax-put-property xlCells "Item"
             row (+ Col 2) (cdadr Sht))
       (setq row (1+ row)))
   (mapcar 'ObjRel
       (list xlApp xlShe UCells xlCells))
   (gc) (gc)
   (alert "Close Excel File Manually"))
   (princ "\n<< No TitleBlocks Found in Drawing >>"))
(princ))

(defun ObjRel (Obj)
(and Obj
   (eq 'VLA-OBJECT (type Obj))
   (not (vlax-object-released-p Obj))
       (vl-catch-all-apply
         'vlax-release-object
         (list Obj))))

(vl-load-com)
(princ
(vl-list->string
   '(10 42 42 32 68 119 103 76 115 116 46 108 115 112 32 98
   121 32 76 101 101 32 77 99 68 111 110 110 101 108 108
   44 32 67 111 112 121 114 105 103 104 116 32 169 32 74
   117 108 121 32 50 48 48 57 32 42 42 10 32 32 32 32 32
   32 32 32 32 32 32 32 45 32 84 121 112 101 32 34 68 87
   71 76 83 84 34 32 116 111 32 73 110 118 111 107 101 32 45)))
(princ)

;|
;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;

                         End of Program Code                        

;;;¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø¤º°`°º¤ø,¸¸,ø¤º°`°º¤ø,¸¸,;
|;

ReMark 发表于 2022-7-6 11:09:03

李:
 
我会考虑开始按角色收费。

Lee Mac 发表于 2022-7-6 11:13:17

 
哈哈,我希望
 
那将是我梦想中的工作目标。。。
 
事实上,我现在正在放暑假,在暑假的几个月里拼命地找工作,直到10月份我回到大学。。。

ReMark 发表于 2022-7-6 11:16:39

你试过推销你的技能了吗?

ReMark 发表于 2022-7-6 11:17:25

你必须想出一个营销活动和目标受众。

Lee Mac 发表于 2022-7-6 11:21:16

 
Tbh,我真的不知道从哪里开始-我正在考虑创建自己的网站,但这本身就是一项任务。。。
 

chelsea1307 发表于 2022-7-6 11:25:53

Marco,如果您决定使用ssm,它将为您创建图纸列表

ReMark 发表于 2022-7-6 11:27:39

做一些简单的描述你能做什么(LISP,宏,VBA,diesel…随便什么)。然后打开本地电话目录。记下每个土木、机械、建筑、工程公司及其电话号码。致电并要求与CAD经理交谈。询问他/她是否使用AutoCAD(我们希望他们正确吗?)。然后询问他们是否创建了自己的自定义LISP例程。我们希望他们说他们没有,但希望能找到能帮助他们的人。这就是你进来的地方。然后问他们想要简化或自动化哪些任务。也许你会给他们提供一个“免费”的小样本,或者给他们看一些你已经写过的代码。这就吸引了他们。现在他们雇用你。你编写代码,他们测试它,它得到了一些调整,你得到一个检查,你给我发送了2%的想法从顶部。好啊1%.但这是我要做的最低限度了。不,等等。0%.我认为你是我的朋友。当你富有和出名的时候,你会给我打电话,邀请我去你在山上的豪宅,让我在你的温水游泳池里游泳。好啊
页: [1] 2
查看完整版本: 创建绘图列表,但是