+发表新主题
秀莱昂纳多 发布于4 天前 2 次浏览 1 位用户参与讨论
跳转到指定楼层
一个添加岩层产状的lisp程序,求大牛帮忙指正,谢谢!
源码:
(defun c:jlf(/ umask_s p0 pl p2 p3 p4 p5 h h0 h1 h2 h3 h4 d ft tt ttl hd)
(if(null ia)(setq ia 1))
(command "osnap" "intersection" "")
(setq j1 (getpoint "n 请选择坐标系原点:"))
(setq j2 (getpoint "n 请选择坐标系E方向:"))
(setq j3 (getpoint "n 请选择坐标系N方向:"))
(command "ucs" "3" j1 j2 j3)
(command "osnap" "off" "")
(if(not(setq umask_s (getint(strcat"产状类型(<l>岩层层理<2>岩层节理<3>岩层垂直节理)< "(itoa ia)">:"))))
(setq umask_s s)
(setq s umask_s))
(setq p0 (getpoint "n请选取平面任一点:"))
(setq h1 (getstring 1 "n走向:"))
(while(="" h1)
(alert"请输入走向!")
(setq h1 (getstring 1 "n走向:")))
(setq hl (strcase hl T))
(setq h2 (getstring 1 "n倾向:"))
(while(="" h2)
(alert"请输入倾向!")
(setq h2 (getstring 1 "n倾向:")))
(setq h2 (strcase h2 T))
(setq h3 (getangle"n 走向角:"))
(while (null h3)
(alert "请输入走向角!")
(setq h3 (getangle"n 走向角:")))
(setq d (getangle"n 倾向角:"))
(while(null d)
(alert "请输入倾向角!")
(setq d (getangle"n 倾向角:")))
(cond
((and(=hl "nw")(= h2 "ne"))
(setq h (+ (/pi 2) h3))
(setq h0 h3)
(setq zxl "N" zx2 "W"))
((and (=h1 "ne")(=h2"nw"))
(setq h (- (/pi 2) h3))
(setq h0 (+ (/pi 2) h))
(setq zxl "N" zx2 "E"))
((and(=h1 "nw")(=h2 "sw"))
(setq h (+ (/pi 2) h3))
(setq h0 (+ (/pi 2) h))
(setq zxl "N" zx2 "w"))
((and(= h1 "ne")(= h2 "se"))
(setq h(- (/pi 2) h3))
(setq hO(- h (/pi 2)))
(setq zxl "N" zx2 "E")))
(setq pl (polar pO h l6))
(setq p2 (polar pO h 8))
(setq p5 (polar pO h 4))
(setq p6 (polar pO h 12))
(setq p3 (polar p2 hO 6))
(setq p7 (polar p5 hO 1))
(setq p8 (polar p7 h 8))
(setq p9 (polar pO hO -1.5))
(cond
((=umask_s 1)
(command "pline" p2 "w" "0" "" p3 "")
(command "pline" pO "w" "0" "" pl ""))
((=umask_s 2)
(command "pline" p7 "w" "2" "" p8 "")
(command "pline" pO "w" "0" "" pl ""))
((=umask_s 3)
(command "pline" p5 "w" "2" ""p6 "")
(command "pline" pO "w" "0" "" pl "")))
(setq hd(/ (* h3 180) pi))
(setq h(/ (* h 180) pi))
(setq d(/ (* d 180) pi))
(if(/ =d 9O)
(progn
(setq ttl (strcat(rtos d 2 0)"% %d"))
(setq tt (strcat zxl (rtos hd 2 0)"%%d" zx2))))
(if(=d 9O)
(progn
(setq ttl nil)
(setq tt (strcat zxl(rtos hd 2 0) "%%d" zx2))))
(cond
((and(=h1 "nw")(=h2 "ne"))
(setq h0(+ 270 h0))
(setq p4(polar pl h0 -5.5))
(setq h(+ ( /(* 180 3) 2) hd))
(command "text"p3 "3" "0" ttl "")
(command "text" p4 "3.5" h tt ""))
((and(=hl "ne")(=h2 "nW"))
(setq p9 (polar p9 h0 -3.5))
(command "text" p3 "3" "0" ttl "")
(command "text" p9 "3.5" h tt ""))
((and (=hl "nw")(=h2 "sw"))
(setq h0 (+ 270 h0))
(setq p4 (polar pl h0 -1.5))
(setq p5 (polar p3 10 5))
(setq h(+ (/ (* 180 3) 2) hd))
(command "text" p5 "3" "0" ttl "")
(command "text" p4 "3.5" h tt "" ))
((and(=h1 "ne")(=h2 "se"))
(command "text" p3 "3" "0" ttl "")
(command "text" p9 "3.5" h tt ""))
))
回复

使用道具 举报

已有1人评论

秀莱昂纳多 发表于 4 天前
例如走向输入 30 就提示参数类型错误
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ| Archiver|手机版|小黑屋| 碧波制图网 Published by Stonespider

Copyright © 2021-2023 Kangli Wu   All Rights Reserved.

Powered by Discuz! X3.5( 苏ICP备18011607号-1 )

快速
回复
返回
列表
返回
顶部