Making the creation of arrays more user friendly

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Post by vocx »

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
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Making the creation of arrays more user friendly

Post by carlopav »

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
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Making the creation of arrays more user friendly

Post by Joel_graff »

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
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Post by vocx »

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
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Post by vocx »

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
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Making the creation of arrays more user friendly

Post by vocx »

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
Veteran
Posts: 2898
Joined: Thu Aug 09, 2018 11:14 am

Re: Making the creation of arrays more user friendly

Post by Syres »

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

Re: Making the creation of arrays more user friendly

Post by vocx »

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
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Making the creation of arrays more user friendly

Post by bitacovir »

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)

Canal Youtube Grupo Telegram de FreeCAD Español

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

Re: Making the creation of arrays more user friendly

Post by Kunda1 »

Awesome!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply