参数标记无效



我正在Autocad中对块插入进行一些自定义。设置属性时,我的过程中出现错误:

"设置标记字符串时参数标记无效"

代码如下:

Sub Ch10_GettingAttributes()
 ' Create the block
 Dim blockObj As AcadBlock
 Dim insertionPnt(0 To 2) As Double
 insertionPnt(0) = 0
 insertionPnt(1) = 0
 insertionPnt(2) = 0
 Set blockObj = ThisDrawing.Blocks.Add _
 (insertionPnt, "TESTBLOCK")
 ' Define the attribute definition
 Dim attributeObj As AcadAttribute
 Dim height As Double
 Dim mode As Long
 Dim prompt As String
 Dim insertionPoint(0 To 2) As Double
 Dim tag As String
 Dim value As String
 height = 1#
 mode = acAttributeModeVerify
 prompt = "Attribute Prompt"
 insertionPoint(0) = 5
 insertionPoint(1) = 5
 insertionPoint(2) = 0
 tag = "Attribute Tag"
 value = "Attribute Value"
 ' Create the attribute definition object on the block
 Set attributeObj = blockObj.AddAttribute(height, mode,_
prompt, insertionPoint, tag, value)
 End Sub

什么会导致此错误?

好吧,错误消息相当明确,您有一个"设置TagString时参数标签无效"

因此,只需删除标签值中的空格,您就可以开始了。它不支持空格。

tag = "Attribute Tag" 'BAD
tag = "AttributeTag" 'OK

相关内容

  • 没有找到相关文章

最新更新