明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 554|回复: 1

插入失败

[复制链接]
发表于 2016-5-10 16:33:15 | 显示全部楼层 |阅读模式
  1. Private Sub CommandButton6_Click()
  2. Dim i&
  3. Dim insertionPnt(0 To 2) As Double
  4. Dim blockRefObj As AcadBlockReference
  5. Dim blockRefObj1 As AcadBlockReference
  6. Dim Obj1 As Object
  7. On Error Resume Next
  8. insertionPnt(0) = 0#: insertionPnt(1) = 0#: insertionPnt(2) = 0#
  9. Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "C:\Program Files (x86)\AutoCAD 2007\块.dwg", 1#, 1#, 1#, 0)’在第二个dwg文档内插入失败。除非关闭所有CAD。
  10. For Each Obj1 In ThisDrawing.ModelSpace
  11. If Obj1.Name = "块" Then Obj1.Delete
  12. Next
  13. Set blockRefObj = Nothing
  14. CR:
  15. i = i + 1
  16. Set blockRefObj1 = ThisDrawing.ModelSpace.InsertBlock(ThisDrawing.Utility.GetPoint, "超级数据拾取", 1#, 1#, 1#, 0)
  17.    Dim varAttributes As Variant
  18.     varAttributes = blockRefObj1.GetAttributes
  19.     varAttributes(0).TextString = i & "#"
  20. If CheckKey(VK_ESCAPE) = True Then
  21.      varAttributes(0).TextString = i - 1 & "#"
  22.        Exit Sub
  23. End If
  24. 'If CheckKey(VK_SHIFT) = True Then

  25.    GoTo CR
  26. 'End If
  27. End Sub

该贴已经同步到 尼玛的臭屌丝的微博
发表于 2016-6-5 15:08:54 | 显示全部楼层
第二次插入不需要路径和".dwg",即
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, "块", 1#, 1#, 1#, 0)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-29 01:43 , Processed in 0.154762 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表