I am looking at utilitiestools.rb wright now and have question about …
why it works… this part…
# Try to create a Face from the Edges in the active component
face = nil
begin
face = Sketchup.active_model.active_entities.add_face edges
rescue
end
# If a Face wasn't created, then there should be an error message
# telling what the problem was
if( not face )
if( $! )
msg = $!.message
else
msg = $uStrings.GetString("Create Face from Edges failed")
end
UI.messagebox msg
end
I’m pretty sure that $ ! should keep ‘nil’ anywhere outside of the rescue or ensure… So how is it that it works here… Are the sKetchup only errors somehow unicly deffined to keep the error info in the $! variable even after the rescue clause?
This doesn’t work:
begin
p aaaa
rescue
end
if $!
puts 'exists'
else
puts "doesn't"
end
=> doesn't