What is the precision of float used in the entities.add_face() method?

I’m trying to make an importer for an odd 3d file format.

I used the entities.add_face() method with this array of points

points = [
          [42.71485234, 209.62487411999996, 250.11738902],
          [42.714308779999996, 209.62499603999998, 250.11809006],
          [41.68481122, 209.73286222, 250.79711841999998],
          [41.68513634, 209.768059, 250.79128149999997],
          [42.024871499999996, 251.49564635999997, 243.86403855999998],
          [42.71438244, 209.64350248, 250.11436134],
          [42.71467962, 209.63453882, 250.11595899999998]
         ]
Sketchup.active_model.entities.add_face(points)

I get an exception saying there are duplicate points.
I understand there are points very close together but none are exactly the same.

I’m guessing my precision could be truncated…

I’ll try to convert the points to Geom::Point3d.

Any help is welcome.

Here, I guess, the #== method is used to compare two points for equality. This uses the standard SketchUp tolerance to determine if two points are the same.
The standard SketchUp tolerance is 0.001"
e.g.:

0.0.to_l == 0.001.to_l  => false

0.0.to_l == 0.0001.to_l => true

See also.
https://ruby.sketchup.com/Length.html

You can not create a face if the points are within the tolerance. You have to scale up …

1 Like

Thank you, this was very helpful :slight_smile:

1 Like