Problem with the Publish command when called within VB.NET.

Problem with the Publish command when called within VB.NET.

Anonymous
Not applicable
416 Views
4 Replies
Message 1 of 5

Problem with the Publish command when called within VB.NET.

Anonymous
Not applicable
I have noticed a few other postings regarding this problem, however, I have not been able to find a solution yet. When I try running the publish command from within a VB.NET application I get the following FATAL ERROR: Unhandled Access Violation Reading 0x4caf778 Exception at 62d2e8aah. Here are the lines that cause the problem: strCommand = "(command " & Chr(34) & "-publish" & Chr(34) & " " & Chr(34) & "C:/temp/A00214.dsd" & Chr(34) & ")" & Chr(13) objAcadDoc.SendCommand(strCommand) If I break right before this call and try running the exact same command from the AutoCAD command prompt, everything works fine. Since I havn't had any luck with the SendCommand method, I'm also trying to implement the WinAPI SendMessage method. If anyone can post an example of how I would implement the SendMessage method from VB.NET it would help a lot. Here is what I have so far with the SendMessage method. This doesn't error on me, instead nothing happens at all. _ Public Shared Function SendMessageA(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long End Function _ Public Shared Function FindWindowA(ByVal lpClassName As String, ByVal lpWindowName As String) As Long End Function Public Function SendACADCommand(ByVal strCommand As String, ByVal objAcadDoc As AutoCAD.AcadDocument) As Boolean 'remeber that strCommand = "(command " & Chr(34) & "-publish" & Chr(34) & " " & Chr(34) & "C:/temp/A00214.dsd" & Chr(34) & ")" & Chr(13) Const WM_COPYDATA = &H4A Dim Hwnd As Long = FindWindowA(vbNullString, objAcadDoc.Name) SendMessageA(Hwnd, WM_COPYDATA, Hwnd, strCommand) End Function Thanks, Paul Thompson Continental Imaging Products paul.thompson@gocip.com (403)541-2545
0 Likes
417 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
I struggled with this in VBA last summer.
My solution was to run '-publish' fron lisp.
You will not get any of these error meassages.
My investigation from other newsgroups is there is an autodesk problem here.
This means to automate the publish command I must
build the 'dsd' from within lisp. this is difficult but not impossible.
0 Likes
Message 3 of 5

Anonymous
Not applicable
I have had success running the publish command from LISP as well. Unfortunatly if I try loading and running my lisp from inside VB, I still get this error. Only when I run the LISP from the command line do I get it to work. Have you been able to get the LISP to work from inside VB or just from the command line. Thanks, Paul. "peterw" wrote in message news:5961074.1075910541998.JavaMail.jive@jiveforum2.autodesk.com... > I struggled with this in VBA last summer. > My solution was to run '-publish' fron lisp. > You will not get any of these error meassages. > My investigation from other newsgroups is there is an autodesk problem here. > This means to automate the publish command I must > build the 'dsd' from within lisp. this is difficult but not impossible.
0 Likes
Message 4 of 5

Anonymous
Not applicable
I finally figured out a way around this issue. First I build all of my .dsd files and a master LISP file from within VB.NET. The master LISP file contains a seperate publish line for each .dsd file. I than use the Shell command in VB.NET to call acad.exe with the /b argument. The script that I call using the /b option will (1) load my new master LISP file, (2) run my new master LISP program to publish all of my .dwf files, and (3) quit to close down acad.exe. After the Shell command is finished executing I clean up all of the .dsd and .csv files and the master LISP file. I can also check out all of the .csv log files that were created during publish to find any problem files. "Paul Thompson" wrote in message news:402134e5_2@newsprd01... > I have had success running the publish command from LISP as well. > Unfortunatly if I try loading and running my lisp from inside VB, I still > get this error. Only when I run the LISP from the command line do I get it > to work. Have you been able to get the LISP to work from inside VB or just > from the command line. > > Thanks, > > Paul. > > > > "peterw" wrote in message > news:5961074.1075910541998.JavaMail.jive@jiveforum2.autodesk.com... > > I struggled with this in VBA last summer. > > My solution was to run '-publish' fron lisp. > > You will not get any of these error meassages. > > My investigation from other newsgroups is there is an autodesk problem > here. > > This means to automate the publish command I must > > build the 'dsd' from within lisp. this is difficult but not impossible. > >
0 Likes
Message 5 of 5

Anonymous
Not applicable
Don't try to do it through VBA at all. just write a dsd and batch file then call the batch with command line to start autocad. you can be publishing multiple multi-sheet DWF files in the background this way...
0 Likes