Author Topic: acad_truecolordlg in separate namespace  (Read 2483 times)

0 Members and 1 Guest are viewing this topic.

Pepe

  • Newt
  • Posts: 87
acad_truecolordlg in separate namespace
« 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:

Code: [Select]
(defun C:TEST () (acad_truecolordlg 1 T))
Does anybody knows what to do?

Thanks in advance

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: acad_truecolordlg in separate namespace
« Reply #1 on: November 29, 2010, 05:56:56 PM »
Perhaps vl-arx-import ?

Read about it in the VLIDE Help  :-)

Pepe

  • Newt
  • Posts: 87
Re: acad_truecolordlg in separate namespace
« Reply #2 on: November 30, 2010, 03:14:52 AM »
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... :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: acad_truecolordlg in separate namespace
« Reply #3 on: November 30, 2010, 04:28:16 AM »

Something like :-

Code: [Select]
(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)
)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Pepe

  • Newt
  • Posts: 87
Re: acad_truecolordlg in separate namespace
« Reply #4 on: November 30, 2010, 05:41:28 AM »
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: )

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: acad_truecolordlg in separate namespace
« Reply #5 on: November 30, 2010, 05:50:36 AM »

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
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: acad_truecolordlg in separate namespace
« Reply #6 on: November 30, 2010, 06:09:53 AM »
Kerry,

One thing I was slightly stumped on when reading the help is to why they include:

Code: [Select]
(vl-doc-export 'testarx)
at the top of the code.

Is there something I am missing?

Thanks for your time :-)

Pepe

  • Newt
  • Posts: 87
Re: acad_truecolordlg in separate namespace
« Reply #7 on: November 30, 2010, 07:14:14 AM »
Quote
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...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: acad_truecolordlg in separate namespace
« Reply #8 on: November 30, 2010, 06:59:19 PM »
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
Code: [Select]

;; 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)
« Last Edit: November 30, 2010, 07:11:09 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Lee Mac

  • Seagull
  • Posts: 12937
  • London, England
Re: acad_truecolordlg in separate namespace
« Reply #9 on: November 30, 2010, 07:01:41 PM »
Excellent explanation - thanks Kerry, I understand  :-)