Skip to content

Instantly share code, notes, and snippets.

@ialhashim
Last active February 28, 2026 11:04
Show Gist options
  • Select an option

  • Save ialhashim/9522211 to your computer and use it in GitHub Desktop.

Select an option

Save ialhashim/9522211 to your computer and use it in GitHub Desktop.
==============================
Expression: (id=\d)(.+?)(")
==============================
Python script to download:
import os.path
import urllib.request
links = open('list.txt', 'r')
c=0
for link in links:
prefix = "https://3dwarehouse.sketchup.com/3dw/getbinary?subjectClass=entity&name=s&subjectId="
prefix6 = "https://3dwarehouse.sketchup.com/3dw/getbinary?subjectClass=entity&name=s6&subjectId="
prefix7 = "https://3dwarehouse.sketchup.com/3dw/getbinary?subjectClass=entity&name=s7&subjectId="
prefix8 = "https://3dwarehouse.sketchup.com/3dw/getbinary?subjectClass=entity&name=s8&subjectId="
link = link.strip()
name = link.rsplit('/', 1)[-1]
filename = os.path.dirname(os.path.realpath(__file__)) + "\\downloads\\" + ("%03d" % c) + ".skp"
c += 1
if not os.path.isfile(filename):
print('Downloading: ' + filename)
try:
urllib.request.urlretrieve(prefix8 + link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
try:
urllib.request.urlretrieve(prefix7 + link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
try:
urllib.request.urlretrieve(prefix6 + link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
try:
urllib.request.urlretrieve(prefix + link, filename)
except Exception as inst:
print(inst)
print(' Encountered unknown error. Continuing.')
===========================================
Ruby to convert to STL
==========================
STL_ASCII = 'ASCII'.freeze
OPTIONS = {
'selection_only' => false,
'export_units' => 'Model Units',
'stl_format' => STL_ASCII
}
STL_Exporter = CommunityExtensions::STL::Exporter
model_path = Sketchup.active_model.path
model_basename = File.basename(model_path, ".skp")
model_dir = File.dirname(model_path)
Dir.entries(model_dir).each{ |d|
file_load = File.join(model_dir,d)
next if File.extname(file_load).upcase!=".SKP"
mbasename = File.basename(file_load, ".skp")
next if File.exist?(model_dir + "/" + mbasename + ".stl")
model = Sketchup.active_model
entities = model.active_entities
definitions = model.definitions
status = entities.clear!
componentdefinition = definitions.load( file_load )
point = Geom::Point3d.new 0,0,0
transform = Geom::Transformation.new point
instance = entities.add_instance componentdefinition, transform
e = instance
target_size = 1.m
s = [e.bounds.width, e.bounds.height, e.bounds.depth].max
r = target_size / s
t = Geom::Transformation.scaling(r)
e.transform!(t)
mpath = Sketchup.active_model.path
outfile = "#{model_dir}/#{mbasename}.stl"
STL_Exporter.export(outfile, OPTIONS)
}
@Mi-Pe
Copy link

Mi-Pe commented Feb 28, 2026

How to use this? Does it download SKP or STL models? Does this work in SketchUp or in browser? If browser, which one? So many questions :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment