thisdrawing.utility.prompt .... overwriting

thisdrawing.utility.prompt .... overwriting

Anonymous
Not applicable
2,579 Views
8 Replies
Message 1 of 9

thisdrawing.utility.prompt .... overwriting

Anonymous
Not applicable
hi

i am trying to use the thisdrawing.utitity.prompt, whenever i run this from
the vba editor it works, but if i run the routine from a toolbar / lisp the
prompt seems to overwrite the previous command line, not start a new line..

'code:

ThisDrawing.Utility.Prompt vbNewLine & "Current settings: Opening = " &
sSaveAndClose & ", Filter = " & sDrawingFilter & ", Xref path = " &
sXrefPath & vbNewLine
ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
Options"
sDrawingOption = ThisDrawing.Utility.GetKeyword(vbNewLine & "Open
drawing options [Previous/Next/via Text/Xref/Options]: ")


any help would be great

cheers

mark
0 Likes
2,580 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
Try vbCrLf in lieu of vbNewLine
I've never heard of vbNewLine but if it's the same as vbCR then that is the
behaviour you get
hth
Mark

"Mark Dubbelaar" wrote in message
news:[email protected]...
> hi
>
> i am trying to use the thisdrawing.utitity.prompt, whenever i run this
from
> the vba editor it works, but if i run the routine from a toolbar / lisp
the
> prompt seems to overwrite the previous command line, not start a new
line..
>
> 'code:
>
> ThisDrawing.Utility.Prompt vbNewLine & "Current settings: Opening = "
&
> sSaveAndClose & ", Filter = " & sDrawingFilter & ", Xref path = " &
> sXrefPath & vbNewLine
> ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
> Options"
> sDrawingOption = ThisDrawing.Utility.GetKeyword(vbNewLine & "Open
> drawing options [Previous/Next/via Text/Xref/Options]: ")
>
>
> any help would be great
>
> cheers
>
> mark
>
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
i've tried the vbcrlf, but get the same effect... i looked vbcrlf in the
help and found the vbnewline function, the help says they are the same, i
just found the vbnewline easier to understand then vbcrlf
i've also tried the vbcr, but ended up with the same results

mark

"Mark Propst" wrote in message
news:[email protected]...
> Try vbCrLf in lieu of vbNewLine
> I've never heard of vbNewLine but if it's the same as vbCR then that is
the
> behaviour you get
> hth
> Mark
>
> "Mark Dubbelaar" wrote in message
> news:[email protected]...
> > hi
> >
> > i am trying to use the thisdrawing.utitity.prompt, whenever i run this
> from
> > the vba editor it works, but if i run the routine from a toolbar / lisp
> the
> > prompt seems to overwrite the previous command line, not start a new
> line..
> >
> > 'code:
> >
> > ThisDrawing.Utility.Prompt vbNewLine & "Current settings: Opening =
"
> &
> > sSaveAndClose & ", Filter = " & sDrawingFilter & ", Xref path = " &
> > sXrefPath & vbNewLine
> > ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
> > Options"
> > sDrawingOption = ThisDrawing.Utility.GetKeyword(vbNewLine & "Open
> > drawing options [Previous/Next/via Text/Xref/Options]: ")
> >
> >
> > any help would be great
> >
> > cheers
> >
> > mark
> >
> >
>
>
0 Likes
Message 4 of 9

Anonymous
Not applicable
weird
like you said from the editor it works fine
I shortened it to
Sub TEST()
ThisDrawing.Utility.prompt vbNewLine & "Current settings: Opening = " &
vbNewLine
ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
Options"
ThisDrawing.Utility.GetKeyword (vbNewLine & "Open drawing options
[Previous/Next/via Text/Xref/Options]: ")
End Sub
and called it from lisp via:
(defun c:test()
(macro "testprj.dvb" "testprompt" "test")
)
which basically just calls the usual dvb!module.macro syntax
and the output now gives me a double line
thus:
Command: test
_.-VBARUN
Macro name: testprompt.test
Current settings: Opening =

Open drawing options [Previous/Next/via Text/Xref/Options]:
Open drawing options [Previous/Next/via Text/Xref/Options]: x

Command:
Command: test
_.-VBARUN
Macro name: testprompt.test
Current settings: Opening =

Open drawing options [Previous/Next/via Text/Xref/Options]:
Open drawing options [Previous/Next/via Text/Xref/Options]: p

Command:
Command: test
_.-VBARUN
Macro name: testprompt.test
Current settings: Opening =

Open drawing options [Previous/Next/via Text/Xref/Options]:
Open drawing options [Previous/Next/via Text/Xref/Options]: n

Command:

so it's not overwriting the previous line, it's writing twice???
no idea why
sorry no help
good luck
Mark

"Mark Dubbelaar" wrote in message
news:[email protected]...
> i've tried the vbcrlf, but get the same effect... i looked vbcrlf in the
0 Likes
Message 5 of 9

Anonymous
Not applicable
Mark,
I was wondering if you figured it out.
I now notice that the project I'm working on also has a weird effect with
the prompts (imo)

I get that double prompt I mentioned with your code even with a getpoint
prompt:

this line:
ws.inspt = oDoc.Utility.GetPoint(, "Pick point for weld sym " & vbCrLf)

yields at command line:

Command: weld
_.-VBARUN
Macro name: modWeldSym.WeldSym Pick point for weld sym
Pick point for weld sym

so now I'm wondering how to suppress prompts like the above

of the above lines I wouldn't want to see:
_.-VBARUN
Macro name: modWeldSym.WeldSym Pick point for weld sym

all I would want to see is:
Command: weld
Pick point for weld sym

it's like having to add a (princ) statement to the end of a lisp routine,
not to see the return value
so the question is what is the equivalent of (princ) in vb?...even though
the getpoint was not the last line in the sub (which is what would get
returned in a lisp prog) it seems to be the line that's returning a value to
the autocad command line.

very weird (only because of my ignorance I guess)

any ideas?
other Mark

"Mark Dubbelaar" wrote in message
news:[email protected]...
> hi
>
0 Likes
Message 6 of 9

Anonymous
Not applicable
mark,

i haven't yet figured out the problem of double lines, and lines overwriting
each other... i've had a look at you post on 21/06/03 and would be
interested in how the vla-runmacro is going.. i haven't been able to find
any info on this function...

on another matter, i've been having some similar problems with lisps... for
some reason, if the lisp is compiled to a .fas file, any (princ
"\nwhatever") or (prompt "\nwhatever") does not show up.... but if i were to
run the source file (ie the .lsp file) it seems to work fine. Below is a
sample code of what i tested this on... i'll post this on the general 2004
newsgroup as well

;start code
;;***********************
;;Created: Mark Dubbelaar
;;***********************

;internal error
(defun LISPERROR (s)
(setq *CURR_OSNAP
nil
COPYSET nil
)
(setq *error* olderror)
(setq olderror nil)
(command "undo" "end")
(princ "\n LISP CANCELLED / ERROR")
(princ "\n SETTINGS HAVE BEEN RESET")
(princ "\n ")
(princ)
)


;program
(defun C:CO (/ *CURR_OSNAP olderror COPYSET)

(setq *CURR_OSNAP (getvar "osmode"))
(setq olderror *error*)
(setq *error* LISPERROR)

(setvar "cmdecho" 0)
(command "undo" "begin")
(setvar "osmode" 0)

(setq COPYSET (ssget))
(if (/= COPYSET nil)
(command "copy" COPYSET "" "0,0" "0,0")
(prompt "\nNothing selected!")
) ;if

(setvar "osmode" *CURR_OSNAP)
(setq *error* olderror)
(setq olderror nil)
(command "undo" "end")
(setvar "cmdecho" 0)

(princ)
)

(princ)
;end code

cheers

mark

"Mark Propst" wrote in message
news:[email protected]...
> Mark,
> I was wondering if you figured it out.
> I now notice that the project I'm working on also has a weird effect with
> the prompts (imo)
>
> I get that double prompt I mentioned with your code even with a getpoint
> prompt:
>
> this line:
> ws.inspt = oDoc.Utility.GetPoint(, "Pick point for weld sym " & vbCrLf)
>
> yields at command line:
>
> Command: weld
> _.-VBARUN
> Macro name: modWeldSym.WeldSym Pick point for weld sym
> Pick point for weld sym
>
> so now I'm wondering how to suppress prompts like the above
>
> of the above lines I wouldn't want to see:
> _.-VBARUN
> Macro name: modWeldSym.WeldSym Pick point for weld sym
>
> all I would want to see is:
> Command: weld
> Pick point for weld sym
>
> it's like having to add a (princ) statement to the end of a lisp routine,
> not to see the return value
> so the question is what is the equivalent of (princ) in vb?...even though
> the getpoint was not the last line in the sub (which is what would get
> returned in a lisp prog) it seems to be the line that's returning a value
to
> the autocad command line.
>
> very weird (only because of my ignorance I guess)
>
> any ideas?
> other Mark
>
> "Mark Dubbelaar" wrote in message
> news:[email protected]...
> > hi
> >
>
>
0 Likes
Message 7 of 9

Anonymous
Not applicable
results at textscreen:

Command: testmacro

Try test 1Initializing VBA System...
Loading VBA startup file...
Current settings: Opening =
Open drawing options [Previous/Next/via Text/Xref/Options]: o

Command:
Try test 2_.-VBARUN
Macro name: testpromptprj.dvb!testprompt.Test1
Current settings: Opening =
Open drawing options [Previous/Next/via Text/Xref/Options]:
Open drawing options [Previous/Next/via Text/Xref/Options]: o

Command:


lisp code to produce above:
(defun C:TestMacro()
(vl-load-com)
(setq acadObj (vlax-get-acad-object)) ;;; get the currently active dwg
; Test Macro
(princ"\nTry test 1")
(defun c:Test1 ()
(setq fname "testpromptprj.dvb!testprompt.Test1")
(vla-runmacro acadObj fname)
(princ)
)
(C:test1)

(princ"\nTry test 2")
; Test Macro
(defun c:Test2 ()
(setq fname "testpromptprj.dvb!testprompt.Test1")
(vl-vbarun fname)
(princ)
)
(C:test2)
)

contents of vba macro

Option Explicit
Sub TEST1()
ThisDrawing.Utility.prompt vbNewLine & "Current settings: Opening = " &
vbNewLine
ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
Options"
ThisDrawing.Utility.GetKeyword (vbCr & "Open drawing options
[Previous/Next/via Text/Xref/Options]: ")

End Sub

so it seems like vla-runmacro 'works', but I'd still like to know how to
avoid the:
" Initializing VBA System...
Loading VBA startup file..."
lines

maybe something with vbcr to erase the previous messages, but havent' gotten
it to work yet.

"Mark Dubbelaar" wrote in message
news:[email protected]...
> mark,
>
> i haven't yet figured out the problem of double lines, and lines
overwriting
> each other... i've had a look at you post on 21/06/03 and would be
> interested in how the vla-runmacro is going.. i haven't been able to find
> any info on this function...
>

i found a few posts on google for it. seems vl-vbarun resets fileDia sys
var to 0 as well as the weird prompt phenomena. Amazingly I haven't found
any posts on google complaining about this exact problem!!! How is that
possible? Are we the only two guys for whom this doesn't work? Amazing.!
good luck
Mark
0 Likes
Message 8 of 9

Anonymous
Not applicable
mark

i've just come across maybe a bug in the vla-runmacro function... in the vba
routine i am writing (where this line comes from: Open drawing options
[Previous/Next/via Text/Xref/Options]:) the routine opens up drawings
depending on what option the user chooses.... the problem is that when i use
the vla-runmacro, autocad opens the drawing up, but it then returns to the
previous drawing ie the one where i ran the open drawing routine from....
any suggestions, i think i might post this on the lisp newsgroup as well

cheers

mark

"Mark Propst" wrote in message
news:[email protected]...
> results at textscreen:
>
> Command: testmacro
>
> Try test 1Initializing VBA System...
> Loading VBA startup file...
> Current settings: Opening =
> Open drawing options [Previous/Next/via Text/Xref/Options]: o
>
> Command:
> Try test 2_.-VBARUN
> Macro name: testpromptprj.dvb!testprompt.Test1
> Current settings: Opening =
> Open drawing options [Previous/Next/via Text/Xref/Options]:
> Open drawing options [Previous/Next/via Text/Xref/Options]: o
>
> Command:
>
>
> lisp code to produce above:
> (defun C:TestMacro()
> (vl-load-com)
> (setq acadObj (vlax-get-acad-object)) ;;; get the currently active dwg
> ; Test Macro
> (princ"\nTry test 1")
> (defun c:Test1 ()
> (setq fname "testpromptprj.dvb!testprompt.Test1")
> (vla-runmacro acadObj fname)
> (princ)
> )
> (C:test1)
>
> (princ"\nTry test 2")
> ; Test Macro
> (defun c:Test2 ()
> (setq fname "testpromptprj.dvb!testprompt.Test1")
> (vl-vbarun fname)
> (princ)
> )
> (C:test2)
> )
>
> contents of vba macro
>
> Option Explicit
> Sub TEST1()
> ThisDrawing.Utility.prompt vbNewLine & "Current settings: Opening = " &
> vbNewLine
> ThisDrawing.Utility.InitializeUserInput 1, "Previous Next Text Xref
> Options"
> ThisDrawing.Utility.GetKeyword (vbCr & "Open drawing options
> [Previous/Next/via Text/Xref/Options]: ")
>
> End Sub
>
> so it seems like vla-runmacro 'works', but I'd still like to know how to
> avoid the:
> " Initializing VBA System...
> Loading VBA startup file..."
> lines
>
> maybe something with vbcr to erase the previous messages, but havent'
gotten
> it to work yet.
>
> "Mark Dubbelaar" wrote in message
> news:[email protected]...
> > mark,
> >
> > i haven't yet figured out the problem of double lines, and lines
> overwriting
> > each other... i've had a look at you post on 21/06/03 and would be
> > interested in how the vla-runmacro is going.. i haven't been able to
find
> > any info on this function...
> >
>
> i found a few posts on google for it. seems vl-vbarun resets fileDia sys
> var to 0 as well as the weird prompt phenomena. Amazingly I haven't found
> any posts on google complaining about this exact problem!!! How is that
> possible? Are we the only two guys for whom this doesn't work? Amazing.!
> good luck
> Mark
>
>
0 Likes
Message 9 of 9

Anonymous
Not applicable

You may find this helpful with getting the prompts to display when launching vba from lisp

http://forums.autodesk.com/t5/Visual-Basic-Customization/Lisp-calls-VBA-Utility-Prompt-does-not-show...

0 Likes