Jump to content

lisp routine won't load


nativedog

Recommended Posts

When I inserted the first command and hit return it brought up the command line again. Subsequently with the next two commands I received a "T" on the command line after each command.

The first line loaded the VisualLISP extension; the behaviour is the expected one.

The next two lines confirms that the folders are available, but the files seems to be missing. Can you load again, one by one, the lines from post #12?

Link to comment
Share on other sites

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

  • MSasu

    16

  • nativedog

    14

  • BlackBox

    9

  • rblades21

    3

Top Posters In This Topic

Posted Images

Sorry, what are you wanting me to do next? I am not a programmer just a humble tech.

Sorry, that was an answer at Lee Mac's observation.

Link to comment
Share on other sites

When I hit return the mirro image of the path is displayed minus the double forward slash which is the normal single.

Link to comment
Share on other sites

That means that the files are in fact available on the said paths. Sorry, I realy don't know now where else the error can be - I'll have to think about this.

Link to comment
Share on other sites

That's OK. I need to get back on the job. I will check back again tomorrow or later today if there are anymore posts. Thanks for trying to help.

Link to comment
Share on other sites

By the way, do you know the origin of this code? I mean, who written it. Maybe you can contact that person for a better debug.

Link to comment
Share on other sites

AFAIK, when adding directories to the AutoCAD Support Path list, only the specified directory is searched, no subfolders beneath the directory will be searched - you would need to add the required subfolder paths to the Support Path list separately.

 

... Unless one adds the subfolder as a prefix to the string argument, which holds true for both the Load, and Findfile functions. :thumbsup:

 

(load "[color=red]SubFolderToSomeSfsp[/color]\\foo.lsp")

 

 

Example:

 

foo.lsp is located in the user's Documents folder. Assuming that "C:\\Users\\" has been added to SFSP, then:

Command: (load (strcat (getvar 'loginname) "\\Documents\\foo.lsp"))

** Bow ties are cool **

foo.lsp

(prompt "\n** Bow ties are cool ** ")
(princ)

 

:beer:

Link to comment
Share on other sites

... Unless one adds the subfolder as a prefix to the string argument, which holds true for both the Load, and Findfile functions.

 

Ah yes, I had overlooked that - thanks Renderman :)

Link to comment
Share on other sites

To recap the tests, please paste one by one the lines below on command line prompt and check what returns - starting from second one, all line except last (which may return nil), must return T if everything is well set:

(vl-load-com)
(vl-file-directory-p "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\Lisp\\")
(and (findfile "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\Lisp\\LineTypes.lsp"))
(and (findfile "Lisp\\LineTypes.lsp"))
(vl-file-directory-p "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\LINETYPES\\")
(and (findfile "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\LINETYPES\\MCES.lin"))
(and (findfile "LINETYPES\\MCES.lin"))
(wcmatch (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) "*C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012*")
(wcmatch (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) "*C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\*")

If last line will return T, then this should be investigated deeper.

Link to comment
Share on other sites

Opening an AutoCAD 2013 format file.

Regenerating model.

AutoCAD menu utilities loaded.

Metropolitan Council Environmental Services Configuration Loaded.

AutoCAD MEP menu utilities loaded.

AutoCAD Architecture menu utilities loaded.

Command:

Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application or Autodesk licensed application.

Command:

Command: (vl-load-com)

 

Command: (vl-file-directory-p "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\Lisp\\")

T

Command: (and (findfile "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\Lisp\\LineTypes.lsp"))

T

Command: (and (findfile "Lisp\\LineTypes.lsp"))

nil

Command: (vl-file-directory-p "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\LINETYPES\\")

T

Command: (and (findfile "C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\LINETYPES\\MCES.lin"))

T

Command: (and (findfile "LINETYPES\\MCES.lin"))

nil

Command: (wcmatch (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) "*C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012*")

nil

Command: (wcmatch (vla-get-supportpath (vla-get-files (vla-get-preferences (vlax-get-acad-object)))) "*C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012\\*")

nil

Link to comment
Share on other sites

Seems to me that the path:

C:\\Users\\Susan\\Documents\\Autodesk 2013\\My Projects\\WASTE WATER ELECTRICAL AND HVAC\\MCES CAD STANDARDS FOR 2012

exists on your workstation, but you didn't added it to the list of Support File Search Path:

 

supp.gif

 

Please check again.

 

Click first the Add... button, this will add a new, empty entry; after use Browse... to indicate that path. Don't forget to confirm your changes.

Link to comment
Share on other sites

I had it in with subfolders but not alone. Just added and it loaded.:D Thanks so much. Sorry to take up so much of your time for something that was probably very simple.

Link to comment
Share on other sites

What is important is that your issue is now gone! You're entirely welcomed.

 

Maybe is just the time to write down a small procedure describing the steps to install that tools pack on your workstation! Save it along the tools. May find it very useful later.

Link to comment
Share on other sites

This seemed relevant:

 

(defun c:SFSP+  (/ *error*)
 (vl-load-com)

 (defun *error*  (msg)
   (if oShell
     (setq oShell (vlax-release-object oShell)))
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
   (princ))

 ((lambda (acApp / oShell oFolder acDoc acFiles path oldPath)
    (if
      (and
        (setq oShell
               (vlax-get-or-create-object "Shell.Application"))
        (setq oFolder
               (vlax-invoke
                 oShell 'BrowseForFolder (vla-get-hwnd acApp)
                 "Select a folder to add to SFSP:" 0)))
       (if
           (not
             (vl-string-search
               (strcase
                 (setq path
                        (strcat
                          (vlax-get-property
                            (vlax-get-property oFolder 'Self)
                            'Path)
                          ";")))
               (strcase
                 (setq oldPath
                        (strcat
                          (vl-string-right-trim
                            ";"
                            (vla-get-supportpath
                              (setq acFiles
                                     (vla-get-files
                                       (vla-get-preferences
                                         acApp)))))
                          ";")))))
         
            (progn
              (vla-put-supportpath acFiles (strcat oldPath ";" path))
              (*error* nil))
            (*error* "Path already exists in SFSP"))
       (cond
         (oShell (*error* nil))
         ((*error* "Unable to create Shell.Application Object")))))
   (vlax-get-acad-object)))

Link to comment
Share on other sites

You know you don't need VLA to do the support paths:

(defun SFSP-append (path / sfsp)
 (setq sfsp (getenv "ACAD"))
 (if (not (wcmatch (strcase sfsp) (strcat "*" (strcase path) "*")))
   (setenv "ACAD" (strcat sfsp ";" path))))

 

BTW, I can't remember exactly, but I thought there was some limit on the length of the total SFSP. So after adding several folders you might find that the last few folders are not stored in SFSP.

Link to comment
Share on other sites

(getenv "ACAD")

I knew for sure that I have used to parse the SFSP list in old versions of AutoCAD, prior to advent of VisualLISP, but I wasn't able to locate that old code. Thank you for refreshing my memory!

 

BTW, I can't remember exactly, but I thought there was some limit on the length of the total SFSP. So after adding several folders you might find that the last few folders are not stored in SFSP.

This is an interesting observation that should be accounted!

Link to comment
Share on other sites

Glad to remind you :D ... also remember that environment variables are case sensitive, so (getenv "acad") will give nil.

 

As for the limit on length - I don't know if it still applies. I think it was an old Registry limit of around 4000 characters. Perhaps with newer Windows the limit has disappeared, though I'm not going to test it ;)

 

Edit: Apparently it's 800 characters, and it's still listed as an Issue ... up to 2007, don't know of later ACads!

http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=2884947&linkID=9240617

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...