Regression in PartDesign mirror

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression in PartDesign mirror

Post by chrisb »

I will retest as soon as the next precompiled version is available.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression in PartDesign mirror

Post by wmayer »

After doing a manual bisect I could track it down to the following four subsequent commits:
git commit 03da9d350: This shows a very obscure behaviour because the tip of the body is either empty or it shows the inverted and mirrored shape
git commit fecf9c2e84: Shows still the same behaviour
git commit 8453d4151: This fixes the above oddity but when mirroring a pad then the gap of the pocket is filled. And if mirroring the pocket then it's not transformed correctly.
git commit 3131b97aa: The log message says it fixes a bug in the preview but for me it doesn't make any difference.

It needs some further testing to figure what exactly makes it to behave incorrectly.
chrisb
Veteran
Posts: 53919
Joined: Tue Mar 17, 2015 9:14 am

Re: Regression in PartDesign mirror

Post by chrisb »

wmayer wrote: Mon Sep 20, 2021 8:22 am It needs some further testing to figure what exactly makes it to behave incorrectly.
How can we help?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression in PartDesign mirror

Post by wmayer »

chrisb wrote: Mon Sep 20, 2021 8:42 am
wmayer wrote: Mon Sep 20, 2021 8:22 am It needs some further testing to figure what exactly makes it to behave incorrectly.
How can we help?
I have tested it with:
OS: Ubuntu 18.04.5 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.20.24419 (Git)
Build type: Unknown
Branch: (HEAD losgelöst bei 3131b97aa8)
Hash: 3131b97aa88736ac628428a8ceb025d9b7a8a965
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)

Some of you said it's working with newer OCCT versions. So, I would like to hear whether it works with OCCT 7.5.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression in PartDesign mirror

Post by wmayer »

I have an older build from April that has included the regression and it uses OCCT 7.5.0 and the bug is also there. Now when looking at the changes in PD since April I cannot see anything that fixes the transform features. So, I think the bug must be still present in current master independent of the OCCT version.

OS: Ubuntu 18.04.5 LTS (XFCE/xubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.24758 (Git)
Build type: Unknown
Branch: master
Hash: b7aee7bfa101e37e0211aaa8ef36e318f3d797c1
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.5.0.beta
Locale: German/Germany (de_DE)
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression in PartDesign mirror

Post by wmayer »

Here the forum thread where the pattern stuff was discussed: https://forum.freecadweb.org/viewtopic.php?f=19&t=55860
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Regression in PartDesign mirror

Post by wmayer »

Here is a script that is supposed to demonstrate the issue and avoids that users do slightly different things:

Code: Select all

import FreeCAD as App

doc = App.newDocument("Mirror_Pattern")
body = doc.addObject('PartDesign::Body','Body')

sketch = body.newObject('Sketcher::SketchObject','Sketch')
sketch.Support = (doc.getObject('XY_Plane'),[''])
sketch.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.LineSegment(App.Vector(0.0, 30, 0), App.Vector(100, 30, 0)))
geoList.append(Part.LineSegment(App.Vector(100, 30, 0), App.Vector(100,-30, 0)))
geoList.append(Part.LineSegment(App.Vector(100,-30, 0), App.Vector(0.0,-30, 0)))
geoList.append(Part.LineSegment(App.Vector(0.0,-30, 0), App.Vector(0.0, 30, 0)))
sketch.addGeometry(geoList,False)

conList = []
conList.append(Sketcher.Constraint('Coincident',0,2,1,1))
conList.append(Sketcher.Constraint('Coincident',1,2,2,1))
conList.append(Sketcher.Constraint('Coincident',2,2,3,1))
conList.append(Sketcher.Constraint('Coincident',3,2,0,1))
conList.append(Sketcher.Constraint('Horizontal',0))
conList.append(Sketcher.Constraint('Horizontal',2))
conList.append(Sketcher.Constraint('Vertical',1))
conList.append(Sketcher.Constraint('Vertical',3))
sketch.addConstraint(conList)
sketch.addConstraint(Sketcher.Constraint('PointOnObject',0,1,-2)) 
doc.recompute()

pad = body.newObject('PartDesign::Pad','Pad')
sketch.Visibility = False
pad.Profile = sketch
pad.Length = 10.0
pad.Length2 = 100.000000
pad.UseCustomVector = 0
pad.Direction = (0, 0, 1)
pad.AlongSketchNormal = 1
pad.Type = 0
pad.UpToFace = None
pad.Reversed = 0
pad.Midplane = 0
pad.Offset = 0
doc.recompute()

print (pad.Shape.Volume == 60000)

sketch1 = body.newObject('Sketcher::SketchObject','Sketch001')
sketch1.Support = (pad,['Face3',])
sketch1.MapMode = 'FlatFace'

geoList = []
geoList.append(Part.LineSegment(App.Vector(-10, 25, 0), App.Vector( 20, 25, 0)))
geoList.append(Part.LineSegment(App.Vector( 20, 25, 0), App.Vector( 20,-12, 0)))
geoList.append(Part.LineSegment(App.Vector( 20,-12, 0), App.Vector(-10,-12, 0)))
geoList.append(Part.LineSegment(App.Vector(-10,-12, 0), App.Vector(-10, 25, 0)))
sketch1.addGeometry(geoList,False)

conList = []
conList.append(Sketcher.Constraint('Coincident',0,2,1,1))
conList.append(Sketcher.Constraint('Coincident',1,2,2,1))
conList.append(Sketcher.Constraint('Coincident',2,2,3,1))
conList.append(Sketcher.Constraint('Coincident',3,2,0,1))
conList.append(Sketcher.Constraint('Horizontal',0))
conList.append(Sketcher.Constraint('Horizontal',2))
conList.append(Sketcher.Constraint('Vertical',1))
conList.append(Sketcher.Constraint('Vertical',3))
sketch1.addConstraint(conList)

doc.recompute()

pocket = body.newObject('PartDesign::Pocket','Pocket')
sketch1.Visibility = False
pad.Visibility = False
pocket.Profile = sketch1
pocket.Length = 20.000000
pocket.Length2 = 100.000000
pocket.Type = 0
pocket.UpToFace = None
pocket.Reversed = 0
pocket.Midplane = 0
pocket.Offset = 0
doc.recompute()

print (pocket.Shape.Volume==56000)

mirror = body.newObject('PartDesign::Mirrored','Mirrored')
mirror.Originals = [pad,]
mirror.MirrorPlane = (pad, ['Face4'])

body.Tip = mirror
doc.recompute()

print (mirror.Shape.Volume) # returns 120000.0 but should be 116000.0
At the end it prints a volume of 120000 of the mirror feature instead of the expected 116000 (=60000 + 56000)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Regression in PartDesign mirror

Post by uwestoehr »

wmayer wrote: Mon Sep 20, 2021 11:20 am Here is a script that is supposed to demonstrate the issue and avoids that users do slightly different things:
I can confirm the bug is still inn today's master. The bug can be reproduced using the script and also the initial example file of this thread.

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.25778 (Git)
Build type: Release
Branch: master
Hash: 7f772ba227aa5fcb778f0e6991f167d080ebd03f
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: German/Germany (de_DE)
Post Reply