[ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

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: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by vocx »

Syres wrote: Tue May 26, 2020 10:14 am <class 'AttributeError'>: 'PathArray' object has no attribute 'use_link'
I just tested my patch, and it seems to work. As I said in your pull request, just use the migrate function before setting the properties.

Code: Select all

    def onDocumentRestored(self, obj):
        self.migrate_attributes(obj)
        self.setProperties(obj)
        ...
You can see your objects as follows.

Code: Select all

import Draft
all = App.ActiveDocument.Objects

for obj in all:
    App.ActiveDocument.getObject(obj.Name).Visibility = False

for obj in all:
    if Draft.get_type(obj) == "Array":
        print(obj.Label, obj.Proxy.__dict__)
        App.ActiveDocument.getObject(obj.Name).Visibility = True

print()

for obj in all:
    if Draft.get_type(obj) == "PathArray":
        print(obj.Label, obj.Proxy.__dict__)
        App.ActiveDocument.getObject(obj.Name).Visibility = True
The rest of the code doesn't need to be touched at the moment, but if you want you can also add this to the pull request.

Code: Select all

        if self.use_link and "ExpandArray" not in pl:
            _tip = _tr("Show array element as children object")
            obj.addProperty("App::PropertyBool","ExpandArray", "Parameters", _tip)
            obj.ExpandArray = False
            obj.setPropertyStatus('Shape','Transient')
New pull request #3519.
Last edited by vocx on Wed May 27, 2020 6:56 pm, edited 1 time in total.
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: 2899
Joined: Thu Aug 09, 2018 11:14 am

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by Syres »

@vocx, thanks for the advice. I've tested a variety of files from both late 2019 and mid 2018, all is working correctly from what I can see.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by vocx »

wandererfan wrote: Wed May 13, 2020 12:21 am The changes are in _PathArray and the 2 calculatePlacement routines.
It would be nice if you could provide an example of each alignment mode to demonstrate it. I could go into the code and try to figure it out, but it's not very easy to understand vector mathematics without doing various tests.
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
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by wandererfan »

vocx wrote: Sun May 31, 2020 12:21 am It would be nice if you could provide an example of each alignment mode to demonstrate it. I could go into the code and try to figure it out, but it's not very easy to understand vector mathematics without doing various tests.
Draft_PathArray - last section.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by vocx »

wandererfan wrote: Sun May 31, 2020 2:41 am Draft_PathArray - last section.
Thanks, but that explanation is not very complete, it's the same as in the code. It's not really user friendly.
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.
paullee
Veteran
Posts: 5119
Joined: Wed May 04, 2016 3:58 pm

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by paullee »

Thanks looking into this :)

Anyway to try before it is merged and Appimage available ? E.g. files that need to be downloaded from github and replace in .../src/Mod/... to make it work ?
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by wandererfan »

paullee wrote: Sun May 31, 2020 4:00 am Anyway to try before it is merged and Appimage available ? E.g. files that need to be downloaded from github and replace in .../src/Mod/... to make it work ?
It is already merged into master. Don't know about AppImage.

These two should do it:
Mod/Draft/draftobjects/patharray.py
Mod/Draft/draftmake/make_path_array.py
paullee
Veteran
Posts: 5119
Joined: Wed May 04, 2016 3:58 pm

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by paullee »

wandererfan wrote: Sun May 31, 2020 2:16 pm
paullee wrote: Sun May 31, 2020 4:00 am Anyway to try before it is merged and Appimage available ? E.g. files that need to be downloaded from github and replace in .../src/Mod/... to make it work ?
It is already merged into master. Don't know about AppImage.

These two should do it:
Mod/Draft/draftobjects/patharray.py
Mod/Draft/draftmake/make_path_array.py
Thanks ! See if I can test to verify if the regression is fixed :)
paullee
Veteran
Posts: 5119
Joined: Wed May 04, 2016 3:58 pm

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by paullee »

paullee wrote: Sun May 31, 2020 2:19 pm
It is already merged into master. Don't know about AppImage.
It turn out FreeCAD_0.19-21280-Linux-Conda_glibc2.12-x86_64.AppImage has the patch (except @vocx's further commit)

It seems the Original model fix the regression :D

For other Option, e.g. Tangent w/ Force Vertical, seem strange as copies are in different 'direction' ?
Strange with Vertical Vector x=1 or y=1 ...

Screenshot from 2020-06-01 00-44-31.png
Screenshot from 2020-06-01 00-44-31.png (438.07 KiB) Viewed 458 times
Screenshot from 2020-06-01 00-47-42.png
Screenshot from 2020-06-01 00-47-42.png (244.93 KiB) Viewed 458 times
Screenshot from 2020-06-01 00-50-02.png
Screenshot from 2020-06-01 00-50-02.png (238.85 KiB) Viewed 458 times
Screenshot from 2020-06-01 00-50-16.png
Screenshot from 2020-06-01 00-50-16.png (238.95 KiB) Viewed 458 times
User avatar
wandererfan
Veteran
Posts: 6320
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [ Regression ? ] LinkPathArray 'Mis-Behave' ? - Carpenter Center

Post by wandererfan »

paullee wrote: Sun May 31, 2020 4:57 pm For other Option, e.g. Tangent w/ Force Vertical, seem strange as copies are in different 'direction' ?
Strange with Vertical Vector x=1 or y=1 ...
There is a rotation(to, from) that should be rotation(from, to). Fix will be along shortly.
Post Reply