该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

;;主程序

(defun c:qxys( / r an ps pe pc dis1)

(setvar "cmdecho" 0)

(command "layer" "m" "曲线要素" "c" 1 "" "")

(command "style" "样式1" "simplex,hztxt" "0" ".7" "0" "n" "n" "n")

(command "units" 2 3 2 4 "" "")

(command "graphscr")

(if (setq ent (car (entsel "\n请选择圆弧:")))

(if (= (cdr (assoc 0 (setq db (entget ent)))) "ARC")

(progn

(setq pc (cdr (assoc 10 db)) ;圆心

r (cdr (assoc 40 db)) ;半径

a0 (cdr (assoc 50 db))

a1 (cdr (assoc 51 db))

ps (polar pc a0 r);起点

pe (polar pc a1 r);止点

pd (mapcar '* '(0.5 0.5) (mapcar '+ ps pe))

pm (polar pc (angle pc pd) r);中点

an (- a1 a0) ;圆心角

hc (abs (* r an));弧长

) ;end setq

;;;判断是角度 坐标系

(if (< an 0) (setq an (+ an (* 2.0 pi))))

(if (not (equal '(0 0 0) (setq org (getvar "ucsorg"))))

(setq pc (mapcar '- pc org)

ps (mapcar '- ps org)

pe (mapcar '- pe org)

m (mapcar '- pm org)

);end setq

) ;end if

;求出切线长

(setq t1 (* (/ (sin (/ an 2)) (cos (/ an 2))) r))

;;弧度转换为度

;;度转换为度分秒

(setq a6 (fix (/ (* an 180) 3.1415926)));;;;;;;度

(setq a7 (fix (* (- a5 a6) 60)));;;;;;;;分

(setq a8 (fix (* (- (* (- a5 a6) 60) a7) 60)));;;;;;;;秒

(command "osnap" "off")

;(setq dis1 (getint "\n已选择圆弧,标注文字高度:默认:"))

;(if (equal dis1 nil);默认为3.0

;(setq dis1 3)

;)

(setq dis1 3 )

(setq dis2 (* dis1 8))

(setq dis3 (* dis1 8))

(setq d1 (list (+ (car pc) dis2) (+ (cadr pc) dis3)))

(command "rectang" pc d1 )

(command "line" ps pc "")

(command "line" pc pe "")

(setq f1 (list (+ (car pc) 1) (+ (cadr pc) 1)))

(setq f2 (list (car f1) (+ (cadr f1) (* dis1 2))))

(setq f3 (list (car f2) (+ (cadr f2) (* dis1 2))))

(setq f4 (list (car f3) (+ (cadr f3) (* dis1 2))))

(command "text" f4 dis1 "0" (strcat "R=" (rtos r 2 3) "m"))

(command "text" f3 dis1 "0" (strcat "a=" (rtos a6 2 0) "%%d" (rtos a7 2 0) "\U+2032" (rtos a8 2 0) "\U+2033"))

(command "text" f2 dis1 "0" (strcat "T=" (rtos t1 2 3) "m"))

(command "text" f1 dis1 "0" (strcat "L=" (rtos hc 2 3) "m"))

) ;end progn

(alert "所选取的不是圆弧!")

);end "ARC")

) ;end if

(setvar "osmode" 16383);打开对象捕捉

(command "LAYER" "s" "0" "");返回0层

(princ )

)

运行后提示:错误: 参数类型错误: numberp: nil

但是如果运行网友的另一个以后就能正常用了:

网友的:

(VL-Load-Com)

(SetQ **SysVarNL** '("AUNITS" "AUPREC" "ATTDIA" "BLIPMODE" "CECOLOR" "CELTYPE"

"CLAYER" "CMDECHO" "EXPERT" "HIGHLIGHT" "LUNITS" "LUPREC"

"OSMODE" "ORTHOMODE" "TEXTSTYLE" "PLINEWID"

)

)

(Defun-Q SetIErr (/ sv)

(If (= 'LIST (Type *error*))

(Alert "注意:最后一个(SetIErr)函数没有配对的(ReErr)!")

(Progn (SetQ **svarl** '())

(ForEach sv **SysVarNL**

(SetQ **svarl** (Cons (GetVar sv) **svarl**))

)

(ForEach sv '("ATTDIA" "BLIPMODE" "CMDECHO" "HIGHLIGHT"

"OSMODE" "ORTHOMODE"

)

(SetVar sv 0)

)

(SetVar "EXPERT" 5)

(Defun-Q *error* (st) (ReErr))

)

)

)

(Defun-Q ReErr ()

(If (= 'List (Type *error*))

(Progn (MapCar 'SetVar **SysVarNL** (Reverse **svarl**))

(SetQ *error* nil) (PrinC)

)

(Alert "注意:没有对应引用 (SetIErr)!")

)

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;主程序

(defun C:qxjs()

(setierr)

(vl-load-com)

(setq acadobject(vlax-get-acad-object)

acaddocument(vla-get-activedocument acadobject)

mspace1(vla-get-modelspace acaddocument)

mspace2(vla-get-modelspace acaddocument))

(command "layer" "m" "曲线要素" "c" 1 "" "")

(command "style" "standard" "txt,hztxt" "0" ".8" "0" "n" "n" "n")

(command "units" 2 3 2 4 "" "")

(command "graphscr")

(ysjs);;;;;;;;调用要素计算函数(YSJS)

(princ)

(reerr)

(princ)

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;要素计算

(defun ysjs ()

(princ "\n※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")

(princ "\n※※※※※※※※※※※欢迎使用本程序,Thank You!※※※※※※※※※※※※")

(princ "\n※※※曲线要素计算程序 V1.0 版本 作者:谢亮 2003年10月15日 于娄底。※※※")

(princ "\n※※※※※※※※※※※※※※※※※说明※※※※※※※※※※※※※※※※※")

(princ "\n※※※※※※本程序的功能是:通过分别选取两条直线上的每两个点,※※※※※※")

(princ "\n※※※※※※及输入的半径把曲线要素标注出来,并画弧。※※※※※※※※※※")

(princ "\n※※※※※※注意:如果两直线共线则程序退出!※※※※※※※※※※※※※※※")

(princ "\n※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※※")

;;;;;;;;;;;;;;;;;;;计算方角

(command "osmode" 16383)

;;;;;;;;;;;;;选择直线上的点以计算方位角

(setq a10 (getpoint"\n请选择一直线上一点:"))

;;;;;;;出错循环

(while (= nil a10)

(setq a10 (getpoint"\n请重新选择直线上一点:")))

(setq a11 (getpoint"\n请选择直线上另一点:"))

;;;;;;;出错循环

(while (or (= nil a11)

(= a11 a10))

(setq a11 (getpoint"\n请重新选择直线上另一点:")))

(setq a20 (getpoint"\n请选择另一直线上一点:"))

;;;;;;;出错循环

(while (or (= nil a20)

(= a20 a11)

(= a20 a10))

(setq a20 (getpoint"\n请重新选择另一直线上一点:")))

(setq a21 (getpoint"\n请选择直线上另一点:"))

;;;;;;;出错循环

(while (or (= nil a21)

(= a21 a11)

(= a21 a10)

(= a21 a20))

(setq a21 (getpoint"\n请重新选择直线上另一点:")))

;;;;;;;得到选中点(a10与a11、a20与a21)的X、Y坐标及增量

(setq a10x (car a10))

(setq a10y (cadr a10))

(setq a11x (car a11))

(setq a11y (cadr a11))

(setq a20x (car a20))

(setq a20y (cadr a20))

(setq a21x (car a21))

(setq a21y (cadr a21))

(setq da1y (- a11y a10y))

(setq da1x (- a11x a10x))

(setq da2x (- a21x a20x))

(setq da2y (- a21y a20y))

;;;;;;;;;;;判断除数是否为零(方位角是否为:0、90、180、270、360度)

(if (= da1x 0) (setq da1x (+ da1x 0.000000000000001)))

(if (= da1y 0) (setq da1y (+ da1y 0.000000000000001)))

(if (= da2x 0) (setq da2x (+ da2x 0.000000000000001)))

(if (= da2y 0) (setq da2y (+ da2y 0.000000000000001)))

;;;;;;;;判断方位角象限(一、二、三、四)

;;;;;;;;;判断直线一

;;;;;;;;;一象限

(if (and (> da1x 0)

(> da1y 0))

(setq a1 (atan (/ da1y da1x))))

;;;;;;;;;二象限

(if (and (< da1x 0)

(> da1y 0))

(setq a1 (+ 3.1415926 (atan (/ da1y da1x)))))

;;;;;;;;;三象限

(if (and (< da1x 0)

(< da1y 0))

(setq a1 (+ 3.1415926 (atan (/ da1y da1x)))))

;;;;;;;;;四象限

(if (and (> da1x 0)

(< da1y 0))

(setq a1 (+ (* 2 3.1415926) (atan (/ da1y da1x)))))

;;;;;;;;;判断直线二

;;;;;;;;;一象限

(if (and (> da2x 0)

(> da2y 0))

(setq a2 (atan (/ da2y da2x))))

;;;;;;;;;二象限

(if (and (< da2x 0)

(> da2y 0))

(setq a2 (+ 3.1415926 (atan (/ da2y da2x)))))

;;;;;;;;;三象限

(if (and (< da2x 0)

(< da2y 0))

(setq a2 (+ 3.1415926 (atan (/ da2y da2x)))))

;;;;;;;;;四象限

(if (and (> da2x 0)

(< da2y 0))

(setq a2 (+ (* 2 3.1415926) (atan (/ da2y da2x)))))

;;;;;;;;;;;;;;;;;;判断a1(直线一)、a2(直线二)的方位角(逆时针)、(顺时针)是否大于一个圆周(360度)

;;;;;;;;;;;;;;;判断a1(直线一)的方位角(逆时针)是否大于一个圆周(360度)

(if (> a1 (* 2 3.1415926))

(setq a1 (- a1 (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a1(直线一)的方位角(顺时针)是否大于一个圆周(360度)

(if (< a1 (* -2 3.1415926))

(setq a1 (+ a1 (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a2(直线二)的方位角(逆时针)是否大于一个圆周(360度)

(if (> a2 (* 2 3.1415926))

(setq a2 (- a2 (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a2(直线二)的方位角(顺时针)是否大于一个圆周(360度)

(if (< a2 (* -2 3.1415926))

(setq a2 (+ a2 (* 2 3.1415926))))

;;;;;;;;;;;求点

(setq u1 (sin a1))

(setq u2 (cos a1))

(setq u3 (/ u1 u2))

;;;;;;;;;;(直线2斜率

(setq w1 (sin a2))

(setq w2 (cos a2))

(setq w3 (/ w1 w2))

;;;;;;;;判断斜率是否等

(setq k1 (- w3 u3))

(if (= 0 k1)

(setq k1 (+ k1 0.000000000000001)))

;;;;;;;;;求交点

(setq jd1x (/ (+ (* -1 u3 a10x) (* w3 a20x) (* -1 a20y) a10y) k1));;;;;交点X坐标

(setq jd1y (+ a10y (* u3 jd1x) (* -1 u3 a10x)));;;;;;;;交点Y坐标

;;;;;;;;;求出1与交点方位角,交点与4方位角

(setq da10xjd1x (- jd1x a10x))

(setq da10yjd1y (- jd1y a10y))

(setq djd1xa21x (- a21x jd1x))

(setq djd1ya21y (- a21y jd1y))

;;;;;;;;;;;判断除数是否为零(方位角是否为:0、90、180、270、360度)

(if (= da10xjd1x 0) (setq da10xjd1x (+ da10xjd1x 0.000000000000001)))

(if (= da10yjd1y 0) (setq da10yjd1y (+ da10yjd1y 0.000000000000001)))

(if (= djd1xa21x 0) (setq djd1xa21x (+ djd1xa21x 0.000000000000001)))

(if (= djd1ya21y 0) (setq djd1ya21y (+ djd1ya21y 0.000000000000001)))

;;;;;;;;判断方位角象限(一、二、三、四)

;;;;;;;;;判断直线一

;;;;;;;;;一象限

(if (and (> da10xjd1x 0)

(> da10yjd1y 0))

(setq a1j (atan (/ da10yjd1y da10xjd1x))))

;;;;;;;;;二象限

(if (and (< da10xjd1x 0)

(> da10yjd1y 0))

(setq a1j (+ 3.1415926 (atan (/ da10yjd1y da10xjd1x)))))

;;;;;;;;;三象限

(if (and (< da10xjd1x 0)

(< da10yjd1y 0))

(setq a1j (+ 3.1415926 (atan (/ da10yjd1y da10xjd1x)))))

;;;;;;;;;四象限

(if (and (> da10xjd1x 0)

(< da10yjd1y 0))

(setq a1j (+ (* 2 3.1415926) (atan (/ da10yjd1y da10xjd1x)))))

;;;;;;;;;判断直线二

;;;;;;;;;一象限

(if (and (> djd1xa21x 0)

(> djd1ya21y 0))

(setq a2j (atan (/ djd1ya21y djd1xa21x))))

;;;;;;;;;二象限

(if (and (< djd1xa21x 0)

(> djd1ya21y 0))

(setq a2j (+ 3.1415926 (atan (/ djd1ya21y djd1xa21x)))))

;;;;;;;;;三象限

(if (and (< djd1xa21x 0)

(< djd1ya21y 0))

(setq a2j (+ 3.1415926 (atan (/ djd1ya21y djd1xa21x)))))

;;;;;;;;;四象限

(if (and (> djd1xa21x 0)

(< djd1ya21y 0))

(setq a2j (+ (* 2 3.1415926) (atan (/ djd1ya21y djd1xa21x)))))

;;;;;;;;;;;;;;;;;;判断a1(直线一)、a2(直线二)的方位角(逆时针)、(顺时针)是否大于一个圆周(360度)

;;;;;;;;;;;;;;;判断a1(直线一)的方位角(逆时针)是否大于一个圆周(360度)

(if (> a1j (* 2 3.1415926))

(setq a1j (- a1j (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a1(直线一)的方位角(顺时针)是否大于一个圆周(360度)

(if (< a1j (* -2 3.1415926))

(setq a1j (+ a1j (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a2(直线二)的方位角(逆时针)是否大于一个圆周(360度)

(if (> a2j (* 2 3.1415926))

(setq a2j (- a2j (* 2 3.1415926))))

;;;;;;;;;;;;;;;判断a2(直线二)的方位角(顺时针)是否大于一个圆周(360度)

(if (< a2j (* -2 3.1415926))

(setq a2j (+ a2j (* 2 3.1415926))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;求出(直线一)与(直线二)偏角

(setq a31 (abs (- a1j a2j)))

(if (= "3.14159" a31) (quit))

(setq a3 a31)

;;;;;;;;;;;;;;;判断偏角是否大于180度

(if (> a3 3.1415926)

(setq a3 (- (* 2 3.1415926) a3)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;半偏角、半圆角

(setq a4 (/ a3 2))

;;;;;;;;;;;;;输入半径

(setq r1 (getreal "\n圆角半径:"))

;;;;;;;半径数值出错循环

(while (= nil r1)

(setq r1 (getreal "\n圆角半径:")))

;;;;;;;;求出切线长

(setq n1 (sin a4))

(setq n2 (cos a4))

(setq n3 (/ n1 n2))

(setq t1 (* n3 r1))

;;;;;;;;;求出外距长

(setq e1(- (/ r1 n2) r1))

;;;;;;;;;求出曲线长

(setq m1 (* a3 180))

(setq m2 (/ m1 3.1415926))

(setq m3 (/ m2 360))

(setq m4 (* 2 3.1415926 r1))

(setq l1 (* m3 m4))

;;;;;;;;;角度转换

;;;;;;;;弧度转换为度

(setq a5 (/ (* a3 180) 3.1415926))

;;;;;;;;度转换为度分秒

(setq a6 (fix a5));;;;;;;度

(setq a7 (fix (* (- a5 a6) 60)));;;;;;;;分

(setq a8 (fix (* (- (* (- a5 a6) 60) a7) 60)));;;;;;;;秒

(hjx);;;;;;;;调用画矩形函数(HJX)

(princ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;画矩形

(defun hjx()

(command "osnap" "off")

(setq d0 (getpoint "\n标注基点:"));;;;;;;;;;;标注基点

(while (= nil d0)

(setq d0 (getpoint "\n标注基点:")))

(setq d1 (list (+ (car d0) 23) (+ (cadr d0) 25)))

(command "rectang" d0 d1 )

(bzwz);;;;;;;;调用标注文字函数(BZWZ)

(princ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;标注文字

(defun bzwz()

(setq f1 (list (+ (car d0) 1) (+ (cadr d0) 1)))

(setq f2 (list (car f1) (+ (cadr f1) 5)))

(setq f3 (list (car f2) (+ (cadr f2) 5)))

(setq f4 (list (car f3) (+ (cadr f3) 5)))

(setq f5 (list (car f4) (+ (cadr f4) 5)))

(command "text" f5 "2.5" "0" (strcat "a=" (rtos a6 2 0) "%%d" (rtos a7 2 0) "\U+2032" (rtos a8 2 0) "\U+2033"))

(command "text" f4 "2.5" "0" (strcat "R=" (rtos r1 2 3) "m"))

(command "text" f3 "2.5" "0" (strcat "T=" (rtos t1 2 3) "m"))

(command "text" f2 "2.5" "0" (strcat "L=" (rtos l1 2 3) "m"))

(command "text" f1 "2.5" "0" (strcat "E=" (rtos e1 2 3) "m"))

(reerr)

(princ)

(yj);;;;;;;;调用圆角函数(YJ)

(princ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;圆角

(defun yj()

(setierr)

(command "fillet" "r" r1)

(command "fillet" )

(princ)

)

;*************************************************************

角度转度分秒lisp函数_自改小程序,提示错误,运行另一个lisp后就不会出错,求帮忙!...相关推荐

  1. oracle 度分秒转小数点,角度的度分秒与小数点格式互相转换

    一.角度的度分秒与小数点格式互相转换 EXCEL能将角度转换成度"°"分"′"秒"″"格式吗? 如将:120.999722222222°转换 ...

  2. EXCEL 十进制角度转换为度分秒格式

    写篇比较简单的文章,大家都不屑一顾的问题,但希望有人能够用上. 最近同事用到使用EXCEL将十进制角度转度分秒,找我帮忙,网上搜罗一下,大多是度分秒转为十进制的计算方法,偶有这种算法,还要判断度的位数 ...

  3. lisp如何将度分秒转换为弧度_地学中常用度、度分、度分秒,弧度、角度在MATLAB中的转换...

    地学中常用度.度分.度分秒,弧度.角度在MATLAB中的转换 转化为角度: deg = DMS2DEG(35,20,10) deg = 35.3361 转化为弧度 rad=DMS2RAD(35,20, ...

  4. 角度转度分秒lisp函数_AutoLISP在尼康全站仪原始数据重新计算中的应用:尼康全站仪...

    摘 要:AutoLISP是针对AutoCAD系统的开发工具之一,也是开发AutoCAD图形软件的强有力工具,在很大程度上减轻了作业人员的工作强度.本文作者在研究AutoLISP与尼康全站仪原始数据结构 ...

  5. lisp如何将度分秒转换为弧度_测量学习题

    测量学习题 一.测量学概述 1.测量学的任务是什么? 2.如何表示地球的形状和大小? 3.如何确定地面点位? 4.已知某点P的高斯平面直角坐标为XP=2050442.5m,YP=18523775.2m ...

  6. 中望CAD的lisp编辑器_中望CAD+API接口应用教程之Lisp篇

    前段时候中望公司发布了新一代拥有全新内核的产品:中望CAD+,作为一个国产CAD软件的支持者,我进行了下载测试,使用过后确实有了耳目一新的感觉,新功能方面有很多朋友已经做了深入的评测,我就不凑热闹了, ...

  7. 单片机oled显示浮点数函数_问中文编程在单片机上实现一个电子时钟,总共有几步?...

    首先介绍开发一下语言:mcuScript,他是一个支持同时支持中文编程和英文编程的弱数据类型的脚本语言.相关介绍可参考前面的两篇文章: 彭贞:mcuScript一个洋名字的中文(汉语)编程语言,初体验 ...

  8. 微信小程序销毁某一注册函数_微信小程序 生命周期函数详解

    微信小程序 生命周期函数 小程序中 判断当前首页是从其他页面返回,还是由入口打开 由于小程序的数据在我们退出小程序时并没有得到释放,因此再次点击开来数据依然没有变成初始化 解决方法:在小程序 data ...

  9. 十进制度分秒lisp函数_十进制与度分秒坐标互转

    十进制 十进制 60进制 60进制 39.72092453 115.836417 39.431532831 115.501110117 39.7215745 115.8360305 39.431766 ...

最新文章

  1. Bio-protocol与Cell Research达成合作:共同提升科研的可重复性
  2. php5.3连接sqlserver2005
  3. perl学习笔记(9)
  4. ES6中对象新增方法
  5. Python 3.9.0a6 已可用于测试
  6. 软件工程基础-结对项目Ⅰ-2014
  7. Too many authentication failures for
  8. activemq中怎么知道推送消息是否成功_消息队列面试,你能顶得住面试官这波10大连环炮的攻势吗?...
  9. holotoolkit 客户端与服务器架构的建立
  10. CSS3淘宝支付成功打勾动画代码
  11. CAD文件查看器Acme CAD Converter V 8.10.2.1536【轻松查看CAD】
  12. fork函数结果分析
  13. 贾俊平统计学思维导图- 第八章 假设检验
  14. 【Linux】关于Linux中的权限
  15. 春晚宫女唐奕霖被爆背景深厚 可携助手出入央视排练场享有特权
  16. python报错Ran out of input
  17. iOS9有哪些新特性
  18. Oracle EBS 模拟登入
  19. VS2019打包VB.NET可安装项目
  20. 在angular中,我有一个路由'/sdfsd/sss/ss',实现在一函数,判断路由配置对象中是否存在该路由...

热门文章

  1. 恢复iPhone已删除的短信
  2. 如何组建权责明确、运营高效的数据团队
  3. 捷配浅谈PCB叠层的概念、设计原则
  4. 【小白向】简单随意DIY你的U盘图标
  5. 媒体查询支持ie浏览器各版本的方法
  6. P13 - 软件设计质量评审 之 八个评审要求
  7. 联想小新 win10电脑系统安装教程
  8. 推荐一款很好用的调试JS的Eclipse插件
  9. 网络故障的技术一些东东
  10. 开源 iOS 项目分类索引大全 - 待整理