原打算在绘图时添加些内容,但不知为何一直出错,正好借mycad兄的帖子,一事不烦2主了! setname 的问题 是:提供的输入无效。请重新检查输入并重试。 我试过2个变量如dt(0 to 1)...,就通过了! Sub SetName() Dim Ent As AcadEntity, pt, dt(0 To 2) As Integer, Str(0 To 2) dt(0) = 1001: dt(1) = 1002: dt(2) = 1003 With ThisDrawing.Utility .GetEntity Ent, pt, "赋名对象:》" Str(0) = "水线": Str(1) = "200sx": Str(2) = "30mm" 'Str(1) = .GetString(False, "对象名称:》") 'Str(2) = .GetString(False, "对象厚度:》") End With Ent.SetXData dt, Str End Sub getname 问题:直接报错及退出cad Sub GetName() Dim Ent As AcadEntity, pt, dt, Str, tep, Mystr$ ThisDrawing.Utility.GetEntity Ent, pt, "取值对象:》" Ent.GetXData "", dt, Str If VarType(Str) <> vbEmpty Then For Each tep In Str Mystr = Mystr & vbCrLf & tep Next End If ThisDrawing.Utility.Prompt Mystr End Sub
|