I try to launch Autolisp function which works well on Autocad 2014, and I get an error on Autocad 2015.
My lisp is launched from c# .NET app with the method "invokeLisp".
I get an error on _zoom and _expert command in lisp :
Commande: ; erreur: commande AutoCAD refusée: "_zoom"
Régénération du modèle.
Folio chargé : 101
; erreur: commande AutoCAD refusée: "_expert"
Commande: _EXPERT
here is part of my lisp function:
(defun client_expfol ( / Lay LayList affichageDp chemin)
(ax_infoLogger "client_expfol - Debut")
(vl-load-com)
(command "_expert" "5")
(command "_zoom" "_e")
; plus de croix sur les points
...
These commands are working well when launched directly from Autocad Console in 2015.
Do you have an Idea, maybe a security issue??
Solved! Go to Solution.
Solved by phenriet. Go to Solution.
method "invokeLisp" ?? what method is that?
@phenrietwrote:I try to launch Autolisp function which works well on Autocad 2014, and I get an error on Autocad 2015.
My lisp is launched from c# .NET app with the method "invokeLisp".
I get an error on _zoom and _expert command in lisp :
Commande: ; erreur: commande AutoCAD refusée: "_zoom"
Régénération du modèle.
Folio chargé : 101
; erreur: commande AutoCAD refusée: "_expert"
Commande: _EXPERT
here is part of my lisp function:
(defun client_expfol ( / Lay LayList affichageDp chemin)
(ax_infoLogger "client_expfol - Debut")
(vl-load-com)
(command "_expert" "5")
(command "_zoom" "_e")
; plus de croix sur les points...
These commands are working well when launched directly from Autocad Console in 2015.
Do you have an Idea, maybe a security issue??
EXPERT is a system variable, not a command. If you treat it as such, you should be able to set it directly without LISP (which should be calling (setvar ...) rather than (command ...)).
I don't have any problems executing the following LISP from the command line, so my guess is that you are calling the LISP function that contains the calls to (command) from an illegal calling context.
Command: (command "._EXPERT" 5) ._EXPERT Enter new value for EXPERT <0>: 5 Command: nil
The LISP (command) function cannot be used when executing LISP in certain calling contexts (the application context).
Further, you still haven't explained what "invokeLisp" is, or shown the .NET code that calls the LISP function, and indicated what execution context that .NET code is runs in, which I suspect is the problem.
@dgorsmanwrote:EXPERT is a system variable, not a command. If you treat it as such, you should be able to set it directly without LISP (which should be calling (setvar ...) rather than (command ...)).
System variables can be executed like commands. The OP's problem has nothing to do with that. It is the use of the (command) function itself that is the problem, regardless of what command is being used.
Thank you for your response,
In effect I use this like a command in order to change Expert state in my command, before doing other actions. I can't do it manually because this Lisp function is part of a big C# .NET method.
This is working on 2014, so the question is why this is not working on 2015?...
I have read the migrating documentation but couldn't see anything like this...
I have also lot's of lisp functions which use (command) and I don't have any problem.
Maybe this Issue comes from C# invokeLisp
Thanks!
@phenrietwrote:Thank you for your response,
In effect I use this like a command in order to change Expert state in my command, before doing other actions. I can't do it manually because this Lisp function is part of a big C# .NET method.
This is working on 2014, so the question is why this is not working on 2015?...
I have read the migrating documentation but couldn't see anything like this...
I have also lot's of lisp functions which use (command) and I don't have any problem.
Maybe this Issue comes from C# invokeLisp
Thanks!
See my previous reply. Without knowing more about the calling context and the C# code that calls the LISP function, and precisely what "invokeLisp" is, no one can help you.
There were changes to the threading model AutoCAD uses between AutoCAD 2014 and 2015, which is most-likely why it may have worked in the former.
Sorry, I didn't understand that.
Here is my C# code:
chargerFolio(folio.Idl, true, false, 2); //Load DWG used by the command
AxiomNetUtils.Logger.AxiomNetLogger.ConsoleLine("Folio chargé (Dépose) : " + folio["NUMERO"] + " " + folio["LIBELLE"]);
AxiomNetUtils.Logger.AxiomNetLogger.NetInfo("Folio chargé (Dépose) : " + folio["NUMERO"] + " " + folio["LIBELLE"]);
AxiomNetUtils.Wrapper.AcadWrapper.invokeLisp(new ResultBuffer(new TypedValue((int)LispDataType.Text, "client_expfol"))); //Launch my Lisp "client_expfol"
Here is the Lisp function:
(defun client_expfol ( / )
(ax_infoLogger "client_expfol - Debut")
; mode export
(command "_expert" "5") //Command Denied
; zoom étendu
(command "_zoom" "_e") //Command Denied
; plus de croix sur les points
(command "_pdmode" "1")
;désactivation de la bannière de tracé
(command "-PLOTSTAMP" "_OFF" "")
(rf_savLayerLockState)
(rf_unlockLayer)
(setq orient (rf_docorient))
(setq chemin (strcat (rf_nomdwgschme 1) "_couleur"))
...
)
This the same code for 2014 and 2015 like said before.
Thank you for your help.
You are calling code that is not shown or included, and are expecting others to tell you what's wrong with it.
The code I'm referring to is highlighted below in red.
@phenriet wrote:Sorry, I didn't understand that.
Here is my C# code:
chargerFolio(folio.Idl, true, false, 2); //Load DWG used by the command
AxiomNetUtils.Logger.AxiomNetLogger.ConsoleLine("Folio chargé (Dépose) : " + folio["NUMERO"] + " " + folio["LIBELLE"]);
AxiomNetUtils.Logger.AxiomNetLogger.NetInfo("Folio chargé (Dépose) : " + folio["NUMERO"] + " " + folio["LIBELLE"]);
AxiomNetUtils.Wrapper.AcadWrapper.invokeLisp(new ResultBuffer(new TypedValue((int)LispDataType.Text, "client_expfol"))); //Launch my Lisp "client_expfol"
Here is the Lisp function:
(defun client_expfol ( / )
(ax_infoLogger "client_expfol - Debut")
; mode export
(command "_expert" "5") //Command Denied
; zoom étendu
(command "_zoom" "_e") //Command Denied
; plus de croix sur les points
(command "_pdmode" "1")
;désactivation de la bannière de tracé
(command "-PLOTSTAMP" "_OFF" "")
(rf_savLayerLockState)
(rf_unlockLayer)
(setq orient (rf_docorient))
(setq chemin (strcat (rf_nomdwgschme 1) "_couleur"))...
)
This the same code for 2014 and 2015 like said before.
Thank you for your help.
My problem is resolved thanks to this topic:
Can't find what you're looking for? Ask the community or share your knowledge.