Modifying Z of an Edge

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
MRx
Posts: 319
Joined: Wed Jul 08, 2020 5:59 am
Location: Tainan / Taiwan

Modifying Z of an Edge

Post by MRx »

Hi,

is there any common function available to move Z of an Edge to a given value?

I used translate() and minus the original Z value, but that's not sufficient in all cases it seems.
Sometimes there's an ARC with a floating point inaccuracy.
Vector (46.298862999999955, -58.933671553031985, -7.100000000000369)

(the last one should be -7.1 and nothing else)

But that seems to be enough to make eg. Part.__sortEdges__ fail on my side.

I even had following situation:
return [Part.Wire(e) for e in EdgeList] -- fails (and listing the edges showed up floating point inaccuracies as well)
return [Part.Wire(EdgeList)] -- succeeds (listing clearly showed up that everything was ok)

----

Update:
__sortEdges__ seems to be very troublesome, I have replaced it with a function that allows some tolerance and it's fine now.
In my case __sortEdges__ sometimes even decreased the number of Edges inside the list (from 18 to 9 for some reason).

My problem is solved.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Modifying Z of an Edge

Post by onekk »

You could try to round the values, maybe using python round functions, with enough decimals:

https://docs.python.org/3.9/library/fun ... ound#round

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply