[Solved] Block: create library item location
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
[Solved] Block: create library item location
Is there a place to set the preferred location for a new library block?
I have defined the top library location in the Library browser widget, but the command 'create library item' opens my home directory.
Thanks,
Robert
I have defined the top library location in the Library browser widget, but the command 'create library item' opens my home directory.
Thanks,
Robert
Last edited by RobB on Sun Oct 17, 2021 6:21 pm, edited 1 time in total.
Linux Mint 20 , qcadcam-3.24.3.10-pro-linux-x86_64
Re: Block: create library item location
Hi RobB,
You may then declare the path within app pref in QCAD
It is up to you where you wish to store your items. Create as many folders as you would when saving files. You may do that within the default library or create a personal one where you would normally save your files.the command 'create library item' opens my home directory
You may then declare the path within app pref in QCAD
JJ Win7 pro-64
Re: Block: create library item location
Hi J-J,
Yes, I have defined my library location tree in the app pref.
But that does not seem to influence which directory location opens, once I issue the command 'create library item' for a completed block.
It is always my home directory. Do I miss something?
Robert
Yes, I have defined my library location tree in the app pref.
But that does not seem to influence which directory location opens, once I issue the command 'create library item' for a completed block.
It is always my home directory. Do I miss something?
Robert
Linux Mint 20 , qcadcam-3.24.3.10-pro-linux-x86_64
Re: Block: create library item location
That is by default ... hardcoded in CreateLibraryItem.js
See:
https://qcad.org/rsforum/viewtopic.php?t=7726
https://www.ribbonsoft.com/bugtracker/i ... sk_id=2128
Regards,
CVH
Re: Block: create library item location
The more I use it, that default is not great.
As many other users probably do, I keep all my data, drawings etc on a backend server.
Even a 'hardwired' link like 'home/qcadlib' could solve the problem.
Robert.
As many other users probably do, I keep all my data, drawings etc on a backend server.
Even a 'hardwired' link like 'home/qcadlib' could solve the problem.
Robert.
Linux Mint 20 , qcadcam-3.24.3.10-pro-linux-x86_64
Re: Block: create library item location
Just my two cents ...
1. This "Hardwired" path isn't working as coded. It should open the launch path + "/libraries" but it already fails to jump to that subdirectory "libraries". Ok, I've to admit that I'm not a coder ..... but it looks like that to me ...
2. (the much more important point!) Every QCAD update will ruin your library item organization.
Before a update QCAD tries to save the item below "C:\Program Files\qcad-3.25.0-pro-win64" and after a update the same task leads you to save to "C:\Program Files\qcad-3.26.0-pro-win64". Confusing for every user and it requires a manual step in with a file management tool to move the items to the new location.
In short: If I'm able to tell QCAD where to look for library items (Application Preferences/Widgets/Library Browser) then I should also be able to tell QCAD where to save a new created (BT) library item.
I agree!
Second that too. Wherever you like to store your library items it should be outside the QCAD launch path / tree. Why?
1. This "Hardwired" path isn't working as coded. It should open the launch path + "/libraries" but it already fails to jump to that subdirectory "libraries". Ok, I've to admit that I'm not a coder ..... but it looks like that to me ...
2. (the much more important point!) Every QCAD update will ruin your library item organization.
Before a update QCAD tries to save the item below "C:\Program Files\qcad-3.25.0-pro-win64" and after a update the same task leads you to save to "C:\Program Files\qcad-3.26.0-pro-win64". Confusing for every user and it requires a manual step in with a file management tool to move the items to the new location.
In short: If I'm able to tell QCAD where to look for library items (Application Preferences/Widgets/Library Browser) then I should also be able to tell QCAD where to save a new created (BT) library item.
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."
Re: Block: create library item location
A fixed subdirectory in home could be a reasonable compromise.
I don't know how it is with Windows, but in Linux I would run a cron job to pickup what gets into home/qcadlib and send it to the backend.
And if I would stick to my own naming conventions, with a bit of python it might even end up in the right subdirectory...
However, running such a job directly in my home directory does not seem wise.
Robert
I don't know how it is with Windows, but in Linux I would run a cron job to pickup what gets into home/qcadlib and send it to the backend.
And if I would stick to my own naming conventions, with a bit of python it might even end up in the right subdirectory...
However, running such a job directly in my home directory does not seem wise.
Robert
Linux Mint 20 , qcadcam-3.24.3.10-pro-linux-x86_64
Re: Block: create library item location
Confirmed:
It doesn't open the launch path + "/libraries" disregarding the fact that the folder exist or not.
Over here, Create Library Item (BT) initiates a file dialog with my desktop as destination folder.
Probably a bare path vs a QFileInfo clash, a file called "libraries" will not exist but it is functional as "/libraries/".
Also remark that all paths "C:\Program Files ..." may be guarded by the Windows system to write to.
In such case it doesn't serve anything to present the application path aka launch path.
All disregarding it is "C:\Program Files\qcad-3.25.0-pro-win64" or the general "C:\Program Files\QCAD" or "...QCADCAM" on Windows.
More appropriate would be the recently added User Documents Location, if that exists.
Storing the last used path similar to 'Save As' and many others is not a big deal.
It only requires a few lines of standard code and an entry in the QCAD.ini/conf file.
By preferences would work.
But I think that many would already be happy with the dialog opening the last used path.
Not that I use the library often, fixed that on the fly.
Regards,
CVH
It doesn't open the launch path + "/libraries" disregarding the fact that the folder exist or not.
Over here, Create Library Item (BT) initiates a file dialog with my desktop as destination folder.
Probably a bare path vs a QFileInfo clash, a file called "libraries" will not exist but it is functional as "/libraries/".
Also remark that all paths "C:\Program Files ..." may be guarded by the Windows system to write to.
In such case it doesn't serve anything to present the application path aka launch path.
All disregarding it is "C:\Program Files\qcad-3.25.0-pro-win64" or the general "C:\Program Files\QCAD" or "...QCADCAM" on Windows.
More appropriate would be the recently added User Documents Location, if that exists.
Storing the last used path similar to 'Save As' and many others is not a big deal.
It only requires a few lines of standard code and an entry in the QCAD.ini/conf file.
By preferences would work.
But I think that many would already be happy with the dialog opening the last used path.
Not that I use the library often, fixed that on the fly.
Regards,
CVH
Re: Block: create library item location
Thanks CVH,
The modified CreateLibraryItem.js that you gave me works very well.
The BT command now remembers the directory where I saved the selected block.
Regards, Robert
The modified CreateLibraryItem.js that you gave me works very well.
The BT command now remembers the directory where I saved the selected block.
Regards, Robert
Linux Mint 20 , qcadcam-3.24.3.10-pro-linux-x86_64
Re: Block: create library item location
All,
The issue that Husky mentioned above was solved by forcing it to a path.
Appending "/libraries/" instead of "/libraries".
Otherwise, that can sometimes lead to the dialog suggesting the filename 'libraries.dxf'.
Usually when calling File.getSaveFileName() a complete filename is provided as suggestion.
The order of paths is now:
- A persistent saved path if that still exists
- The user document location + "/libraries/" if that exists
- The original launch path + "/libraries/"
Also added a test if the export was successful before updating the LibraryBrowser path and the persistent saved path.
I had to tweak including BlockDialog.js there dotdot isn't functional in a custom script over here.
To supersede the original CreateLibraryItem.js:
- Ensure that the next folder structure exist in your application path
"...\QCAD\scripts\Block\CreateLibraryItem\..."
(QCAD or QCADCAM or whatever folder that is used)
- With none, copy over all 5 files from GitHub: https://github.com/qcad/qcad/tree/maste ... ibraryItem
- Replace the script file CreateLibraryItem.js with the one below.
This was the first revision.
- The launch path 'C:/Program Files/QCAD ...' may be guarded on a Windows system.
(Then RSettings.getDocumentsLocation() seems more appropriate)
- A pickpoint isn't required with a single Block Reference and we could suggest the block its name.
- Same goes when BT is used in block edit mode.
- BT can also be used while 'Edit Block In place' is active. (What I can/will not test given FS#2179)
I'll add the proposal(s) to https://www.ribbonsoft.com/bugtracker/i ... sk_id=2128
Regards,
CVH
The issue that Husky mentioned above was solved by forcing it to a path.
Appending "/libraries/" instead of "/libraries".
Otherwise, that can sometimes lead to the dialog suggesting the filename 'libraries.dxf'.
Usually when calling File.getSaveFileName() a complete filename is provided as suggestion.
The order of paths is now:
- A persistent saved path if that still exists
- The user document location + "/libraries/" if that exists
- The original launch path + "/libraries/"
Also added a test if the export was successful before updating the LibraryBrowser path and the persistent saved path.
I had to tweak including BlockDialog.js there dotdot isn't functional in a custom script over here.
To supersede the original CreateLibraryItem.js:
- Ensure that the next folder structure exist in your application path
"...\QCAD\scripts\Block\CreateLibraryItem\..."
(QCAD or QCADCAM or whatever folder that is used)
- With none, copy over all 5 files from GitHub: https://github.com/qcad/qcad/tree/maste ... ibraryItem
- Replace the script file CreateLibraryItem.js with the one below.
This was the first revision.
- The launch path 'C:/Program Files/QCAD ...' may be guarded on a Windows system.
(Then RSettings.getDocumentsLocation() seems more appropriate)
- A pickpoint isn't required with a single Block Reference and we could suggest the block its name.
- Same goes when BT is used in block edit mode.
- BT can also be used while 'Edit Block In place' is active. (What I can/will not test given FS#2179)
I'll add the proposal(s) to https://www.ribbonsoft.com/bugtracker/i ... sk_id=2128
Regards,
CVH
Re: Block: create library item location
All,
Should be fixed in the next release (> 3.26.4.9).
The script on GitHub is already updated by Andrew, thanks.
One can delete any custom created folder and/or file before updating QCAD.
Regards,
CVH
Should be fixed in the next release (> 3.26.4.9).
The script on GitHub is already updated by Andrew, thanks.
One can delete any custom created folder and/or file before updating QCAD.
Regards,
CVH