Determine If The Command Line Is Ready
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
Determine If The Command Line Is Ready

 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA
Author Message
ptti
Guest





Posted: Fri Jan 07, 2005 6:21 pm    Post subject: Determine If The Command Line Is Ready Reply with quote

Hello All. I am writing a macro to override the SAVE,QSAVE,SAVEAS, and OPEN commands in AutoCAD 2000. I have a macro in which I have ACADStartup(). I want to send the "UNDEFINE" function and "SAVE" to the command line in ACADStartup(), but when I do it sends it but the command does not work since the command line is not quite ready to receive commands yet. It is sending the command when the command line says:

Regenerating model.
Initializing VBA System...
Loading VBA startup file...

But the command line does not say:

Command:

yet. So I am guessing that this means that AutoCAD is doing some loading of stuff and the command line is not quite ready to receive anything. So my question is how to determine that the command line is ready to receive commands? Or should I be placing the "UNDEFINE" command in a different place and where?

Thanks,
Brad

Back to top
R. Robert Bell
Guest





Posted: Fri Jan 07, 2005 8:00 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

The (S::Startup) function in AutoLISP. Or see if one of the Document events
would fit the bill.

--
R. Robert Bell


"ptti" <nospam@address.withheld> wrote in message
news:12891213.1105104140980.JavaMail.jive@jiveforum2.autodesk.com...
Hello All. I am writing a macro to override the SAVE,QSAVE,SAVEAS, and OPEN
commands in AutoCAD 2000. I have a macro in which I have ACADStartup(). I
want to send the "UNDEFINE" function and "SAVE" to the command line in
ACADStartup(), but when I do it sends it but the command does not work since
the command line is not quite ready to receive commands yet. It is sending
the command when the command line says:

Regenerating model.
Initializing VBA System...
Loading VBA startup file...

But the command line does not say:

Command:

yet. So I am guessing that this means that AutoCAD is doing some loading of
stuff and the command line is not quite ready to receive anything. So my
question is how to determine that the command line is ready to receive
commands? Or should I be placing the "UNDEFINE" command in a different
place and where?

Thanks,
Brad
Back to top
Mike Tuersley
Guest





Posted: Fri Jan 07, 2005 10:12 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Public Function IsAwake() As Boolean
'+-- check acadState object to see if
'AutoCAD is running a command
Dim State As AcadState
State = _cadApp.GetAcadState
'send back return value
IsAwake = IIf(State.IsQuiescent, True, False)
End Function

-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...

Back to top
Tony Tanzillo
Guest





Posted: Sat Jan 08, 2005 4:27 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

"Mike Tuersley" write:

Quote:
IsAwake = IIf(State.IsQuiescent, True, False)

PMJI, but what is the difference between the above
and this:

IsAwake = State.IsQuiescent


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com
Back to top
Mike Tuersley
Guest





Posted: Mon Jan 10, 2005 6:40 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Good question =) One of those "I grabbed it from ADN but never spent the
time to read it"s.

-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...
Back to top
ptti
Guest





Posted: Mon Jan 10, 2005 8:21 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

I tried this but it is not quite what I want. Within the
Sub ACADStartup()
I ran a Do Loop calling this routine but it just caused AutoCAD to focus on this Do loop and not on finishing loading up. I also have a DoEvents within the Do loop.

What I want is to run an "UNDEFINE" function and then redefine the OPEN and SAVE methods. When I do this in
Sub ACADStartup()
it fires the code before the actual Command prompt is ready therefore the undefining and redefining did not actually work.

So, I was wanting a way to see when the command prompt showed "Command:"
At the beginning of launching AutoCAD the command line says:
Regenerating model.
Initializing VBA System...
Loading VBA startup file...
and then will say:
Command:
It is here where I want my VB code in
Sub ACADStartup()
to actually run.

Any ideas or suggestions?

Thanks in Advance.

Brad
Back to top
Mike Tuersley
Guest





Posted: Mon Jan 10, 2005 11:04 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Try on EndLoad?

-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...
Back to top
ptti
Guest





Posted: Mon Jan 10, 2005 11:15 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

How do I get to the EndLoad Event. I did a search for it in the Object Browser, but got no results.

Thanks,
Brad
Back to top
Tony Tanzillo
Guest





Posted: Tue Jan 11, 2005 12:43 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

ADN? You got that from ADN ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com

"Mike Tuersley" <mtuersley@rand.com> wrote in message news:tj6uxct8iq2b.12jeljjqxmpd2.dlg@40tude.net...
Quote:
Good question =) One of those "I grabbed it from ADN but never spent the
time to read it"s.

-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...
Back to top
Tony Tanzillo
Guest





Posted: Tue Jan 11, 2005 12:59 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Why are you trying to undefine OPEN and SAVE?

What are you going to do in place of them?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005
http://www.acadxtabs.com

"ptti" <nospam@address.withheld> wrote in message news:25066279.1105370541253.JavaMail.jive@jiveforum2.autodesk.com...
Quote:
I tried this but it is not quite what I want. Within the
Sub ACADStartup()
I ran a Do Loop calling this routine but it just caused AutoCAD to focus on this Do loop and not on finishing loading
up. I also have a DoEvents within the Do loop.

What I want is to run an "UNDEFINE" function and then redefine the OPEN and SAVE methods. When I do this in
Sub ACADStartup()
it fires the code before the actual Command prompt is ready therefore the undefining and redefining did not actually
work.

So, I was wanting a way to see when the command prompt showed "Command:"
At the beginning of launching AutoCAD the command line says:
Regenerating model.
Initializing VBA System...
Loading VBA startup file...
and then will say:
Command:
It is here where I want my VB code in
Sub ACADStartup()
to actually run.

Any ideas or suggestions?

Thanks in Advance.

Brad
Back to top
Mike Tuersley
Guest





Posted: Tue Jan 11, 2005 1:25 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Quote:
ADN? You got that from ADN ?
Fairly sure ???? - back about 2000i/2002 time frame


-- Mike
___________________________
Mike Tuersley
CADalyst's CAD Clinic
Rand IMAGINiT Technologies
___________________________
the trick is to realize that there is no spoon...
Back to top
Nathan Taylor
Guest





Posted: Tue Jan 11, 2005 2:46 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

The following works fine for me:

(DEFUN S::STARTUP ()
(SETVAR "CMDECHO" 0)
(command "undefine" "copy")
(SETVAR "CMDECHO" 1)
)

Regards - Nathan
Back to top
Nathan Taylor
Guest





Posted: Tue Jan 11, 2005 2:50 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

I just realised you are using the AcadStartup procedure method in VBA use the S::STARTUP procedure in ACAD.LSP like above and you shouldn't have a problem.
Regards - Nathan
Back to top
ptti
Guest





Posted: Tue Jan 11, 2005 6:53 pm    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

That is what I have right now and it is acting goofy. On some of our computers it works fine, on some it worked fine and then goofed up. Eventually it quits working and the user cannot do anything. When AutoCAD loads up, the crosshairs do not appear and if you try to exit out of AutoCAD it tells you that there is still an active command and you cannot close. So you have to use the 3-finger salute to quit AutoCAD. So I figured that I would skip the lisp file and try using all VBA. Any other suggestions?

Thanks,
Brad
Back to top
Oberer
Guest





Posted: Thu Jan 13, 2005 12:16 am    Post subject: Re: Determine If The Command Line Is Ready Reply with quote

Sorry to ask the obvious, but your certain you have things set up like Nathan suggested? I've used the S::STARTUP to undefine many functions (offset and plot being two).


ptti wrote:
When AutoCAD loads up, the crosshairs do not appear and if you try to exit out of AutoCAD it tells you that there is still an active command and you cannot close. So you have to- use the 3-finger salute to quit AutoCAD

This is happening from JUST changing the S::STARTUP?? Sure sounds like a lot more is happening...


FWIW...
I wanted to redefine plot for two reasons - i had to step into LDD's "daystamp" crap and create a nicer daystamp. i also wanted to alert the user of layers that are turned off, as well as the last time the document was saved.

As for offset, i wanted to provide our users with a way to deal with different horz and vert scales (as in plan and profile sheets). I redefined offset to include the use of negative numbers. Essentially, any number < 0 is multiplied by the scale factor. this allows a user to offset -1 (as in 1 foot) without having to calculate the scale factor (40/6)
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> VBA All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB