乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 243|回复: 12

External References, can you change the overlay property?

[复制链接]

7

主题

16

帖子

2

银币

初来乍到

Rank: 1

铜币
44
发表于 2008-10-16 18:30:54 | 显示全部楼层 |阅读模式
I need a quick way to look up all the xrefs in a drawing and then change them to all overlay. I have not found where that control might be. Can someone point me in the right direction? Also how do I get VBA to make a collection of Xref names?
Thanks,
Alex
回复

使用道具 举报

10

主题

63

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
103
发表于 2008-10-16 18:47:53 | 显示全部楼层
With lisp or VBA, you might have to detach and re-attach the xref. Not sure about with .NET languages like C# or VB.NET. Probably no need.
回复

使用道具 举报

7

主题

16

帖子

2

银币

初来乍到

Rank: 1

铜币
44
发表于 2008-10-16 18:59:37 | 显示全部楼层
You can't change the attachment type, you have to detach and reattach.
回复

使用道具 举报

3

主题

88

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2008-10-16 19:04:07 | 显示全部楼层
With everything I've been reading lately, I would like to do it in VBA. Would I have to make a collection of the file name, file path and insertion point. (We do all xrefs at 1 to 1 scale and don't do rotations.) Then detach all xrefs using the file name. Then attach again as an overlay, using the file name, and path and insertion point. Is that the basic idea?
回复

使用道具 举报

86

主题

744

帖子

6

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1092
发表于 2008-10-16 19:20:35 | 显示全部楼层
Do a filtered selection set, then a for each loop on the set.  Get the path/name of the xref and the insertion point, detach, then attach the new one.
Can you go from here or do you need some help?
回复

使用道具 举报

86

主题

744

帖子

6

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1092
发表于 2008-10-16 19:21:37 | 显示全部楼层
I actually wrote something in VBA to do this a few years ago but probably don't have it anymore.  I'll check though.
回复

使用道具 举报

7

主题

16

帖子

2

银币

初来乍到

Rank: 1

铜币
44
发表于 2008-10-16 19:57:57 | 显示全部楼层
I couldn't find it so I did it again really quickly.  This is less elegant than it could be because I did some quick cribbing and patching from other things.  It will also only work on modelspace xrefs.  If it hits a pspace xref it will detach it and reattach in mspace.  I've been told before that I shouldn't post any code unless it's fully tested and bulletproof because I'm wasting the persons time if they have to actually put any effort into it themselves, but this is not tested.  It should work.  If it doesn't, it will with minor tweaking.
  1. Public Sub Layover()
  2. Dim objSelSets As AcadSelectionSets
  3. Dim objSelSet As AcadSelectionSet
  4. Dim objOverlay As AcadExternalReference
  5. Dim intType(0) As Integer
  6. Dim varData(0) As Variant
  7. Dim strPath As String
  8. Dim strName As String
  9. Dim dblInsPnt(0 To 2) As Double
  10. Dim objXref As AcadExternalReference
  11. Dim objEnt As AcadEntity
  12. Dim objBlk As AcadBlock
  13. Dim objBlks As AcadBlocks
  14. Set objBlks = ThisDrawing.Blocks
  15. Set objSelSets = ThisDrawing.SelectionSets
  16. For Each objSelSet In objSelSets
  17.    If objSelSet.Name = "GetXrefs" Then
  18.      objSelSets.Item("GetXrefs").Delete
  19.      Exit For
  20.    End If
  21. Next
  22. Set objSelSet = objSelSets.Add("GetXrefs")
  23. intType(0) = 0
  24. varData(0) = "INSERT"
  25. objSelSet.Select 5, filtertype:=intType, filterdata:=varData
  26.    For Each objEnt In objSelSet
  27.      Set objBlk = objBlks(objEnt.Name)
  28.      If objBlk.IsXRef Then
  29.        Set objXref = objEnt
  30.        strName = obxref.Name
  31.        strPath = objXref.Path
  32.        dblInsPt = objXref.InsertionPoint
  33.        objBlk.Detach
  34.        Set objOverlay = ModelSpace.AttachExternalReference(strPath, strName, dblInsPnt, 1, 1, 1, 1, True)
  35.      End If
  36.    Next objEnt
  37. End Sub
回复

使用道具 举报

7

主题

16

帖子

2

银币

初来乍到

Rank: 1

铜币
44
发表于 2008-10-16 19:59:16 | 显示全部楼层
Oh, no error control, use at your own risk or ignore at will, blahgitty, blahgitty, blah.
回复

使用道具 举报

3

主题

88

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2008-10-16 22:02:01 | 显示全部楼层
Nice code Boob.
Now could you change it to do something entirely different.  I don't have time to tell you exactly what I need, so please make sure it works.  
Thanks in advance.  
PS.  I'm only trying to help others learn by asking you to do my job.
回复

使用道具 举报

3

主题

88

帖子

4

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
100
发表于 2008-10-17 07:36:35 | 显示全部楼层
Somebody needs a nap.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-4 01:22 , Processed in 0.726949 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表