Hi TIG, I realised that I hadn't run it through the console straight after I finished yesterday. I've now run it through the console & found there's a problem in the self.softcheck method that gives a Error: #<NoMethodError: undefined method `material' for nil:NilClass> when run in some models.
I changed the condition from if @face_array[0] && @face_array[0].material == nil and got a Error: #<SystemStackError: stack level too deep>.. Ouch. I believe this is because of excessive recursion, the model comes back with smoothed surfaces half finished so I don't think there's an infinite loop in there. I presume this means I need to rewrite the code algorithmically?
def self.softcheck(face)
face.edges.each do |edge|
if edge.soft?
@face_array = edge.faces
@face_array.delete(face)
if @face_array[0] && @face_array[0].material == nil
@face_array[0].material = @colour_current
self.softcheck(@face_array[0])
end
else next
end
end
end
I'm guessing I'm not the first person to try and 'select' all faces in a softened surface, so if there's a good existing definition I could have a look at I'd be most obliged. Cheers
-CJ