Part.Edge.fixTolerance question

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mconsidine
Posts: 125
Joined: Wed Jan 18, 2023 10:41 pm
Location: Randolph, VT USA

Part.Edge.fixTolerance question

Post by mconsidine »

Firstly:

In another thread regarding sortEdges I described an effort to try to round vertex values:
viewtopic.php?p=684338#p684338

It turns out that the TopoShapes are read-only so there would need to be some gymnastics to deal with that.

in trying to explore that using the distToShape function that was very helpfully pointed out, I came across the fixTolerance function for the same type of objects. At a glance of the doc, e.g.

Code: Select all

help(Part.Edge.fixTolerance)
I got the impression that this might take care of the rounding issue. But I don't seem to understand how to properly use it (or to understand what arguments getPoints takes).

Can someone point me to an example of the use of fixTolerance and tell me what the parameter for getPoints is?

In the case of the latter, it only seems to take an integer, but I don't know what the significance of the number is.
In the case of former, if I start out with an edge and use getPoints, I get what I assume are the points making this line up:

Code: Select all

test=Part.Edge(Part.Vertex(1.2345,2.345,3.456),Part.Vertex(4.567,5.467,7.234))
test.getPoints(1)
The result is:

Code: Select all

([Vector (1.2345, 2.345, 3.456), Vector (1.7967863157106727, 2.871769055558506, 4.09345467389495), Vector (2.3590726314213457, 3.3985381111170114, 4.7309093477899005), Vector (2.9213589471320187, 3.925307166675517, 5.368364021684851), Vector (3.4836452628426917, 4.452076222234023, 6.005818695579801), Vector (4.045931578553365, 4.978845277792528, 6.643273369474752), Vector (4.567, 5.466999999999999, 7.234)], [])
I *thought* if I did something like this:

Code: Select all

test.fixTolerance(0.1,Part.Edge) #also takes Part.Vertex, Part.Face, Part.Wire; but not "other value" as stated in doc
that I would get a set of points back that have been rounded to 1 decimal place.

What is the expected function of fixTolerance?

(FWIW, the use case is having created a line and an arc, the arc endpoints need to be adjusted to be close to or match the endpoint of a given line. Maybe I'm going about this all wrong. If that's the thought, any advise would be welcome.)

TIA,
mconsidine
Post Reply