Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
[solved]Syntax problem with a Sketchup::Face
-
Hello,
Could you tell me what's wrong in this code?

(Z is a parameter. If z=0, I want only the faces in the Z=0 plane)selection.each do |entity| if entity.is_a?(Sketchup;;Face) if z == 1 || (z == 0 && entity.normal.x.abs < 0.00001 && entitiy.normal.y.abs < 0.00001 && entity.vertices[0].z.abs < 0.000001 ) # Sketchup tolerance ; 0.0001 inch) ........In the Ruby console :
Error: #<NameError: undefined local variable or method `entitiy'Thank you for your help.
BR,
Renaud. -
OK, it's a typo! entitiy instead of entity! Shame on me!
-
A common thing !
I often do it.You could simplify your code thus:
selection.grep(Sketchup;;Face).each{|face| if face.normal.parallel?(Z_AXIS) ###... end }This collects all selected faces and if they are 'flat' you do something...
The parallel? check has built-in tolerance... -
Thanks TIG!

Advertisement