forked from specklesystems/speckle-sketchup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
speckle_connector.rb
45 lines (29 loc) · 1.11 KB
/
speckle_connector.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
require "sketchup"
require "extensions"
module SpeckleSystems
module SpeckleConnector
# Version - patched by CI
CONNECTOR_VERSION = "0.0.0"
file = __FILE__.dup
# Account for Ruby encoding bug under Windows.
file.force_encoding("UTF-8") if file.respond_to?(:force_encoding)
# Support folder should be named the same as the root .rb file.
folder_name = File.basename(file, ".*")
# Path to the root .rb file (this file).
PATH_ROOT = File.dirname(file).freeze
# Path to the support folder.
PATH = File.join(PATH_ROOT, folder_name).freeze
# Run from localhost or from build files
DEV_MODE = false
puts("Loading Speckle Connector v#{CONNECTOR_VERSION} from #{DEV_MODE ? 'dev' : 'build'}")
unless file_loaded?(__FILE__)
ex = SketchupExtension.new("Speckle SketchUp", File.join(PATH, "main"))
ex.description = "Speckle Connector for SketchUp"
ex.version = CONNECTOR_VERSION
ex.copyright = "AEC Systems Ltd."
ex.creator = "Speckle Systems"
Sketchup.register_extension(ex, true)
file_loaded(__FILE__)
end
end
end