mirror of
https://github.com/yeicor-3d/yet-another-cad-viewer.git
synced 2025-12-19 22:24:17 +01:00
add full support for locations, better helpers and more server fixes
This commit is contained in:
@@ -2,29 +2,29 @@ import asyncio
|
||||
import logging
|
||||
import os
|
||||
|
||||
from OCP.TopoDS import TopoDS_Shape
|
||||
from build123d import *
|
||||
|
||||
|
||||
def build_logo() -> TopoDS_Shape:
|
||||
def build_logo(text: bool = True) -> Part:
|
||||
"""Builds the CAD part of the logo"""
|
||||
with BuildPart(Plane.XY.offset(50)) as logo_obj:
|
||||
Box(22, 40, 30)
|
||||
fillet(edges().filter_by(Axis.Y).group_by(Axis.Z)[-1], 10)
|
||||
offset(solid(), 2, openings=faces().group_by(Axis.Z)[0] + faces().filter_by(Plane.XZ))
|
||||
text_at_plane = Plane.YZ
|
||||
text_at_plane.origin = faces().group_by(Axis.X)[-1].face().center()
|
||||
with BuildSketch(text_at_plane.location):
|
||||
Text('Yet Another\nCAD Viewer', 7, font_path='/usr/share/fonts/TTF/OpenSans-Regular.ttf')
|
||||
extrude(amount=1)
|
||||
if text:
|
||||
text_at_plane = Plane.YZ
|
||||
text_at_plane.origin = faces().group_by(Axis.X)[-1].face().center()
|
||||
with BuildSketch(text_at_plane.location):
|
||||
Text('Yet Another\nCAD Viewer', 7, font_path='/usr/share/fonts/TTF/OpenSans-Regular.ttf')
|
||||
extrude(amount=1)
|
||||
|
||||
return logo_obj.part.wrapped
|
||||
return logo_obj.part
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
# Start an offline "server" to merge the CAD part of the logo with the animated GLTF part of the logo
|
||||
# Start an offline "server" to export the CAD part of the logo in a way compatible with the frontend
|
||||
os.environ['YACV_DISABLE_SERVER'] = '1'
|
||||
from yacv_server import show_object, server
|
||||
|
||||
|
||||
Reference in New Issue
Block a user