cad如何提取三维多段线每个节点的三维坐标

站长个人微信号:17350562750 之前没加过佬雷的,请加下。筹备建微信群
请先 登录 后评论

1 个回答

通测工作室 - 测量工程师

一般用插件可以实现提取多段线的坐标,lisp代码如下。


;;;----2015/6/1--修改 BY  QQ: 2135405144

(vl-load-com)

(prompt "\n批量提取多段线(pline,lwpline)坐标,加载命令:tqzb。") 

;;;-----图面绘制编号--输出为测量坐标系------------

(defun C:tqzb (/ ss en ii ptb no pz)

  (vl-load-com)

  (setq cm (getvar "cmdecho"))

  (setvar "cmdecho" 0)

(or TH_old

(setq TH_old 0.3)

    )

    (princ "\n请输入点号文字高度<")

    (princ TH_old)

    (if(setq tmp (getreal ">: "))

(setq TH_old tmp)

    )  

(setq TH TH_old)

  (setq line_bh (getstring "\n请输入多段线编号:"))

;;;;;=====写入文本=========

  (if th

    (setq dPh (getvar "dwgprefix")

          dn  (getvar "dwgname")

          dn  (strcat (substr dn 1 (- (strlen dn) 4)) ".txt")

          fn  (getfiled "多义线端点输出" (strcat dph dn) "txt" 9)

          f   (open fn "a")

        )

  )

    (princ (strcat "点号,X(N),Y(E),Z(H)") f)

    (princ "\n" f)

;;;;===================

  (setq ss (ssget '((0 . "lwPOLYLINE"))))

  (setq ii 0

        no 0

  )

  (repeat (sslength ss)

    (setq en  (ssname ss ii)

          ii  (1+ ii)

          ptb (vxs en)

          pz (cdr (assoc 38 (entget en)))

    )

    (foreach pt ptb

      (setq no (1+ no))


    (command "text" "j" "bl" pt th "0" (strcat line_bh  "-" (rtos no 2 0)) "");图面绘制编号

    (princ  line_bh  f)

    (princ  "-"  f)

    (princ  (rtos no 2 0)  f)

    (princ "," f)

    (princ (rtos (cadr pt) 2 3) f)

    (princ "," f)

    (princ (rtos (car pt) 2 3) f)

    (princ "," f)

    (princ (rtos (caddr pt) 2 3) f)

    (princ "\n" f)

  )

 

  )

  (close f)

  (princ (strcat "\n输出为测量坐标系坐标,已存入\"" dPh "\"中"))

  (setvar "cmdecho" cm)

  (princ)

)


;;46.2 [功能] pline,lwpline点坐标表  By 无痕;;示例(vxs (car (entsel))),返回三维点坐标

(defun vxs (e / i v lst)

  (setq i -1)

  (while

    (setq v (vlax-curve-getpointatparam e (setq i (1+ i))))

     (setq lst (cons v lst))

  )

  (reverse lst)

)

请先 登录 后评论
  • 2 关注
  • 0 收藏,1053 浏览
  • 雷江湖 提出于 2018-12-05 00:24

相似问题