使用autolisp语言程序统计线的步骤

 我来答
  • 你的回答被采纳后将获得:
  • 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
匿名用户
2014-11-23
展开全部
你的问题太过于笼统,写明白一点才能给你解答
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
AiPPT
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图... 点击进入详情页
本回答由AiPPT提供
in_city
2014-11-25 · TA获得超过258个赞
知道小有建树答主
回答量:430
采纳率:0%
帮助的人:288万
展开全部
;-----------------------------------------------------------------------------------------------------
;LWPOLYLINE获得点列表子程序。
;-----------------------------------------------------------------------------------------------------
(defun lwpolyline_get_pt_list ( );/ sub_list ent_list)
(setq pt_list nil)
(setq ent_list (entget ent_name))
(while (setq ent_list (cdr ent_list))
(setq sub_list ent_list)
(setq sub_list (car sub_list))
(if (= (car sub_list) 10)
(progn
(setq pt (cdr sub_list))
(if (member pt pt_list) ;过滤掉重复点。
(setq pt_list pt_list)
(setq pt_list (cons pt pt_list))
)
)
)
)
(setq len (length pt_list))
)
;-----------------------------------------------------------------------------------------------------
;POLYLINE获得点列表子程序。
;-----------------------------------------------------------------------------------------------------
(defun polyline_get_pt_list ()
(setq pt_list nil)
(setq sub_ent_name ent_name)
(setq sub_ent_name (entnext sub_ent_name))
(while (and (/= sub_ent_name nil) (/= (cdr (assoc 0 (entget sub_ent_name))) "SEQEND"))
(setq pt (cdr (assoc 10 (entget sub_ent_name))))
(if (member pt pt_list) ;过滤掉重复点。
(setq pt_list pt_list)
(setq pt_list (cons pt pt_list))
)
(setq sub_ent_name (entnext sub_ent_name))
)
)
;-----------------------------------------------------------------------------------------------------
;应用点列表计算单条多段线长。
;-----------------------------------------------------------------------------------------------------
(defun dxc ();/ pt1 pt2)
(setvar "osmode" 0)
(setvar "cmdecho" 1)
(setq lenth_p 0)
(setq pt1 (car pt_list))
;(princ (strcat "\n" (rtos (car pt1) 2 4) "," (rtos (cadr pt1) 2 4)))
(write-line (strcat (rtos (car pt1) 2 4) "," (rtos (cadr pt1) 2 4)) x)
(setq pt_list (cdr pt_list))
(while (setq pt2 (car pt_list))
;(princ (strcat "\n" (rtos (car pt2) 2 4) "," (rtos (cadr pt2) 2 4)))
(write-line (strcat (rtos (car pt2) 2 4) "," (rtos (cadr pt2) 2 4)) x)
(setq pt_list (cdr Pt_list))
(setq xx (- (car pt2) (car pt1)))
(setq yy (- (cadr pt2) (cadr pt1)))
(setq lenth_p (+ lenth_p (sqrt (+ (* xx xx) (* yy yy)))))
(setq pt1 pt2)
)
;(princ (strcat "\n>>>>>『全长』 " (rtos lenth_p 2 6)))
(write-line (strcat ">>>>>『全长』 " (rtos lenth_p 2 6)) x)
(princ)
)
;-----------------------------------------------------------------------------------------------------
(defun c:tjd()
(prompt "\nPlease select objects need to count:")
(setq set_data nil)
(while (= (setq set_data (ssget '((-4 . "<OR") (0 . "LWPOLYLINE") (0 . "POLYLINE") (-4 . "OR>")))) nil)
(prompt"\nPlease select Polylines:")
)
(setq dc_file (getfiled "命名保存文件名" "" "txt" 1))
(princ "\n>>>>> Wait...")
(setq x (open dc_file "w"))
(setq long_total 0)
(setq set_length 0)
(while (setq ent_name (ssname set_data set_length))
(setq set_length (+ set_length 1))
(cond
((= (cdr (assoc 0 (entget ent_name))) "LWPOLYLINE") (lwpolyline_get_pt_list))
((= (cdr (assoc 0 (entget ent_name))) "POLYLINE" ) ( polyline_get_pt_list))
)
;(princ "\n-----------------------")
(write-line (strcat "NO." (itoa set_length) " 图层 " (cdr (assoc 8 (entget ent_name))) " ----------") x)
(dxc)
(setq long_total (+ long_total lenth_p))
)
;(princ "\n-----------------------")
(prompt "\n>>>>>...OK!")
(princ (strcat "\n\n>>>>>【共计】 " (itoa set_length) " Polylines"))
(princ (strcat "\n>>>>>【总长】 " (rtos long_total 2 4)))
(write-line "-----------------------" x)
(write-line (strcat "\n>>>>>【共计】 " (itoa set_length) " Polylines") x)
(write-line (strcat ">>>>>【总长】 " (rtos long_total 2 4)) x)
(fixc)
(close x)
(startapp "notepad" dc_file) ;用记事本打开保存的文件。
(princ)
)
;-----------------------------------------------------------------------------------------------------
(defun fixc()
(write-line "\n------------- Write By In_city ---------------" x) ;在打开文件里写入信息。
(write-line "在百度文库查找「in_city」,下载更多Autolisp程序。" x)
(prompt "\n\n------------- Write By In_city ---------------") ;在文本窗口写入信息。
(prompt "\n在百度文库查找「in_city」,下载更多Autolisp程序。")
)
;-----------------------------------------------------------------------------------------------------
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式