Skip to content

Instantly share code, notes, and snippets.

View Eneroth3's full-sized avatar

Eneroth3 Eneroth3

  • Lund
View GitHub Profile
function sketchup_version() {
const regex = /SketchUp Pro\/(\d+(?:\.\d+)+)/;
const matches = navigator.userAgent.match(regex);
return matches[1];
}
@Eneroth3
Eneroth3 / metric_sketchup.rb
Last active November 13, 2023 13:04
Test if SketchUp uses a metric unit or not
def metric?
unit_options = Sketchup.active_model.options["UnitsOptions"]
return false unless unit_options["LengthFormat"] == Length::Decimal
[Length::Millimeter, Length::Centimeter, Length::Meter].include?(unit_options["LengthUnit"])
end
default = metric? ? 100.mm : 4.inch
puts default
module SketchupApplicationHelper
def self.path
Sketchup.find_support_file('sketchup.exe')
end
def self.start
# Need quotation marks around path as it contains spaces.
pid = Process.spawn("\"#{path}\"")
Process.detach(pid)
end
@Eneroth3
Eneroth3 / metric.rb
Last active December 3, 2020 12:57
Test if SketchUp uses metric units
def metric?(model = Sketchup.active_model)
unit_options = model.options["UnitsOptions"]
return false unless unit_options["LengthFormat"] == Length::Decimal
[
Length::Millimeter,
Length::Centimeter,
Length::Meter
].include?(unit_options["LengthUnit"])
end
# Load SketchUp plugins from Git working directories.
#
# Place this script in SketchUp's extension folder and adapt pattern
# to where you keep SketchUp extensions Git repos.
#
# Make sure all Git repos have a folder `src` or `source` containing
# the actual SketchUp extension code, as opposed to tests and other
# project related files.
pattern = "/Users/cenerot/Source/SketchUp Extensions/*/{src,source}/"

https://extensions.sketchup.com/extension/16cd999d-050e-4910-b0a4-699f83decd75/eneroth-auto-weld


Another weld plugin? Yup, but this one has some unique features.

This plugin doesn't just weld the selected edges together but searches for edges that can be welded and weld them all at once. The search is limited to the selection if there is one, otherwise all edges in the current drawing context are checked.

The plugin also automatically look for edges to weld whenever Follow Me Tool has been used. This means you wont have to deal with all the exploded curves each time you use the tool.

https://extensions.sketchup.com/extension/9296041e-0a67-4cf0-a520-13de000e20b8/eneroth-component-replacer


Swiftly pick up any component or group and use it to replace others. Useful for architectural design when you need to replace many components at once, e.g. try out how the building looks with another kind of windows or to quickly replace lots of furniture. Also useful for rendering to replace proxies with more detailed components.

Activated from Extensions > Eneroth Component Replacer or its toolbar.