乐筑天下

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

[编程交流] 这么做的简单方法???

[复制链接]

6

主题

21

帖子

15

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 20:03:28 | 显示全部楼层 |阅读模式
嗨,frids,
 
如果有任何其他方法可以简单地完成此程序。。请帮帮我
plpl。csv
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-5 20:08:04 | 显示全部楼层
将字符串内容从读取行转换为列表
 
删除所有“,”
将字符串转换为列表
使用另一个列表进行比较检查
 
避免使用多个“如果”,而是使用cond或while函数在满足条件时终止评估
回复

使用道具 举报

4

主题

2143

帖子

2197

银币

限制会员

铜币
-24
发表于 2022-7-5 20:10:46 | 显示全部楼层
请使用代码标签,而不是代码的引号标签。
 
代码发布指南
回复

使用道具 举报

6

主题

21

帖子

15

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 20:13:35 | 显示全部楼层
  1. (defun c:exc()
  2. (setq f (findfile "plpl.csv"))
  3. (setq g (open f "r"))
  4. (setq tmpstr 0)
  5. (while (/= tmpstr nil)
  6. (cond
  7. (
  8. (setq tmpstr (read-line g))
  9. (assing_val)
  10. )
  11. )
  12. )
  13. (princ))
  14. (defun assing_val ()
  15. (setq idx (strlen tmpstr))
  16. ;Pipe length
  17. (if (and (= (substr tmpstr 3 5) "ND,25") (/= (substr tmpstr 8 1) "0")) (setq ND25 (substr tmpstr 9 4) ))
  18. (if (and (= (substr tmpstr 3 5) "ND,50") (/= (substr tmpstr 8 1) "0")) (setq ND50 (substr tmpstr 9 4) ))
  19. (if (and (= (substr tmpstr 3 5) "ND,80") (/= (substr tmpstr 8 1) "0")) (setq ND80 (substr tmpstr 9 4) ))
  20. (if (and (= (substr tmpstr 3 6) "ND,100") (/= (substr tmpstr 9 1) "0")) (setq ND100 (substr tmpstr 10 4)))
  21. (if (and (= (substr tmpstr 3 6) "ND,150") (/= (substr tmpstr 9 1) "0")) (setq ND150 (substr tmpstr 10 5)))
  22. (if (and (= (substr tmpstr 3 6) "ND,200") (/= (substr tmpstr 9 1) "0")) (setq ND200 (substr tmpstr 10 5)))
  23. (if (and (= (substr tmpstr 3 6) "ND,250") (/= (substr tmpstr 9 1) "0")) (setq ND250 (substr tmpstr 10 5)))
  24. (if (and (= (substr tmpstr 3 6) "ND,300") (/= (substr tmpstr 9 1) "0")) (setq ND300 (substr tmpstr 10 5)))
  25. (if (and (= (substr tmpstr 3 6) "ND,350") (/= (substr tmpstr 9 1) "0")) (setq ND350 (substr tmpstr 10 5)))
  26. (if (and (= (substr tmpstr 3 6) "ND,400") (/= (substr tmpstr 9 1) "0")) (setq ND400 (substr tmpstr 10 5)))
  27. (if (and (= (substr tmpstr 3 6) "ND,450") (/= (substr tmpstr 9 1) "0")) (setq ND450 (substr tmpstr 10 5)))
  28. (if (and (= (substr tmpstr 3 6) "ND,500") (/= (substr tmpstr 9 1) "0")) (setq ND500 (substr tmpstr 10 5)))
  29. (if (and (= (substr tmpstr 3 6) "ND,550") (/= (substr tmpstr 9 1) "0")) (setq ND550 (substr tmpstr 10 5)))
  30. (if (and (= (substr tmpstr 3 6) "ND,600") (/= (substr tmpstr 9 1) "0")) (setq ND600 (substr tmpstr 10 5)))
  31. (if (and (= (substr tmpstr 3 6) "ND,650") (/= (substr tmpstr 9 1) "0")) (setq ND650 (substr tmpstr 10 5)))
  32. (if (and (= (substr tmpstr 3 6) "ND,700") (/= (substr tmpstr 9 1) "0")) (setq ND700 (substr tmpstr 10 5)))
  33. (if (and (= (substr tmpstr 3 6) "ND,750") (/= (substr tmpstr 9 1) "0")) (setq ND750 (substr tmpstr 10 5)))
  34. (if (and (= (substr tmpstr 3 6) "ND,800") (/= (substr tmpstr 9 1) "0")) (setq ND800 (substr tmpstr 10 5)))
  35. (if (and (= (substr tmpstr 3 6) "ND,850") (/= (substr tmpstr 9 1) "0")) (setq ND850 (substr tmpstr 10 5)))
  36. (if (and (= (substr tmpstr 3 6) "ND,900") (/= (substr tmpstr 9 1) "0")) (setq ND900 (substr tmpstr 10 5)))
  37. (if (and (= (substr tmpstr 3 6) "ND,950") (/= (substr tmpstr 9 1) "0")) (setq ND950 (substr tmpstr 10 5)))
  38. (if (and (= (substr tmpstr 3 7) "ND,1000") (/= (substr tmpstr 10 1) "0")) (setq ND950 (substr tmpstr 11 5)))
  39. (if (and (= (substr tmpstr 3 7) "ND,1050") (/= (substr tmpstr 10 1) "0")) (setq ND1050 (substr tmpstr 11 5)))
  40. (if (and (= (substr tmpstr 3 7) "ND,1100") (/= (substr tmpstr 10 1) "0")) (setq ND1100 (substr tmpstr 11 5)))
  41. (if (and (= (substr tmpstr 3 7) "ND,1150") (/= (substr tmpstr 10 1) "0")) (setq ND1150 (substr tmpstr 11 5)))
  42. (if (and (= (substr tmpstr 3 7) "ND,1200") (/= (substr tmpstr 10 1) "0")) (setq ND1200 (substr tmpstr 11 5)))
  43. (if (and (= (substr tmpstr 3 7) "ND,1250") (/= (substr tmpstr 10 1) "0")) (setq ND1250 (substr tmpstr 11 5)))
  44. (if (and (= (substr tmpstr 3 7) "ND,1300") (/= (substr tmpstr 10 1) "0")) (setq ND1300 (substr tmpstr 11 5)))
  45. (if (and (= (substr tmpstr 3 7) "ND,1350") (/= (substr tmpstr 10 1) "0")) (setq ND1350 (substr tmpstr 11 5)))
  46. (if (and (= (substr tmpstr 3 7) "ND,1400") (/= (substr tmpstr 10 1) "0")) (setq ND1400 (substr tmpstr 11 5)))
  47. (if (and (= (substr tmpstr 3 7) "ND,1450") (/= (substr tmpstr 10 1) "0")) (setq ND1450 (substr tmpstr 11 5)))
  48. (if (and (= (substr tmpstr 3 7) "ND,1500") (/= (substr tmpstr 10 1) "0")) (setq ND1500 (substr tmpstr 11 5)))
  49. (if (and (= (substr tmpstr 3 7) "ND,1550") (/= (substr tmpstr 10 1) "0")) (setq ND1550 (substr tmpstr 11 5)))
  50. (if (and (= (substr tmpstr 3 7) "ND,1600") (/= (substr tmpstr 10 1) "0")) (setq ND1600 (substr tmpstr 11 5)))
  51. (if (and (= (substr tmpstr 3 7) "ND,1650") (/= (substr tmpstr 10 1) "0")) (setq ND1650 (substr tmpstr 11 5)))
  52. (if (and (= (substr tmpstr 3 7) "ND,1700") (/= (substr tmpstr 10 1) "0")) (setq ND1700 (substr tmpstr 11 5)))
  53. (if (and (= (substr tmpstr 3 7) "ND,1750") (/= (substr tmpstr 10 1) "0")) (setq ND1750 (substr tmpstr 11 5)))
  54. (if (and (= (substr tmpstr 3 7) "ND,1800") (/= (substr tmpstr 10 1) "0")) (setq ND1800 (substr tmpstr 11 5)))
  55. (if (and (= (substr tmpstr 3 7) "ND,1850") (/= (substr tmpstr 10 1) "0")) (setq ND1850 (substr tmpstr 11 5)))
  56. (if (and (= (substr tmpstr 3 7) "ND,1900") (/= (substr tmpstr 10 1) "0")) (setq ND1900 (substr tmpstr 11 5)))
  57. (if (and (= (substr tmpstr 3 7) "ND,1950") (/= (substr tmpstr 10 1) "0")) (setq ND1950 (substr tmpstr 11 5)))
  58. (if (and (= (substr tmpstr 3 7) "ND,2000") (/= (substr tmpstr 10 1) "0")) (setq ND2000 (substr tmpstr 11 5)))
  59. ;Elbow length
  60. (princ))
回复

使用道具 举报

6

主题

21

帖子

15

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 20:18:31 | 显示全部楼层
非常感谢。我为我的程序张贴代码标签。
请用其他方法帮助我?
回复

使用道具 举报

6

主题

21

帖子

15

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 20:20:40 | 显示全部楼层
“当我阅读CVS文件时,这是一种法律行为,这就是我为什么打电话给我的程序。
 
你能把字符串转换成一个列表吗。请
回复

使用道具 举报

0

主题

375

帖子

385

银币

限制会员

铜币
-7
发表于 2022-7-5 20:24:39 | 显示全部楼层
  1. (setq l (read-line g))
  2. (setq item (read (strcat "(" (vl-string-translate "," " " l) ")")))
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-5 20:28:10 | 显示全部楼层
 
 
就像那样
回复

使用道具 举报

6

主题

21

帖子

15

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 20:30:32 | 显示全部楼层
谢谢你的快速回复。让我试试这个。。。。
回复

使用道具 举报

pBe

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-5 20:34:44 | 显示全部楼层
这里的常数值是多少?源还是目标?查看if语句,如果值位于excel文件中,则如果满足targetsource或sourcetarget的条件,则为每个值“分配”一个变量。你处理这件事的方式有点奇怪,我认为你做得不对。
 
阿南丹这一套的目的是什么?
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-12 00:54 , Processed in 0.401678 second(s), 72 queries .

© 2020-2025 乐筑天下

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