Skip to content

Instantly share code, notes, and snippets.

@dnovais
Created October 31, 2024 22:21
Show Gist options
  • Save dnovais/3860c38dbd6ed4aadfa6964d30cd1248 to your computer and use it in GitHub Desktop.
Save dnovais/3860c38dbd6ed4aadfa6964d30cd1248 to your computer and use it in GitHub Desktop.
Ruby On Sketchup - Script Ruby para Criar uma Parede com Porta e Janela
model = Sketchup.active_model
entities = model.active_entities
# Dimensões da parede
wall_width = 400.cm
wall_height = 250.cm
wall_thickness = 20.cm
# Criando a parede
wall = entities.add_face [0, 0, 0], [wall_width, 0, 0], [wall_width, wall_thickness, 0], [0, wall_thickness, 0]
wall.pushpull -wall_height
# Dimensões da porta
door_width = 90.cm
door_height = 210.cm
door_offset = 50.cm
# Criando a porta
door = entities.add_face [door_offset, 0, 0], [door_offset + door_width, 0, 0], [door_offset + door_width, 0, door_height], [door_offset, 0, door_height]
door.pushpull -wall_thickness
# Dimensões da janela
window_width = 120.cm
window_height = 100.cm
window_offset_x = 200.cm
window_offset_y = 100.cm
# Criando a janela
window = entities.add_face [window_offset_x, 0, window_offset_y], [window_offset_x + window_width, 0, window_offset_y], [window_offset_x + window_width, 0, window_offset_y + window_height], [window_offset_x, 0, window_offset_y + window_height]
window.pushpull -wall_thickness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment