乐筑天下

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

[编程交流] 动态块提取到表

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 17:44:10 | 显示全部楼层
在不测试代码的情况下,我怀疑出现错误的原因是其中一个属性值为null,因为在将foreach循环推送到主数据列表之前,在评估foreach循环之后,没有测试包含每个属性值的变量的有效性:
测试该理论的一种简单方法是在评估外部vlax for循环后打印attdata的值。
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 17:47:50 | 显示全部楼层
 
 
正确,其中一个块属性名称与foreach循环中的名称不对应。
 
 
谢谢你的帮助。
回复

使用道具 举报

63

主题

6297

帖子

6283

银币

后起之秀

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

铜币
358
发表于 2022-7-5 17:52:27 | 显示全部楼层
不客气!
回复

使用道具 举报

6

主题

62

帖子

57

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 17:54:07 | 显示全部楼层
回复

使用道具 举报

6

主题

62

帖子

57

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 17:56:47 | 显示全部楼层
Hi Marko
 
Thanks for the input, but that did not seem to work. The routine does not recognize the specified blocks.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:01:20 | 显示全部楼层
 
Table names (i.e. layers, blocks, linetypes etc.) which contain the pipe character are xref-dependent items, with the content to the left of the pipe equal to the name of the xref from which they are derived.
 
 
Can you post your current modified code?
回复

使用道具 举报

6

主题

62

帖子

57

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 18:04:35 | 显示全部楼层
 
Aha, helps if you understand these nuances.
 
 
Sure...
 
CList_Duct.LSP
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:06:52 | 显示全部楼层
Without testing the code, I suspect that the error arises because one of the attribute values is null, as the variables holding each attribute value are not tested for validity following evaluation of the foreach loop before being pushed onto the main data list:
  1. (progn           (setq atts (vlax-invoke x 'getattributes))       (foreach att atts             (cond ((wcmatch (vla-get-tagstring att) "DUCT_START")                    (setq a1 (vla-get-textstring att))            ;(setq coordStart (vlax-get att insertionpoint))                   )                   ((wcmatch (vla-get-tagstring att) "DUCT_END")                    (setq a2 (vla-get-textstring att))                    ;(setq coordEnd (vlax-get att insertionpoint))                   )                   ((wcmatch (vla-get-tagstring att) "DUCT_TYPE")                    (setq a3 (vla-get-textstring att))                   )             ) ;end Cond           ) ; end ForEach           (setq attdata (cons (list [highlight]a1 a2 a3[/highlight]) attdata))         )
An easy way to test this theory is to print the value of attdata after evaluation of the outer vlax-for loop.
回复

使用道具 举报

6

主题

62

帖子

57

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-5 18:10:03 | 显示全部楼层
 
 
Correct, one of the block attribute names did not correspond with the name in the foreach loop.   
 
 
Thank you kindly for the help.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:13:40 | 显示全部楼层
You're welcome!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-7-13 23:20 , Processed in 0.587228 second(s), 70 queries .

© 2020-2025 乐筑天下

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