TheSwamp

CAD Forums => CAD General => Topic started by: bfred805 on December 09, 2015, 01:54:02 PM

Title: Command Unknown
Post by: bfred805 on December 09, 2015, 01:54:02 PM
Hello,

I have been assigned the task of running the CAD organization in our office. I am new to this so sorry in advance if my methods seem elementary to the more advanced, I am figuring it out!

Right now, I have decided that I will maintain our office standards on my local machine and mirror those to the server where other users are pulling from. This way, the original and most up to date copy of our system standards are provided. I created a button on the ribbon that is supposed to launch this code:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:sendtoserver ()
  2.         (command "_.shell" "\"C:\\Program Files\\Autodesk\\ACAD_Config\\File Sync\\updateserverfromlocal.ffs_batch\"")
  3.         (alert "Files have been sent to the server!")
  4.         (princ)
  5. )

However, whenever I click the button, I get an error (Command: SENDTOSEVER Unknown command "SENDTOSERVER".)

If I type in (load "SENDTOSERVER") and then execute it, the program works fine. Also know that I have included a line for (load "SENDTOSERVER") in my acad.doc file that I use to load other .lsp files into at startup.

Any ideas on what is causing the button not to work unless I reload the function? Also, while I am here - does anyone have any ideas for running this program automatically when I startup my ACAD? That would be nice to skip the button all together.

Thanks in advance!


EDIT: Added code tags. - John
Title: Re: Command Unknown
Post by: mjfarrell on December 09, 2015, 02:50:08 PM
not sure about your Unknown Command issue,

however, why or have you not considered an Enterprise CUI to deal with setting the standards in that fashion instead?
Title: Re: Command Unknown
Post by: Mark on December 09, 2015, 03:00:09 PM
If I type in (load "SENDTOSERVER") and then execute it, the program works fine. Also know that I have included a line for (load "SENDTOSERVER") in my acad.doc file that I use to load other .lsp files into at startup.

Any ideas on what is causing the button not to work unless I reload the function? Also, while I am here - does anyone have any ideas for running this program automatically when I startup my ACAD? That would be nice to skip the button all together.

EDIT: Added code tags. - John

Perhaps acaddoc.lsp could help with the loading/running.

http://jtbworld.com/autocad-acaddoc-lsp

another good source!

http://www.lee-mac.com/autoloading.html
Title: Re: Command Unknown
Post by: JohnK on December 09, 2015, 03:02:06 PM
I managed office standards for many years so feel better about your decision to having them local and publishing them to the network (I've done it that way for many years). I would, however, not use a button in AutoCAD. Here is a thread I started in the Revit forum (talking about my process on Revit files, of course) which I also used for AutoCAD stuff before that. You'll need to learn a few new tools though but it will be well worth your efforts.

https://www.theswamp.org/index.php?topic=49375.0
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 03:12:54 PM
If I type in (load "SENDTOSERVER") and then execute it, the program works fine. Also know that I have included a line for (load "SENDTOSERVER") in my acad.doc file that I use to load other .lsp files into at startup.

Any ideas on what is causing the button not to work unless I reload the function? Also, while I am here - does anyone have any ideas for running this program automatically when I startup my ACAD? That would be nice to skip the button all together.

EDIT: Added code tags. - John

Perhaps acaddoc.lsp could help with the loading/running.

http://jtbworld.com/autocad-acaddoc-lsp

another good source!

http://www.lee-mac.com/autoloading.html

apologies, that was a typo. Just to be clear - I have it loaded into acaddoc.lsp


EDIT: Fixed quote - John
Title: Re: Command Unknown
Post by: ronjonp on December 09, 2015, 03:14:40 PM
THIS (http://www.theswamp.org/index.php?topic=39415.msg446782#msg446782) may also help with copy\updating files from CAD.

Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 03:18:44 PM
THIS (http://www.theswamp.org/index.php?topic=39415.msg446782#msg446782) may also help with copy\updating files from CAD.


Thank you, I don't really follow what is going on there. Will you please explain?
Title: Re: Command Unknown
Post by: ronjonp on December 09, 2015, 03:22:04 PM
Read the header of the code & also at the bottom there is an example how to use it. THIS (http://www.computerhope.com/xcopyhlp.htm#01) site has some good examples of usage.

Title: Re: Command Unknown
Post by: JohnK on December 09, 2015, 03:33:51 PM
XCOPY? ...That's far too slow especially if you insist on doing this from within an AutoCAD process. XCOPY would be good (I suppose) for copying a few lisp files to the network but nothing extensive as standards can be.
Title: Re: Command Unknown
Post by: ronjonp on December 09, 2015, 03:44:18 PM
XCOPY? ...That's far too slow especially if you insist on doing this from within an AutoCAD process. XCOPY would be good (I suppose) for copying a few lisp files to the network but nothing extensive as standards can be.
Works fine here ... *shrug*
It's pretty fast after initial copy when using /D switch.
Title: Re: Command Unknown
Post by: JohnK on December 09, 2015, 03:58:19 PM
To each his own I guess.  I used XCOPY to publish my stds (for about 1 week maybe 10 or so years ago) but I out grew that method fast; I had two departments create several projects off some standards that were still in the process of being fixed/updated and it was chaos (I don't miss that place). Still, the /D switch is only so good (you can break that simply by copying files from a USB stick or something that will reset that date stamp...Windows gremlins).  ...Sorry, I'm just a proponent of more bullet proof stuff.
Title: Re: Command Unknown
Post by: ronjonp on December 09, 2015, 04:04:18 PM
I'm sure your method is much better ... what I have has been working for a loooong time so I figure if it ain't broke :)
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 04:37:09 PM
To get back on the subject of "teaching"... does anyone see any errors with my routine that could be causing it not to work?
Title: Re: Command Unknown
Post by: JohnK on December 09, 2015, 05:14:38 PM
I'm sure your method is much better ... what I have has been working for a loooong time so I figure if it ain't broke :)
I'm not saying that, ronjonp. I agree with you that if it isn't broke... I just found the use of XCOPY in an actual production environment surprising.
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 05:27:01 PM
not sure about your Unknown Command issue,

however, why or have you not considered an Enterprise CUI to deal with setting the standards in that fashion instead?

I don't know too much about the advantages to an Enterprise CUI. I'll look into that. Thanks for the idea.
Title: Re: Command Unknown
Post by: Kerry on December 09, 2015, 06:01:58 PM
brewser,
Just check pathing :
In AutoCAD at the command line enter
(findfile "AcadDoc.lsp")

Does the return value match where the file you are using is located.

Add something like  this temporarily to  the AcadDoc.lsp
(princ "\nNow loading AcadDoc.lsp")

then Appload the "AcadDoc.lsp"
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 06:05:44 PM
brewser,
Just check pathing :
In AutoCAD at the command line enter
(findfile "AcadDoc.lsp")

Does the return value match where the file you are using is located.

Add something like  this temporarily to  the AcadDoc.lsp
(princ "\nNow loading AcadDoc.lsp")

then Appload the "AcadDoc.lsp"

Yep. Everything matches correctly.
Title: Re: Command Unknown
Post by: Kerry on December 09, 2015, 06:14:07 PM
When (after) you manually appload the AcadDoc.lsp is the SENDTOSERVER command available ??

Just as a matter of interest, What is the Path for each file ?
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 06:54:40 PM
When (after) you manually appload the AcadDoc.lsp is the SENDTOSERVER command available ??

Just as a matter of interest, What is the Path for each file ?

The command is available ONLY after I type in (load "sendtoserver.lsp") at the command line. Then the program becomes totally functional. It's strange that it does not load automatically as do the other .LSP routines that I have slated to load in the acaddoc.lsp file.

All of my .LSP files live in the same location and work correctly:

C:\Program Files\Autodesk\ACAD_Config\LISP

I have also added them as trusted locations and mapped them in my working support files.

Title: Re: Command Unknown
Post by: JohnK on December 09, 2015, 07:10:48 PM
Then it has to be in your AcadDoc.lsp file. The load line must be incorrect some how.
Title: Re: Command Unknown
Post by: bfred805 on December 09, 2015, 07:47:25 PM
Then it has to be in your AcadDoc.lsp file. The load line must be incorrect some how.

(load "syncfromserver.lsp")
(load "sendtoserver.lsp")

Would the fact that I am using (command "_.shell"...) have anything to do with it? Are there special requirements for loading a shell command that don't apply to a standard routine?
Title: Re: Command Unknown
Post by: Kerry on December 09, 2015, 08:52:37 PM
Please Change the load statement in AcadDoc.lisp to
(load "sendtoserver.lsp" "Wooops it happened again")

So please confirm :
AcadDoc.lisp contains (load "sendtoserver.lsp"  "Wooops it happened again")

When you start an AutoCAD session , SENDTOSERVER at the commandLine generates "Unknown Command"

When you use Appload to load AcadDoc.lisp , SENDTOSERVER at the commandLine  generates "Unknown Command"

When you run at the Command Line (load "sendtoserver.lsp") , SENDTOSERVER at the commandLine works as expected.


Is this correct. ?

Title: Re: Command Unknown
Post by: Kerry on December 09, 2015, 08:59:44 PM

Can you provide a suitably sized snapshot of your menu button definition file related to this command ?


Title: Re: Command Unknown
Post by: bfred805 on December 21, 2015, 02:45:11 PM
When (after) you manually appload the AcadDoc.lsp is the SENDTOSERVER command available ??

Just as a matter of interest, What is the Path for each file ?

The APPLOAD command appears to be unavailable in my AutoCAD product (AutoCAD LT)
Title: Re: Command Unknown
Post by: Jeff H on December 21, 2015, 02:46:58 PM
Does AutoCAD LT have appload?
Title: Re: Command Unknown
Post by: bfred805 on December 21, 2015, 02:49:47 PM
Please Change the load statement in AcadDoc.lisp to
(load "sendtoserver.lsp" "Wooops it happened again")

So please confirm :
AcadDoc.lisp contains (load "sendtoserver.lsp"  "Wooops it happened again")

When you start an AutoCAD session , SENDTOSERVER at the commandLine generates "Unknown Command"

When you use Appload to load AcadDoc.lisp , SENDTOSERVER at the commandLine  generates "Unknown Command"

When you run at the Command Line (load "sendtoserver.lsp") , SENDTOSERVER at the commandLine works as expected.


Is this correct. ?

1. yes. The AcadDoc.lisp contains (load "sendtoserver.lsp"  "Wooops it happened again")
2. yes. When I start an AutoCAD session , SENDTOSERVER at the commandLine generates "Unknown Command" (as well as several other LISP routines I have now.)
3. I am unable to use Appload to load AcadDoc.lisp , SENDTOSERVER at the commandLine
4. yes. When I run at the Command Line (load "sendtoserver.lsp") , SENDTOSERVER at the commandLine works as expected.
Title: Re: Command Unknown
Post by: bfred805 on December 21, 2015, 02:51:23 PM
Does AutoCAD LT have appload?

My version states "The appload command is not available in this product..."

Is there a way to modify this in the registry?
Title: Re: Command Unknown
Post by: BKT on December 22, 2015, 01:10:41 PM
You won't be able to modify the registry as a fix for this.  AutoCAD LT does not have the APPLOAD command so there is no LISP programming capability in the LT product.
Title: Re: Command Unknown
Post by: bfred805 on December 22, 2015, 05:31:27 PM
You won't be able to modify the registry as a fix for this.  AutoCAD LT does not have the APPLOAD command so there is no LISP programming capability in the LT product.

This may be true, but how come several other LISP files that I got from Lee Mac and other sources seem to work just fine? They are also loaded through the ACADDOC.LSP file
Title: Re: Command Unknown
Post by: Kerry on December 22, 2015, 05:46:02 PM
Considering your stated skill set I thought you'd have known this:
From http://www.autodesk.com.au/products/autocad/compare/compare-products
Title: Re: Command Unknown
Post by: bfred805 on December 31, 2015, 12:54:14 PM
well... I figure it out.

The ACADDOC.LSP file broke on me because there was a (,) in place of a (.) when loading a LISP file.

 :crazy2:

SMH today.
Title: Re: Command Unknown
Post by: tedg on January 05, 2016, 11:13:47 AM
well... I figure it out.

The ACADDOC.LSP file broke on me because there was a (,) in place of a (.) when loading a LISP file.

 :crazy2:

SMH today.
Glad you figured it out but..
I'm confused how you're using AutoCAD LT and using LISP too?