
SketchUp Step Importer
A SketchUp extension that imports STEP assemblies and keeps their structure:
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
A SketchUp extension that imports STEP assemblies and keeps their structure: parts become groups, repeated parts (screws, nuts…) become components, and heavy sub-assemblies such as a populated PCB can be merged into a single mesh. The result is saved next to the STEP file as a .skp.
SketchUp's Ruby API cannot read STEP (a B-Rep / NURBS format), so the extension delegates the geometry to FreeCAD running headless, then rebuilds the model in SketchUp.
Assembly hierarchy preserved as nested groups
Identical parts detected automatically → one component definition, many instances
Big containers (default: 50+ parts) merged into one mesh, so a PCB with ~1200 components imports in seconds instead of creating 1200 groups
Native progress window: stage, current part, log, elapsed time, Cancel
FreeCAD console window is hidden
Result saved as <name>.skp next to the STEP file
Progress log in %TEMP%\step_import.log
How it works
STEP ──► FreeCADCmd + step2stl_fc.py ──► def_XXXX.stl + manifest.json │ SketchUp (Ruby) ◄───────────────┘ groups / components with placement matrices ──► .skp
FreeCAD opens the STEP, walks the assembly tree and tessellates each unique shape once.
Parts are compared by a position-independent fingerprint (solids, faces, edges, volume, area, bounding box of the local shape). Matches share one STL.
manifest.json records the hierarchy, the definitions and a 4×4 placement matrix for every instance.
The extension reads the STL files, creates groups / component definitions and places the instances with the matrices.
Requirements
Windows (the launcher and FreeCAD discovery are Windows-specific)
SketchUp 2021 or newer (Ruby 2.7+). Developed and tested on SketchUp 2024.
FreeCAD installed (FreeCADCmd.exe). Tested with: FreeCAD version — fill in. No separate Python is needed; the script runs inside FreeCAD's own interpreter.
Installation
Download eugenyh_step_import-<version>.rbz from the Releases page (or build it yourself, see below).
SketchUp: Window → Extension Manager → Install Extension and pick the .rbz.
Restart SketchUp.
On first run the extension looks for C:\Program Files\FreeCAD*\bin\FreeCADCmd.exe; if it is not found you are asked to point to it, and the path is remembered.
Extensions → Import STEP assembly (FreeCAD), choose a .step / .stp file and watch the progress window. When it finishes, the model is in SketchUp and a .skp is saved next to the STEP file.
Don't edit the model while the import is running: the model is built inside a single undoable operation, which is rolled back on cancel or error.
Constants at the top of eugenyh_step_import/main.rb (inside the installed extension folder under Plugins):
Colors and materials are not imported. FreeCADCmd has no GUI and does not read STEP colors; STL carries none.
Units are assumed to be millimetres (FreeCAD's native unit).
Assemblies built from App::Link objects may come out incomplete (links are skipped).
If a part's geometry is baked into global coordinates instead of a placement, repeated copies are not recognised and come out as separate groups.
SketchUp cannot represent edges shorter than 0.001″ (≈ 0.025 mm): the tiniest sliver triangles of dense meshes disappear (≈ 0.16 % of the area on a test PCB).
Parts whose shapes differ by less than 0.01 mm may be treated as identical.
The user interface is currently in Russian only.
Windows only; not tested on other platforms.
Troubleshooting
Progress and errors are written to %TEMP%\step_import.log (readable while the import runs).
On errors the temporary folder %TEMP%\step2stl… is kept: it contains the STL files, manifest.json, freecad.log and error.txt.
If the FreeCAD window is visible, Windows Script Host is probably disabled; the extension then falls back to a normal launch.
Performance notes for SketchUp extension developers
Findings from building this, measured on a ~160k-triangle PCB mesh:
tools/step_bench.rb and tools/step_check.rb are the small scripts used for these measurements (run them from the Ruby Console).
python build_rbz.py
produces dist/eugenyh_step_import-<version>.rbz. The .rbz is a ZIP archive with the loader in the root; the script makes sure paths use forward slashes.
This project is not affiliated with or endorsed by Trimble / SketchUp or the FreeCAD project. FreeCAD is started as a separate process and is not bundled.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。