测试该理论的一种简单方法是在评估外部vlax for循环后打印attdata的值。
正确,其中一个块属性名称与foreach循环中的名称不对应。
谢谢你的帮助。 不客气! Hi Marko
Thanks for the input, but that did not seem to work. The routine does not recognize the specified blocks.
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?
Aha, helps if you understand these nuances.
Sure...
CList_Duct.LSP 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:
(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 a1 a2 a3) attdata)) )An easy way to test this theory is to print the value of attdata after evaluation of the outer vlax-for loop.
Correct, one of the block attribute names did not correspond with the name in the foreach loop.
Thank you kindly for the help. You're welcome!
页:
1
[2]