Author Topic: Resolve path and dwg list  (Read 3203 times)

0 Members and 1 Guest are viewing this topic.

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Resolve path and dwg list
« on: October 13, 2006, 01:24:26 PM »
I am trying to create a text file of dwg files to be processed using VBA and Acad 2007.  I thought I would use the common control dialog box, but I cant find the reference to add.  I have VS2003 and VS2005 express for C# on machine. (just fyi in case it matters)  I also have office, Im running XP pro and Office 2003 i think.

Anyway, I would like to give users a way to point to files or directory of files for batch plotting.  The batch plotting part is done, I just need to create the file to use for printing.  Any ideas what I need to reference to get this functionality?
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #1 on: October 13, 2006, 04:05:27 PM »
Update

What i am trying to do is make a simple interface for some of my challenged users.  What I do is go to the folder I want to plot, and type

dir *.dwg /b/s > c:\dwgnum.dat

which creates a file that my code reads and plots.  I was thinking that if I could use the open dialog box to get a folder name w/ path, I could shell out and run my DOS command to create the file.
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #2 on: October 13, 2006, 04:06:21 PM »
I have tried to use an example of the Win API, but Im lost, so if that is how I should do it, I could use some pointers
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

MP

  • Seagull
  • Posts: 17664
  • Have thousands of dwgs to process? Contact me.
Engineering Technologist CAD Specialist Programmer Analyst
Design Drafting Document Control Automation.
cadanalyst@fastmail.com https://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

Bryco

  • Water Moccasin
  • Posts: 1851
Re: Resolve path and dwg list
« Reply #4 on: October 14, 2006, 02:22:24 AM »
CmdrDuh , I agree it's pretty confusing.
Here is a mix of a few different functions, including some from Mp's site. This is basically a class that does most of the folder,file handling stuff. BrowseCallbackProc needs to be in a standard module.
« Last Edit: October 14, 2006, 02:38:55 AM by Bryco »

Bryco

  • Water Moccasin
  • Posts: 1851
Re: Resolve path and dwg list
« Reply #5 on: October 18, 2006, 11:08:49 PM »
CmdrDuh, just wondering if it was useable to you?

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #6 on: October 23, 2006, 01:02:59 PM »
sorry, i went on holiday for 4 days.  i'm going to try those out today
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #7 on: October 23, 2006, 01:03:34 PM »
the fishing was great, 22 trout in 2 days.
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #8 on: October 23, 2006, 03:33:19 PM »
OK, its crashing on this line
Code: [Select]
mvarFileName = String(mvarMaxFileSize, 0) in the class init sub

Code: [Select]
Private Sub Class_Initialize()
    Set cFiles = New Collection
    mvarMaxFileSize = 256
    mvarFileName = String(mvarMaxFileSize, 0)
    Set Fs = CreateObject("Scripting.FileSystemObject")
End Sub

any ideas?  It looks like a cast that went wrong

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

Bryco

  • Water Moccasin
  • Posts: 1851
Re: Resolve path and dwg list
« Reply #9 on: October 23, 2006, 05:58:58 PM »
Hi CmdrDuh, I'm glad the fishing was so good, must have been a blast.

About the code, do you have incredibly long path names?
Like over  256 long, if so up the 256.
I don't know the workings of api's that well and I'm not sure if the 256 is bits or characters, but if the paths are really long try 512

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #10 on: October 23, 2006, 06:07:19 PM »
it never gets far enough for me to pick a path.

The error msg is :
Quote
Compile error:
Can't find project or library[/quote
« Last Edit: October 23, 2006, 06:08:49 PM by CmdrDuh »
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #11 on: October 23, 2006, 06:09:58 PM »
using this
Code: [Select]
Sub GetFolder()
    Dim CD As CommonDialog
    Dim sFolder As String
    Set CD = New CommonDialog  ' this line calls the init class
    CD.DialogTitle = "Pick the drawings folder:"
    sFolder = CD.BrowseForFolder("C")
    Debug.Print sFolder
End Sub
it goes to this
Code: [Select]
Private Sub Class_Initialize()
    Set cFiles = New Collection
    mvarMaxFileSize = 256
    mvarFileName = String(mvarMaxFileSize, 0)
    Set Fs = CreateObject("Scripting.FileSystemObject")
End Sub
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #12 on: October 23, 2006, 06:11:19 PM »
I have never used API calls, mostly because I never learned how, so I have no clue whats wrong
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

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Resolve path and dwg list
« Reply #13 on: October 23, 2006, 06:17:36 PM »
I was just told I might need VB6.  Anybody else have issues like this?
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

Bryco

  • Water Moccasin
  • Posts: 1851
Re: Resolve path and dwg list
« Reply #14 on: October 23, 2006, 08:54:32 PM »
There is a problem with   BrowseForFolderByPIDL as vb5 doesn't have a AddressOf , but I have a fix I used in acad2000. I'll have a look when I get home.