inventree-wireviz-plugin


Nameinventree-wireviz-plugin JSON
Version 0.6.2 PyPI version JSON
download
home_pagehttps://github.com/inventree/inventree-wireviz
SummaryWireviz plugin for InvenTree
upload_time2024-08-06 03:10:26
maintainerNone
docs_urlNone
authorOliver Walters
requires_python>=3.9
licenseMIT
keywords inventree inventory wireviz wiring cable harness
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI](https://img.shields.io/pypi/v/inventree-wireviz-plugin)](https://pypi.org/project/inventree-wireviz-plugin/)
![PEP](https://github.com/inventree/inventree-wireviz/actions/workflows/pep.yaml/badge.svg)

# inventree-wireviz

The **inventree-wireviz** plugin provides direct integration for [wireviz](https://github.com/formatc1702/WireViz), a text-based wiring harness specification tool.

## Functionality

The plugin provides a number of key functions:

### Harness Diagram Generation

This plugin provides server-side generation of a wiring harness diagram from a `.wireviz` file. Uploading a simple [harness file](./demo/harness.wireviz) results in the generation of a wiring diagram:

![](./demo/harness.svg)

> **Note**
> Refer to the [wireviz syntax guide](https://github.com/formatc1702/WireViz/blob/master/docs/syntax.md) for a full description of the file format.

The generated harness diagram is available as a `.svg` file.

### BOM Extraction

Bill of Materials (BOM) information can be extracted directly from the harness description file, allowing for a harness assembly to be fully qualified from the template file.

### Report Generation

The generated `.svg` can be used in report templates, for example as a reference diagram in a Build Order Report

## Installation

### Installation Requirements

You must have [graphviz](https://graphviz.org/) installed, and accessible by the InvenTree server.

e.g. `apt-get install graphviz`

If installing in a container environment (e.g. Docker), the dockerfile will need to be extended to install the *graphviz* binaries

### Plugin Installation

The plugin is available [via PIP](https://pypi.org/project/inventree-wireviz-plugin/). Follow the [InvenTree plugin installation guide](https://docs.inventree.org/en/latest/extend/plugins/install/) to install the plugin on your system

### Configuration

Once the plugin is installed, it needs to be enabled before it is available for use. Again, refer to the InvenTree docs for instructions on how to enable the plugin. After the plugin is enabled, the following configuration options are available:

![](./docs/config.png)

| Setting | Description |
| --- | --- |
| Wireviz Upload Path | Directory where wireviz *template* files can be uploaded, and referenced by wireviz. This is an *advanced* option. Refer to the wireviz docs for more information on templates. |
| Delete Old Files | Remove old harness diagram files when a new `.wireviz` file is uploaded |
| Extract BOM Data | Extract BOM data from harness file and generate new BOM entries |
| Clear BOM Data | Remove existing BOM entries first, before creating new ones |
| Add Part Image | Where available, embed part images in the generated harness diagram |

Additionally, you must ensure that the *Enable event integration* setting is enabled in the *Plugin Settings* view:

![](./docs/event_plugin.png)

## Operation

### Uploading Wireviz File

To generate a wiring harness diagram for a specific Part, upload a (valid) wireviz yaml file. The file **must* have the `.wireviz` extension to be recognized by the plugin.

When the file is uploaded to the server, the plugin is notified and begins the process of generating the harness diagram. If successful, a `.svg` file is attached to the part instance:

![](./docs/svg_file.png)

### Harness Diagram Panel

When a Part has a valid harness diagram (i.e. generated without any critical errors), the *Harness Diagram* panel will be available for that part. This panel displays the diagram image, and a simple Bill of Materials (as defined in the uploaded `.wireviz` file):

![](./docs/harness_panel.png)

> **Note**
> You may need to reload the page before this panel is visible

> **Warning**
> Any warnings or errors which were raised during the process will be displayed here

### BOM Extraction

If enabled, the plugin will attempt to generate a linked Bill of Materials based on the data provided in the file. Part linking is performed based on the `pn` (part number) attribute in the wireviz BOM.

For each line item in the uploaded BOM, the plugin attempts to match the `pn` field to an existing part in the InvenTree database. If a matching part is not found, this is marked with a warning in the simplified BOM table in the [harness diagram panel](#harness-diagram-panel).

### Reports

The generated diagram can be used in certain reports (such as the Build Order Report). If a wiring harness diagram is available for a Part, it is included in the report context as a variable named `wireviz_svg_file`.

> **Note**
> The provided variable refers to the *filename* of the `.svg` image - not the file itself.
> Use the `{% encode_svg_image %}` template tag to render the image file.

A very simple example is shown below:

```html
{% extends "report/inventree_build_order_base.html" %}

{% load report %}

{% block style %}
{{ block.super }}

.harness {
    border: 1px solid #AAA; 
    width: 100%;
    display: inline-block;
}

{% endblock %}

{% block page_content %}

{{ block.super }}

{% if wireviz_svg_file %}

    <h4>Harness Drawing</h4>
    <img class='harness' src='{% encode_svg_image wireviz_svg_file %}'>
{% endif %}

{% endblock page_content %}
```

The resulting report is rendered as below:

![](./docs/report.png)

## Wireviz Documentation

Documentation on the capabilities of wireviz itself:

- https://github.com/formatc1702/WireViz/blob/master/docs/README.md
- https://github.com/formatc1702/WireViz/blob/master/docs/syntax.md

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/inventree/inventree-wireviz",
    "name": "inventree-wireviz-plugin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "inventree inventory wireviz wiring cable harness",
    "author": "Oliver Walters",
    "author_email": "oliver.henry.walters@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/09/17/c8fc8c73a539552befda42e59f7d21de1e06d45be406fc087731a0901a06/inventree-wireviz-plugin-0.6.2.tar.gz",
    "platform": null,
    "description": "[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI](https://img.shields.io/pypi/v/inventree-wireviz-plugin)](https://pypi.org/project/inventree-wireviz-plugin/)\n![PEP](https://github.com/inventree/inventree-wireviz/actions/workflows/pep.yaml/badge.svg)\n\n# inventree-wireviz\n\nThe **inventree-wireviz** plugin provides direct integration for [wireviz](https://github.com/formatc1702/WireViz), a text-based wiring harness specification tool.\n\n## Functionality\n\nThe plugin provides a number of key functions:\n\n### Harness Diagram Generation\n\nThis plugin provides server-side generation of a wiring harness diagram from a `.wireviz` file. Uploading a simple [harness file](./demo/harness.wireviz) results in the generation of a wiring diagram:\n\n![](./demo/harness.svg)\n\n> **Note**\n> Refer to the [wireviz syntax guide](https://github.com/formatc1702/WireViz/blob/master/docs/syntax.md) for a full description of the file format.\n\nThe generated harness diagram is available as a `.svg` file.\n\n### BOM Extraction\n\nBill of Materials (BOM) information can be extracted directly from the harness description file, allowing for a harness assembly to be fully qualified from the template file.\n\n### Report Generation\n\nThe generated `.svg` can be used in report templates, for example as a reference diagram in a Build Order Report\n\n## Installation\n\n### Installation Requirements\n\nYou must have [graphviz](https://graphviz.org/) installed, and accessible by the InvenTree server.\n\ne.g. `apt-get install graphviz`\n\nIf installing in a container environment (e.g. Docker), the dockerfile will need to be extended to install the *graphviz* binaries\n\n### Plugin Installation\n\nThe plugin is available [via PIP](https://pypi.org/project/inventree-wireviz-plugin/). Follow the [InvenTree plugin installation guide](https://docs.inventree.org/en/latest/extend/plugins/install/) to install the plugin on your system\n\n### Configuration\n\nOnce the plugin is installed, it needs to be enabled before it is available for use. Again, refer to the InvenTree docs for instructions on how to enable the plugin. After the plugin is enabled, the following configuration options are available:\n\n![](./docs/config.png)\n\n| Setting | Description |\n| --- | --- |\n| Wireviz Upload Path | Directory where wireviz *template* files can be uploaded, and referenced by wireviz. This is an *advanced* option. Refer to the wireviz docs for more information on templates. |\n| Delete Old Files | Remove old harness diagram files when a new `.wireviz` file is uploaded |\n| Extract BOM Data | Extract BOM data from harness file and generate new BOM entries |\n| Clear BOM Data | Remove existing BOM entries first, before creating new ones |\n| Add Part Image | Where available, embed part images in the generated harness diagram |\n\nAdditionally, you must ensure that the *Enable event integration* setting is enabled in the *Plugin Settings* view:\n\n![](./docs/event_plugin.png)\n\n## Operation\n\n### Uploading Wireviz File\n\nTo generate a wiring harness diagram for a specific Part, upload a (valid) wireviz yaml file. The file **must* have the `.wireviz` extension to be recognized by the plugin.\n\nWhen the file is uploaded to the server, the plugin is notified and begins the process of generating the harness diagram. If successful, a `.svg` file is attached to the part instance:\n\n![](./docs/svg_file.png)\n\n### Harness Diagram Panel\n\nWhen a Part has a valid harness diagram (i.e. generated without any critical errors), the *Harness Diagram* panel will be available for that part. This panel displays the diagram image, and a simple Bill of Materials (as defined in the uploaded `.wireviz` file):\n\n![](./docs/harness_panel.png)\n\n> **Note**\n> You may need to reload the page before this panel is visible\n\n> **Warning**\n> Any warnings or errors which were raised during the process will be displayed here\n\n### BOM Extraction\n\nIf enabled, the plugin will attempt to generate a linked Bill of Materials based on the data provided in the file. Part linking is performed based on the `pn` (part number) attribute in the wireviz BOM.\n\nFor each line item in the uploaded BOM, the plugin attempts to match the `pn` field to an existing part in the InvenTree database. If a matching part is not found, this is marked with a warning in the simplified BOM table in the [harness diagram panel](#harness-diagram-panel).\n\n### Reports\n\nThe generated diagram can be used in certain reports (such as the Build Order Report). If a wiring harness diagram is available for a Part, it is included in the report context as a variable named `wireviz_svg_file`.\n\n> **Note**\n> The provided variable refers to the *filename* of the `.svg` image - not the file itself.\n> Use the `{% encode_svg_image %}` template tag to render the image file.\n\nA very simple example is shown below:\n\n```html\n{% extends \"report/inventree_build_order_base.html\" %}\n\n{% load report %}\n\n{% block style %}\n{{ block.super }}\n\n.harness {\n    border: 1px solid #AAA; \n    width: 100%;\n    display: inline-block;\n}\n\n{% endblock %}\n\n{% block page_content %}\n\n{{ block.super }}\n\n{% if wireviz_svg_file %}\n\n    <h4>Harness Drawing</h4>\n    <img class='harness' src='{% encode_svg_image wireviz_svg_file %}'>\n{% endif %}\n\n{% endblock page_content %}\n```\n\nThe resulting report is rendered as below:\n\n![](./docs/report.png)\n\n## Wireviz Documentation\n\nDocumentation on the capabilities of wireviz itself:\n\n- https://github.com/formatc1702/WireViz/blob/master/docs/README.md\n- https://github.com/formatc1702/WireViz/blob/master/docs/syntax.md\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Wireviz plugin for InvenTree",
    "version": "0.6.2",
    "project_urls": {
        "Homepage": "https://github.com/inventree/inventree-wireviz"
    },
    "split_keywords": [
        "inventree",
        "inventory",
        "wireviz",
        "wiring",
        "cable",
        "harness"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16c458f7921e5b6b188f651237086832647b15bfa449a80bfda18540a06d23a5",
                "md5": "3edb0da8479012f4871b15de40f36893",
                "sha256": "7f0bb7d7ac565df7d37d3ee27c8c23c5dbc05882a26f00a5417a07d68e52909f"
            },
            "downloads": -1,
            "filename": "inventree_wireviz_plugin-0.6.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3edb0da8479012f4871b15de40f36893",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.9",
            "size": 16419,
            "upload_time": "2024-08-06T03:10:25",
            "upload_time_iso_8601": "2024-08-06T03:10:25.478760Z",
            "url": "https://files.pythonhosted.org/packages/16/c4/58f7921e5b6b188f651237086832647b15bfa449a80bfda18540a06d23a5/inventree_wireviz_plugin-0.6.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0917c8fc8c73a539552befda42e59f7d21de1e06d45be406fc087731a0901a06",
                "md5": "ff36c37c3a5040f365bccb8174007a95",
                "sha256": "13cf519ada018a9cb0dbb5b19b96227b5bb0338974eaf80847bfa7b3da937342"
            },
            "downloads": -1,
            "filename": "inventree-wireviz-plugin-0.6.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ff36c37c3a5040f365bccb8174007a95",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14893,
            "upload_time": "2024-08-06T03:10:26",
            "upload_time_iso_8601": "2024-08-06T03:10:26.690699Z",
            "url": "https://files.pythonhosted.org/packages/09/17/c8fc8c73a539552befda42e59f7d21de1e06d45be406fc087731a0901a06/inventree-wireviz-plugin-0.6.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-06 03:10:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "inventree",
    "github_project": "inventree-wireviz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "inventree-wireviz-plugin"
}
        
Elapsed time: 0.51005s