Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

File Manager Add-On & UNC Paths

Hi All,

We need to write out some data files from GDL objects to specific locations depending on network connections to office servers etc.

I would like to be able to use the File Manager Add-On to check if a UNC path exists, if not then to set the file location to the ArchiCAD Data folder.

My problem is that if the UNC path is not accessible, the GDL script simply stops instead of giving me an error code condition that I can check for.

I am aware that this could work if we had mapped drive letters for the folders, but we do not have control over the drive letter assignments.

Any thoughts appreciated.

Cheers,
Danny
8 REPLIES 8
Barry Kelly
Moderator
I don't know that it is possible to check if a folder exists.
But why not use the full folder network path (is that what it's called?) rather than a mapped drive path.

ie instead of "W:\Working Files" use the full path of "\\MyServer\Data\Working Files".
This full path should be the same regardless of what machine you are on and whether the drive has been mapped or not.

Of course I am talking Windows OS here - I guess it is similar for a Mac.


There is another option with the data out where you can set it to ask the user to browse for the path each time.
But that is annoying as it doesn't remember and will ask each time.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Frank Beister
Moderator
You habe to separate each node of the path and have to check from root. You can read files and folders and can proof, if the next folder in your path exist. If not, abort further checking, otherwise continue with next level.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Hi Barry - thanks for the reply.

We are using UNC paths (\\server\share\folder), but there is no way to check that the folder exists. When users are on the internal domain, then they have access to the server share, when they are outside on public internet, they do not (this is when we would use the ArchiCAD Data folder instead.

F. Beister - I know the File Manager I/O Add On can check for the presence of files / folders, but for the root level scan it will only list mapped drive letters, not UNC paths.

It would be great if when opening a file / folder in the following way that ch1 would return -1 or similar if the file / folder didnt exist. Currently it just stops running the GDL script at that point.

ch1 = open ("TEXT", f1, "mode = ro")
OR
ch1 = open ("FileMan", folderpath, "folders")
Barry Kelly
Moderator
When I write data files I usually just send them to the folder the job is saved in.
That way the data files stay with the job and aren't stored on individual users hard drives in the Archicad Data folder.

Use ... rrr=REQUEST ("Name_of_plan", "", pname, pfullname, ppath)
to get the file name and path.

You will need to use a bit of string editing to separate the path from the file name.
I just do this ...

rrr=REQUEST ("Name_of_plan", "", pname, pfullname, ppath)
!pname="test21345"

!print pname
!print pfullname
!print ppath

file_name_start = STRSTR(ppath, pfullname)
!print file_name_start

fold_path = STRSUB(ppath, 1, file_name_start-1)
!print fold_path




This way it doen't matter if the user has mapped a drive letter or is using the full network path or is working from their own hard drive the files will go to where ever the job is.

I guess you could extend it and if you always have a "Data" folder in the job folder you could add that to the folder path. It has been a while since I have checked but if the "Data" folder doesn't exist then the GDL script will not create it.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Frank Beister
Moderator
...but for the root level scan it will only list mapped drive letters, not UNC paths.
This I didn't understood in your post. Sorry.
It would be great if when opening a file / folder in the following way that ch1 would return -1 or similar if the file / folder didnt exist. Currently it just stops running the GDL script at that point.
Yes, I know, because of this I am doing file allocation every time by a certain macro object, which navigates straight to folder, enshuring, that every folder exists.
Of course you have to check if the path is existing every time you try to open.
It would be so easy, if GS would add an error message/code as you mention.

@Barry
Nice idea to use project path! But does not work in TW environment.
The data folder has moved from ArchiCAD folder to system user settings folder in AC15 (?).

Would it be helpful, if a root path is stored in MVO? There you could adjust hard coded, or "by project path". Needs to be entered for each MVO setting, but would be better than for hundred placed objects. If you like, I could add to openLibraryGlobals.
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Thanks for the replies and the ideas ... something for me to think over. At the moment we are unable to store the files alongside the project - the company directive is for them to be on the UNC path server, failing that on the ArchiCAD Data folder.

We also have local and teamwork files & perform a test in a master_gdl object to identify if it is local pln or teamwork file, and set other file locations on this information.
Frank Beister
Moderator
We also have local and teamwork files & perform a test in a master_gdl object to identify if it is local pln or teamwork file, and set other file locations on this information.
Sounds interesting. Can you explain, how you do this?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
rrr=REQUEST("Name_of_plan", "", prj_name, prj_fullname, prj_path)
strPart="teamwork:"
ppp=STRSTR(prj_path,strPart)

if ppp>0 then teamworkProject
REQUEST Name_of_plan will return teamwork: as part of the path to project ...