Skip to main content

Sweet home 3D file tools, currently providing SVG converter.

Project description

sh3dkit

sh3dkit is a flexible and extensible Python library and command-line interface (CLI) toolset for working with .sh3d files, commonly used by Sweet Home 3D. It provides an easy way to render, visualize, and convert .sh3d files into other formats such as SVG, while offering an architecture to add support for additional renderers in the future.

Key Features:

  • Render .sh3d files: Extracts and visualizes floor plans and 3D home designs from .sh3d files.
  • Format Conversion: Convert .sh3d files into various output formats, including SVG, and with the potential for more formats in the future.
  • Extensible: Built with flexibility in mind, allowing for easy addition of new rendering engines (e.g., Matplotlib, custom formats).
  • CLI and Library: Provides both a command-line interface (CLI) and a Python library for use in automated workflows or custom applications.
  • Easy Integration: Installable via pip and ready to use in your Python projects.

Whether you're an architect, a designer, or a developer working with home design data, sh3dkit enables efficient processing of Sweet Home 3D project files for your own needs.

CLI

Currently only convertion into SVG is supported by using sh3d2svg command provided in sh3dkit/bin/sh3d2svg.py, it usage is:

Usage: sh3d2svg [OPTIONS] INPUT_FILE

Options:
  -o, --output TEXT      Output SVG file path.
  -l, --level-name TEXT  What level name to render, if not specified all are
                         rendered into separate files automatically.
  --help                 Show this message and exit.

API

Single renderer interface is provided for implementation in sh3dkit/renderer/HomeRenderer.py, SVG renderer used by sh3d2svg command is implemented in sh3dkit/renderer/SvgHomeRenderer.py. "Only" these functions are required to be implemented to get your custom renderer working:

from typing import List, Tuple, Optional
from pathlib import Path
import skia
from sh3d.model.Wall import Wall
from sh3d.model.TextureImage import TextureImage
from sh3d.model.DimensionLine import DimensionLine
from sh3d.model.Polyline import Polyline, ArrowStyle
from sh3d.model.BackgroundImage import BackgroundImage
from sh3d.model.Room import Room
from sh3d.model.Color import Color
from sh3d.model.TextStyle import TextStyle
from sh3d.model.Label import Label
from sh3d.model.HomePieceOfFurniture import HomePieceOfFurniture
from sh3dkit.renderer.HomeRenderer import HomeRenderer


class MyCustomHomeRenderer(HomeRenderer):

    def drawn_walls(self, walls: List[Wall], area: skia.Path, plan_scale: float, wall_pattern: TextureImage) -> None:
        raise NotImplementedError

    def drawn_dimension_lines(self, dimension_lines: List[DimensionLine], plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_polylines(self, polylines: List[Polyline], plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_background(self, color: str) -> None:
        raise NotImplementedError

    def drawn_background_image(self, background_image: BackgroundImage, plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_rooms(self, rooms: List[Room], plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_furniture(self, furniture: List[HomePieceOfFurniture], walls: List[Wall], plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_arrow(self, point: Tuple[float, float], angle: float, arrow_style: ArrowStyle, thickness: float, color: Color, delta: float) -> None:
        raise NotImplementedError

    def drawn_labels(self, labels: List[Label], plan_scale: float) -> None:
        raise NotImplementedError

    def drawn_text(self, text: str, x: float, y: float, angle: float, style: TextStyle, color: Color, outline_color: Optional[Color] = None) -> None:
        raise NotImplementedError

    def save_to_file(self, path: Path) -> None:
        raise NotImplementedError

Objects Wall, DimensionLine, Polyline, Room, Label, HomePieceOfFurniture, HomeDoorOrWindow(HomePieceOfFurniture) implement Renderable that provides properties points and geometry, where points are List of tuples containing x, y coordinates and geometry returns shapely shape.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sh3dkit-0.2.5.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sh3dkit-0.2.5-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file sh3dkit-0.2.5.tar.gz.

File metadata

  • Download URL: sh3dkit-0.2.5.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for sh3dkit-0.2.5.tar.gz
Algorithm Hash digest
SHA256 6498e13589c4255ba3a8f6f5e8abbb92e7938af7c26d5a20d24b2a3e28887c34
MD5 553624007abbccfe6b6c8743f1a7ef03
BLAKE2b-256 dbc4ab907eadf14a71ba45d6033149df15a634356c2daf67f5bf91100c4e5b0f

See more details on using hashes here.

File details

Details for the file sh3dkit-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: sh3dkit-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.2

File hashes

Hashes for sh3dkit-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 81f303a01e1d2e58a51d2288f559c53d4934cb9fe57a8a29a1117f5a2757f33a
MD5 c5f92512e07446dd6d911e8dead4cfc5
BLAKE2b-256 c42989d23d64aa92bdb7c2ae1fa7c961d1d1771628fcb52106682cb9974837b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page