Author Topic: multiple xrefs....  (Read 7626 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
multiple xrefs....
« on: September 15, 2005, 06:43:35 PM »
Do any of you have a routine to force an xref to be detached even if it exist more than once in a drawing on multiple tabs?

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: multiple xrefs....
« Reply #1 on: September 15, 2005, 06:48:17 PM »
If you erase all instances of an xref, save the drawing, and then re-open it AutoCAD will dump the xref definition all by itself. Of course, one can automate this via lisp /vba too ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: multiple xrefs....
« Reply #2 on: September 15, 2005, 06:56:33 PM »
Michael,

I've been deleting all instances manually and got tired of it.....so you know anyone that could whip up this routine :wink:.

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: multiple xrefs....
« Reply #3 on: September 15, 2005, 07:06:49 PM »
Michael,

I've been deleting all instances manually and got tired of it.....so you know anyone that could whip up this routine :wink:.

Ron

Ahhh. Sorry bud, I'm tied up until 10pm +/- and the little bit of grey matter I'll have left after that won't be of much use (not that I'm currently all that coherent). But fear not, lot's of capable hands here ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Bob Wahr

  • Guest
Re: multiple xrefs....
« Reply #4 on: September 15, 2005, 07:31:21 PM »
no error control, limited thought, less testing but this should get you.

Code: [Select]
Sub KillDaXwefs()
Dim objWascawyXwef As AcadBlock
Dim objblks As AcadBlocks
Dim intCnt As Integer
Set objblks = ThisDrawing.Blocks
For intCnt = objblks.Count - 1 To 0 Step -1
  Set objblk = objblks(intCnt)
  If objblk.IsXRef Then
    objblk.Detach
  End If
Next intCnt
End Sub

Andrea

  • Water Moccasin
  • Posts: 2372
Re: multiple xrefs....
« Reply #5 on: September 15, 2005, 08:27:22 PM »
simply use....


OVERKILL  command.

 :lol:
Keep smile...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: multiple xrefs....
« Reply #6 on: September 15, 2005, 11:52:32 PM »
Assuming all instances share the same insert point and scale would be folly imo.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: multiple xrefs....
« Reply #7 on: September 15, 2005, 11:53:44 PM »
Assuming all instances share the same insert point and scale would be folly imo.

Isn't that what backups are for ??
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: multiple xrefs....
« Reply #8 on: September 15, 2005, 11:57:42 PM »
Isn't that what backups are for ??

<Jeff Spicolli> Whaaaa? </Jeff Spicolli>
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: multiple xrefs....
« Reply #9 on: September 16, 2005, 12:03:42 AM »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: multiple xrefs....
« Reply #10 on: September 16, 2005, 12:27:53 AM »
lol, touche.

 :-D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

ronjonp

  • Needs a day job
  • Posts: 7529
Re: multiple xrefs....
« Reply #11 on: September 16, 2005, 10:05:58 AM »
Quote
simply use....


OVERKILL  command.
No workie...

Bob,

I get an error with your code "Duplicate Key" on the line     objblk.Detach

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Bob Wahr

  • Guest
Re: multiple xrefs....
« Reply #12 on: September 16, 2005, 11:04:58 AM »
Code: [Select]
Sub KillDaXwefs()
Dim objWascawyXwef As AcadBlock
Dim objblks As AcadBlocks
Dim intCnt As Integer
Dim objSelSet As AcadSelectionSet
Dim objSelSets As AcadSelectionSets
Dim intGroup(0) As Integer
Dim varData(0) As Variant
Dim strSetName As String
Dim objBlkRef As AcadBlockReference

Set objSelSets = ThisDrawing.SelectionSets
strSetName = "LeftInAlbekoikie"
  intGroup(0) = 0: varData(0) = "INSERT"
 
  KillSet strSetName
  Set objSelSet = objSelSets.Add(strSetName)
  objSelSet.Select acSelectionSetAll, , , intGroup, varData

  For Each objBlkRef In objSelSet
    If TypeOf objBlkRef Is AcadExternalReference Then
      objBlkRef.Delete
    End If
  Next objBlkRef
Set objblks = ThisDrawing.Blocks
For intCnt = objblks.Count - 1 To 0 Step -1
  Set objWascawyXwef = objblks(intCnt)
  If objWascawyXwef.IsXRef Then
    objWascawyXwef.Detach
  End If
Next intCnt

End Sub
give this one a shot then

ronjonp

  • Needs a day job
  • Posts: 7529
Re: multiple xrefs....
« Reply #13 on: September 16, 2005, 11:19:04 AM »
Now it says sub or function not defined:  KILLSET

hhmmm

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Bob Wahr

  • Guest
Re: multiple xrefs....
« Reply #14 on: September 16, 2005, 11:20:22 AM »
sorry.  Toss this in with it
Code: [Select]
Function KillSet(strSet As String)
  Dim objSelSet As AcadSelectionSet
  Dim objSelSets As AcadSelectionSets
 
  Set objSelSets = ThisDrawing.SelectionSets
     
  For Each objSelSet In objSelSets
    If objSelSet.Name = strSet Then
      ThisDrawing.SelectionSets.Item(strSet).Delete
    Exit For
    End If
  Next

End Function