Making the creation of arrays more user friendly

A forum dedicated to the Draft, Arch and BIM workbenches development.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Postby vocx » Wed Jan 22, 2020 5:52 pm

Joel_graff wrote:
Tue Dec 03, 2019 1:45 pm
Not a lot to really show. Mostly just practice for me doing releases. :)
Ping. Is it possible for you to take a look at this thread?

Alonso created a macro to show a task panel to set the properties of the array in a more user friendly way. I would like to add it properly into the Draft Workbench. I already added commands for the Draft_PolarArray and Draft_CircularArray modes of the existing Draft_Array tool.

Alonso added a "preview", which essentially creates a temporary Array, before creating the final Array. The commands that I wrote don't create any preview, but it could be done in the same way alonso did. My question is, would it be possible to create such preview using the Coin trackers that you wrote? How would this be done?

You can take a look at alonso's code, and mine. My code is in Draft/draftguitools, which communicates with the Draft/drafttaskpanels files to manage the widgets defined in Draft/Resources/ui/
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
carlopav
Posts: 1570
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Making the creation of arrays more user friendly

Postby carlopav » Wed Jan 22, 2020 7:03 pm

Other modifiers like move and copy use DraftTrackers.ghostTracker to "copy coin3d node" of edited object and to preview the transformation. Perhaps this is the right tool.
follow my experiments on BIM modelling for architecture design
User avatar
Joel_graff
Posts: 1851
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Making the creation of arrays more user friendly

Postby Joel_graff » Wed Jan 22, 2020 11:40 pm

carlopav wrote:
Wed Jan 22, 2020 7:03 pm
Other modifiers like move and copy use DraftTrackers.ghostTracker to "copy coin3d node" of edited object and to preview the transformation. Perhaps this is the right tool.
If that's all the functionality that's needed, I'd recommend using that approach. Copying nodes it a really small thing and using pivy_trackers to do it is overkill, really. I'd consider writing custom code to do the job before building a dependency on pivy_trackers.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Postby vocx » Thu Jan 30, 2020 4:03 pm

With pull request #2972 I place all array tools in a container button so the toolbar and menu is more organized.

This has to be merged after #2970 and #2971.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Postby vocx » Mon Feb 03, 2020 7:05 am

With pull request #2988 I add the task panel interface to the Draft Array command, similar to what alonso presents in the first post.

I am using my own code, not alonso's, so it is very similar to how Draft_PolarArray and Draft_CircularArray work. What this means is that there is at the moment no preview shown on the 3D view. I will investigate how to create such preview in the best manner, and then we can add it to the code.

To note is that this command is called Draft_OrthoArray, and not just Draft_Array. I keep the old command definition for now (DraftTools.py), but there is no button for it in the interface. Internally they both use the Draft.makeArray function so the Array object created is the same.

The Draft_OrthoArray command can create App Links too, so it also replaces the Draft_LinkArray button.

This has to be merged after #2972, which organizes the array tools in a new button.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Postby vocx » Mon Feb 03, 2020 8:02 am

With pull request #2989 I change the parameter of the Array creation commands from "useLink" to "use_link" to follow Python conventions. We also make this change in the Gui Commands defined that can create App_Links, meaning, Draft_PolarArray, Draft_CircularArray, Draft_PathLinkArray, and the new Draft_OrthoArray.

We don't risk breaking 0.18 code because the App::Link object and the Link arrays were introduced in the middle of 0.19. We could only break code that was developed in the middle of 0.19, but this is easy to correct manually.

---

The following is a second change that is actually independent of the first.

The Array objects have an attribute called "useLink". Inside the class "_DraftLink" the "onDocumentRestored" function tests for the existence of this attribute "useLink", which is a boolean. If it is present, it creates a new boolean, "use_link". Then the old "useLink" is deleted so it is no longer saved when the document is saved. This effectively migrates the code from an older attribute name to a newer attribute name.

Again, this should only affect model files created from the LinkMerge until now, or about 6 months. If there is any problem with missing "useLink" messages, let me know.

---

This pull request should be merged after #2988 is merged, which introduces the Draft_OrthoArray command, which is a re-implementation of the Draft_Array tool.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: Making the creation of arrays more user friendly

Postby Syres » Tue Mar 03, 2020 6:42 pm

vocx wrote: ping
Minor bugfix regarding Z interval in OrthoArray submitted https://github.com/FreeCAD/FreeCAD/pull/3127
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Postby vocx » Tue Mar 03, 2020 8:00 pm

Syres wrote:
Tue Mar 03, 2020 6:42 pm
Minor bugfix regarding Z interval in OrthoArray submitted https://github.com/FreeCAD/FreeCAD/pull/3127
Thanks.

OrthoArray is merged now, so everybody can test it.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
bitacovir
Posts: 1169
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Making the creation of arrays more user friendly

Postby bitacovir » Tue Mar 03, 2020 10:51 pm

vocx wrote:
Tue Mar 03, 2020 8:00 pm
OrthoArray is merged now, so everybody can test it.
Thanks for your hard work.
::bitacovir::
===================================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

My personal web site
My GitHub repository
My old Blog
Mini Airflow Tunnel Project
User avatar
Kunda1
Posts: 8772
Joined: Thu Jan 05, 2017 9:03 pm

Re: Making the creation of arrays more user friendly

Postby Kunda1 » Tue Mar 03, 2020 11:07 pm

Awesome!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features