Author Topic: is there a way for "if path nil, use this path"?  (Read 262 times)

0 Members and 1 Guest are viewing this topic.

tedg

  • Swamp Rat
  • Posts: 807
is there a way for "if path nil, use this path"?
« on: August 04, 2021, 01:23:43 PM »
Hello all, been a while since I posted here..
Hoping this is an easy fix or there's maybe an easier way.
 

I /we have a custom "revcloud" routine that we use, that inserts a rev triangle block (delta with attributes) from the same location that the lisp routine lives on our server.
The issue is, with most of us working remotely, and we use Dropbox as our virtual server when away from the office, the path isn't the same as if in the office.
The office computers don't/won't have Dropbox loaded, as I've been told.


(example)
Code: [Select]
(command "-insert" "C:\\Dropbox\\CADD\\Symbols\\Revision") ;;dropbox location
;;vs
(command "-insert" "Y:\\Symbols\\Revision") ;;office server





So is there a way to force which drive in gets the dwg file from depending on where the routine lives?
Any other ideas?
I'm trying to make it idiot-proof for people using the routine no matter where they are working, and avoid having duplicates of the routine with different names (which may be my option B).
Thanks
Windows 7 Pro 64bit, AutoCAD 2018, REVIT 2017, Inventor Professional 2015

mhupp

  • Newt
  • Posts: 33
Re: is there a way for "if path nil, use this path"?
« Reply #1 on: August 04, 2021, 01:36:40 PM »
Code: [Select]
(if (not (findfile (setq path "C:\\Dropbox\\CADD\\Symbols\\Revision")))
  (setq path "Y:\\Symbols\\Revision")
)
(vl-cmdf "-insert" path)

tedg

  • Swamp Rat
  • Posts: 807
Re: is there a way for "if path nil, use this path"?
« Reply #2 on: August 04, 2021, 02:31:20 PM »
Code: [Select]
(if (not (findfile (setq path "C:\\Dropbox\\CADD\\Symbols\\Revision")))
  (setq path "Y:\\Symbols\\Revision")
)
(vl-cmdf "-insert" path)


Thanks mhupp, this helped!
Windows 7 Pro 64bit, AutoCAD 2018, REVIT 2017, Inventor Professional 2015

ronjonp

  • Needs a day job
  • Posts: 7327
Re: is there a way for "if path nil, use this path"?
« Reply #3 on: August 05, 2021, 10:11:38 AM »
Can also be written like this:
Code - Auto/Visual Lisp: [Select]
  1. (setq path (cond ((findfile "C:\\Dropbox\\CADD\\Symbols\\Revision"))
  2.                  ((findfile "Y:\\Symbols\\Revision"))
  3.            )
  4. )

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC