明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1110|回复: 3

[基础] 求助,帮忙看下此程序哪里出错

[复制链接]
发表于 2011-7-8 23:13:49 | 显示全部楼层 |阅读模式
  1. (defun c:tt(/insertp n1 wz )

  2. (if (not (setq n1 (getint "\n请输入起始顺序号 <1>: ")))
  3.     (setq n1 1)
  4. )

  5. (setq wz (strcat (itoa 3) (itoa -50) (itoa -411) "-" (itoa n1)))
  6. (setq insertp (getpoint "\n请指定插入点: "))
  7. (setq insertp_move (pmove insertp 0 -2))
  8.   (while (/= insertp nil)

  9.    (command ".text" "j" "mc" insertp_move 0.6 0  wz)  ;;设置文字
  10.    
  11.     (setq
  12.       n1   (+ n1 1)
  13.       wz (strcat (itoa 3) (itoa -50) (itoa -411) "-" (itoa n1))
  14.       insertp   (getpoint "\n请指定下一插入点: ")
  15.       insertp_move (pmove insertp 0 -2)
  16.     )
  17.   )
  18. );end defun


  19. (defun pmove(/point_xy px py);点位,X Y Z
  20.     (setq point_x(car point_xy))
  21.     (setq point_y(cadr point_xy))
  22.     (list (+ point_x  px)(+ point_y py))
  23. )


程序的功能 是输入3-50-411-1,3-50-411-2 。。。。。。。
捕捉线段的中点,在该点向下偏移2单位输入3-50-411-1
不知道哪里出错,请高手指教。(请指定插入点: ; 错误: 参数类型错误: numberp: nil)
还有怎么定义 wz (strcat (itoa 3) (itoa -50) (itoa -411) "-" (itoa n1))
可以直接写成 (setq wz (strcat  3-50-411-  (itoa n1)))
发表于 2011-7-9 20:55:54 | 显示全部楼层

  1. (defun c:tt (/insertp n1 wz)
  2.   (if (not (setq n1 (getint "\n请输入起始顺序号 <1>: ")))
  3.     (setq n1 1)
  4.   )
  5.   ;;(setq wz (strcat (itoa 3) (itoa -50) (itoa -411) "-" (itoa n1)))
  6.   (setq wz (strcat "3-50-411-" (itoa n1)))
  7.   (setq insertp (getpoint "\n请指定插入点: "))
  8.   (setq insertp_move (pmove insertp 0 -2))
  9.   (while (/= insertp nil)
  10.     (command ".text" "j" "mc" insertp_move 0.6 0 wz)
  11.     ;;设置文字

  12.     (setq
  13.       n1           (+ n1 1)
  14.       wz           (strcat "3-50-411-" (itoa n1))
  15.       insertp           (getpoint "\n请指定下一插入点: ")
  16.       insertp_move (pmove insertp 0 -2)
  17.     )
  18.   )
  19. )                                        ;end defun

  20. (defun pmove (point_xy px py)                ;点位,X Y Z
  21.   (setq point_x (car point_xy))
  22.   (setq point_y (cadr point_xy))
  23.   (list (+ point_x px) (+ point_y py))
  24. )
发表于 2011-7-9 20:57:10 | 显示全部楼层
如果前面的字符串是固定的可以写成
(setq wz (strcat  “3-50-411-"  (itoa n1)))
 楼主| 发表于 2011-7-9 23:31:22 | 显示全部楼层
本帖最后由 zhb236623 于 2011-7-9 23:42 编辑

谢谢zhynt
发错地方多发了帖子,http://bbs.mjtd.com/forum.php?mo ... 01&page=1#pid472759,也谢谢gbhsu 帮忙解决。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-10 04:22 , Processed in 0.160837 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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