Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

(layoutlist) fails in vlx

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
277 Views, 5 Replies

(layoutlist) fails in vlx

Using Vanilla 2005 here, thought some of you might like to know what I have found. Seems that when the layoutlist function has been compiled in a separate namespace vlx it is no longer recognized by the calling application. Unsure of previous version behavior. Take this and compile it into a seperate namespace vlx (defun c:test () (layoutlist) ) Command: test "no function definition: LAYOUTLIST" But when called at the command line it still works. Command: (layoutlist) ("Layout1" "Layout2") -- Autodesk Discussion Group Facilitator
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: Anonymous

Also, does anyone know if separate namespace vlx applications use a different error handler? Just noticing some difference in messages in regards to a function being undefined. Command: (abc) ; error: no function definition: ABC Command: !*error* # Command: test "no function definition: LAYOUTLIST" Command: !*error* # -- Autodesk Discussion Group Facilitator "Jason Piercey" wrote in message news:40e4a8bf_3@newsprd01... > Take this and compile it into a seperate namespace vlx
Message 3 of 6
Anonymous
in reply to: Anonymous

You may have to add LayoutList to those functions that need to be loaded into a separate namespace VLX... (foreach item '(ACAD_COLORDLG ACAD_STRLSORT INITDIA ACAD-POP-DBMOD ACAD-PUSH-DBMOD STARTAPP) (vl-arx-import item) ) As to errors, you have to use a (vl-exit-with-error) to make them visible to the document namespace... (defun *error* (Error) (cond ((not Error)) ((wcmatch (strcase Error) "*QUIT*,*CANCEL*") (vl-exit-with-error "\r ") ) ((wcmatch (strcase Error) "*CANCEL*,*QUIT*") (vl-exit-with-error (strcat "\r*ERROR*: " Error)) ) ) (princ) ) -- John Uhden, Cadlantic http://www.cadlantic.com Sea Girt, NJ "Jason Piercey" wrote in message news:40e4a8bf_3@newsprd01... > Using Vanilla 2005 here, thought some of you might > like to know what I have found. Seems that when the > layoutlist function has been compiled in a separate > namespace vlx it is no longer recognized by the calling > application. Unsure of previous version behavior. > > > Take this and compile it into a seperate namespace vlx > > (defun c:test () > (layoutlist) ) > > Command: test > "no function definition: LAYOUTLIST" > > > But when called at the command line it still works. > > Command: (layoutlist) > ("Layout1" "Layout2") > > > -- > Autodesk Discussion Group Facilitator > > >
Message 4 of 6
Anonymous
in reply to: Anonymous

I see, thanks John. I wasn't aware that needed to be done. I'll have to chew on the vl-exit-with-error for a minute. Not something I've used before. -- Autodesk Discussion Group Facilitator "John Uhden" wrote in message news:40e4bcd8$1_1@newsprd01... > You may have to add LayoutList to those functions that need to be loaded into a > separate namespace VLX... > (foreach item '(ACAD_COLORDLG ACAD_STRLSORT INITDIA ACAD-POP-DBMOD > ACAD-PUSH-DBMOD STARTAPP) > (vl-arx-import item) > ) > > As to errors, you have to use a (vl-exit-with-error) to make them visible to the > document namespace... > (defun *error* (Error) > (cond > ((not Error)) > ((wcmatch (strcase Error) "*QUIT*,*CANCEL*") > (vl-exit-with-error "\r ") > ) > ((wcmatch (strcase Error) "*CANCEL*,*QUIT*") > (vl-exit-with-error (strcat "\r*ERROR*: " Error)) > ) > ) > (princ) > ) > > -- > John Uhden, Cadlantic > > http://www.cadlantic.com > Sea Girt, NJ
Message 5 of 6
Anonymous
in reply to: Anonymous

Just a word of advice. In the code below, using wildcard pattern matching on the error string is unwise and unsound. With the advent of ActiveX, the range of strings that can appear in the argument passed to the *error* function (or to vl-catch-all-apply) is infinite. Make no assumptions. ActiveX methods can raise errors with messages that contain anything at all (including ones that can match the pattern shown in that same code). So, I would stongly advise others to not follow this pattern. Use explicit string comparisons if you need to determine precisely what the nature of error is. And of course, this is merely my opinion. :-) -- http://www.caddzone.com AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005 http://www.acadxtabs.com "Jason Piercey" wrote in message news:40e4c4b9$1_1@newsprd01... > I see, thanks John. I wasn't aware that needed > to be done. I'll have to chew on the vl-exit-with-error > for a minute. Not something I've used before. > > > -- > Autodesk Discussion Group Facilitator > > > "John Uhden" wrote in message > news:40e4bcd8$1_1@newsprd01... > > You may have to add LayoutList to those functions that need to be loaded > into a > > separate namespace VLX... > > (foreach item '(ACAD_COLORDLG ACAD_STRLSORT INITDIA ACAD-POP-DBMOD > > ACAD-PUSH-DBMOD STARTAPP) > > (vl-arx-import item) > > ) > > > > As to errors, you have to use a (vl-exit-with-error) to make them visible > to the > > document namespace... > > (defun *error* (Error) > > (cond > > ((not Error)) > > ((wcmatch (strcase Error) "*QUIT*,*CANCEL*") > > (vl-exit-with-error "\r > ") > > ) > > ((wcmatch (strcase Error) "*CANCEL*,*QUIT*") > > (vl-exit-with-error (strcat "\r*ERROR*: " Error)) > > ) > > ) > > (princ) > > ) > > > > -- > > John Uhden, Cadlantic > > > > http://www.cadlantic.com > > Sea Girt, NJ > >
Message 6 of 6
Anonymous
in reply to: Anonymous

Thank you for the advice. Why is it that some LISP functions have to be imported to work inside the vlx? Guess I just assumed that anything that is available in the document's namespace would also be in the application's namespace. -- Autodesk Discussion Group Facilitator "Tony Tanzillo" wrote in message news:40e4dad9_1@newsprd01... > Just a word of advice. In the code below, using wildcard > pattern matching on the error string is unwise and unsound. > > With the advent of ActiveX, the range of strings that can > appear in the argument passed to the *error* function (or > to vl-catch-all-apply) is infinite. Make no assumptions. > > ActiveX methods can raise errors with messages that contain > anything at all (including ones that can match the pattern > shown in that same code). > > So, I would stongly advise others to not follow this > pattern. Use explicit string comparisons if you need to > determine precisely what the nature of error is. > > And of course, this is merely my opinion. :-) > > -- > http://www.caddzone.com > > AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005 > http://www.acadxtabs.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report