乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: geo1595

[综合讨论] 自定义AutoLISP命令

[复制链接]

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-7 00:24:11 | 显示全部楼层
是否希望在一个图形中,而不是在多个图形中?
 
会尽量找时间做点什么。
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 00:27:28 | 显示全部楼层
最好在多个图形中。我真的很感谢你的帮助,目前我对这类事情的大部分了解不足
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-7 00:31:17 | 显示全部楼层
好的,这是让读取文件工作的第一步,接下来将编写一个脚本并对多个文件重复。只需在末尾更改文件名即可。也要感谢李。
 
  1. ; tunnel takes a txt file ignores lines that are not xy description
  2. (vl-load-com)
  3. ;;-------------------=={ Parse Numbers }==--------------------;;
  4. ;;                                                            ;;
  5. ;;  Parses a list of numerical values from a supplied string. ;;
  6. ;;------------------------------------------------------------;;
  7. ;;  Author: Lee Mac, Copyright © 2011 - www.lee-mac.com       ;;
  8. ;;------------------------------------------------------------;;
  9. ;;  Arguments:                                                ;;
  10. ;;  s - String to process                                     ;;
  11. ;;------------------------------------------------------------;;
  12. ;;  Returns:  List of numerical values found in string.       ;;
  13. ;;------------------------------------------------------------;;
  14. (defun LM:ParseNumbers ( s )
  15. (
  16.    (lambda ( l )
  17.      (read
  18.        (strcat "("
  19.          (vl-list->string
  20.            (mapcar
  21.              (function
  22.                (lambda ( a b c )
  23.                  (if
  24.                    (or
  25.                      (< 47 b 58)
  26.                      (and (= 45 b) (< 47 c 58) (not (< 47 a 58)))
  27.                      (and (= 46 b) (< 47 a 58) (< 47 c 58))
  28.                    )
  29.                    b 32
  30.                  )
  31.                )
  32.              )
  33.              (cons nil l) l (append (cdr l) (list nil))
  34.            )
  35.          )
  36.          ")"
  37.        )
  38.      )
  39.    )
  40.    (vl-string->list s)
  41. )
  42. )
  43. (defun tunnel (fname / x xyzlist xyz)
  44. (setq fo (open fname "R"))
  45. (command "_pline")
  46. (while (= (getvar "cmdactive") 1 )
  47. (while (setq newline (read-line fo))
  48. (if (or (= (substr newline 1 1 ) "+")(= (substr newline 1 1 ) "-"))
  49. (progn
  50. (setq xyzlist (LM:ParseNumbers newline))
  51. ;(setq xyz (strcat (rtos (nth 0 xyzlist)2 4) "," (rtos (nth 1 xyzlist)2 4)))
  52. ;(command xyz) ; co-ords of line
  53. (command (list (nth 0 xyzlist) (nth 1 xyzlist) 0.0))
  54. );progn
  55. (princ "skip")
  56. );if
  57. ); while read file
  58. (command "") ; end line
  59. ) ; end pline while
  60. );defun
  61. ; run code
  62. (tunnel "C:\\acadtemp\\175475BK.txt")
  63. ;(command "saveas" "c:\\cadtemp\\175475BK" "close")
回复

使用道具 举报

2

主题

15

帖子

13

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 00:35:17 | 显示全部楼层
运行时。lsp返回错误:
 
 
有什么想法吗?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 05:01 , Processed in 1.037592 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表