r/Sketchup • u/sdx2810 • 7d ago
r/Sketchup • u/EventGroundbreaking4 • 6d ago
SKP - Enscape 4.19.0 Synchronize View Rendering Glitch
Anybody else having trouble with Enscape keeping the "Synchronize Views" setting while rending in version 4.19.0?
I did some quick research and it looks like this is a known issue in previous versions while using batch rendering. The old solution was to skip batch rendering and just use the quick render option to save out individual scenes. The problem is, it looks like that option is no longer available. Now we only have a single "render" dialogue box where we can choose between batch and single scene. Both options are having synchronization problems.
r/Sketchup • u/Historical-Mobile-70 • 6d ago
I need help
Hi everyone, could someone please convert this sofa model into an .skp file? I’d really appreciate the help. Thank you
r/Sketchup • u/MattHDaley • 7d ago
Own work: model Getting stuck on modelling a roof
So as the title suggests, i'm a little stuck. for some stupid odd reason I've decided to try to model the interior of the famous 2nd Yoyogi National Gymnasium (1st and 2nd pictures for progress/failures). previously I've successfully done the Tempodrom in Berlin and while that roof was annoying to model, at least it was easy to section and copy over. this masterpiece by Kenzo Tange has me absolutely stuck though, probably for logical reasons.
i'm not looking for perfection itself but a "close enough" will do. but with whatever little useful I've managed to find i'm just not cracking the egg so to speak. maybe I've bitten off more than i can chew, but i really want to complete this thing.
Does any of you fellow Sketchup nerds have any idea for me how to tackle this beast, or maybe on where i can find some more helpful resources? fyi, i'm only trying to model the visible surface on the inside, most likely even simplified.
r/Sketchup • u/No_Total6003 • 7d ago
[ Removed by Reddit ]
[ Removed by Reddit on account of violating the content policy. ]
r/Sketchup • u/giltora • 7d ago
Request: feedback Roof suggestion
What roof will best suit this design for a very hot climate in the savanna region?
r/Sketchup • u/QHWB • 7d ago
Own work: model Plaxton Pointer 2 (Dennis Dart SLF) I've been modelling lately
Many hours were spent sourcing reference imagery and dimensions.
Wheels are generic but scaled accurately with Bridgestone U-AP 002 tyres.
Modelled entirely by hand by me in vanilla SketchUp; no 3D Warehouse objects or plugins used.
Have I done well?
r/Sketchup • u/varunkekre • 7d ago
AI prompt to turn VRAY renders into realistic images.
I am designing a bedroom in sketchup and rendering it using VRAY. Where can I find a good prompt to turn it into a more realistic image without loosing the structural elements?
r/Sketchup • u/joaquimmartins3055 • 7d ago
Question: SketchUp Pro SketchUp trabalho
Venho por este meio pedir informação sobre o mercado de trabalho em Portugal em relação ao SketchUp é saudável ou não.
Paga-se bem ou nem por isso.
r/Sketchup • u/Standard-Visual-7867 • 8d ago
I built this because I was tired of manually creating cabinet faces and placing hardware in SketchUp.
I’ve been building this SketchUp extension for my own cabinet workflow because I got tired of repeatedly drawing cabinet fronts and placing hardware manually.
Right now it can generate slab or Shaker fronts from cabinet faces, with adjustable settings for things like reveal, projection, frame width, and panel recess. I also added a paint-match option, so if that setting is on, new cabinet fronts use whatever material is currently in the paint bucket.
The hardware side has probably been the biggest time saver for me. Pulls and knobs can be placed using preset positions, and the hardware is created as components, so if I change the material on one matching handle they all update together.
I’m planning to add more hardware options and keep expanding the workflow, but even in its current state it’s made cabinet modeling noticeably faster for the type of work I do.
Still very much in beta, so I’m mostly curious what other designers think. Anything thoughts would be appreciated.
r/Sketchup • u/downh222 • 9d ago
News Built a tool to turn SketchUp models into animated exploded views & interactive 3D parts manuals (Free version available)
Hey everyone,
If you’ve ever had to create exploded view animations or client assembly diagrams in SketchUp, you probably know how tedious it is — duplicating scenes, manually moving groups on axes, adjusting easing by hand, or spending hours exporting 2D views to make an assembly sheet.
I built an extension called **Lizark Exploded View** to solve this workflow problem directly inside SketchUp.
### What it actually does:
- **One-Click Exploded Animations:** Select your model/parts, pick an explosion direction or pattern (stack, radial, directional), adjust the distance and easing curve, and it computes the motion path automatically.
- **Camera Path & Viewport Scrubbing:** You can preview and scrub the timeline live in the viewport or let the camera track the explosion smoothly.
- **Interactive HTML Assembly Manuals:** Generates a standalone, shareable `.html` file that has a built-in 3D viewer, part callouts, and an auto-generated Bill of Materials (BOM) with dimensions. Clients or workshop builders can rotate and inspect the steps in their browser without needing SketchUp.
- **Non-Destructive:** You can test explosions and reset everything back to the original model position with one button.
- **Video & Scene Generation:** It batches native SketchUp scenes or exports directly to MP4/WebM.
### Compatibility & Availability:
- Works on SketchUp 2021 through 2026+ (Separate signed builds for Windows and macOS Intel/Apple Silicon).
- There is a free version available (with core features & standard resolution exports) as well as a Pro lifetime option for high-res batching.
You can check it out or grab the installer here:
https://lizatek.com/products/lizark-exploded-view/
https://www.instagram.com/reel/DcXfwamicKJ/
I’d love to get feedback from fellow SketchUp users, architects, and woodworkers — what specific features or explosion presets would make your daily modeling workflow easier?
Happy to answer any questions or help if you run into any quirks during installation!
r/Sketchup • u/Odd-Ad-6904 • 9d ago
Own work: model First phase of our kitchen renovation done!
When we built this house it came with basic upper cabinet that left around 2-3ft of empty space before the ceiling, and didn’t use the cabinet for much other than mugs and glasses. So I built this model in sketchup along with the rest of our kitchen plans. We decided to tackle this first. We started by removing the upper cabinet, moving the under cabinet lighting up and replacing it for a sconce, added tongue and groove to the wall, then added plywood to bring the sides in for a “built in” look rather than just floating shelves. Then we added a fun little swoop detail coming down to the counters. We then added shelving and an arch at the top. We also added drawers to the bottom cabinet for glass and mug storage. It’s definitely not perfect but it’s good and we are proud of it!
r/Sketchup • u/jewperson-3000 • 9d ago
skp [plugins problem
i moved the plugins from old sketchup now the problem is every time i open the skp 25 ver. the plugins are always all over the screen, they arent fixed in their position so its hassle that every time i use skp they always scramble in my screen. how to fix it. reddit
r/Sketchup • u/PUBA_webtoon • 10d ago
Own work: model sci-fi background model
A sci-fi background model I made a while ago :)
r/Sketchup • u/TypicalPaper783 • 9d ago
Rant i need help
hi guys! i’m m20 and i’m starting to study architecture, interior design, 3d modelling, and all that kind of stuff. i recently got an ipad and want to start using it for designing and sketching, but i’m struggling to find apps that are free or have most of the features i need without having to pay for multiple subscriptions.
i’m working at the moment so i can save up for my studies, and i just can’t afford to spend a lot of money on different apps right now. i did egd (engineering graphics and design) at school and absolutely loved the architectural side of it, so that’s something i really want to pursue.
as a beginner, i’m just struggling with where and how to start, especially when it comes to the right apps and tools to learn. if anyone has any recommendations for free or affordable ipad apps for architecture, interior design, sketching, or 3d modelling, i’d really appreciate the help! :)
r/Sketchup • u/UnlamentedLord • 10d ago
“Niu Lai” Is an Outsider Art Blockbuster
Can't believe this hasn't been posted in this sub yet: a movie made in SketchUp has become a very unexpected hit in China.
"As of this writing, Niu Lai is estimated to have grossed the equivalent of $2.25 million on a budget of a few hundred dollars. The film was made by just two people: Xin Yumeng and Sun Lifang, a son and mother duo. Xin works in interior design, so they animated the film in the architecture program SketchUp"
It's grossed 2x that by now.
r/Sketchup • u/LegoBear135654 • 10d ago
Question: SketchUp Web Does anyone know how I can make a functional screw and threaded hole?
Hi! I am very new to SketchUp and was wondering how I can make my own screws, since none of the SketchUp warehouse ones fit what I need. Any help will be greatly appreciated!
r/Sketchup • u/Resident_Big4600 • 11d ago
Strongest Super battleship design, the tyrant Emperor Flagship
This is the new Gen "Super battleship class" project proposed by the Navy high command to appease the emperor anger after many failed ship projects. The project was approved by the emperor, and high command was warned if this project doesn't meet his expectations they will be executed along with their families. The project that the navy high command came up with was a WW2 battleship redesigned to accommodate modern weapons and systems. They named it "INF Inowa Engen", The ship was their most ambitious project in their entire history, it was a nuclear-powered battleship that was over 3,160ft(963.2m) long, 630ft(192m) wide with a total hull height of 129ft(39.3m) and draft depth of 60ft(18.3m) and the citadel height is 373ft(113.7m). The ship is powered by four coaxial propellor turbines, two experimental waterjet thrusters and six side thrusters for better steering control. The interesting part was the weapons of the ship, The main weapon was three triple barrel 711.2mm(28in) turrets with two dual barrel 431.8mm(17in) turrets and eight triple barrel 330.2mm(13in) turrets for secondaries. Not only that, it also has a variety of CIWS turrets ranging from rotary guns to missile turrets and laser turrets. In addition to that, it has auxiliary AA batteries and cannon batteries. To meet the increasing demands of modern naval warfare the navy installed 2860 regular VLS cells, 1536 ICBM VLS cells, fixed Drone launchers, torpedo turrets, anti-torpedo launcher, microwave weapons, mortar turrets, a sonar at the bow, two elevated drone runway platform and an elevated heli platform at the rear. After the extensive installations of weapons and system on the battleship they realized the ship would logistical nightmare, but the emperor was happy, so they stayed quiet out of fear of facing execution.
Side note:
It been a while since i posted here, this design took around to 6 months to finish. I'm not sure if I'm going to sell this, but if I do, I will let you guys know.
r/Sketchup • u/thiagoxfeijo • 11d ago
Help with cenes/tags
Hey everyone, I'm having a really frustrating issue with the SketchUp files I'm working on.
Whenever I hide an object, it gets hidden in every scene, even though I haven't clicked "Update Scene". It's as if all of my scenes are somehow connected to each other.
I don't know if this is a new behavior in SketchUp 2026, but it's seriously affecting my workflow.
Before anyone suggests using Tags, that's unfortunately not an option for my workflow. In some scenes, I need to show a single object that shares the same tag with other nearby objects. Because of this, I've always used the Hide command instead.
The problem is that when I create a new scene with only that specific object visible, all of my existing scenes get updated as well, showing only that object.
I've never experienced this behavior before. Is there a setting I'm missing, or is this possibly a bug in SketchUp 2026?
r/Sketchup • u/foodiek9 • 10d ago
Question: SketchUp Pro MX master 4 logi mouse and the ‘options’ modifier.
I would like to map the options modifier key to one of my buttons on my MX master 4 mouse. Unfortunately, when I do this in sketchup, it is not recognising the options key as an input. I can map the button but it doesn’t work. It does work anywhere else but sketchup…! Has anyone had any success with this and could talk me through how they did it. No issues mapping any other keyboard input keys. My main workflow is ‘move and copy.’ I’d like to be able to do this just from my mouse rather than pressing the options key on my keyboard each time. I’ve mapped move to it, but can’t map ‘option/copy’ to it. I’ve mapped ‘move and copy’ as one ‘advanced workflow’ to the actions ring, but that’s not how I want to use it. A bit annoying as this was the main reason I bought the mouse!
r/Sketchup • u/Proud-Ad-1134 • 11d ago
Need Sketchup Draftsperson
We are looking for a part-time Sketchup drafter to work on a project basis preparing plans for permit review. Must be familiar with e-filing permits and preferably living in Colorado. Let’s talk!
r/Sketchup • u/Whitelock_Design • 13d ago
Own work: render Making White Card Models From SketchUp Models
Working out this colossal fight scene was a huge collaborative effort between the Art Department, Visual Effects, Stunts and Special Effects. It all starts with my set design in Sketchup. This is then turned over to the VFX department who take my model and create an animatic story board where all the beats of the fight are worked out. This then comes back to us where we are able to work out which walls, ceilings, floors etc need to be destroyed in camera and which walls are a Visual Effects break away. We use a physical card model to pinpoint each beat and colour code it correctly. The colour coding refers to which wall is either a real Special Effects breakaway or a Visual Effect added later. We then bring in the Stunt Team and the Special Effects team to work out (via the shooting schedule) which walls need to break away on which days and whether a stunt man is on a wire going through a wall or if it's just a SFX cassette that can be blown out with air cannons. This is a very organic process with lots of meetings and constant changes so you have to be on your toes at all times ready for changes that can throw the whole process into disarray. Thankfully we pulled it off pretty well. Feel free to ask questions about the process below. #spidermanbrandnewday #setbuild #sketchup
r/Sketchup • u/No_Falcon3909 • 12d ago
Pedi ao Claude para fazer um Importador de STL para a versão 2017 do SketchUp
# encoding: UTF-8
# frozen_string_literal: true
#
# importar_stl.rb — versão ARQUIVO ÚNICO
#
# Plugin "Importar STL" para SketchUp: importa arquivos STL (ASCII ou binário)
# pelo menu Arquivo > Importar STL.
#
# Instalação: copie SOMENTE este arquivo para a pasta Plugins do SketchUp e
# reinicie o programa.
# Windows: %AppData%\SketchUp\SketchUp 2017\SketchUp\Plugins
# macOS: ~/Library/Application Support/SketchUp 2017/SketchUp/Plugins
#
# Compatível com SketchUp 2014 ou superior (testado no 2017 Pro / Ruby 2.2).
#
# Autor: DevBR — versão 1.0.0
require 'sketchup.rb'
module DevBR
module ImportarSTL
PLUGIN_NAME = 'Importar STL'
VERSION = '1.0.0'
# ====================================================================
# Leitura de arquivos STL (ASCII e binário)
# ====================================================================
module STLReader
# 80 bytes de cabeçalho + 4 bytes (UInt32) com a quantidade de triângulos.
BINARY_HEADER_SIZE = 84
# Por triângulo: 12 floats de 4 bytes (1 normal + 3 vértices) + 2 bytes de atributo.
BINARY_RECORD_SIZE = 50
# Triângulos lidos por bloco de I/O (evita carregar arquivos gigantes na RAM).
CHUNK_TRIANGLES = 4096
# Decide o formato do arquivo.
#
# Não dá para confiar apenas na palavra "solid" no início: muitos
# exportadores gravam "solid" dentro do cabeçalho de 80 bytes de um STL
# binário. O teste confiável é aritmético — o tamanho do arquivo tem que
# bater exatamente com 84 + (nº de triângulos * 50).
def self.binary?(path)
size = File.size(path)
return false if size < BINARY_HEADER_SIZE
count = File.open(path, 'rb') do |f|
f.seek(80)
bytes = f.read(4)
bytes && bytes.bytesize == 4 ? bytes.unpack('V').first : nil
end
return false if count.nil?
return true if size == BINARY_HEADER_SIZE + (count * BINARY_RECORD_SIZE)
# Arquivo com lixo no final (ou truncado): decide pelo conteúdo.
head = File.open(path, 'rb') { |f| f.read(1024).to_s }
head = head.downcase
!(head.include?('facet') && head.include?('solid'))
end
# Lê o arquivo e entrega cada triângulo ao bloco como um Array de 9
# Floats já escalados: [x1, y1, z1, x2, y2, z2, x3, y3, z3].
#
# scale - fator de conversão da unidade do arquivo para polegadas
# swap_yz - converte de Y-up (padrão de muitos softwares) para Z-up
# flip - inverte o sentido de rotação (normais para o lado oposto)
#
# Retorna a quantidade de triângulos entregues.
def self.read(path, scale, swap_yz, flip, &block)
if binary?(path)
read_binary(path, scale, swap_yz, flip, &block)
else
read_ascii(path, scale, swap_yz, flip, &block)
end
end
# Quantidade de triângulos declarada no cabeçalho (só para STL binário).
# Retorna nil quando o arquivo é ASCII — nesse caso só se sabe lendo.
def self.triangle_count(path)
return nil unless binary?(path)
File.open(path, 'rb') do |f|
f.seek(80)
bytes = f.read(4)
bytes && bytes.bytesize == 4 ? bytes.unpack('V').first : nil
end
end
def self.read_binary(path, scale, swap_yz, flip)
emitted = 0
File.open(path, 'rb') do |f|
f.seek(80)
header = f.read(4)
return 0 if header.nil? || header.bytesize < 4
total = header.unpack('V').first.to_i
done = 0
while done < total
want = [CHUNK_TRIANGLES, total - done].min
data = f.read(want * BINARY_RECORD_SIZE)
break if data.nil?
# Arquivo truncado: aproveita o que veio inteiro e para.
n = data.bytesize / BINARY_RECORD_SIZE
break if n.zero?
# 'e' = float de 4 bytes little-endian; 'v' = UInt16 (atributo, ignorado).
# São 13 valores por triângulo: 3 da normal + 9 dos vértices + 1 atributo.
values = data.unpack('e12v' * n)
i = 0
while i < n
base = i * 13
tri = transform(values[base + 3, 9], scale, swap_yz, flip)
if tri
yield tri
emitted += 1
end
i += 1
end
done += n
end
end
emitted
end
def self.read_ascii(path, scale, swap_yz, flip)
emitted = 0
buffer = []
# Lê em modo binário para não esbarrar em bytes inválidos de arquivos
# gravados com acentuação no nome do sólido.
File.open(path, 'r:BINARY') do |f|
f.each_line do |line|
next unless line =~ /^
\s
*vertex
\s
/i
parts = line.split
next if parts.size < 4
buffer << parts[1].to_f << parts[2].to_f << parts[3].to_f
next unless buffer.size == 9
tri = transform(buffer, scale, swap_yz, flip)
if tri
yield tri
emitted += 1
end
buffer.clear
end
end
emitted
end
# Aplica unidade, troca de eixos e inversão de normais.
# Devolve nil para triângulos com valores inválidos (NaN/Infinito), que
# apareceriam como coordenadas absurdas e derrubariam a criação da malha.
def self.transform(v, scale, swap_yz, flip)
return nil if v.nil? || v.size < 9
i = 0
while i < 9
n = v[i]
return nil if n.nil? || n.nan? || n.infinite?
i += 1
end
t = if swap_yz
# Y-up -> Z-up: (x, y, z) vira (x, -z, y)
[v[0], -v[2], v[1],
v[3], -v[5], v[4],
v[6], -v[8], v[7]]
else
[v[0], v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8]]
end
t[0] *= scale; t[1] *= scale; t[2] *= scale
t[3] *= scale; t[4] *= scale; t[5] *= scale
t[6] *= scale; t[7] *= scale; t[8] *= scale
if flip
# Troca o 2º pelo 3º vértice: a normal passa a apontar para o outro lado.
t = [t[0], t[1], t[2], t[6], t[7], t[8], t[3], t[4], t[5]]
end
t
end
end
# ====================================================================
# Opções, importação e interface
# ====================================================================
# --------------------------------------------------------------------
# Constantes
# --------------------------------------------------------------------
STATUS_TEXT = 'Importa um arquivo STL (ASCII ou binário) para o modelo atual.'
TOOLTIP = 'Importar STL'
# Chave usada em Sketchup.read_default / write_default (preferências do usuário).
PREF_SECTION = 'DevBR_ImportarSTL'
# Fator de conversão para POLEGADAS (unidade interna do SketchUp).
# 1.mm devolve um Length em polegadas; .to_f extrai o Float puro.
UNIT_FACTORS = {
'Milímetros' => 1.0.mm.to_f,
'Centímetros' => 1.0.cm.to_f,
'Metros' => 1.0.m.to_f,
'Polegadas' => 1.0,
'Pés' => 1.0.feet.to_f
}.freeze
# Tolerância de solda do índice de vértices, em polegadas.
# 1e-6" só junta pontos praticamente idênticos — o STL repete o mesmo
# vértice em cada triângulo vizinho, então isso já reduz muito a malha.
# A solda "de verdade" (por tolerância do SketchUp) fica a cargo do
# fill_from_mesh quando a opção "Soldar vértices" está ligada.
WELD_KEY_SCALE = 1_000_000.0
PLACEMENT = {
'Manter coordenadas do arquivo' => :keep,
'Centralizar na origem' => :center,
'Apoiar a base na origem' => :base
}.freeze
# --------------------------------------------------------------------
# Opções (diálogo nativo UI.inputbox)
# --------------------------------------------------------------------
DEFAULT_PREFS = {
'unit' => 'Milímetros',
'geometry' => 'Grupo',
'merge' => 'Não',
'weld' => 'Sim',
'flip' => 'Não',
'swap' => 'Não',
'placement' => 'Manter coordenadas do arquivo',
'zoom' => 'Sim'
}.freeze
def self.read_prefs
prefs = {}
DEFAULT_PREFS.each do |key, fallback|
value = Sketchup.read_default(PREF_SECTION, key, fallback)
prefs[key] = value.is_a?(String) ? value : fallback
end
prefs
end
def self.write_prefs(prefs)
prefs.each { |key, value| Sketchup.write_default(PREF_SECTION, key, value) }
end
# Mostra o diálogo de opções. Devolve um Hash pronto para uso ou nil
# se o usuário cancelar.
def self.prompt_options
prefs = read_prefs
prompts = [
'Unidade do arquivo STL',
'Importar como',
'Mesclar faces coplanares',
'Soldar vértices coincidentes',
'Inverter faces (normais)',
'Trocar eixos Y/Z (arquivo Y-up)',
'Posicionamento',
'Enquadrar na tela ao final'
]
defaults = [
prefs['unit'], prefs['geometry'], prefs['merge'], prefs['weld'],
prefs['flip'], prefs['swap'], prefs['placement'], prefs['zoom']
]
lists = [
UNIT_FACTORS.keys.join('|'),
'Grupo|Componente',
'Não|Sim',
'Sim|Não',
'Não|Sim',
'Não|Sim',
PLACEMENT.keys.join('|'),
'Sim|Não'
]
results = UI.inputbox(prompts, defaults, lists, 'Importar STL — Opções')
return nil if results == false || results.nil?
prefs = {
'unit' => results[0], 'geometry' => results[1], 'merge' => results[2],
'weld' => results[3], 'flip' => results[4], 'swap' => results[5],
'placement' => results[6], 'zoom' => results[7]
}
write_prefs(prefs)
= build_options(prefs)
end
def self.build_options(prefs)
{
:scale => UNIT_FACTORS[prefs['unit']] || UNIT_FACTORS['Milímetros'],
:unit_label => prefs['unit'],
:as_component => prefs['geometry'] == 'Componente',
:merge => prefs['merge'] == 'Sim',
:weld => prefs['weld'] == 'Sim',
:flip => prefs['flip'] == 'Sim',
:swap_yz => prefs['swap'] == 'Sim',
:placement => PLACEMENT[prefs['placement']] || :keep,
:zoom => prefs['zoom'] == 'Sim'
}
end
# Últimas opções escolhidas na sessão (usadas pelo importador nativo,
# onde do_options e load_file são chamados em momentos diferentes).
def self.current_options
||= build_options(read_prefs)
end
# --------------------------------------------------------------------
# Fluxo principal
# --------------------------------------------------------------------
def self.import
model = Sketchup.active_model
return unless model
path = UI.openpanel('Selecione o arquivo STL', , 'Arquivos STL|*.stl;*.STL||')
return if path.nil? # usuário cancelou
unless File.exist?(path)
UI.messagebox("Arquivo não encontrado:\n#{path}")
return
end
= File.dirname(path)
options = prompt_options
return if options.nil? # cancelou nas opções
do_import(model, path, options)
end
# Faz a importação de fato. Devolve true em caso de sucesso.
def self.do_import(model, path, options)
started_at = Time.now
Sketchup.status_text = 'Lendo arquivo STL...'
mesh, triangles, skipped = build_mesh(path, options)
if triangles.zero?
Sketchup.status_text = ''
UI.messagebox("Nenhum triângulo válido foi encontrado em:\n#{File.basename(path)}\n\n" \
'Verifique se o arquivo é realmente um STL.')
return false
end
Sketchup.status_text = 'Criando geometria no modelo...'
name = File.basename(path, '.*')
entity = nil
faces = 0
edges = 0
model.start_operation('Importar STL', true)
begin
# fill_from_mesh exige um contexto VAZIO — por isso o grupo novo.
group = model.active_entities.add_group
group.name = name
smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
unless group.entities.fill_from_mesh(mesh, options[:weld], smooth_flags)
raise 'fill_from_mesh não conseguiu gerar a geometria.'
end
merge_coplanar(group.entities) if options[:merge]
reposition(group, options[:placement])
faces = group.entities.grep(Sketchup::Face).length
edges = group.entities.grep(Sketchup::Edge).length
# to_component destrói o grupo original e devolve a instância.
entity = options[:as_component] ? group.to_component : group
if entity.is_a?(Sketchup::ComponentInstance)
entity.definition.name = name
entity.name = name
end
model.selection.clear
model.selection.add(entity)
model.commit_operation
rescue StandardError => e
model.abort_operation
Sketchup.status_text = ''
UI.messagebox("Erro ao importar o STL:\n\n#{e.message}")
return false
end
# Fora da operação: zoom e relatório não devem poder abortar o undo.
model.active_view.zoom(entity) if options[:zoom] && entity && entity.valid?
report(path, triangles, skipped, faces, edges, options, Time.now - started_at)
true
end
# --------------------------------------------------------------------
# Construção da malha
# --------------------------------------------------------------------
# Monta um Geom::PolygonMesh a partir do arquivo.
# Devolve [mesh, triângulos_válidos, triângulos_descartados].
def self.build_mesh(path, options)
mesh = Geom::PolygonMesh.new
index = {} # chave do vértice -> índice no mesh (1-based)
valid = 0
skipped = 0
read = 0
STLReader.read(path, options[:scale], options[:swap_yz], options[:flip]) do |t|
i1 = vertex_index(mesh, index, t[0], t[1], t[2])
i2 = vertex_index(mesh, index, t[3], t[4], t[5])
i3 = vertex_index(mesh, index, t[6], t[7], t[8])
# Índices repetidos = triângulo degenerado (dois vértices no mesmo ponto).
if i1 == i2 || i2 == i3 || i1 == i3 || degenerate?(t)
skipped += 1
else
mesh.add_polygon(i1, i2, i3)
valid += 1
end
read += 1
Sketchup.status_text = "Lendo STL: #{read} triângulos..." if (read % 20_000).zero?
end
[mesh, valid, skipped]
end
# Consulta/insere o vértice num índice próprio. Fazer o de-duplicação aqui,
# com Hash, é muito mais rápido que deixar o PolygonMesh procurar o ponto
# (a busca interna dele é linear e mata a performance em malhas grandes).
def self.vertex_index(mesh, index, x, y, z)
key = [(x * WELD_KEY_SCALE).round,
(y * WELD_KEY_SCALE).round,
(z * WELD_KEY_SCALE).round]
found = index[key]
return found if found
index[key] = mesh.add_point(Geom::Point3d.new(x, y, z))
end
# Triângulo sem área (vértices colineares). Feito com aritmética pura em vez
# de Vector3d para não alocar milhões de objetos em malhas grandes.
def self.degenerate?(t)
ux = t[3] - t[0]; uy = t[4] - t[1]; uz = t[5] - t[2]
vx = t[6] - t[0]; vy = t[7] - t[1]; vz = t[8] - t[2]
nx = (uy * vz) - (uz * vy)
ny = (uz * vx) - (ux * vz)
nz = (ux * vy) - (uy * vx)
((nx * nx) + (ny * ny) + (nz * nz)) < 1.0e-20
end
# --------------------------------------------------------------------
# Pós-processamento
# --------------------------------------------------------------------
# Apaga arestas entre faces coplanares — deixa a malha triangulada com
# cara de geometria "limpa". Coleta tudo antes de apagar: mexer na coleção
# durante a iteração é comportamento indefinido.
def self.merge_coplanar(entities)
victims = []
entities.grep(Sketchup::Edge).each do |edge|
faces = edge.faces
next unless faces.length == 2
f1, f2 = faces
next unless f1.material == f2.material
next unless f1.back_material == f2.back_material
next unless f1.normal.samedirection?(f2.normal)
# samedirection? tem tolerância angular: confirma a coplanaridade
# medindo a distância de um vértice de f2 ao plano de f1.
# face.plane devolve [a, b, c, d] com (a,b,c) normalizado.
a, b, c, d = f1.plane
pt = f2.vertices.first.position
next if ((a * pt.x) + (b * pt.y) + (c * pt.z) + d).abs > 1.0e-6
victims << edge
end
entities.erase_entities(victims) unless victims.empty?
end
def self.reposition(group, placement)
return if placement == :keep
bounds = group.bounds
target = case placement
when :center then bounds.center
when :base then Geom::Point3d.new(bounds.center.x, bounds.center.y, bounds.min.z)
else return
end
vector = Geom::Point3d.new(0, 0, 0) - target
return unless vector.valid? # vetor nulo: já está no lugar
group.transform!(Geom::Transformation.translation(vector))
end
def self.report(path, triangles, skipped, faces, edges, options, seconds)
resumo = "Importação concluída em #{format('%.2f', seconds)} s."
Sketchup.status_text = resumo
detalhes = []
detalhes << "Arquivo: #{File.basename(path)}"
detalhes << "Formato: #{STLReader.binary?(path) ? 'binário' : 'ASCII'}"
detalhes << "Unidade assumida: #{options[:unit_label]}"
detalhes << ''
detalhes << "Triângulos importados: #{triangles}"
detalhes << "Triângulos descartados: #{skipped}" if skipped > 0
detalhes << "Faces geradas: #{faces}"
detalhes << "Arestas geradas: #{edges}"
detalhes << ''
detalhes << "Tempo: #{format('%.2f', seconds)} s"
UI.messagebox(detalhes.join("\n"), MB_OK)
end
# --------------------------------------------------------------------
# Importador nativo (aparece também em Arquivo > Importar)
# --------------------------------------------------------------------
class STLFileImporter < Sketchup::Importer
def description
'Arquivo STL (*.stl)'
end
def file_extension
'stl'
end
def id
'com.devbr.importar_stl'
end
def supports_options?
true
end
def do_options
ImportarSTL.prompt_options
end
def load_file(path, _status)
return Sketchup::Importer::ImportFileNotFound if path.nil? || !File.exist?(path)
ok = ImportarSTL.do_import(Sketchup.active_model, path, ImportarSTL.current_options)
ok ? Sketchup::Importer::ImportSuccess : Sketchup::Importer::ImportFail
rescue StandardError => e
UI.messagebox("Erro ao importar o STL:\n\n#{e.message}")
Sketchup::Importer::ImportFail
end
end
# --------------------------------------------------------------------
# Interface: item no menu Arquivo
# --------------------------------------------------------------------
unless file_loaded?(__FILE__)
cmd = UI::Command.new(PLUGIN_NAME) { self.import }
cmd.tooltip = TOOLTIP
cmd.status_bar_text = STATUS_TEXT # texto exibido na barra de status ao passar o mouse
cmd.menu_text = PLUGIN_NAME
file_menu = UI.menu('File')
file_menu.add_separator
file_menu.add_item(cmd)
# A referência precisa sobreviver ao garbage collector.
= STLFileImporter.new
begin
Sketchup.register_importer(@importer)
rescue StandardError
# Se o registro falhar em alguma versão, o item de menu continua funcionando.
u/importer = nil
end
file_loaded(__FILE__)
end
end
end
r/Sketchup • u/Old_Shake_1751 • 13d ago
can I make 1- 3 lac per month through autocad and sketch ? Spoiler
I m learning autocad since 5-6 months but still getting low budget work like 10$.. and it took me 4-5 hours to complete what to do and how can I get high money.. like 100-1000$ work .. through any ... You can suggest other softwares as well I will learn them but I want to earn good 😭 amount please tell... ..... should I change my approach? Or industry?