| Author |
Message |
Matthew Hastings
Guest
|
Posted:
Fri Jan 07, 2005 4:40 am Post subject:
Custom Programs |
|
|
Hi, I have a custom program writen in VB6 that works without a problem in AutoCad 2002. But if I run the program in AutoCad 2005 it stop in the code and I get a runtime error.
frmProgress.ProgressBar1.Value = 27
Application.Update
Application.ZoomExtents <<<stops here
Unload frmProgress
Unload frmDrawShed
This is the error message I get . Run-time error '-2145320932 (8021001c)':AutoCAD Main window is invisible.
Any help would be appreciated. I have support subscription with autodesk. This is what they suggested which wasn't much help (Thank you for choosing Autodesk Subscription.
We are unable to help you with customization issues, as the Product Support team provides support only on product related queries and we do not have the required resources to support API related queries.
Request you to please go through Questions and Answers available at the following link
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770215
For a complete description of the new and changed objects, as well as instructions on how to migrate your VBA projects, please refer the Active X and VBA Developers Guide in the AutoCAD 2005 help files.
You may refer to http://www.autodesk.com/adn for more details on API support.
I am sorry for not being able to help you much on this occasion.
Hope the above information helps.)
This makes me wounder why I paid for support in the first place. If anyone can help me it would be much appreciated.
|
|
| Back to top |
|
 |
Laurie Comerford
Guest
|
Posted:
Fri Jan 07, 2005 5:15 am Post subject:
Re: Custom Programs |
|
|
Hi Matthew,
In addition, they could have told you that you can join the Autodesk
Developers Network where you can get support for things like this. (Cost
may be prohibitive for an individual.)
However, their advice to come here is sensible as there are many users here
who will try to help.
Most likely you will find that your VB code has a reference to the R2000
format drawing objects.
In later versions of AutoCAD you will need a reference to the R2004 format
drawing objects.
Open your VB project and check the references. Compile the file under a
suitable name to distinguish it from the original.
--
Laurie Comerford
CADApps
www.cadapps.com.au
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:9490337.1105054842811.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Hi, I have a custom program writen in VB6 that works without a problem in
AutoCad 2002. But if I run the program in AutoCad 2005 it stop in the code |
and I get a runtime error.
| Quote: |
frmProgress.ProgressBar1.Value = 27
Application.Update
Application.ZoomExtents <<<stops here
Unload frmProgress
Unload frmDrawShed
This is the error message I get . Run-time error '-2145320932
(8021001c)':AutoCAD Main window is invisible.
Any help would be appreciated. I have support subscription with autodesk.
This is what they suggested which wasn't much help (Thank you for choosing |
Autodesk Subscription.
| Quote: |
We are unable to help you with customization issues, as the Product
Support team provides support only on product related queries and we do not |
have the required resources to support API related queries.
and VBA Developers Guide in the AutoCAD 2005 help files.
| Quote: |
You may refer to http://www.autodesk.com/adn for more details on API
support.
I am sorry for not being able to help you much on this occasion.
Hope the above information helps.)
This makes me wounder why I paid for support in the first place. If anyone
can help me it would be much appreciated. |
|
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Fri Jan 07, 2005 6:34 am Post subject:
Re: Custom Programs |
|
|
Do you have an active document at the time of the zoom ??
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:9490337.1105054842811.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Hi, I have a custom program writen in VB6 that works without a problem in
AutoCad 2002. But if I run the program in AutoCad 2005 it stop in the code
and I get a runtime error.
frmProgress.ProgressBar1.Value = 27
Application.Update
Application.ZoomExtents <<<stops here
Unload frmProgress
Unload frmDrawShed
This is the error message I get . Run-time error '-2145320932
(8021001c)':AutoCAD Main window is invisible.
Any help would be appreciated. I have support subscription with autodesk.
This is what they suggested which wasn't much help (Thank you for choosing
Autodesk Subscription.
We are unable to help you with customization issues, as the Product
Support team provides support only on product related queries and we do
not have the required resources to support API related queries.
Request you to please go through Questions and Answers available at the
following link
http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=770215
For a complete description of the new and changed objects, as well as
instructions on how to migrate your VBA projects, please refer the Active
X and VBA Developers Guide in the AutoCAD 2005 help files.
You may refer to http://www.autodesk.com/adn for more details on API
support.
I am sorry for not being able to help you much on this occasion.
Hope the above information helps.)
This makes me wounder why I paid for support in the first place. If anyone
can help me it would be much appreciated. |
|
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Fri Jan 07, 2005 7:59 am Post subject:
Re: Custom Programs |
|
|
| Hi Jorge, no at the time the program is run all that is active is AutoCad 2005, the form from the program, and a progress bar. I have tried unloading the form and progress bar before zooming but it get the error. |
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Fri Jan 07, 2005 8:54 am Post subject:
Re: Custom Programs |
|
|
Hi Laurie, do you mean in the visual basic editor, tools menu, reference I had a look there but I couldn't find R2000
format drawing objects or R2004 format drawing objects. In the list. Is this the spot you are talking about I'm still learning. Thanks. |
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Fri Jan 07, 2005 9:03 am Post subject:
Re: Custom Programs |
|
|
| Hi Laurie, had alook at you companys web site it mentions training just woundering what AutoCad and Visual basic training courses you have in Melbourne ? |
|
| Back to top |
|
 |
Mike Tuersley
Guest
|
Posted:
Fri Jan 07, 2005 9:52 am Post subject:
Re: Custom Programs |
|
|
What Jorge meant was is there a drawing open. If no drawing is open, then
you can't do a zoom extents.
You also need to show more code. For example what is Application and how do
you set it? By default, Application is the program you are runnning which
would be your VB6 app [or are you really in VBA?]; Application would not be
AutoCAD.
-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon... |
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Fri Jan 07, 2005 10:28 am Post subject:
Re: Custom Programs |
|
|
Yes there is a drawing open after the program stops. you can zoom from the command line. I've posted more code I hope it helps.
Private Sub Form_Load()
frmDrawShed.Caption = "Draw Shed Ver - " & App.Major & "." & App.Minor & "." & App.Revision
On Error Resume Next
'Get the AutoCad Application
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
'Start AutoCAD
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
Set acadDoc = acadApp.ActiveDocument
Set ModelSpace = acadDoc.ModelSpace
cmbColumnType.SetFocus
NumBay = txtNumBays.text
UpDown1.Max = NumBay
ShedWidth = txtShedWidth
ReDim BaySize(4)
NumBay = 4
BaySize(1) = 6000: BaySize(2) = 6000: BaySize(3) = 6000: BaySize(4) = 6000
ReDim MullSizeA(2)
MullNumA = 1
MullSizeA(1) = 5835
MullSizeA(2) = 5835
ReDim MullSizeB(2)
MullNumB = 1
MullSizeB(1) = 5835
MullSizeB(2) = 5835
Private Sub cmdDraw_Click()
Dim pnt1(0 To 2) As Double
Dim n As Integer
Dim MullTotal As Double
Dim MullTotalB As Double
pnt1(0) = 0: pnt1(1) = 0
If Not CheckBaySize() Then
MsgBox "There is a Zero value in the Bay Size." & Chr(10) & "You should correct the error.", 48
txtBaySize.SetFocus
Exit Sub
End If
SWidth = 0
SWOver = 0
For n = 1 To cmbMullNumbera + 1
SWidth = SWidth + MullSizeA(n)
Next n
If SWidth > txtShedWidth Then
SWOver = SWidth - txtShedWidth
MsgBox "The Mullion spacings(c) exceed the Shed Width by " & SWOver
Exit Sub
End If
SWidth = 0
SWOver = 0
For n = 1 To cmbMullNumberb + 1
SWidth = SWidth + MullSizeB(n)
Next n
If SWidth > txtShedWidth Then
SWOver = SWidth - txtShedWidth
MsgBox "The Mullion spacings(d) exceed the Shed Width by " & SWOver
Exit Sub
End If
SWidth = 0
SWOver = 0
If chkPropCleat = vbChecked Or chkPropCleat = True Then
If cmbPropNoHoles = "" Then
MsgBox "Please choose the Cleat Size", vbOKOnly
Exit Sub
End If
End If
If optMSYes = True Then
If Left(cmbColumnType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Columns"
Exit Sub
End If
If optColumnSameNo = True Then
If Left(cmbColumnType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Columns"
Exit Sub
End If
End If
End If
If optMSYes = True Then
If Left(cmbMullionType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Mullions"
Exit Sub
End If
End If
frmProgress.Show
frmProgress.ProgressBar1.Max = 27
frmProgress.ProgressBar1.Value = 1
SaveBackup
frmProgress.ProgressBar1.Value = 2
SetShedVars
frmProgress.ProgressBar1.Value = 3
SetDrawingVars
frmProgress.ProgressBar1.Value = 4
DrawShedStructual
frmProgress.ProgressBar1.Value = 21
DrawShedFloorPlan
If optMSYes = True Then
RollerDoors
End If
frmProgress.ProgressBar1.Value = 26
OffsetBlocks
frmProgress.ProgressBar1.Value = 27
Application.Update
Application.ZoomExtents >>>>stops here
Unload frmProgress
Thanks,
Matt |
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Fri Jan 07, 2005 11:13 am Post subject:
Re: Custom Programs |
|
|
Try this to see what happens.
| Quote: | OffsetBlocks
frmProgress.ProgressBar1.Value = 27
'Application.Update (comment this line of code)
Application.ZoomExtents
Unload frmProgress
|
Maybe ACAD is still busy when you issue the zoomextents
If so, a check for no activity (IsQuiescent = True) would be a good idea
before doing the zoom.
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:8673002.1105075765001.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Yes there is a drawing open after the program stops. you can zoom from
the command line. I've posted more code I hope it helps.
Private Sub Form_Load()
frmDrawShed.Caption = "Draw Shed Ver - " & App.Major & "." & App.Minor
& "." & App.Revision
On Error Resume Next
'Get the AutoCad Application
Set acadApp = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
'Start AutoCAD
Set acadApp = CreateObject("AutoCAD.Application")
acadApp.Visible = True
If Err Then
MsgBox Err.Description
Exit Sub
End If
End If
Set acadDoc = acadApp.ActiveDocument
Set ModelSpace = acadDoc.ModelSpace
cmbColumnType.SetFocus
NumBay = txtNumBays.text
UpDown1.Max = NumBay
ShedWidth = txtShedWidth
ReDim BaySize(4)
NumBay = 4
BaySize(1) = 6000: BaySize(2) = 6000: BaySize(3) = 6000: BaySize(4) =
6000
ReDim MullSizeA(2)
MullNumA = 1
MullSizeA(1) = 5835
MullSizeA(2) = 5835
ReDim MullSizeB(2)
MullNumB = 1
MullSizeB(1) = 5835
MullSizeB(2) = 5835
Private Sub cmdDraw_Click()
Dim pnt1(0 To 2) As Double
Dim n As Integer
Dim MullTotal As Double
Dim MullTotalB As Double
pnt1(0) = 0: pnt1(1) = 0
If Not CheckBaySize() Then
MsgBox "There is a Zero value in the Bay Size." & Chr(10) & "You
should correct the error.", 48
txtBaySize.SetFocus
Exit Sub
End If
SWidth = 0
SWOver = 0
For n = 1 To cmbMullNumbera + 1
SWidth = SWidth + MullSizeA(n)
Next n
If SWidth > txtShedWidth Then
SWOver = SWidth - txtShedWidth
MsgBox "The Mullion spacings(c) exceed the Shed Width by " & SWOver
Exit Sub
End If
SWidth = 0
SWOver = 0
For n = 1 To cmbMullNumberb + 1
SWidth = SWidth + MullSizeB(n)
Next n
If SWidth > txtShedWidth Then
SWOver = SWidth - txtShedWidth
MsgBox "The Mullion spacings(d) exceed the Shed Width by " & SWOver
Exit Sub
End If
SWidth = 0
SWOver = 0
If chkPropCleat = vbChecked Or chkPropCleat = True Then
If cmbPropNoHoles = "" Then
MsgBox "Please choose the Cleat Size", vbOKOnly
Exit Sub
End If
End If
If optMSYes = True Then
If Left(cmbColumnType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Columns"
Exit Sub
End If
If optColumnSameNo = True Then
If Left(cmbColumnType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Columns"
Exit Sub
End If
End If
End If
If optMSYes = True Then
If Left(cmbMullionType, 1) <> "C" Then
MsgBox "You can only rotate 'C' Section Mullions"
Exit Sub
End If
End If
frmProgress.Show
frmProgress.ProgressBar1.Max = 27
frmProgress.ProgressBar1.Value = 1
SaveBackup
frmProgress.ProgressBar1.Value = 2
SetShedVars
frmProgress.ProgressBar1.Value = 3
SetDrawingVars
frmProgress.ProgressBar1.Value = 4
DrawShedStructual
frmProgress.ProgressBar1.Value = 21
DrawShedFloorPlan
If optMSYes = True Then
RollerDoors
End If
frmProgress.ProgressBar1.Value = 26
OffsetBlocks
frmProgress.ProgressBar1.Value = 27
Application.Update
Application.ZoomExtents >>>>stops here
Unload frmProgress
Thanks,
Matt |
|
|
| Back to top |
|
 |
Laurie Comerford
Guest
|
Posted:
Fri Jan 07, 2005 11:55 am Post subject:
Re: Custom Programs |
|
|
Hi Matthew,
We do a one day introduction to VBA course and a whole range of Land
Desktop, Civil Design, Survey, Civil 3D courses as well as training in our
own software.
Any further discussion on this is not appropriate in the public NG. Please
write to denis.quinlan@cadapps.com.au to get further details.
--
Laurie Comerford
CADApps
www.cadapps.com.au
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:23952458.1105070661189.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi Laurie, had alook at you companys web site it mentions training just
woundering what AutoCad and Visual basic training courses you have in |
Melbourne ? |
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Tue Jan 11, 2005 8:33 am Post subject:
Re: Custom Programs |
|
|
Hi, I removed the application.update and add the code before zoom but i still have the same problem it stops at zoomextents. Thanks for your help.
Matt. |
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Tue Jan 11, 2005 10:06 am Post subject:
Re: Custom Programs |
|
|
Just to be sure, is the acad window visible at the time ??
Is the active document (dwg) visible??
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:28519564.1105414456126.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi, I removed the application.update and add the code before zoom but i
still have the same problem it stops at zoomextents. Thanks for your help.
Matt. |
|
|
| Back to top |
|
 |
Jorge Jimenez
Guest
|
Posted:
Tue Jan 11, 2005 10:06 am Post subject:
Re: Custom Programs |
|
|
BTW, have you tried making the acad windows the top window
using the system API call
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Declare Function SetWindowPos Lib "User32" _
(ByVal hwnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS) before doing any zoom
???
--
Saludos, Ing. Jorge Jimenez, SICAD S.A., Costa Rica
"Matthew Hastings" <nospam@address.withheld> wrote in message
news:28519564.1105414456126.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | Hi, I removed the application.update and add the code before zoom but i
still have the same problem it stops at zoomextents. Thanks for your help.
Matt. |
|
|
| Back to top |
|
 |
Matthew Hastings
Guest
|
Posted:
Wed Jan 12, 2005 8:00 am Post subject:
Re: Custom Programs |
|
|
I had a second look at the program reference you were right. I didn't see it the first time I looked. Feel pretty stupid anyway thanks a bunch.
Kind Regards,
Matt |
|
| Back to top |
|
 |
Jackrabbit
Guest
|
Posted:
Wed Jan 12, 2005 7:14 pm Post subject:
Re: Custom Programs |
|
|
Hi Matthew,
I had similar problems with several programs that I had written in Delphi. They ran fine in AutoCAD 2000 but would cause AutoCAD 2005 to throw and exception--usually before/after Saves, Regens, and Zooms. It appears that the out-of-process automation controller is getting ahead of AutoCAD. I added code to check the state of AutoCAD before/after Saves, Regens, and Zooms and that seems to have eliminated the freeze-ups.
Here's my code in Delphi and a VB version (which I didn't test):
[pre]
// Delphi
procedure WaitForAcad( const Acad : AcadApplication );
var
IsIdle : Boolean;
State : AcadState;
begin
State := Acad.GetAcadState;
IsIdle := False;
repeat
IsIdle := State.IsQuiescent;
until IsIdle;
end;
' Visual Basic
Public Sub WaitForAcad( Acad As AcadApplication )
Dim IsIdle As Boolean
Dim State As AcadState
State = Application.GetAcadState;
IsIdle = False;
Do
IsIdle = State.IsQuiescent;
Loop Until IsIdle;
End Sub
' In your code...
WaitForAcad Application
Application.ZoomExtents
[/pre]
There may be a better method of resolving this problem but the above solution works and got my users up and running for the time being. |
|
| Back to top |
|
 |
|
|
|
|