Jump to content

Recommended Posts

Posted

I must be getting rusty because I can't seem to get anything to work with this:

(LOAD "G:/My Drive/VLISP/utils.lsp")

The path contains a space and I'm not getting the syntax correct on how to make it work?

 

Posted

See no reason your code shouldn't work but you can try :


(if (not (setq fn (findfile "G:/My DRIVE/VLISP/utils.lsp")))(prompt "\nfile not found")(load fn))

 

or use check code in your vlisp editor. Maybe code itself in file is to blame.

 

Posted

There is a space in the path "My Drive" and that's where I'm not getting the syntax correct. The code above produce a "file not found" message.

Posted (edited)

just did a little test with (if (not (setq fn (findfile "d:/My DRIVE/VLISP/utils.lsp")))(prompt "\nfile not found")(load fn)) and it loaded as expected. Maybe your pc still thinks it's halloween? Does this folder itself has any restrictions? (read/write)

 

you could also try to add your folder (G:/My DRIVE/VLISP/)  to the your support folders in options. (findfile "utils.lsp") should then return the complete path & filename. And if your path is part of a network folder something like //mynetwork/vlisp/utils.lsp (with the // at the beginning)

Edited by rlx
Posted (edited)

The space in a directory is a undocumented  problem with lisp,  VBA works fine I had like 200 blocks in a directory all the menus done and it did not work fell over on the space tried \\ instead was doing my head in. It probably starts with DOS and its 8 character limit and definitely no spaces in name.

 

Try this (LOAD "G:\\My Drive\\VLISP\\utils.lsp")

 

(LOAD "d:\\acadtemp\\alan space\\Bigal 1.lsp") worked with Briscad & Autocad

 

This was my way around opening a block dwg

(defun openblk (blkname / adocs)
(setq acDocs (vla-get-documents (vlax-get-acad-object)))
(vla-open acDocs blkname)
(vla-activate (vla-item acdocs 1))
)

 

Edited by BIGAL
Posted

didn't know space was a problem , can't remember ever having problems with it but maybe I was just lucky 😁

 

anyways, have a few core routines I'm using to convert path's and filenames


(defun string-p (s)(if (= (type s) 'str) t nil))

(defun vl_path ($p)(if (= (type $p) 'str)
   (strcat (vl-string-right-trim "/" (strcase (vl-string-translate "\\" "/" $p) t)) "/") ""))

(defun vl_filename ($p)(if (= (type $p) 'str)(strcase (vl-string-translate "\\" "/" $p) t) ""))

(defun dos_path ($p)
  (if (= (type $p) 'STR) (strcase (strcat (vl-string-right-trim "\\" (vl-string-translate "/" "\\" $p)) "\\")) ""))
(defun SplitDosPath (p)(vl-remove "" (SplitStr (dos_path p) "\\")))

(defun SplitStr ( s d / p )
  (if (setq p (vl-string-search d s))(cons (substr s 1 p) (SplitStr (substr s (+ p 1 (strlen d))) d)) (list s)))

Posted

Its only space probably some other characters, if you use like /Big_AL/ or /Big-AL/ no problems. Did just that as a quick fix made the space a -

Posted

Thanks all. It's also a problem when you're working on a new network topology. The IT staff helped me correct this. the G:\ drive is actually in the cloud and something in my login script (darn M$ Windows 10) was causing latency and then you had to factor in the Autumnal Equinox against the current lunar phase of the moon, etc...it works now like it should.

Posted

So it really was sort of a ghost in the machine 😄

 

but glad you / IT sorted it out

Posted

IT Yeah oh we are removing your drive and must use corporate docu management system. The screams were heard, so then oh but we will still have some drives where necessary. Ok away we went. Some time later IT we are remapping your drive your P: is now L: just watched stuff not work anymore, fixed now. If they can get the doc system to work with Autocad then that's the way they want it. Don't worry about the fact that we can find any project since 1996 very fast.

Posted

I know exactly what you mean bigal 😪 IT can be irritating at times. I can't tell anymore how many times they have switched server this year alone. For P&ID's we have CadWorx and last week , without notice they switched server. Result was program stopped working because licence server refused to work with new server and a couple of colleagues could do nothing for a couple of days (just glad I wasn't the one to make things right again haha). I have a lot of drawings with xref. For technical reasons I had to put in the full path but next year I will finally be able to strip all xref paths and use projectname again. Written a odbx app for this and it can filter out from 200.000 drawings all drawings with xref , strip the path and it can even bind xrefs on all layout tabs if needed and do so in half a day. It's not I'm not pleased I was able to write this app , but I wish I didn't need to you know. For this I also made a getfolder sub that works with network path's rather than the standard getfolder sub. But looking on the bright side , my colleagues are happy that I'm able to cleanup after IT and I'm not entirely useless after all 😁

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...