最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 正文

CAD程序展点

来源:动视网 责编:小OO 时间:2025-09-30 08:12:43
文档

CAD程序展点

;txt文件格式为“1,,28633.0681,19025.2661,506.688”对应“流水号,点名,X,Y,高程”(defunc:ye_zd(/aff_1gaoklist_2mnn1new_n1ob1pptptds1strwtxtxyz)(alert"\\n警告:\\n\\n展点前请先检查数据,将数据多余抬头和空格尽量删掉,以保证展点顺畅!!!!")(setvar"cmdecho"0)(command"_undo""_begin");改变点的样式和大小(setvar"pdmode"32)
推荐度:
导读;txt文件格式为“1,,28633.0681,19025.2661,506.688”对应“流水号,点名,X,Y,高程”(defunc:ye_zd(/aff_1gaoklist_2mnn1new_n1ob1pptptds1strwtxtxyz)(alert"\\n警告:\\n\\n展点前请先检查数据,将数据多余抬头和空格尽量删掉,以保证展点顺畅!!!!")(setvar"cmdecho"0)(command"_undo""_begin");改变点的样式和大小(setvar"pdmode"32)
;txt文件格式为“1,,28633.0681,19025.2661,506.688”对应“流水号,点名,X,Y,高程”

(defun c:ye_zd ( / a f f_1 gao k list_2 m n n1 new_n1 ob1 p pt ptd s1 str wtxt x y z)

  (alert "\\n警告:\\n\\n    展点前请先检查数据,将数据多余抬头和空格尽量删掉,以保证展点顺畅!!!!")

  (setvar "cmdecho" 0)

  (command "_undo" "_begin")

  ; 改变点的样式和大小

  (setvar "pdmode" 32)

  (setvar "pdsize" 0.25)

  ; 指定路径

  (setq wtxt (getfiled "Select a Lisp File"

               "c:/program files/acad2000/support/" "*" 8

         )

  )                       ; 开始打开文件读取数据

(princ "\\n--------------------------------------------------------------->开始展点!!!\\n")

  (setq a (open wtxt "r"))

  (setq list_2 nil)

  (while (setq f (read-line a))

    (if (/= f "")

      (progn

    (setq f_1 (delstring f 

    (setq list_2 (cons f_1 list_2))

      )

    )

  )

  (close a)

  (setq list_2 (vl-remove NIL (reverse list_2)))       ; 开始从TXT到CAD处理

  (if (null (tblsearch "layer" "孤点"))

    (command "layer" "m" "孤点" "c" "1" "" "")

  )

  (if (null (tblsearch "layer" "注记"))

    (command "layer" "m" "注记" "c" "6" "" "")

  )

  (setq k 0)

  (setq m 0)

  (setq p (length list_2))

  (repeat p

    (setq n1 (nth k list_2))

    (setq new_n1 nil)

    (foreach n n1

      (if (vl-string-search "." n)

    (setq new_n1 (cons n new_n1))

      )

    )

    (if (/= new_n1 nil)

      (progn

    (setq new_n1 (reverse new_n1))

    (setq x (nth 0 new_n1))

    (setq y (nth 1 new_n1))

    (setq z (nth 2 new_n1))

    (if (and

          (/= x nil)

          (/= y nil)

          (/= z nil)

        )

      (progn

        (setq pt (cons 10 (list (atof x) (atof y) (atof z)))) ; 展出孤点

        (entmake (append

               '((0 . "POINT") (8 . "孤点"))

               (list pt)

             )

        )

        (setq s1 (entlast))

;(setq ob1 (vlax-ename->vla-object s1))

        ;(vla-put-Layer ob1 "孤点")

      )

      (progn

        (setq str "")

        (foreach n new_n1

          (setq str (strcat str n 

        )

        (princ (strcat "\\n" str "-------------------------------------------有误"))

      )

    )                   ; 开始写出标高

    (command "style" "ye1" "txt" "" "" "" "n" "n" "n")

    (setq ptd (assoc 10 (entget s1)))

    (setq gao (strcat " " (rtos (nth 3 ptd) 2 2)))

    (entmake (append

           '((0 . "TEXT") (8 . "注记"))

           (list ptd)

           '((40 . 1.0))

           (list (cons 1 gao))

           '((41 . 1.0) (51 . 0.0)

            (7 . "ye1")

            (71 . 0)

            (72 . 0)

           )

           (list (cons 11 (cdr ptd)))

           '((73 . 0))

         )

    )

      )

      (progn

    (setq str "")

    (foreach n n1

      (setq str (strcat str n 

    )

    (princ (strcat "\\n" str

               "-------------------------------------------有误\\n"

           )

    )

    (setq m (+ m 1))

      )

    )

    (setq k (+ k 1))

    (Gfun-progress K P)

  )                       

(princ (strcat "\\n--------------------------------------------------------------->完成展点!!!"))

(princ (strcat "\\n--------->共成功展点:<" (itoa (- k m)) ">个,其中:<"

     (itoa m) ">个点有误,未能展出."

     )

  )

  (prin1)

  (command "zoom" "e")

  (command "_undo" "e")

)

;;; 把字符串用  " " , . 隔开----------------------------------------------->

(defun delstring (str delim / ptr lst)

  ;(setq str "1       ,1000.0000        ,1000.0000,1000.0000,922,    " )

  ;(setq delim 

  (while (setq ptr (vl-string-search delim str))

    (if (/= ptr 0)

      (setq lst (cons (vl-string-trim " " (substr str 1 ptr)) lst))

    )

    (setq str (substr str (+ ptr 2)))

  )

  (setq str(vl-string-trim " " str))

  (if (/= str "")

  (setq lst (cons str lst)))

  (reverse lst)

)

;===========================状态栏进度条==============================

(defun Gfun-progress(a b / i i1 i2); a:分子,b:分母

    (setq i (atoi (rtos (/ a b 0.01) 2 0)))

(if (< i 0) (setq i 0))

(if (> i 100) (setq i 100))

  (if (/= i (atoi (rtos (/ (- a 1) b 0.01) 2 0)));只显示100次,进度与上一次相同时不显示

    (progn

        (setq i1 (* (fix (/ i 8)) 2))

        (setq i2 (rem i 8))

        (GRTEXT -2 (strcat

                     ">>>>>>>>>> " (itoa i) "%"

                        (substr "████████████████████" 1 i1) 

                        (nth i2 '("" "▏" "▎" "▍" "▌" "▋" "▊" "▉"))

        ))

        (if (= i 100) (GRTEXT))

    )

  )

)

文档

CAD程序展点

;txt文件格式为“1,,28633.0681,19025.2661,506.688”对应“流水号,点名,X,Y,高程”(defunc:ye_zd(/aff_1gaoklist_2mnn1new_n1ob1pptptds1strwtxtxyz)(alert"\\n警告:\\n\\n展点前请先检查数据,将数据多余抬头和空格尽量删掉,以保证展点顺畅!!!!")(setvar"cmdecho"0)(command"_undo""_begin");改变点的样式和大小(setvar"pdmode"32)
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top