sanju2323 发表于 2022-7-5 18:42:53

文字沿多段线导出长度

我让人口报告沿着多段线600公里。我需要文字(在图层结构下)沿多段线导出长度、距离、坐标以及文字的右侧或左侧。
请下载附件样本文件以了解更多详细信息。
沿文字距离的多段线。LSP
所需的样本报告。csv
样品图纸

sanju2323 发表于 2022-7-5 19:01:28

海伊,请任何东西给lisp或请其他分开lisp可用的罚款。

Tharwat 发表于 2022-7-5 19:11:00

你好
 
这是这个过程的代码草案,所以测试一下这个例程,如果你需要修改的话告诉我。
 

(defun c:test (/ f o s e lst p1 pt ang v l p _mt _t _parse)
;; Tharwat 16.08.2015                ;;
(if (and (setq f (getfiled "Select Excel file :"
                            (getvar 'dwgprefix)
                            "csv"
                            16
                            )
                )
          (setq o (open f "r"))
          (princ "\nSelect LWpolyline :")
          (setq s (ssget "_+.:S:E" '((0 . "LWPOLYLINE"))))
          )
   (progn
   (defun _mt (pt str)
       (entmakex (list '(0 . "MTEXT")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbMText")
                     '(40 . 0.6)
                     '(8 . "point")
                     (cons 10 pt)
                     (cons 1 str)
                     (cons 7
                           (if (tblsearch "STYLE" "STANDARD")
                               "STANDARD"
                               (getvar 'textstyle)
                               )
                           )
                     )
               )
       )
   (defun _t (pt str)
       (entmakex (list '(0 . "TEXT")
                     '(8 . "Structure")
                     (cons 10 pt)
                     (cons 11 pt)
                     (cons 1 str)
                     (cons 7
                           (if (tblsearch "STYLE" "ARIAL-N")
                               "ARIAL-N"
                               (getvar 'textstyle)
                               )
                           )
                     '(8 . "Structure")
                     '(40 . 2.0)
                     '(50 . 0.0)
                     ;; '(71 . 0)
                     ;; '(72 . 1)
                     ;; '(73 . 2)
                     )
               )
       )
   (defun _parse (string delimiter / pos lst)
       (while (setq pos (vl-string-search delimiter string 0))
         (progn (setq lst (cons (substr string 1 pos) lst))
                (setq string (substr string (+ pos 2) (strlen string)))
                )
         )
       (if (and string (/= string ""))
         (setq lst (cons string lst))
         )
       (setq lst (reverse lst))
       )
   (setq e (ssname s 0)
         l (vlax-curve-getdistatpoint e (vlax-curve-getendpoint e))
         p (vlax-curve-getstartpoint e)
         )
   (read-line o)
   (while (setq v (read-line o))
       (setq lst (_parse v ","))
       (if (< (read (nth 5 lst)) l)
         (progn
         (setq pt(vlax-curve-getpointatdist e (read (nth 5 lst)))
               ang (angle '(0. 0. 0.)
                            (vlax-curve-getfirstderiv
                              e
                              (vlax-curve-getparamatpoint e pt)
                              )
                            )
               p1(polar pt
                            ((eval (if (eq (last lst) "Right")
                                     '+
                                     '-
                                     )
                                 )
                              ang
                              (* pi 1.5)
                              )
                            (read (nth 4 lst))
                            )
               )
         (entmake (list '(0 . "LINE")
                        (cons 10 pt)
                        (cons 11 p1)
                        (cons 8 "perp")
                        )
                  )
         (entmake (list '(0 . "POINT")
                        (cons 10 p1)
                        '(62 . 256)
                        (assoc 8 (entget e))
                        )
                  )
         (_mt (list (car p1) (cadr p1) (read (nth 3 lst)))
                (nth 4 lst)
                )
         (_t p1 (car lst))
         )
         )
       )
   (close o)
   )
   )
(princ)
)(vl-load-com)

sanju2323 发表于 2022-7-5 19:14:15

塔尔瓦特,
非常感谢您的回复,但我希望autocad提供csv报告。

Tharwat 发表于 2022-7-5 19:23:29

 
我做的恰恰相反?
你的第一篇帖子不够清晰,无法说明你想要的是excel,而不是从excel到cad!

sanju2323 发表于 2022-7-5 19:33:28

对不起,混淆了,是的,我想要相反的(答案)Lisp程序。已绘制600km DWG文件数据。所以我需要根据附件csv要求导出数据。

sanju2323 发表于 2022-7-5 19:50:31

嗨,塔瓦,你能给我密码吗。
需要图纸2的报告。CSV
页: [1]
查看完整版本: 文字沿多段线导出长度