明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1099|回复: 7

[提问] cad标注问题(一个开源程序)

[复制链接]
发表于 2015-8-18 15:57:42 | 显示全部楼层 |阅读模式
桥梁上面的一个插件,在使用  钢束大样   标注时,一直用不了:提示  
”选择水平标注位置:; 错误: 参数类型错误: numberp: nil “。

程序为 同济建筑设计院的 开源程序,已联系不上作者。求高手看看。
  1. ———— 预应力工具
  2. ;;;===============================================================================
  3. ;;;-------------------------------------------------------------------------------
  4. ;;; 钢束初始化
  5. ;;; 功能:定义钢束
  6. ;;;-------------------------------------------------------------------------------
  7. (defun c:gscsh(/ id whatnext tendonno count tcount tendonid tendonsty tendonstylst constress prelength orientstyle position symmertry
  8.         ename entlst vlaobj pto orient ptold orientold orientucs tcountold)
  9.   (defun showerrtile()
  10.     (cond
  11.       ((or (null ename)(/= "LWPOLYLINE" (cdr (assoc 0 (entget ename)))))
  12.         (mode_tile "accept" 1)
  13.         (set_tile "error" "未选中有效曲线!"))
  14.       (t
  15.         (mode_tile "accept" 0)
  16.         (set_tile "error" "OK!"))))
  17.   (setq id            (load_dialog "BRTools.dcl")
  18.       tendonstylst '((0 . "15.20") (1 . "12.70") (2 . "11.10") (3 . "9.50") (4 . "JL18") (5 . "JL25") (6 . "JL32") (7 . "JL40")))
  19.   (mapcar 'set '(whatnext tendonno count tcount constress prelength orientstyle position symmertry tendonid tendonsty) '(2 "N1" 1 12 1395 700 "currentucs" "both" "0" 0 "15.20"))
  20.   (setq pto      '(0.0 0.0 0.0)
  21.       ptold     pto
  22.       orient    (MAT:UnitVec2P '(0.0 0.0 0.0) (append (mapcar '+ '(0.0 0.0) (getvar "UCSXDIR")) '(0.0)))
  23.       orientold orient
  24.       orientucs orient
  25.       tcountold tcount)
  26.   (while (>= whatnext 2)
  27.     (new_dialog "SETTENDON" id)
  28.     (mapcar 'set_tile
  29.       '("tendonno" "count" "tendonsty" "constress" "prelength" "orientstyle" "position" "symmertry" "originmsg" "orientmsg")
  30.       (list tendonno (itoa count) (itoa tendonid) (rtos constress 2) (rtos prelength 2) orientstyle position symmertry (vl-princ-to-string pto) (vl-princ-to-string orient)))
  31.     (LT:BUTTON-POINT-PICK "pickorigin" T)
  32.     (LT:BUTTON-SELECT-PICK "picktondon" T)
  33.     (if (= "currentucs" orientstyle)
  34.       (progn
  35.         (mode_tile "pickorient" 1)
  36.         (LT:BUTTON-POINT-PICK "pickorient" nil))
  37.       (progn
  38.         (mode_tile "pickorient" 0)
  39.         (LT:BUTTON-POINT-PICK "pickorient" T)))
  40.     (if (> tendonid 3)
  41.       (progn (mode_tile "tcount" 1) (set_tile "tcount" (itoa tcountold)))
  42.       (progn (mode_tile "tcount" 0) (set_tile "tcount" (itoa tcount))))
  43.     (showerrtile)
  44.     (action_tile "tendonno" "(setq tendonno $value)")
  45.     (action_tile "count" "(setq count (atoi $value))")
  46.     (action_tile "tcount" "(setq tcount (atoi $value))")
  47.     (action_tile "tendonsty" "(setq tendonid (atoi $value) tendonsty (cdr (assoc tendonid tendonstylst)))(if (> (atoi $value) 3) (progn (mode_tile "tcount" 1) (setq tcountold tcount tcount 0))(progn (mode_tile "tcount" 0) (setq tcount tcountold)))")
  48.     (action_tile "constress" "(setq constress (atof $value))")
  49.     (action_tile "prelength" "(setq prelength (atof $value))")
  50.     (action_tile "currentucs" "(setq orientstyle (get_tile "orientstyle") orientold orient orient orientucs)(set_tile "orientmsg" (vl-princ-to-string orient))(mode_tile "pickorient" 1)(LT:BUTTON-POINT-PICK "pickorient" nil)")
  51.     (action_tile "manualorient" "(setq orientstyle (get_tile "orientstyle") orient orientold ) (set_tile "orientmsg" (vl-princ-to-string orient)) (mode_tile "pickorient" 0)(LT:BUTTON-POINT-PICK "pickorient" T)")
  52.     (action_tile "start" "(setq position (get_tile "position"))(mode_tile "symmetry" 1)(setq symmetry "0")")
  53.     (action_tile "end" "(setq position (get_tile "position"))(mode_tile "symmetry" 1)(setq symmetry "0")")
  54.     (action_tile "both" "(setq position (get_tile "position"))(mode_tile "symmetry" 0)(setq symmetry (get_tile "symmertry"))")
  55.     (action_tile "symmetry" "(setq symmertry $value)")
  56.     (action_tile "pickorient" "(done_dialog 4)")
  57.     (action_tile "pickorigin" "(done_dialog 3)")
  58.     (action_tile "picktondon" "(done_dialog 2)")
  59.     (action_tile "help" "(help "BRTools" "4_cmd_04_01_gscsh")")
  60.     (setq whatnext (start_dialog))
  61.     (cond
  62.       ((= 4 whatnext)
  63.         (setq orientold orient)
  64.         (if (setq orient (getpoint (trans pto 0 1) "\n选择方向:"))
  65.           (setq orient    (append (mapcar '+ '(0.0 0.0) (trans orient 1 0)) '(0.0))
  66.               orient    (MAT:UnitVec2P pto orient)
  67.               orientold orient)
  68.           (setq orient orientold)))
  69.       ((= 3 whatnext)
  70.         (setq ptold pto)
  71.         (if (setq pto   (getpoint "\n请输入钢束参考点:"))  
  72.           (setq pto   (append (mapcar '+ '(0.0 0.0) (trans pto 1 0)) '(0.0))
  73.               ptold pto)
  74.           (setq pto ptold)))
  75.       ((= 2 whatnext)
  76.         (and
  77.           (setq ename (car (entsel "\n选择一条曲线:")))
  78.           (CK:TendonP ename)
  79.           (mapcar
  80.             '(lambda(x1 x2 x3) (set x1 (BR:GetXdata ename x2 x3)))
  81.             '(tendonno tendonsty tcount count prelength constress position symmetry)
  82.             '(1000 1000 1070 1070 1040 1040 1000 1000)
  83.             '("tendonno" "tendonsty" "tcount" "count" "prelength" "constress" "tenposition" "symmetrystyle"))
  84.           (setq pto    (BR:GetOrigin ename)
  85.               orient (BR:GetOrient ename))))
  86.       ((= 1 whatnext)
  87.         (LA:Rebar)
  88.         (setq entlst (entget ename)
  89.             vlaobj (vlax-ename->vla-object ename)
  90.             entlst (subst (cons 8 "REBAR") (assoc 8 entlst) entlst))
  91.         (entmod entlst)
  92.         (and (minusp (MAT:DotProduct orient (mapcar '- (vlax-curve-getEndPoint vlaobj) (vlax-curve-getStartPoint vlaobj)))) (MD:RevLwPl ename))
  93.         (mapcar
  94.           '(lambda(x1 x2 x3) (BR:SetXdata ename x1 x2 x3))
  95.           '(1000 1000 1070 1070 1040 1040 1000 1000)
  96.           '("tendonno" "tendonsty" "tcount" "count" "prelength" "constress" "tenposition" "symmetrystyle")
  97.           (list tendonno tendonsty tcount count prelength constress position symmertry))
  98.         (BR:SetOrigin ename pto)
  99.         (BR:SetOrient ename orient))
  100.       ((= 0 whatnext)(princ "\n操作取消!"))))
  101.   (unload_dialog id)
  102.   (princ))  
  103. ;;;-------------------------------------------------------------------------------
  104. ;;; 钢束大样
  105. ;;; 功能:对预应力钢束大样进行标注
  106. ;;;-------------------------------------------------------------------------------
  107. (defun c:gsdy (/ ename refename pt prolst dstyle)
  108.   (and
  109.     (setq ename (car (entsel "\n请选择钢束曲线:")))
  110.     (progn
  111.       (redraw ename 3)
  112.       (= "LWPOLYLINE" (cdr (assoc 0 (entget ename)))))
  113.     (setq refename (car (entsel "\n请选择标注参考线:")))
  114.     (progn
  115.       (redraw refename 3)
  116.       (member (cdr (assoc 0 (entget refename))) '("LWPOLYLINE" "LINE")))
  117.     (cond
  118.       ((CK:TendonP ename)(setq prolst (list (BR:GetOrient ename) (BR:GetXdata ename 1040 "prelength") (BR:GetXdata ename 1000 "tenposition") (BR:GetXdata ename 1000 "symmetrystyle"))))
  119.       (t (setq prolst (DL:GetTondonProLst '((0 . 700) (1 . "both") (2 . "1"))))))
  120.     (setq pt (trans (getpoint "\n选择水平标注位置:") 1 0))
  121.     (setq dstyle (getvar "DIMSTYLE"))
  122.     (progn
  123.       (or (tblsearch "DIMSTYLE" (strcat dstyle "$4")) (DSTYLE:Radial-Current))
  124.       (LA:CurNote)
  125.       (LA:CurCEN)
  126.       (LA:CurDim)
  127.       (LA:Rebar)
  128.       (BLK:PRESANCHOR)
  129.       (BLK:PRESTENSION)
  130.       (SET:SC))
  131.     (DR:TondonDim ename refename pt dstyle prolst))
  132.   (and ename (redraw ename 4))
  133.   (and refename (redraw refename 4))
  134.   (princ))
  135. ;;;-------------------------------------------------------------------------------
  136. ;;; 钢束导线
  137. ;;; 功能:画出钢束导线
  138. ;;;-------------------------------------------------------------------------------
  139. (defun c:gsdx(/ r ss ename entlst i)
  140.   (setq r    (getvar "FILLETRAD"))
  141.   (and
  142.     (setq ss (ssget '((0 . "LWPOLYLINE"))))
  143.     (progn
  144.       (LA:CurCen)
  145.       (setvar "CMDECHO" 0)
  146.       (setvar "FILLETRAD" 0.0)
  147.       (setq i 0))
  148.     (repeat (sslength ss)
  149.       (setq entlst (entget (ssname ss i))
  150.           i      (1+ i)
  151.           entlst (vl-remove-if '(lambda(x) (member (car x) '(-1 5 330 ))) entlst))
  152.       (entmake entlst)
  153.       (setq ename (entlast))
  154.       (vl-cmdf "fillet" "P" ename)
  155.       (vlax-put-property (vlax-ename->vla-object ename) 'LAYER *CLACEN*))
  156.     (setvar "FILLETRAD" r))
  157.   (princ))
  158. ;;;-------------------------------------------------------------------------------
  159. ;;; 钢束放样
  160. ;;; 功能:
  161. ;;;-------------------------------------------------------------------------------
  162. (defun c:gsfy()
  163.   (princ))
  164. ;;;-------------------------------------------------------------------------------
  165. ;;;===============================================================================
  166. ;;;菜单命令 ———— 钢结构工具
  167. ;;;===============================================================================
发表于 2015-8-18 17:09:59 | 显示全部楼层
BRTools.dcl 对话框有放入吗?
 楼主| 发表于 2015-8-18 17:28:28 | 显示全部楼层
lucas_3333 发表于 2015-8-18 17:09
BRTools.dcl 对话框有放入吗?

(setq pt (trans (getpoint "\n选择水平标注位置:") 1 0))  ;输入  gsdy  命令。提示选择 选择水平标注位置 然后就显示   参数类型错误: numberp: nil “。
发表于 2015-8-18 17:43:43 | 显示全部楼层
自定义函数缺少很多
 楼主| 发表于 2015-8-18 18:20:51 | 显示全部楼层
spp_wall 发表于 2015-8-18 17:43
自定义函数缺少很多

别人之前说可以用的!
发表于 2015-8-18 23:02:18 | 显示全部楼层
楼主的源码应该没有贴全吧,缺少不少的自定义函数。如果原来其他地方可以用的话,估计是自定义函数专门打包放在另外一个文件了,没有拷贝上
发表于 2015-8-23 23:50:37 | 显示全部楼层
zhanghuohuo 发表于 2015-8-18 17:28
(setq pt (trans (getpoint "\n选择水平标注位置:") 1 0))  ;输入  gsdy  命令。提示选择 选择水平标注位 ...

另外的一个帖子看了,竟然是整个自定义源码库其他程序能正常用的话,估计源码库没什么问题。
按照你给的cad提示,是不是这句话的执行有问题。
试试在上面的getpoint前后加上princ,手动检测下
(princ "\nok=1")
(setq p (getpoint "\n选择水平标注位置:") )
(princ "\nok=2")
(princ p);这个是查看取得的p是三维点还是二维点
(setq pt (trans p 1 0))
(princ "\nok=3")
然后看看显示的ok到哪一步,那么之后的那一步就有问题。这两个都是基础函数,如果有问题的话,要么函数格式有问题,要么参数的格式有问题,一个个排除下试试。
 楼主| 发表于 2015-8-24 12:21:31 | 显示全部楼层
lostbalance 发表于 2015-8-23 23:50
另外的一个帖子看了,竟然是整个自定义源码库其他程序能正常用的话,估计源码库没什么问题。
按照 ...

感谢!!虽然不知道你在说什么!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-23 07:03 , Processed in 0.194053 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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