TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Pepe on November 29, 2010, 05:47:09 PM
-
Just that :angel:.
I've tried to compile a LSP source code to VLX to make it work in its own namespace, but it doesn't works because "acad_truecolordlg" is present (although it does in standard compilation).
Just try to compile this to see the error message:
(defun C:TEST () (acad_truecolordlg 1 T))
Does anybody knows what to do?
Thanks in advance
-
Perhaps vl-arx-import ?
Read about it in the VLIDE Help :-)
-
Thank you very much for the answer, Lee.
My sense goes that way too. But... which ARX should I import :| ? I didn't found any reference at VLIDE help nor at the Net.
Perhaps someone knows antything about the contents of Autocad's standard ARXs that could help.
Regards... :-)
-
Something like :-
(foreach item '(ACAD_TRUECOLORDLG INITDIA ACAD-POP-DBMOD ACAD-PUSH-DBMOD)
(vl-arx-import item)
)
(defun C:TEST101 ()
(alert "In seperate Namespace file")
(acad_truecolordlg 1 T)
)
-
Thank you very much, Kerry!!
Your code seems to work properly :-) !!
Only one question to learn some more: why so may ARXs to be imported? I mean, which is the function of each one?
Thank you again (and Lee too! :roll: )
-
If you read the documentation, I'm not importing files, I'm importing functions(symbols)
http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-68ee.htm
-
Kerry,
One thing I was slightly stumped on when reading the help is to why they include:
(vl-doc-export 'testarx)
at the top of the code.
Is there something I am missing?
Thanks for your time :-)
-
If you read the documentation, I'm not importing files, I'm importing functions(symbols)
( :doa: Oops!)
All right, "acad_truecolordlg": understood (obvious...); "initdia" understood; but...why the rest of them? :? (i don't know much about DBMODE var.)
I suppose all of them are included in acadapp.arx Aren't they?
Regards...
-
Lee.
Commands eg: c:xxxx are exported from a separate Namespace VLX by default.
Functions must be explicitly exported from a separate Namespace to be accessable from the document namespace (ie from the commandLine or called from 'normal' lisp in the document)
Sample
;; This file is intended to be compiled as a Seperate NameSpace .VLX
;; Remember that a Separate NameSpace .VLX must be explicitly unloaded before it can be reloaded.
;;
;; CodeHimBelonga kdub 20101201
;;
(defun c:Test102 (/ pta ptb )
(if (and (setq pta (_Getpoint102a))
(setq ptb (_Getpoint102b))
)
(alert (strcat "Test102 in Seperate NameSpace."
"\n Point a " (vl-princ-to-string pta)
"\n Point b " (vl-princ-to-string ptb)
)
)
)
(princ)
)
;; _Getpoint102a will be exposed to the Document NameSpace
(vl-doc-export '_Getpoint102a)
;; Uncomment the following line to expose _Getpoint102b to
;; any document namespace that loads the VLX.
;; (vl-doc-export '_Getpoint102b)
(defun _Getpoint102a () (getpoint "\n_Getpoint102a : Select a Point"))
(defun _Getpoint102b () (getpoint "\n_Getpoint102b : Select a Point"))
(princ "\n Test102 loaded. Enter 'Test102' at the Command Line.")
(princ)
-
Excellent explanation - thanks Kerry, I understand :-)