Improved object library with preview

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Improved object library with preview

Post by ABeton »

Improved object library with preview

I do not use the object library as much as I would like because it has some limitations. So some ideas I had:

- 3D preview: when an item in the library is selected it is opened in a separate window and the view is split (something similar is done with the Alignement tool). So the user can still see the main window and quickly edit or just look at the model he wants to insert. The model could also be inserted with link in this way. If another file is selected the old file is closed and the one is opened.

- the library should be more flexible, in a way like a file browser, so users can open any file they want(similar how it is done in Rhino 3D)

- save in file: if a user models a chair for example a save button could exist in the library pannel and when it is pressed the file is saved in a folder which is opened in the library.

It could look similar to the image below.

Pasted Layer #12.png
Pasted Layer #12.png (340.41 KiB) Viewed 2459 times
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Improved object library with preview

Post by ABeton »

I started doing some simple changes to the library just to see what changes could be implemented. I managed to add a simple Viewer document(it is just a basic document which opens and closes each time an object in the library is clicked). In this way it would serve as a 3D preview before importing the object into the main file.

My next goal is to split the view when the Viewer is opened, so that the user can see both the Viewer and the document they have been working on.

I have one question, is there some command to select all files in a document and then to delete them all?

Bellow is the modified Parts Library macro, if someone would try it out and tell me what they think about the idea I would appreciate it.
Attachments
PartsLibrary Improved1.FCMacro
(19.85 KiB) Downloaded 43 times
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Improved object library with preview

Post by bitacovir »

ABeton wrote: Sat May 01, 2021 9:39 pm I started doing some simple changes to the library just to see what changes could be implemented. I managed to add a simple Viewer document(it is just a basic document which opens and closes each time an object in the library is clicked). In this way it would serve as a 3D preview before importing the object into the main file.

My next goal is to split the view when the Viewer is opened, so that the user can see both the Viewer and the document they have been working on.

I have one question, is there some command to select all files in a document and then to delete them all?

Bellow is the modified Parts Library macro, if someone would try it out and tell me what they think about the idea I would appreciate it.
You have a tool for Select all: https://wiki.freecadweb.org/Std_SelectAll
and one for delete: https://wiki.freecadweb.org/Std_Delete

I tested your macro and it works. I think your idea is good.
  • I would suggest the Viewer window should be optional (a check box for "Show preview").
  • Also, the viewer should show the model in isometric, rather than top view (there are many 2D objects).
  • What about a new option of the object in the library to be inserted as AppLink?
  • Also, a easy way in the Library panel, to create new folders?
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
paullee
Veteran
Posts: 5092
Joined: Wed May 04, 2016 3:58 pm

Re: Improved object library with preview

Post by paullee »

ABeton wrote: Sat May 01, 2021 9:39 pm My next goal is to split the view when the Viewer is opened, so that the user can see both the Viewer and the document they have been working on.
Awesome development and contribution to FreeCAD / Arch-BIM ! :)

I just re-visit Parts-Library Add-on in FreeCAD, not very handy to install, but find there is a small Preview there :D


Look forward to your development !

Thanks !
Screenshot from 2021-05-02 09-26-37.png
Screenshot from 2021-05-02 09-26-37.png (75.65 KiB) Viewed 2343 times
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Improved object library with preview

Post by ABeton »

bitacovir wrote: Sun May 02, 2021 12:17 am
ABeton wrote: Sat May 01, 2021 9:39 pm I started doing some simple changes to the library just to see what changes could be implemented. I managed to add a simple Viewer document(it is just a basic document which opens and closes each time an object in the library is clicked). In this way it would serve as a 3D preview before importing the object into the main file.

My next goal is to split the view when the Viewer is opened, so that the user can see both the Viewer and the document they have been working on.

I have one question, is there some command to select all files in a document and then to delete them all?

Bellow is the modified Parts Library macro, if someone would try it out and tell me what they think about the idea I would appreciate it.
You have a tool for Select all: https://wiki.freecadweb.org/Std_SelectAll
and one for delete: https://wiki.freecadweb.org/Std_Delete

I tested your macro and it works. I think your idea is good.
  • I would suggest the Viewer window should be optional (a check box for "Show preview").
  • Also, the viewer should show the model in isometric, rather than top view (there are many 2D objects).
  • What about a new option of the object in the library to be inserted as AppLink?
  • Also, a easy way in the Library panel, to create new folders?
Thanks, I forgot about those commands. The problem is when I use the Delete command it often asks me do I want to delete some objects which is annoying. A more elegant way is to create a new viewer file each time I think for this reason.
  • Yes I agree on it being optional.
  • I tried implementing isometric view, perhaps it looks a bit strange how it zooms onto the items. You can try it out and see.
  • I added a button for Linking now in the options, but am having problems to get the command working
  • Create new folders is a good idea, I will try to figure it out
paullee wrote: Sun May 02, 2021 1:31 am
ABeton wrote: Sat May 01, 2021 9:39 pm My next goal is to split the view when the Viewer is opened, so that the user can see both the Viewer and the document they have been working on.
Awesome development and contribution to FreeCAD / Arch-BIM ! :)

I just re-visit Parts-Library Add-on in FreeCAD, not very handy to install, but find there is a small Preview there :D


Look forward to your development !

Thanks !
Thank you :) Yes, having the command in the form of macro is not optimal. Is there some reason why the Object library in BIM workbench and this macro are different?

And on my computer the small Preview almost never works for some reason. That is why I wanted to make a viewer, every time I import five chairs just to find the one I want :lol:

PartsLibrary Improved3.FCMacro
(20.99 KiB) Downloaded 38 times
paullee
Veteran
Posts: 5092
Joined: Wed May 04, 2016 3:58 pm

Re: Improved object library with preview

Post by paullee »

ABeton wrote: Sun May 02, 2021 2:39 pm Thank you :) Yes, having the command in the form of macro is not optimal. Is there some reason why the Object library in BIM workbench and this macro are different?

And on my computer the small Preview almost never works for some reason. That is why I wanted to make a viewer, every time I import five chairs just to find the one I want :lol:

Very seldom use BIM wb, not to mention the Object Library :oops:

The Preview of the Parts-library indeed only works on a small portion, no idea about the reason...
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Improved object library with preview

Post by ABeton »

paullee wrote: Sun May 02, 2021 4:17 pm
ABeton wrote: Sun May 02, 2021 2:39 pm Thank you :) Yes, having the command in the form of macro is not optimal. Is there some reason why the Object library in BIM workbench and this macro are different?

And on my computer the small Preview almost never works for some reason. That is why I wanted to make a viewer, every time I import five chairs just to find the one I want :lol:

Very seldom use BIM wb, not to mention the Object Library :oops:

The Preview of the Parts-library indeed only works on a small portion, no idea about the reason...
That is interesting, what do you use for architecture if not BIM workbench? :lol: BIM workbench is really good, just needs some polish :D
paullee
Veteran
Posts: 5092
Joined: Wed May 04, 2016 3:58 pm

Re: Improved object library with preview

Post by paullee »

ABeton wrote: Sun May 02, 2021 8:55 pm That is interesting, what do you use for architecture if not BIM workbench? :lol: BIM workbench is really good, just needs some polish :D

I just use Arch wb, not have more gaps to seriously study the BIM wb yet :)
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Improved object library with preview

Post by ABeton »

paullee wrote: Sun May 02, 2021 11:29 pm
ABeton wrote: Sun May 02, 2021 8:55 pm That is interesting, what do you use for architecture if not BIM workbench? :lol: BIM workbench is really good, just needs some polish :D

I just use Arch wb, not have more gaps to seriously study the BIM wb yet :)
Ahh ok, there is not so much difference anyway, most of the tools are the same :) BIM only has some interesting features added.
ABeton
Posts: 150
Joined: Tue Sep 03, 2019 6:39 pm

Re: Improved object library with preview

Post by ABeton »

I continued working on this a bit, and a lot of things work quite well now. Also I made all of the changes in the BIM object library, not the macro one.

Things that I added:
  • there is a separate Viewer file where you can see the files you want to import or link
  • when you click on a FreeCAD file it just opens it(works like a preview)
  • you can select objects it the viewer file and link them to the main file
  • the main file is the one from which you opened the command first
  • you can also insert files into the main file, just open an object you like and press insert
  • I also coppied the option to save a file from the macro, so you can quickly save anything in the library
Also if you want to create a new folder in the library folder, it is possible to do it while saving the file(this was already possible in the macro, I don't know if it is the best solution). The Upload button does not work, I just added it for later to add the functionality. There are quite a few bugs left, so keep that in mind and report.

One thing that I would really like to get to work is the Online mode. It would really be cool to get models in that way. For now it is not working and I get this error:

Code: Select all

"No structure in cache. Please refresh."
I checked the code, and I saw that it is reffering to "OfflineLibrary.py", but this file does not exist. So I am not sure what should the "OfflineLibrary.py" file contain. Sorry to bother you but could you give me some advice on this?

yorik wrote: Ping

To try the changes out it is necessary to put the file attached bellow, to the place where the BIM folder is and replace the existing "BimLibrary.py" file. First do a backup of course. If this i not the propper way to share and test code please let me know, because I don't know any better at the moment :? :lol:
Attachments
BimLibrary.py
(29.21 KiB) Downloaded 30 times
Post Reply