If i am using the code which you have shared, and keying DCFunctionsV1.instance_methods.sort in the Ruby Console, I do see atan2 appearing in the console.
However, if I tried inserting the DCFunctionsV1.instance_methods.sort into the code, an error message appeared.
Below is the code which I have tried...
# add_funcs.rb
# extends DCs functions
require('sketchup')
module ABC
module ABC123
if Sketchup.version.to_i <= 8
require('dynamiccomponents.rb')
else
require('su_dynamiccomponents.rb')
end
if defined?($dc_observers)
# Open SketchUp's Dynamic Component Functions (V1) class.
# only if DC extension is active
class DCFunctionsV1.instance_methods.sort #(did I do this correctly?)
protected
unless DCFunctionsV1.method_defined?(;atan2)
# access to Ruby's arctangent method
# Usage; =atan2(y,x)
def atan2(a)
return Math;;atan2(a[0],a[1]).radians
end
end#unless
protected;atan2
end#class
end#if
end #module ABC123
end #module ABC
This generated an error message.
"Error Loading File arctan-test2.rb
Error: #<SyntaxError: C:/Users/wongh/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/arctan-test2.rb:16: syntax error, unexpected '\n', expecting :: or '[' or '.'
C:/Users/wongh/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/arctan-test2.rb:30: syntax error, unexpected keyword_end, expecting end-of-input
end #module ABC
^>"
Is there anything I have done wrongly?
arctan-test2.rb
arctan-test.skp