Author Topic: Design Center  (Read 4210 times)

0 Members and 1 Guest are viewing this topic.

Matersammichman

  • Guest
Design Center
« on: July 17, 2006, 03:55:42 PM »
Can Design Center command be accessed through VBA?
If so, how?

Bob Wahr

  • Guest
Re: Design Center
« Reply #1 on: July 17, 2006, 04:01:56 PM »
Accessed how?  If you just want to launch it via VBA you could always go with ThisDrawing.SendCommand "ADCENTER"

Matersammichman

  • Guest
Re: Design Center
« Reply #2 on: July 17, 2006, 04:11:23 PM »
No, I want to dive deeper, like access the commands necessary to check xref data

Bob Wahr

  • Guest
Re: Design Center
« Reply #3 on: July 17, 2006, 04:25:57 PM »
If you want to interface with design center, I don't know but I have my doubts.  If you want to recreate the functionality, sure.

Matersammichman

  • Guest
Re: Design Center
« Reply #4 on: July 17, 2006, 04:32:22 PM »
Thanks Bob...
In a nutshell, what I would like to do is create an app where I can easily search all of the xrefs in a directory, and find out if they're still being used or not by files in the same directory. I can do it one at a time, but it sure would be nice to be able to batch process it so I can can the garbage quickly.

Matersammichman

  • Guest
Re: Design Center
« Reply #5 on: July 18, 2006, 07:30:52 AM »
further hints, Bob?

Bob Wahr

  • Guest
Re: Design Center
« Reply #6 on: July 18, 2006, 08:23:13 AM »
yes but if you mean "some code", not right now.  Right now in the world of Bob, it's 5:00am, I've had no coffee and I couldn't get me brain to code if I tried.  Seems to me like a good way to start would be to flow chart it (always a good idea) or at least write down a where you are, where you want to be, then go in and fill in the steps it will take to get there.  I would think about going at it something like this


[NotCode]
1. get a list of all drawings in a directory
2. open first drawing in list
2a. If you don't want them to open in autocad, look into ObjectDBX
3. check drawing for xrefs
4. put list of xrefs into an array
5. close drawing
6. For each remaining drawing in list
7. open drawing
8. check for xrefs
9. add each xref to the array, checking for duplicates as you go
10. close drawing
11. next drawing
12. compare original drawing list to list of drawings that are xreffed into drawings
13. report the ones that aren't used.
[/NotCode]

MikeJarosz

  • Guest
Re: Design Center
« Reply #7 on: July 18, 2006, 02:03:43 PM »
I wrote this some time ago. Make a list of files with full path and save as a text file. (mj.txt in the example below). Of course you will have to modify some of the code to fit your environment.




Option Base 1

Sub BlockReport()

Dim Filename As String
Dim F As Integer
Dim G As Integer
Dim Block As AcadBlock
Dim BlockType As String

'open files
Close
F = FreeFile()
Open "w:\a\sheet\mj.txt" For Input As #F
G = FreeFile()
Open "w:\a\BlockReport.txt" For Output As #G

Do While Not EOF(F)
    Line Input #F, Filename
    ThisDrawing.Application.Documents.Open Filename, ReadOnly
   
    For Each Block In ThisDrawing.Blocks
    If Left(Block.Name, 1) = "*" Then
        'dimension: do nothing
    Else
        BlockType = "BLOCK"
        If Block.IsLayout Then BlockType = "LAYOUT"
        If Block.IsXRef Then BlockType = "XREF"
        Print #G, Block.Name; Chr$(9); ThisDrawing.FullName; Chr$(9); BlockType
    End If
    Next Block
   
    ThisDrawing.Application.ActiveDocument.Close , savechanges = False
Loop

Close #F
Close #G
Debug.Print "DONE"

End Sub

Matersammichman

  • Guest
Re: Design Center
« Reply #8 on: July 18, 2006, 02:07:03 PM »
Mike,
Thanks, that's good for finding out what blocks are INSIDE a dwg, but what I'm looking for is finding out from witin a dwg, what other dwgs it's xref'd out into. I have a longhand way through Design Center, but it's laborious and slow.

Bob Wahr

  • Guest
Re: Design Center
« Reply #9 on: July 18, 2006, 02:14:15 PM »
There's only one way possible to find what drawings a drawing is xreffed into and that is to open the drawings and check.  Design center does it, the xref manager does it, you will have to do it.  When you xref a drawing in, the drawing is not modified to show that it has been xreffed.  I know it's not what you want to hear but it is the way the world works.

Matersammichman

  • Guest

Bob Wahr

  • Guest
Re: Design Center
« Reply #11 on: July 18, 2006, 02:18:55 PM »
and?

Matersammichman

  • Guest
Re: Design Center
« Reply #12 on: July 18, 2006, 02:56:43 PM »
Just sharing what info I have on the subject.
Did I say something wrong?

Bob Wahr

  • Guest
Re: Design Center
« Reply #13 on: July 18, 2006, 03:01:04 PM »
No, sorry, I guess that did come off as pretty crappy.  I was just asking what you were showing with that.  Is that what you are wanting to do?  If so, the steps I gave you with some additional fleshing out will get you there.  The code Mike posted will help with it.