This commit is contained in:
cjw
2026-02-12 23:22:11 +08:00
parent 7b09eb3d89
commit 89660bba4e
5988 changed files with 2517516 additions and 0 deletions
@@ -0,0 +1,10 @@
<svg
width="100%"
height="100%"
viewBox="{min_x} {min_y} {width} {height}"
xmlns="http://www.w3.org/2000/svg"
xmlns:trimesh="https://github.com/mikedh/trimesh"
{attribs}
>
{elements}
</svg>

After

Width:  |  Height:  |  Size: 190 B

@@ -0,0 +1,67 @@
# flake8: noqa
import bpy
import os
def delete_nonresult(bpy):
objects = bpy.data.objects # use data.objects instead of context.scene.objects
if len(objects) <= 1:
return
try:
# earlier than blender <2.8
objects[0].select = False # keep the first object
for other in objects[1:]: # remove all other objects
other.select = True
bpy.ops.object.delete()
objects[0].select = True
except AttributeError:
# blender 2.8 changed this
objects[0].select_set(False)
for other in objects[1:]:
other.select_set(True)
bpy.ops.object.delete()
objects[0].select_set(True)
if __name__ == '__main__':
# clear scene of default box
bpy.ops.wm.read_homefile()
try:
bpy.ops.object.mode_set(mode='OBJECT')
except BaseException:
pass
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=True)
# get temporary files from templated locations
mesh_pre = $MESH_PRE
mesh_post = os.path.abspath(r'$MESH_POST')
for filename in mesh_pre: # use data.objects instead of context.scene.objects
bpy.ops.wm.stl_import(filepath=os.path.abspath(filename))
mesh = bpy.data.objects[0]
# Make sure mesh is the active object
try:
# earlier than blender <2.8
bpy.context.scene.objects.active = mesh
except AttributeError:
# blender 2.8 changed this
bpy.context.view_layer.objects.active = mesh
for other in bpy.data.objects[1:]:
# add boolean modifier
mod = mesh.modifiers.new('boolean', 'BOOLEAN')
mod.object = other
mod.operation = '$OPERATION'
mod.solver = '$SOLVER_OPTIONS'
mod.use_self = $USE_SELF
# used mod.name instead of hard-coded "boolean"
bpy.ops.object.modifier_apply(modifier=mod.name)
delete_nonresult(bpy)
bpy.ops.wm.stl_export(
filepath=mesh_post,
apply_modifiers=True)
@@ -0,0 +1,40 @@
# flake8: noqa
import bpy
from bl_operators.uvcalc_smart_project import main as smart_proj
import os
if __name__ == '__main__':
# clear scene of default box
bpy.ops.wm.read_homefile()
try:
bpy.ops.object.mode_set(mode='OBJECT')
except BaseException:
pass
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=True)
# get temporary files from templated locations
mesh_pre = $MESH_PRE
mesh_post = os.path.abspath(r'$MESH_POST')
# use data.objects instead of context.scene.objects
bpy.ops.import_scene.obj(filepath=os.path.abspath(mesh_pre[0]))
bpy.ops.object.select_all(action='SELECT')
mesh = bpy.data.objects[0]
# Make sure mesh is the active object
try:
# earlier than blender <2.8
bpy.context.scene.objects.active = mesh
except AttributeError:
# blender 2.8 changed this
bpy.context.view_layer.objects.active = mesh
smart_proj(bpy.context, $ISLAND_MARGIN, $ANGLE_LIMIT, 0, True, True)
bpy.ops.export_scene.obj(
filepath=mesh_post,
use_mesh_modifiers=False,
use_uvs=True)
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
<path d="{path_string}" {attribs}/>
@@ -0,0 +1,9 @@
{
"face": "element face $face_count\nproperty list uchar int vertex_indices\n",
"vertex": "element vertex $vertex_count\nproperty float x\nproperty float y\nproperty float z\n",
"vertex_normal": "property float nx\nproperty float ny\nproperty float nz\n",
"color": "property uchar red\nproperty uchar green\nproperty uchar blue\nproperty uchar alpha\n",
"edge": "element edge $edge_count\nproperty int vertex1\nproperty int vertex2\n",
"intro": "ply\nformat $encoding 1.0\ncomment https://github.com/mikedh/trimesh\n",
"outro": "end_header\n"
}