Maverick® 发表于 2006-10-10 11:46:24

代码请求

本人'我正在寻找可以用来列出dwg文件中包含的所有图像的代码。建议?

T.Willey 发表于 2006-10-10 11:55:45

建议#1&nbsp&nbsp

Bryco 发表于 2006-10-10 12:03:49

查找'ACAD_IMAGE_DICT#039;(字典),然后对所有图像进行单步扫描。

T.Willey 发表于 2006-10-11 04:19:12

你在找什么
Option Explicit
Sub GetImages()
Dim objDict As AcadDictionary
Set objDict = ThisDrawing.Dictionaries("ACAD_IMAGE_DICT")
If objDict.Count0 Then
Dim oEntity As AcadEntity
Dim objImage As AcadRasterImage
Dim tmpArr(1) As Variant
Dim imageColl As New Collection
For Each oEntity In oSset
Set objImage = oEntity
tmpArr(0) = objImage.Name
Debug.Print tmpArr(0)
tmpArr(1) = objImage.ImageFile
Debug.Print tmpArr(1)
imageColl.Add tmpArr
Erase tmpArr
Next
Else
MsgBox "No images inserted."
End If
End If
oSset.Delete
Set oSset = Nothing
End Sub脂肪;J#039~

Bryco 发表于 2006-10-11 08:40:59

感谢您的编码帮助
我试了一下你的代码,它被卡住了:设置objDict=ThisDrawing。词典(“ACAD\U IMAGE\U DICT”)
它为什么这样做?

Bryco 发表于 2006-10-11 10:15:50

 试试下面的例子,字典有点怪,因为它也可以是xrecord,所以typeof是一个很好的方法
;Dim ODIC作为一个加法 Dim-oDic作为加法 直径oD&nbsp
 设置oDics=ThisDrawing。词典 对于ODIC中的每个oD&nbsp&nbsp 如果oD的类型是加法,则&nbsp&nbsp&nbsp&nbsp 如果外径。名称=“”;ACAD_IMAGE_DICT“;然后&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 设置oDic=oD

T.Willey 发表于 2006-10-11 10:43:14

感谢所有的投入,但我'我决定只在字段中使用Diesel表达式。It#039;这要简单得多。

Bryco 发表于 2006-10-11 12:55:25


你好,布莱科,很好,一如既往,你打败了我,谢谢你,胖子;J#039~

Bryco 发表于 2006-10-11 13:08:45

问题可能是字典不是't在图纸中,因此图像在图纸中 我知道这是lisp中的一个问题,我不知道'我不知道/使用VBA,这就是为什么我没有#039;不要发布任何代码,只是一个想法 在lisp中,您将捕捉到错误以查看是否存在。

T.Willey 发表于 2006-10-11 23:16:26

我在一个purge sub中使用它,它列出了所有卸载的图像,并可以选择删除它们。我发现它非常方便,vba做得很好。
页: [1] 2
查看完整版本: 代码请求