Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
AndreyZarembo committed Dec 21, 2022
0 parents commit c09f444
Show file tree
Hide file tree
Showing 50 changed files with 4,059 additions and 0 deletions.
129 changes: 129 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
// Используйте IntelliSense, чтобы узнать о возможных атрибутах.
// Наведите указатель мыши, чтобы просмотреть описания существующих атрибутов.
// Для получения дополнительной информации посетите: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Отладка Laser Offset CLI",
"type": "python",
"request": "launch",
"module": "laser_offset",
"justMyCode": true,
"cwd": "${workspaceFolder}/src",
"args": [
"~/Projects/DXF_Test",
"~/Projects/DXF_Test/Output",
"300",
"--svg"
]
},
{
"name": "Laser Offset CLI HELP",
"type": "python",
"request": "launch",
"module": "laser_offset",
"justMyCode": true,
"cwd": "${workspaceFolder}/src",
"args": [
"--help"
]
}
]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Andrey Zarembo-Godzyatskiy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions Readme.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Laser Offset
============

Simple Tools that creates external and internal offsets for shapes. Supports DXF and SVG Import/Export.

.. note::

This project is in early alpha and was created as side-project for hobby.

It has `Limitations`_

Installing
----------

Install and update using `pip`_:

.. code-block:: text
$ pip install -U laser_offset
.. _pip: https://pip.pypa.io/en/stable/getting-started/

Usage
-----

.. code-block:: text
Usage: laser_offset [OPTIONS] SOURCE_PATH TARGET_PATH LASER_WIDTH
Creates new drawings from DXFs with outer and inner offset lines by
LASER_WIDTH in μm(microns) ans save them into TARGET_PATH as SVG or DXF.
SOURCE_PATH is folder with DXFs for batch convertion
TARGET_PATH is folder for results
LASER_WIDTH is beam diameter in μm(microns) from 1 to 999
Options:
-s, --svg Output as SVG [default: (False)]
-d, --dxf / -D, --no-dxf Output as DXF [default: (True)]
--help Show this message and exit.
Limitations
-----------

1. Not working with splines. Only circles and paths. And can merge lines and arcs into path if they has connected ends
2. Can't handle arcs less that half of laser width
3. Ignores layers, shape size and styles
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
40 changes: 40 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'Laser Offset'
copyright = '2022, Andrey Zarembo-Godzyatskiy'
author = 'Andrey Zarembo-Godzyatskiy'
release = '0.1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc'
]

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']
html_theme_options = {
# Disable showing the sidebar. Defaults to 'false'
'nosidebar': True,
'show_powered_by': False,
'github_user': 'AndreyZarembo',
'github_repo': 'LaserOffset',
'github_banner': True,
'show_related': False,
'note_bg': '#FFF59C'
}
8 changes: 8 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.. rst-class:: hide-header

.. Laser Offset documentation master file, created by
sphinx-quickstart on Tue Dec 20 22:52:07 2022.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. include:: ../../Readme.rst
8 changes: 8 additions & 0 deletions laser_offset.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": "."
}
],
"settings": {}
}
21 changes: 21 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[project]
name = "laser_offset"
version = "0.1.0"
authors = [
{ name="Andrey Zarembo-Godzyatskiy", email="[email protected]" },
]
description = "Simple Tools that creates external and internal offsets for shapes. Supports DXF and SVG Import/Export."
readme = "README.md"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]

[project.urls]
"Homepage" = "https://github.com/AndreyZarembo/LaserOffset"
"Bug Tracker" = "https://github.com/AndreyZarembo/LaserOffset/issues"

[project.scripts]
laser_offset = "laser_offset:laser_offset"
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ezdxf~=0.18
click~=8.1
7 changes: 7 additions & 0 deletions src/laser_offset/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from laser_offset.cli.laser_offset_cli import laser_offset

def run_laser_offset():
laser_offset()

if __name__ == '__main__':
run_laser_offset()
4 changes: 4 additions & 0 deletions src/laser_offset/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from laser_offset.cli.laser_offset_cli import laser_offset

if __name__ == '__main__':
laser_offset()
Loading

0 comments on commit c09f444

Please sign in to comment.