def add_dormer(x, y, width, depth)
def self.generate_roof model = Sketchup.active_model sel = model.selection
# Check if face is selected
if sel.empty? || !sel.first.is_a?(Sketchup::Face)
UI.messagebox("Please select a single face (floor plan) first!")
return false
end
face = sel.first
# Get roof parameters
prompts = ["Roof Height (mm)", "Overhang (mm)", "Eave Thickness (mm)"]
defaults = [1500, 300, 200]
input = UI.inputbox(prompts, defaults, "Instant Roof Settings")
return false unless input
height = input[0].to_mm
overhang = input[1].to_mm
eave_thick = input[2].to_mm
model.start_operation("Generate Roof", true)
begin
# Get face boundary
outer_loop = face.outer_loop
vertices = outer_loop.vertices
points = vertices.map
# Create overhang
overhang_points = expand_polygon(points, overhang)
# Get highest point for roof peak
center = Geom::Point3d.new(0, 0, 0)
overhang_points.each center += p
center = center / overhang_points.length
# Create roof faces
roof_faces = []
overhang_points.each_with_index do |p1, i|
p2 = overhang_points[(i+1) % overhang_points.length]
# Calculate ridge point for this segment
mid = Geom::Point3d.new((p1.x + p2.x)/2, (p1.y + p2.y)/2, 0)
ridge = Geom::Point3d.new(mid.x, mid.y, height)
# Create triangular roof face
points3d = [p1, ridge, p2]
roof_face = model.active_entities.add_face(points3d)
roof_faces << roof_face if roof_face
end
# Add eave thickness (extrude edges)
add_eaves(model, overhang_points, eave_thick)
# Add gutter line
add_gutter(model, overhang_points)
UI.messagebox("✅ Roof generated successfully!\nHeight: #heightmm\nOverhang: #overhangmm")
rescue => e
UI.messagebox("Error: #e.message")
ensure
model.commit_operation
end
true
end
| Problem | Solution |
|---------|----------|
| "No method 'to_mm'" | Replace .to_mm with / 1 (web version bug) |
| Roof faces missing | Make sure your base shape is convex |
| Slow generation | Reduce polygon complexity |
| Web version limits | Use simple shapes (max 20 vertices) |
When a user searches for "instant roof plugin for sketchup free download fixed," they are looking for three specific things: instant roof plugin for sketchup free download fixed
The "fixed" part is crucial. The original free trials expired years ago. "Fixed" files usually refer to reverse-engineered code uploaded to torrent sites or file-sharing forums like Sketchucation (illegally) or Archive.org.
unless file_loaded?(FILE) UI.menu("Plugins").add_item("Instant Roof") do generate_roof end Click "Generate
# Add toolbar button (if you have SketchUp 2017+)
cmd = UI::Command.new("Instant Roof") generate_roof
cmd.tooltip = "Generate a roof instantly from selected face"
cmd.status_bar_text = "Click to generate a hip roof"
toolbar = UI::Toolbar.new("Instant Roof")
toolbar = toolbar.add_item(cmd)
toolbar.show
file_loaded(__FILE__)
end
end
# ==============================================================
# INSTANT ROOF PLUGIN v1.0
# For SketchUp (Free & Pro)
# No external dependencies – Works immediately
# ==============================================================
# HOW TO USE:
# 1. Open SketchUp
# 2. Go to Window > Ruby Console
# 3. Copy ALL code below
# 4. Paste into console, press Enter
# 5. Select a closed face (rectangle/any shape)
# 6. Type: instant_roof
# ==============================================================
module InstantRoof
EXTENSIONS =
name: "Instant Roof",
version: "1.0",
description: "Generate hip roof instantly from any face"
def add_dormer(x, y, width, depth)
def self