Author Topic: change vlx 's command  (Read 3293 times)

0 Members and 1 Guest are viewing this topic.

77077

  • Guest
change vlx 's command
« on: June 03, 2015, 02:17:52 AM »
eg.
VLX name: attmodify 
VLX command: am

Code: [Select]
(defun c:new_command ()
(if (not (member 'ddmodify (vl-list-loaded-vlx)))
(load "attmodify.VLX")
)
(c:am)
)

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: change vlx 's command
« Reply #1 on: June 03, 2015, 07:13:26 AM »
If the VLX was compiled to a separate namespace, you will probably need to use something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil
  2.     (if (member 'attmodify (vl-list-loaded-vlx))
  3.     )
  4.     (princ)
  5. )

Otherwise, try something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil (c:attmodify))

You can use vl-list-loaded-vlx to determine whether the VLX has been compiled to its own namespace, since this function should only list symbols identifying separate-namespace VLX applications.
« Last Edit: June 03, 2015, 07:18:04 AM by Lee Mac »

77077

  • Guest
Re: change vlx 's command
« Reply #2 on: June 03, 2015, 07:43:59 AM »
If the VLX was compiled to a separate namespace, you will probably need to use something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil
  2.     (if (member 'attmodify (vl-list-loaded-vlx))
  3.     )
  4.     (princ)
  5. )

Otherwise, try something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil (c:attmodify))

You can use vl-list-loaded-vlx to determine whether the VLX has been compiled to its own namespace, since this function should only list symbols identifying separate-namespace VLX applications.

Hi lee, Thanks for reply.

I mean some different VLX, But have same command . so need change VLX's command.

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: change vlx 's command
« Reply #3 on: June 03, 2015, 08:34:22 AM »
I mean some different VLX, But have same command . so need change VLX's command.

You cannot modify a VLX.

77077

  • Guest
Re: change vlx 's command
« Reply #4 on: June 03, 2015, 09:47:20 AM »
I mean some different VLX, But have same command . so need change VLX's command.

You cannot modify a VLX.

Yes , So, I post this thread.

It's another way(Method)

eg: a.vlx & b.vlx  have same command "zbbz"

I use this method

Code - Auto/Visual Lisp: [Select]
  1. (defun c:test1 (/ FILE)
  2.   (cond
  3.     ((and c:zbbz
  4.           (VL-ACAD-UNDEFUN 'C:zbbz)
  5.           (setq file (findfile "a.vlx"))
  6.      )
  7.      (load file)
  8.      (C:zbbz)
  9.     )
  10.   )
  11. )
  12. (defun c:test2 (/ FILE)
  13.   (cond
  14.     ((and C:zbbz
  15.           (VL-ACAD-UNDEFUN 'C:zbbz)
  16.           (setq file (findfile "b.vlx"))
  17.      )
  18.      (load file)
  19.      (C:zbbz)
  20.     )
  21.   )
  22. )
  23.  

Marco Jacinto

  • Newt
  • Posts: 47
Re: change vlx 's command
« Reply #5 on: June 03, 2015, 10:04:14 AM »
Lee, can you explain why if the vlx is compiled to a separate Namespace you nid to use sendcommand, I had some problems with a vlx that can run in one PC, but when I distribute it, it doesn´t work anymore.

Saludos
Marco Jacinto

Lee Mac

  • Seagull
  • Posts: 12921
  • London, England
Re: change vlx 's command
« Reply #6 on: June 03, 2015, 12:41:55 PM »
Lee, can you explain why if the vlx is compiled to a separate Namespace you nid to use sendcommand, I had some problems with a vlx that can run in one PC, but when I distribute it, it doesn´t work anymore.

Hi Marco,

When working with AutoLISP, all symbols & functions are usually defined either within the document namespace or blackboard namespace (if vl-bb-set is used); in this way, all defined symbols (functions / constants / global variables etc.) defined in the namespace for one document (drawing) will be accessible by (and may also interfere with!) all other defined symbols in the same namespace, but cannot be accessed by functions defined in another namespace, e.g. in another drawing, unless a function such a vl-propagate has been used to propagate the symbol across multiple namespaces.

Hence, if a VLX is compiled to a separate namespace, all symbols & functions defined by the VLX will reside in a separate namespace (perhaps think of it like a 'container') isolated from the document & blackboard namespaces, and such functions won't be accessible by functions evaluated within the document namespace, unless either exported using vl-doc-export, or defined directly in the document namespace using the vl-doc-set function evaluated from within the VLX namespace.

Here's another brief explanation of a namespace (from an AutoLISP perspective).

Lee
« Last Edit: June 03, 2015, 12:48:56 PM by Lee Mac »

Marco Jacinto

  • Newt
  • Posts: 47
Re: change vlx 's command
« Reply #7 on: June 04, 2015, 09:29:37 AM »
Thanks for your response Lee.

I have always assumed that the c: functions were exported by the compiler by default, so I didn't figure out the problem when my c: functions and all others weren't exposed to the drawing, even when I explicitly exported them via vl-doc-export.

Will do some test to see if I can understand an apply the concepts

Q1241274614

  • Guest
Re: change vlx 's command
« Reply #8 on: July 07, 2015, 06:46:04 AM »
If the VLX was compiled to a separate namespace, you will probably need to use something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil
  2.     (if (member 'attmodify (vl-list-loaded-vlx))
  3.     )
  4.     (princ)
  5. )

It looks very comfortable.

Otherwise, try something like:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:am nil (c:attmodify))

You can use vl-list-loaded-vlx to determine whether the VLX has been compiled to its own namespace, since this function should only list symbols identifying separate-namespace VLX applications.

Hi lee, Thanks for reply.

I mean some different VLX, But have same command . so need change VLX's command.