[Fixed] Tracking down ghost image/drawing. [BUG-Regression]

Need help, or want to share a macro? Post here!
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

[Fixed] Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Thu Sep 10, 2020 6:17 pm

Okay I have implemented a number of GDML objects as Part::FeaturePython objects where the objects are drawn in the createGeometry.

Now if I have an App::Part that contains such an object, if I adjust the Placement of the App::Part then I end up the scene drawn twice.
For example in the following image where the Part has been rotated. I get one scene with the correct rotation and another with no rotation.
Ghost.png
Ghost.png (478.14 KiB) Viewed 472 times
As far as I can see I have not created two of everything. The problem does not happen with a plain Part and Box so it must be something in my code. Would post some code, but not sure what to post. The complete code is on my GitHub athttps://github.com/KeithSloan/GDML

Ideas? Suggestions? of what to look for?
Last edited by keithsloan52 on Fri Sep 11, 2020 2:59 am, edited 1 time in total.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing.

Postby keithsloan52 » Fri Sep 11, 2020 2:47 am

Seems to be a bug and due to a regression does not happen on 0.18

Code: Select all

OS: macOS 10.15
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16146 (Git)
Build type: Release
Branch: (HEAD detached at 0.18.4)
Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8
Python version: 3.6.7
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)
Is happening on

Code: Select all

OS: macOS 10.15
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22164 (Git)
Build type: Release
Branch: master
Hash: f2a9f712e8d68ee2393d0fe748c02096c4148a32
Python version: 3.8.5
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
Will try latest 0.19 for Mac, but about to go way for a break
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing.

Postby keithsloan52 » Fri Sep 11, 2020 2:59 am

Tried latest FreeCAD 0.19 for Mac that I could find and it is still happening

Code: Select all

OS: macOS 10.15
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22366 (Git)
Build type: Release
Branch: master
Hash: 34c11fcc63efa2fc72cbc74c75c76e9f19d5c84c
Python version: 3.8.5
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Mon Sep 21, 2020 7:00 am

Also seems to happen any time the App:Part has any sort of Placement i.e. Not Base Vector(0,0,0) or any rotation.

So happens if I change the Placement or some Python scripts sets a anon default Placement.
chrisb
Posts: 28842
Joined: Tue Mar 17, 2015 9:14 am

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby chrisb » Mon Sep 21, 2020 8:04 am

FitAll doesn't help? Are you using full screen mode with F11? If so, try the system specific full screen with the icons on the window instead.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Mon Sep 21, 2020 1:46 pm

Full screen does not make any difference.

Experimenting it seems to be drawing things at 0,0,0 no rotation and again at what ever I set the Placement to.

Does not happen on FC 0.18
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Tue Sep 22, 2020 5:38 pm

Would be interested to know if this happens on all platforms, for example Windows and Linux

Thanks
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Tue Sep 22, 2020 7:23 pm

Wondering if my coding is not helping the situation.

GDML objects often have a different understanding of where the origin is, so to deal with this in the createGeometry I code say

Code: Select all

base = FreeCAD.Vector(0,0,-fp.z/2)
Which means for this type of shape the Z axis needs to be adjusted to 1/2 the z value of the object.
Then call

Code: Select all

fp.Shape = translate(cone3,base)
Having in this example created a cone shape with FreeCAD origin.

Code: Select all

def translate(shape,base) :
    # Input Object and displacement vector - return a transformed shape
    #return shape
    myPlacement = FreeCAD.Placement()
    myPlacement.move(base)
    mat1 = myPlacement.toMatrix()
    #print(mat1)
    mat2 = shape.Matrix
    mat  = mat1.multiply(mat2)
    #print(mat)
    retShape = shape.copy()
    retShape.transformShape(mat, True)
    return retShape
I would be interested to know if people think this might be my problem with FC 0.19 ( Works under FC 0.18)
and would be interested in doing it more efficiently
chrisb
Posts: 28842
Joined: Tue Mar 17, 2015 9:14 am

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby chrisb » Tue Sep 22, 2020 7:29 pm

If you provide a testscript which I can run, I can test on MacOS 10.13 and on Linux.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
keithsloan52
Posts: 1450
Joined: Mon Feb 27, 2012 5:31 pm

Re: Tracking down ghost image/drawing. [BUG-Regression]

Postby keithsloan52 » Tue Sep 22, 2020 7:54 pm

chrisb wrote:
Tue Sep 22, 2020 7:29 pm
If you provide a testscript which I can run, I can test on MacOS 10.13 and on Linux.
If you install the GDML workbench via the Addon Manager then import the file g4box.gdml in SampleFiles/GDML_Solids
Expand Part world0x55d123cff820
You should then see Part dummy0x55d123905920 and its GDMLBox
If you then change the Parts Placement ( I get the ghost )