明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1341|回复: 1

[基础] [求助]error on lisp

[复制链接]
发表于 2010-1-18 21:28 | 显示全部楼层 |阅读模式
Dear All,

my problem is this lisp not working in meter drg error coming (Value must be positive and nonzero)

change the highlight mark in red

blue highlight line is working on mm drg

request is this program working on both drg



  1. (defun c: Rm1 (/ roomname roomsz)
  2. (defun roomname ()
  3. (textpage)
  4. (princ "\ nROOMNAME OPTIONS:")
  5. (princ "\ n \ t Living Kitchen Bed Toilet")
  6. (princ "\ n \ t Office SHop STore STUdy")
  7. (princ "\ n \ t Dining Puja BAth W.c. = WC")
  8. (princ "\ n \ t LIft = LT LObby S.toi. Living / dining = LD")
  9. (princ "\ n \ nPress any key to return to your drawing")
  10. (grread)
  11. (princ "\ r")
  12. (graphscr)
  13. ); End of roomname
  14. (defun roomsz (/ p1 p2 p3 p4 x x1 y y1 tx h ht1 rm op pl pm tm ft rsz pll)
  15. (if (null txlay)
  16. (progn
  17. (setq txlay "tx")
  18. (setq txlayer (tblsearch "layer" txlay))
  19. (if (null txlayer)
  20. (progn
  21. (setq txlay (getstring "\ nLayer name for TEXT:"))
  22. (setq txclr (getstring (strcat "\ nColor for" txlay "layer:")))
  23. (command "layer" "m" txlay "c" txclr "" "")
  24. )
  25. (prompt "\ nTEXT ON TX LAYER")
  26. )
  27. )
  28. )
  29. (setvar "osmode" 32)
  30. (menucmd "p0 = filters") (menucmd "p0 =*")
  31. ; (if (null ht) (setq ht "250")) ;------------ only working in mm drg
  32. (if (null ht) (setq ht "0.25"))
  33. (setq p1 (getpoint "\ nPick room corner:")
  34. p2 (getcorner p1 "\ nPick Diagonally opposite corner:")
  35. p3 (list (car p2) (cadr p1)) p4 (list (car p1) (cadr p2))
  36. a (distance p1 p3) b (distance p1 p4)
  37. ;x (* 0.001 a) y (* 0.001 b) x1 (rtos x 2 2) y1 (rtos y 2 2) ;------------ only working in mm drg
  38. x (* 1.00 a) y (* 1.00 b) x1 (rtos x 2 2) y1 (rtos y 2 2)
  39. mt (strcat x1 "x" y1))
  40. (setq ix (cvunit x "meter" "inch") iy (cvunit y "meter" "inch")
  41. xf (rtos ix 4 0) yf (rtos iy 4 0) ft (strcat xf "x" yf))
  42. (PROMPT "\ nENTER FOLLOWING KEYWORD OR TY FOR TYPE")
  43. (setq cnt T)
  44. (while cnt
  45. (initget 1 (strcat "Living Kitchen Bed Toilet"
  46. "Office SHop STore STUdy"
  47. "Dining Puja BAth WC TY?"
  48. "LT LObby S.toi. LD"))
  49. (setq rm (getkword
  50. "\ nROOM NAME = Liv / Bed / Kit / Toi / Off / Din / SHop / BAth / WC / STore / STUdy / S. / LT / LD / LO / TYpe /?:"))
  51. (if (/ = (type rm) 'LIST)
  52. (if (= rm "?")
  53. (progn
  54. (roomname) (setq cnt T)
  55. )
  56. (progn
  57. (setq cnt nil)
  58. (if (= rm "LT") (setq rm "LIFT"))
  59. (if (= rm "LD") (setq rm "living / dining"))
  60. (if (= rm "WC") (setq rm "W.C."))
  61. (IF (= rm "TY") (setq rsz (strcase
  62. (getstring t "\ nTYPE ROOM NAME:")))
  63. (setq rsz (strcase rm))
  64. )
  65. )
  66. ) (Setq cnt nil)
  67. )
  68. )
  69. (setq tm (strcase (getstring (strcat "\ nENTER TEXT HEIGHT <" ht ">:")) t))
  70. (if (/ = tm "") (setq ht tm))
  71. (setq h (atof ht) ht1 (* h 0.88888) dt (* h 1.7))
  72. (setvar "osmode" 0)
  73. (setvar "orthomode" 1)
  74. (setq ht1 (fix ht1))
  75. (setq pc (polar p1 (angle p1 p2) (/ (distance p1 p2) 2))
  76. pm (polar pc (* pi 1.5) (/ h 3.55))
  77. pt (polar pc (/ pi 2) dt) pf (polar pc (* pi 1.5) dt))
  78. (command "layer" "t" txlay "on" txlay "s" txlay ""
  79. "text" "s" "rD" "m" pt h "0" rsz)
  80. (setq pm2 (getpoint pm "\ nENDPOINT OF TEXT:")
  81. PM1 (polar pm pi (distance pm pm2))
  82. pf1 (polar pf pi (distance pm pm2))
  83. pf2 (polar pf 0 (distance pm pm2)))
  84. (command "text" "s" "rs" "f" pm1 pm2 ht1 mt
  85. "text" "f" pf1 pf2 ht1 ft)
  86. ) (roomsz))
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2010-1-18 21:41 | 显示全部楼层
为什么都是英文。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-5-17 18:41 , Processed in 0.172457 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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