[Closed] 0.19pre DraftWB, "Split" donnot auto-recompute

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

[Closed] 0.19pre DraftWB, "Split" donnot auto-recompute

Post by fc_tofu »

Version: FreeCAD_0.19.20310-Win-Conda_vc14.x-x86_64.7z
OS: Windows 10 x64

Summary:
DraftWB "Split" command donnot auto-recompute after command.

Reproduce:
1. Restart FC, New document, activate DraftWB.
2. Toggle off snap bar.
3. On Top working plane, draw a line.
4. Select line, click toolbar command "Split"
5. click any position on line.
6. Observe result, the whole line is still there. And a new line object appear on TreeView.
====
7. If toggle off visibility of whole line, nothing left on viewport. (wrong behavior)
8. If delete whole line, splitted partial line appear on viewport. (wrong behavior)
9. If move whole line, whole line turn to partial line appear on viewport, and another partial line appear on viewport also. (become normal)
Last edited by fc_tofu on Thu Apr 09, 2020 4:31 pm, edited 5 times in total.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by carlopav »

I think the problem is just that the object is not automatically recomputed by the command.
Try to recompute the document after you run the command, and tell us is it worked as expected.
follow my experiments on BIM modelling for architecture design
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by fc_tofu »

carlopav wrote: Thu Apr 02, 2020 6:26 am I think the problem is just that the object is not automatically recomputed by the command.
Try to recompute the document after you run the command, and tell us is it worked as expected.
Thank you. After recomputing, I got the correct result of Split.
So the issue is that "Split" now don't auto-recompute after command.
Last edited by fc_tofu on Thu Apr 02, 2020 10:26 am, edited 1 time in total.
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by carlopav »

fc_tofu wrote: Thu Apr 02, 2020 10:05 am Thank you. After recomputing, I got the correct result of Split.
So the issue is that "Split" now don't auto-recompute as FC0.18.
Perhaps vocx already corrected this in his splitting Draft Tools branch.
follow my experiments on BIM modelling for architecture design
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by fc_tofu »

carlopav wrote: Thu Apr 02, 2020 10:26 am
fc_tofu wrote: Thu Apr 02, 2020 10:05 am Thank you. After recomputing, I got the correct result of Split.
So the issue is that "Split" now don't auto-recompute as FC0.18.
Perhaps vocx already corrected this in his splitting Draft Tools branch.
Ok, then I add "Closed" prefix to op. But hope @vocx would confirm it.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by vocx »

carlopav wrote: Thu Apr 02, 2020 10:26 am Perhaps vocx already corrected this in his splitting Draft Tools branch.
Negative. I'm working on the Creator tools right now, and Split is a Modifier, so it will take a few days to get there. However, the code for Draft_Split is pretty simple; it just uses Draft.split() underneath.

https://github.com/FreeCAD/FreeCAD/blob ... 3440-L3445

Code: Select all

    def proceed(self, info):
        Draft.split(FreeCAD.ActiveDocument.getObject(info["Object"]),
            self.point, int(info["Component"][4:]))
        if self.call:
            self.view.removeEventCallback("SoEvent", self.call)
        self.finish()
Basically, we just need to add a final App.ActiveDocument.recompute() after the split function.
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.
fc_tofu
Posts: 653
Joined: Sun Jan 05, 2020 4:56 pm

Re: 0.19pre DraftWB, "Split" produce wrong behavior

Post by fc_tofu »

vocx wrote: Thu Apr 02, 2020 4:32 pm Basically, we just need to add a final App.ActiveDocument.recompute() after the split function.
Thanks, your fix works.

file: [FreeCAD]/Mod/Draft/DraftTools.py
line: from 3438

Code: Select all

    def proceed(self, info):
        Draft.split(FreeCAD.ActiveDocument.getObject(info["Object"]),
            self.point, int(info["Component"][4:]))
        if self.call:
            self.view.removeEventCallback("SoEvent", self.call)
        self.finish()
        FreeCAD.ActiveDocument.recompute()    #added fix
User avatar
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [Closed] 0.19pre DraftWB, "Split" donnot auto-recompute

Post by yorik »

Pull request please! :)
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Closed] 0.19pre DraftWB, "Split" donnot auto-recompute

Post by vocx »

yorik wrote: Wed Apr 08, 2020 10:03 am Pull request please! :)
The corrections are included here, #3308. But I still want to add more commits to 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
yorik
Founder
Posts: 13664
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: [Closed] 0.19pre DraftWB, "Split" donnot auto-recompute

Post by yorik »

Great! ;)
Post Reply