the following lisp command
(defun C:TT ()
(command "._+dsettings" "2")
(setq ChMode (logand OutMode 16383))
(setvar "osmode" ChMode)
(princ)
)
works when when calling from autocad
when you try to call it tranparently (example Polyline pnt1 pnt2 .. 'TT ..) does not work
Please answer me if there is a solution to work
Thanks
Regards,
Gery
Solved! Go to Solution.
Solved by paullimapa. Go to Solution.
GeryKnee wrote:when you try to call it tranparently (example Polyline pnt1 pnt2 .. 'TT ..) does not work
Hello Gery and welcome to the Autodesk Community!
Assuming the OutMode variable was set before, perhaps defining the command call, transparent will do the trick...
(command "'._+dsettings" "2")
Hope that helps
Henrique
Thanks HmSilva
unfortunatelly it does not work
the problem is :
when typing in autocad polyline pnt1 pnt2 ... 'dsettings 2 pnt3 pnt4 ... , works ok
i write the code
(defun C:TT ()
(command "'dsettings" "2")
(princ)
)
Now typing in autocad polyline pnt1 pnt2 ... ;TT pnt3 pnt4 ... , i wait to work opening the dsettings dialog as trasparent call.
But that doesn't happen , answering
Point or option keyword required.
; error: Function cancelled
The same happens using any alternate syntax of command call like
(command "'dsettings" "2")
(command "'+dsettings" "2")
(command "._+dsettings" "2")
(command "'._+dsettings" "2")
(command "._dsettings" "2")
etc
That means that the lisp server cancels the running polyline user insert chain
How can this work withowt breaking this chain?
GeryKnee wrote:unfortunatelly it does not work
Gery,
using
(defun C:TT ()
(command "'._+dsettings" "2")
(princ)
)
it works ok for me...
From the command line:
Command: pline
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 'tt
'._+dsettings >>Tab Index <0>:2
Resuming PLINE command.
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 'tt
'._+dsettings >>Tab Index <0>:2
Resuming PLINE command.
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Command:
Try to change the command name, maybe you're calling another TT.lsp ???
EDIT: Tested on AC2010
Henrique
I use Autocad 2006
(defun C:TT ()
(command "'._+dsettings" "2")
(princ)
)
using another name
Command: _pline
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 'tt
'._+dsettings
2D point or option keyword required.
; error: Function cancelled
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:
Command: *Cancel*
(defun C:ABCDE ()
(command "'._+dsettings" "2")
(princ)
)
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: 'ABCDE
'._+dsettings
Point or option keyword required.
; error: Function cancelled
Specify next point or [Undo]: *Cancel*
the same
Command: _pline
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: 'test
'osnap
2D point or option keyword required.
; error: Function cancelled
Gery,
I'm sorry, but I can't understand why is not working as expected, and with AC2010 I can't reproduce this behavior.
Hopefully someone else will step in with a better solution.
Henrique
Thanks Henrique for your help.
Maybe version of 2006 has a problem , but i use this version and i prefere it.
Anyway, thanks again.
Regards,
Gery
What if you define the function without the C: like this: (defun TT
Then at the prompt call the function within parentesis like this: (TT)
Hi Paul
I wrote this at my lsp file
(defun TT ()
(command "'._+dsettings" 2)
(princ)
)
after that typing
Command:
Command: _pline
Specify start point:
Current line-width is 0.0000
Specify next point or [Arc/Halfwidth/Length/Undo/Width]:
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: '(TT)
2D point or option keyword required.
Specify next point or [Arc/Close/Halfwidth/Length/Undo/Width]: *Cancel*
do you have differnt response in your autocad version?
Regards,
Gery
Would it work if you do not preceed the command with an apostrophe?
So instead of '(TT), just use (TT)
Hi Paul
if i'm not wrong you mean
(defun TT ()
(command "'._+dsettings" 2)
(princ)
)
testing :::
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: '(TT)
Point or option keyword required.
Specify next point or [Undo]: *Cancel*
I thing it's expected because functions are calling from commands but commands (C:) are the only that could be called from autocad
Regards,
Gery
Once you've defined a function assumming +dsettings can really be executed transparently in AutoCAD 2006, then you should be able to call the function within a standard AutoCAD command:
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: (TT)
This is where you would enter (TT) without the need to place the apostrophe
.
See if this works in AutoCAD 2006.
You should also try changing your (TT) function as Henrique suggested to use 'OSNAP which AutoCAD 2006 should see as transparent:
(defun TT ()
(command "'osnap")
(princ)
)
Then call (TT) from within AutoCAD's LINE command but again without preceeding with an apostrophe:
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: (TT)
The code
(defun TT ()
(command "'._+dsettings" 2)
(princ)
)
Autocad
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: (TT)
'._+dsettings
Point or option keyword required.
; error: Function cancelled
Specify next point or [Undo]: *Cancel*
Is that what you say ?
So it looks like AutoCAD 2006 does not support +dsettings as a transparent command yet.
As I metioned, try the 'OSNAP command which I believe AutoCAD 2006 does support transparently.
(defun TT ()
(command "'osnap")
(princ)
)
Command:
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: (TT)
'osnap
Point or option keyword required.
; error: Function cancelled
Specify next point or [Undo]: *Cancel*
I just loaded Acad 2006 and it's definitely a limitation with that version.
A workaround is this.
Write a function called keystuff that'll send the command to the keyboard buffer using vla command:
(defun keystuff (cmd-arg)(vla-Sendcommand(vla-Get-ActiveDocument(vlax-Get-Acad-Object))cmd-arg))
Then define the TT function anway you like invoking keystuff:
(defun C:TT () (keystuff"'OSNAP\n"))
Now when you start the Line command and enter 'TT it'll transparently bring up the OSNAP option window and allow you to continue your Line pick point option.
Semi - Solved
i wrote
(defun keystuff (cmd-arg)(vla-Sendcommand(vla-Get-ActiveDocument(vlax-Get-Acad-Object))cmd-arg))
(defun C:TT ()
(keystuff"'OSNAP\n")
(setq ChMode (logand OutMode 16383))
(setvar "osmode" ChMode)
)
calling from autocad the osnap dialog opens but ...
creating a button to call the command
the button call will be 'TT
1) ::: using not tranparently
Command: *Cancel*
Command: 'TT
; error: bad argument type: fixnump: nil
Command:
Command: 'OSNAP
Command:
2 ::: using tranparently
Command: _line Specify first point:
Specify next point or [Undo]:
Specify next point or [Undo]: 'TT
; error: bad argument type: fixnump: nil
Specify next point or [Undo]:
Specify next point or [Undo]: 'OSNAP
Resuming LINE command.
Specify next point or [Undo]: >>
Resuming LINE command.
Specify next point or [Undo]: *Cancel*
My problem is that autodesc changed the way osnap changes using dsettings or osnap dialog from what was defined in autocad 14.
When user sets snap using the dialog window (ex. adds snap to circle) waits after closing the dialog to set the osnap flag ON without having to press the osnap button.
My opinion is that this progress to autocad application is bad and i try to recover it.
Not knowing if i changed OK or CANCEL to dialog , i prefere to ALWAYS CHANGE THE FLAG ON after closing the dialog.