Draft Snapping to Vertex produces incorrect co-ordinates

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!
Post Reply
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Draft Snapping to Vertex produces incorrect co-ordinates

Post by Syres »

Unfortunately I can't attach the real file I'm working on but in order to recreate the issue, open attached DraftSnapTest file (thanks to @hammax I believe for this example),

Use Draft Line to make the line in green as per screenshot, correct co-ordinates are:
First point: (6000.0, 850.0, -4.374670070639297e-10)
Next point: (6000.0, -850.0, -2.1874099753738108e-10)
CorrectDraftSnapping.jpg
CorrectDraftSnapping.jpg (29.54 KiB) Viewed 389 times
but it will actually appear as this, incorrect co-ordinates are:
First point: (5383.297213243036, 2146.0698053812316, -733.7834858423194)
Next point: (4860.394485586586, 1545.0083079148592, -1355.9590288656448)
InCorrectDraftSnapping.jpg
InCorrectDraftSnapping.jpg (22.61 KiB) Viewed 389 times
The commit that appears to caused this side effect
https://github.com/FreeCAD/FreeCAD/comm ... bbbec25eb4

Therefore I have had to change (as a workaround) line 896 in src\Mod\Draft\DraftSnap.py vertex section from

Code: Select all

        p = Vector(info['x'],info['y'],info['z'])
        if active:
            if self.isEnabled("passive"):
                return [p,'endpoint',self.toWP(p)]
            else:
                return []
        elif self.isEnabled("passive"):
            return [p,'passive',self.toWP(p)]
        else:
            return []

To

Code: Select all

        p = Vector(info['x'],info['y'],info['z'])
        if active:
            if self.isEnabled("passive"):
                return [p,'endpoint',self.toWP(p)]
            else:
                return []
        elif self.isEnabled("passive"):
            return [p,'passive',p]
        else:
            return []


I don't believe this is a long-term fix as I don't understand what scenario caused the requested change for this in December and therefore this may need a more thorough investigation.


OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15694 (Git)
Build type: Release
Branch: master
Hash: 96dee91d5e7d7fd37f43a4dcf406a120ae1f1b8a
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedKingdom (en_GB)
Attachments
DraftSnapTest.FCStd
(24.69 KiB) Downloaded 11 times
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Draft Snapping to Vertex produces incorrect co-ordinates

Post by yorik »

Ah you are right, unwanted regression. Fixed in git commit eb08c67a78
mario52
Veteran
Posts: 4698
Joined: Wed May 16, 2012 2:13 pm

Re: Draft Snapping to Vertex produces incorrect co-ordinates

Post by mario52 »

Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
Post Reply