New VRML output
This commit is contained in:
parent
8c3e5b982b
commit
fafd5d2f6d
|
|
@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [1.5.2] - Unreleased
|
## [1.5.2] - Unreleased
|
||||||
### Fixed
|
### Fixed
|
||||||
|
- New output:
|
||||||
|
- `vrml` export the 3D model in Virtual Reality Modeling Language (#349)
|
||||||
- PCB_Print:
|
- PCB_Print:
|
||||||
- Images not showing in custom frames. (#352)
|
- Images not showing in custom frames. (#352)
|
||||||
|
|
||||||
|
|
|
||||||
48
README.md
48
README.md
|
|
@ -94,7 +94,7 @@ For example, it's common that you might want for each board rev:
|
||||||
* Gerbers, drills and drill maps for a fab in their favourite format
|
* Gerbers, drills and drill maps for a fab in their favourite format
|
||||||
* Fab docs for the assembler, including the BoM (Bill of Materials), costs spreadsheet and board view
|
* Fab docs for the assembler, including the BoM (Bill of Materials), costs spreadsheet and board view
|
||||||
* Pick and place files
|
* Pick and place files
|
||||||
* PCB 3D model in STEP format
|
* PCB 3D model in STEP and VRML format
|
||||||
* PCB 3D render in PNG format
|
* PCB 3D render in PNG format
|
||||||
* Compare PCB/SCHs
|
* Compare PCB/SCHs
|
||||||
* Panelization
|
* Panelization
|
||||||
|
|
@ -137,8 +137,8 @@ Notes:
|
||||||
[**Requests**](https://pypi.org/project/Requests/) [](https://pypi.org/project/Requests/) [](https://pypi.org/project/Requests/) [](https://packages.debian.org/bullseye/python3-requests)
|
[**Requests**](https://pypi.org/project/Requests/) [](https://pypi.org/project/Requests/) [](https://pypi.org/project/Requests/) [](https://packages.debian.org/bullseye/python3-requests)
|
||||||
- Mandatory
|
- Mandatory
|
||||||
|
|
||||||
[**KiCad Automation tools**](https://github.com/INTI-CMNB/KiAuto) v2.0.4 [](https://github.com/INTI-CMNB/KiAuto) 
|
[**KiCad Automation tools**](https://github.com/INTI-CMNB/KiAuto) v2.1.0 [](https://github.com/INTI-CMNB/KiAuto) 
|
||||||
- Mandatory for: `gencad`, `netlist`, `pdf_pcb_print`, `pdf_sch_print`, `render_3d`, `run_drc`, `run_erc`, `step`, `svg_pcb_print`, `svg_sch_print`, `update_xml`
|
- Mandatory for: `gencad`, `netlist`, `pdf_pcb_print`, `pdf_sch_print`, `render_3d`, `run_drc`, `run_erc`, `step`, `svg_pcb_print`, `svg_sch_print`, `update_xml`, `vrml`
|
||||||
- Optional to:
|
- Optional to:
|
||||||
- Compare schematics for `diff` (v2.0.0)
|
- Compare schematics for `diff` (v2.0.0)
|
||||||
- Show KiAuto installation information for `info` (v2.0.0)
|
- Show KiAuto installation information for `info` (v2.0.0)
|
||||||
|
|
@ -1260,6 +1260,7 @@ The available values for *type* are:
|
||||||
- `kicost` BoM in XLSX format with costs generated by [KiCost](https://github.com/INTI-CMNB/KiCost)
|
- `kicost` BoM in XLSX format with costs generated by [KiCost](https://github.com/INTI-CMNB/KiCost)
|
||||||
- 3D model:
|
- 3D model:
|
||||||
- `step` *Standard for the Exchange of Product Data* for the PCB
|
- `step` *Standard for the Exchange of Product Data* for the PCB
|
||||||
|
- `vrml` *Virtual Reality Modeling Language* for the PCB
|
||||||
- `render_3d` PCB render, from the KiCad's 3D Viewer (broken in KiCad 6.0.0)
|
- `render_3d` PCB render, from the KiCad's 3D Viewer (broken in KiCad 6.0.0)
|
||||||
- Web pages:
|
- Web pages:
|
||||||
- `populate` To create step-by-step assembly instructions.
|
- `populate` To create step-by-step assembly instructions.
|
||||||
|
|
@ -3977,6 +3978,47 @@ Notes:
|
||||||
Internally we use 10 for low priority, 90 for high priority and 50 for most outputs.
|
Internally we use 10 for low priority, 90 for high priority and 50 for most outputs.
|
||||||
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
|
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
|
||||||
|
|
||||||
|
* VRML (Virtual Reality Modeling Language)
|
||||||
|
* Type: `vrml`
|
||||||
|
* Description: Exports the PCB as a 3D model (WRL file).
|
||||||
|
This is intended for rendering, unlike STEP which is intended to be
|
||||||
|
an exact mechanic model
|
||||||
|
* Valid keys:
|
||||||
|
- **`comment`**: [string=''] A comment for documentation purposes.
|
||||||
|
- **`dir`**: [string='./'] Output directory for the generated files.
|
||||||
|
If it starts with `+` the rest is concatenated to the default dir.
|
||||||
|
- **`name`**: [string=''] Used to identify this particular output definition.
|
||||||
|
- **`options`**: [dict] Options for the `vrml` output.
|
||||||
|
* Valid keys:
|
||||||
|
- **`download`**: [boolean=true] Downloads missing 3D models from KiCad git. Only applies to models in KISYS3DMOD.
|
||||||
|
- **`no_virtual`**: [boolean=false] Used to exclude 3D models for components with 'virtual' attribute.
|
||||||
|
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=vrml, %x=wrl). Affected by global options.
|
||||||
|
- `dir_models`: [string='shapes3D'] Subdirectory used to store the 3D models for the components.
|
||||||
|
If you want to create a monolithic file just use '' here.
|
||||||
|
Note that the WRL file will contain relative paths to the models.
|
||||||
|
- `dnf_filter`: [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||||
|
A short-cut to use for simple cases where a variant is an overkill.
|
||||||
|
- `kicad_3d_url`: [string='https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'] Base URL for the KiCad 3D models.
|
||||||
|
- `model_units`: [string='millimeters'] [millimeters,meters,deciinches,inches] Units used for the VRML (1 deciinch = 0.1 inches).
|
||||||
|
- `pre_transform`: [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||||
|
A short-cut to use for simple cases where a variant is an overkill.
|
||||||
|
- `ref_units`: [string='millimeters'] [millimeters,inches'] Units for `ref_x` and `ref_y`.
|
||||||
|
- `ref_x`: [number=0] X coordinate to use as reference when `use_pcb_center_as_ref` is disabled.
|
||||||
|
- `ref_y`: [number=0] Y coordinate to use as reference when `use_pcb_center_as_ref` is disabled.
|
||||||
|
- `use_pcb_center_as_ref`: [boolean=true] The center of the PCB will be used as reference point.
|
||||||
|
When disabled the `ref_x`, `ref_y` and `ref_units` will be used.
|
||||||
|
- `variant`: [string=''] Board variant to apply.
|
||||||
|
- `category`: [string|list(string)=''] The category for this output. If not specified an internally defined category is used.
|
||||||
|
Categories looks like file system paths, i.e. PCB/fabrication/gerber.
|
||||||
|
- `disable_run_by_default`: [string|boolean] Use it to disable the `run_by_default` status of other output.
|
||||||
|
Useful when this output extends another and you don't want to generate the original.
|
||||||
|
Use the boolean true value to disable the output you are extending.
|
||||||
|
- `extends`: [string=''] Copy the `options` section from the indicated output.
|
||||||
|
- `output_id`: [string=''] Text to use for the %I expansion content. To differentiate variations of this output.
|
||||||
|
- `priority`: [number=50] [0,100] Priority for this output. High priority outputs are created first.
|
||||||
|
Internally we use 10 for low priority, 90 for high priority and 50 for most outputs.
|
||||||
|
- `run_by_default`: [boolean=true] When enabled this output will be created when no specific outputs are requested.
|
||||||
|
|
||||||
|
|
||||||
#### Consolidating BoMs
|
#### Consolidating BoMs
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ For example, it's common that you might want for each board rev:
|
||||||
* Gerbers, drills and drill maps for a fab in their favourite format
|
* Gerbers, drills and drill maps for a fab in their favourite format
|
||||||
* Fab docs for the assembler, including the BoM (Bill of Materials), costs spreadsheet and board view
|
* Fab docs for the assembler, including the BoM (Bill of Materials), costs spreadsheet and board view
|
||||||
* Pick and place files
|
* Pick and place files
|
||||||
* PCB 3D model in STEP format
|
* PCB 3D model in STEP and VRML format
|
||||||
* PCB 3D render in PNG format
|
* PCB 3D render in PNG format
|
||||||
* Compare PCB/SCHs
|
* Compare PCB/SCHs
|
||||||
* Panelization
|
* Panelization
|
||||||
|
|
@ -737,6 +737,7 @@ The available values for *type* are:
|
||||||
- `kicost` BoM in XLSX format with costs generated by [KiCost](https://github.com/INTI-CMNB/KiCost)
|
- `kicost` BoM in XLSX format with costs generated by [KiCost](https://github.com/INTI-CMNB/KiCost)
|
||||||
- 3D model:
|
- 3D model:
|
||||||
- `step` *Standard for the Exchange of Product Data* for the PCB
|
- `step` *Standard for the Exchange of Product Data* for the PCB
|
||||||
|
- `vrml` *Virtual Reality Modeling Language* for the PCB
|
||||||
- `render_3d` PCB render, from the KiCad's 3D Viewer (broken in KiCad 6.0.0)
|
- `render_3d` PCB render, from the KiCad's 3D Viewer (broken in KiCad 6.0.0)
|
||||||
- Web pages:
|
- Web pages:
|
||||||
- `populate` To create step-by-step assembly instructions.
|
- `populate` To create step-by-step assembly instructions.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,213 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
id="Слой_1"
|
||||||
|
data-name="Слой 1"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
version="1.1"
|
||||||
|
sodipodi:docname="file_wrl.svg"
|
||||||
|
inkscape:version="1.0.2 (e86c870879, 2021-01-15)">
|
||||||
|
<sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="3840"
|
||||||
|
inkscape:window-height="2123"
|
||||||
|
id="namedview30"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="13.980769"
|
||||||
|
inkscape:cx="-8.82917"
|
||||||
|
inkscape:cy="6.3340443"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:document-rotation="0"
|
||||||
|
inkscape:current-layer="layer4">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid_kicad"
|
||||||
|
spacingx="0.5"
|
||||||
|
spacingy="0.5"
|
||||||
|
color="#9999ff"
|
||||||
|
opacity="0.13"
|
||||||
|
empspacing="2" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata43">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<cc:license
|
||||||
|
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title>svg_file</dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
<cc:License
|
||||||
|
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||||
|
</cc:License>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs27305">
|
||||||
|
<style
|
||||||
|
id="style27303">.cls-1{fill:#b9b9b9;}.cls-2{fill:#1a81c4;}.cls-3{fill:#fff;}</style>
|
||||||
|
</defs>
|
||||||
|
<title
|
||||||
|
id="title27307">svg_file</title>
|
||||||
|
<rect
|
||||||
|
class="cls-1"
|
||||||
|
x="3"
|
||||||
|
y="0"
|
||||||
|
width="21"
|
||||||
|
height="24"
|
||||||
|
rx="3.5044518"
|
||||||
|
id="rect27309"
|
||||||
|
style="stroke-width:0.999998" />
|
||||||
|
<g
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer3"
|
||||||
|
inkscape:label="Layer 1">
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="23.501 7.642 23.501 18.392 13.001 24.5 12.999 24.5 2.499 18.392 2.499 7.642"
|
||||||
|
id="polyline115996"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="23.501 7.637 13.001 13.745 12.999 13.745 2.499 7.637"
|
||||||
|
id="polyline115998"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="2.499 7.608 12.999 1.5 13.001 1.5 23.501 7.608"
|
||||||
|
id="polyline116000"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="13.927222"
|
||||||
|
y1="14.523245"
|
||||||
|
x2="13.927222"
|
||||||
|
y2="22.973152"
|
||||||
|
id="line116002"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="13.929344"
|
||||||
|
y1="4.9023495"
|
||||||
|
x2="13.928401"
|
||||||
|
y2="6.0808802"
|
||||||
|
id="line116004"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-2"
|
||||||
|
x1="13.926593"
|
||||||
|
y1="8.5021305"
|
||||||
|
x2="13.923687"
|
||||||
|
y2="12.134048"
|
||||||
|
id="line116006"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.42125, 2.42125" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="12.993 12.245 12.992 13.745 14.364 14.352"
|
||||||
|
id="polyline116008"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-3"
|
||||||
|
x1="17.033438"
|
||||||
|
y1="15.898983"
|
||||||
|
x2="20.084024"
|
||||||
|
y2="17.24785"
|
||||||
|
id="line116010"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.22365, 2.22365" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="21.100861"
|
||||||
|
y1="17.69742"
|
||||||
|
x2="22.178823"
|
||||||
|
y2="18.173941"
|
||||||
|
id="line116012"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="5.6778231"
|
||||||
|
y1="18.173941"
|
||||||
|
x2="6.7554712"
|
||||||
|
y2="17.696793"
|
||||||
|
id="line116014"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-4"
|
||||||
|
x1="8.7851362"
|
||||||
|
y1="16.797966"
|
||||||
|
x2="11.829438"
|
||||||
|
y2="15.449804"
|
||||||
|
id="line116016"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.21972, 2.21972" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="12.844232"
|
||||||
|
y1="15.000393"
|
||||||
|
x2="13.92188"
|
||||||
|
y2="14.523245"
|
||||||
|
id="line116018"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer4"
|
||||||
|
inkscape:label="Layer 2"
|
||||||
|
style="display:inline">
|
||||||
|
<rect
|
||||||
|
class="cls-2"
|
||||||
|
x="0"
|
||||||
|
y="1"
|
||||||
|
width="17"
|
||||||
|
height="9"
|
||||||
|
id="rect27311"
|
||||||
|
style="stroke-width:0.945904" />
|
||||||
|
<path
|
||||||
|
class="cls-3"
|
||||||
|
d="M 2.0688,7.9416479 H 0.99590004 V 6.8772203 H 2.0688 Z"
|
||||||
|
id="path27313"
|
||||||
|
style="stroke-width:1" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:1.25;font-family:'Noto Sans';-inkscape-font-specification:'Noto Sans, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none"
|
||||||
|
x="3.1426811"
|
||||||
|
y="8.0476418"
|
||||||
|
id="text909"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan1842"
|
||||||
|
x="3.1426811"
|
||||||
|
y="8.0476418">wrl</tspan></text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 7.0 KiB |
|
|
@ -2850,3 +2850,42 @@ outputs:
|
||||||
# [string=''] Board variant to apply.
|
# [string=''] Board variant to apply.
|
||||||
# Not fitted components are crossed
|
# Not fitted components are crossed
|
||||||
variant: ''
|
variant: ''
|
||||||
|
# VRML (Virtual Reality Modeling Language):
|
||||||
|
# This is intended for rendering, unlike STEP which is intended to be
|
||||||
|
# an exact mechanic model
|
||||||
|
- name: 'vrml_example'
|
||||||
|
comment: 'Exports the PCB as a 3D model (WRL file).'
|
||||||
|
type: 'vrml'
|
||||||
|
dir: 'Example/vrml_dir'
|
||||||
|
options:
|
||||||
|
# [string='shapes3D'] Subdirectory used to store the 3D models for the components.
|
||||||
|
# If you want to create a monolithic file just use '' here.
|
||||||
|
# Note that the WRL file will contain relative paths to the models
|
||||||
|
dir_models: 'shapes3D'
|
||||||
|
# [string|list(string)='_none'] Name of the filter to mark components as not fitted.
|
||||||
|
# A short-cut to use for simple cases where a variant is an overkill
|
||||||
|
dnf_filter: '_none'
|
||||||
|
# [boolean=true] Downloads missing 3D models from KiCad git. Only applies to models in KISYS3DMOD
|
||||||
|
download: true
|
||||||
|
# [string='https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'] Base URL for the KiCad 3D models
|
||||||
|
kicad_3d_url: 'https://gitlab.com/kicad/libraries/kicad-packages3D/-/raw/master/'
|
||||||
|
# [string='millimeters'] [millimeters,meters,deciinches,inches] Units used for the VRML (1 deciinch = 0.1 inches)
|
||||||
|
model_units: 'millimeters'
|
||||||
|
# [boolean=false] Used to exclude 3D models for components with 'virtual' attribute
|
||||||
|
no_virtual: false
|
||||||
|
# [string='%f-%i%I%v.%x'] Filename for the output (%i=vrml, %x=wrl). Affected by global options
|
||||||
|
output: '%f-%i%I%v.%x'
|
||||||
|
# [string|list(string)='_none'] Name of the filter to transform fields before applying other filters.
|
||||||
|
# A short-cut to use for simple cases where a variant is an overkill
|
||||||
|
pre_transform: '_none'
|
||||||
|
# [string='millimeters'] [millimeters,inches'] Units for `ref_x` and `ref_y`
|
||||||
|
ref_units: 'millimeters'
|
||||||
|
# [number=0] X coordinate to use as reference when `use_pcb_center_as_ref` is disabled
|
||||||
|
ref_x: 0
|
||||||
|
# [number=0] Y coordinate to use as reference when `use_pcb_center_as_ref` is disabled
|
||||||
|
ref_y: 0
|
||||||
|
# [boolean=true] The center of the PCB will be used as reference point.
|
||||||
|
# When disabled the `ref_x`, `ref_y` and `ref_units` will be used
|
||||||
|
use_pcb_center_as_ref: true
|
||||||
|
# [string=''] Board variant to apply
|
||||||
|
variant: ''
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ EXT_IMAGE = {'gbr': 'file_gbr',
|
||||||
'stl': 'file_stl',
|
'stl': 'file_stl',
|
||||||
'step': 'file_stp',
|
'step': 'file_stp',
|
||||||
'stp': 'file_stp',
|
'stp': 'file_stp',
|
||||||
|
'wrl': 'file_wrl',
|
||||||
'html': 'file_html',
|
'html': 'file_html',
|
||||||
'css': 'file_css',
|
'css': 'file_css',
|
||||||
'xml': 'file_xml',
|
'xml': 'file_xml',
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,108 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2022 Salvador E. Tropea
|
||||||
|
# Copyright (c) 2022 Instituto Nacional de Tecnología Industrial
|
||||||
|
# License: GPL-3.0
|
||||||
|
# Project: KiBot (formerly KiPlot)
|
||||||
|
"""
|
||||||
|
Dependencies:
|
||||||
|
- from: KiAuto
|
||||||
|
role: mandatory
|
||||||
|
version: 2.1.0
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
from .gs import GS
|
||||||
|
from .out_base_3d import Base3DOptions, Base3D
|
||||||
|
from .misc import FAILED_EXECUTE
|
||||||
|
from .kiplot import exec_with_retry, add_extra_options
|
||||||
|
from .macros import macros, document, output_class # noqa: F401
|
||||||
|
from . import log
|
||||||
|
|
||||||
|
logger = log.get_logger()
|
||||||
|
|
||||||
|
|
||||||
|
class VRMLOptions(Base3DOptions):
|
||||||
|
def __init__(self):
|
||||||
|
with document:
|
||||||
|
self.output = GS.def_global_output
|
||||||
|
""" *Filename for the output (%i=vrml, %x=wrl) """
|
||||||
|
self.dir_models = 'shapes3D'
|
||||||
|
""" Subdirectory used to store the 3D models for the components.
|
||||||
|
If you want to create a monolithic file just use '' here.
|
||||||
|
Note that the WRL file will contain relative paths to the models """
|
||||||
|
self.use_pcb_center_as_ref = True
|
||||||
|
""" The center of the PCB will be used as reference point.
|
||||||
|
When disabled the `ref_x`, `ref_y` and `ref_units` will be used """
|
||||||
|
self.ref_x = 0
|
||||||
|
""" X coordinate to use as reference when `use_pcb_center_as_ref` is disabled """
|
||||||
|
self.ref_y = 0
|
||||||
|
""" Y coordinate to use as reference when `use_pcb_center_as_ref` is disabled """
|
||||||
|
self.ref_units = 'millimeters'
|
||||||
|
""" [millimeters,inches'] Units for `ref_x` and `ref_y` """
|
||||||
|
self.model_units = 'millimeters'
|
||||||
|
""" [millimeters,meters,deciinches,inches] Units used for the VRML (1 deciinch = 0.1 inches) """
|
||||||
|
super().__init__()
|
||||||
|
self._expand_id = 'vrml'
|
||||||
|
self._expand_ext = 'wrl'
|
||||||
|
|
||||||
|
def get_targets(self, out_dir):
|
||||||
|
targets = [self._parent.expand_filename(out_dir, self.output)]
|
||||||
|
if self.dir_models:
|
||||||
|
# We will also generate the models
|
||||||
|
dir = os.path.join(out_dir, self.dir_models)
|
||||||
|
filtered = {os.path.join(dir, os.path.basename(m)) for m in self.list_models() if m.endswith('.wrl')}
|
||||||
|
targets.extend(list(filtered))
|
||||||
|
return targets
|
||||||
|
|
||||||
|
def get_pcb_center(self):
|
||||||
|
center = GS.board.ComputeBoundingBox(True).Centre()
|
||||||
|
return self.to_mm(center.x), self.to_mm(center.y)
|
||||||
|
|
||||||
|
def run(self, name):
|
||||||
|
command = self.ensure_tool('KiAuto')
|
||||||
|
super().run(name)
|
||||||
|
board_name = self.filter_components()
|
||||||
|
cmd = [command, 'export_vrml', '--output_name', os.path.basename(name), '-U', self.model_units]
|
||||||
|
if self.dir_models:
|
||||||
|
cmd.extend(['--dir_models', self.dir_models])
|
||||||
|
if not self.use_pcb_center_as_ref or GS.ki5:
|
||||||
|
# KiCad 5 doesn't support using the center, we emulate it
|
||||||
|
if self.use_pcb_center_as_ref and GS.ki5:
|
||||||
|
x, y = self.get_pcb_center()
|
||||||
|
units = 'millimeters'
|
||||||
|
else:
|
||||||
|
x = self.ref_x
|
||||||
|
self.ref_y
|
||||||
|
units = self.ref_units
|
||||||
|
cmd.extend(['-x', str(x), '-y', str(x), '-u', units])
|
||||||
|
cmd.extend([board_name, os.path.dirname(name)])
|
||||||
|
cmd, video_remove = add_extra_options(cmd)
|
||||||
|
# Execute it
|
||||||
|
try:
|
||||||
|
ret = exec_with_retry(cmd)
|
||||||
|
finally:
|
||||||
|
self.remove_tmp_board(board_name)
|
||||||
|
if ret:
|
||||||
|
logger.error(command+' returned %d', ret)
|
||||||
|
exit(FAILED_EXECUTE)
|
||||||
|
if video_remove:
|
||||||
|
video_name = os.path.join(self.expand_filename_pcb(GS.out_dir), 'pcbnew_export_vrml_screencast.ogv')
|
||||||
|
if os.path.isfile(video_name):
|
||||||
|
os.remove(video_name)
|
||||||
|
|
||||||
|
|
||||||
|
@output_class
|
||||||
|
class VRML(BaseOutput): # noqa: F821
|
||||||
|
""" VRML (Virtual Reality Modeling Language)
|
||||||
|
Exports the PCB as a 3D model (WRL file).
|
||||||
|
This is intended for rendering, unlike STEP which is intended to be
|
||||||
|
an exact mechanic model """
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self._category = 'PCB/3D'
|
||||||
|
with document:
|
||||||
|
self.options = VRMLOptions
|
||||||
|
""" *[dict] Options for the `vrml` output """
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_conf_examples(name, layers, templates):
|
||||||
|
return Base3D.simple_conf_examples(name, 'PCB in VRML format', '3D')
|
||||||
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
id="Слой_1"
|
||||||
|
data-name="Слой 1"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
version="1.1">
|
||||||
|
<metadata
|
||||||
|
id="metadata43">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<cc:license
|
||||||
|
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title>svg_file</dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
<cc:License
|
||||||
|
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Reproduction" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Distribution" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Notice" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#Attribution" />
|
||||||
|
<cc:permits
|
||||||
|
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
|
||||||
|
<cc:requires
|
||||||
|
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
|
||||||
|
</cc:License>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs27305">
|
||||||
|
<style
|
||||||
|
id="style27303">.cls-1{fill:#b9b9b9;}.cls-2{fill:#1a81c4;}.cls-3{fill:#fff;}</style>
|
||||||
|
</defs>
|
||||||
|
<title
|
||||||
|
id="title27307">svg_file</title>
|
||||||
|
<rect
|
||||||
|
class="cls-1"
|
||||||
|
x="3"
|
||||||
|
y="0"
|
||||||
|
width="21"
|
||||||
|
height="24"
|
||||||
|
rx="3.5044518"
|
||||||
|
id="rect27309"
|
||||||
|
style="stroke-width:0.999998" />
|
||||||
|
<g
|
||||||
|
id="layer3">
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="23.501 7.642 23.501 18.392 13.001 24.5 12.999 24.5 2.499 18.392 2.499 7.642"
|
||||||
|
id="polyline115996"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="23.501 7.637 13.001 13.745 12.999 13.745 2.499 7.637"
|
||||||
|
id="polyline115998"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="2.499 7.608 12.999 1.5 13.001 1.5 23.501 7.608"
|
||||||
|
id="polyline116000"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="13.927222"
|
||||||
|
y1="14.523245"
|
||||||
|
x2="13.927222"
|
||||||
|
y2="22.973152"
|
||||||
|
id="line116002"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="13.929344"
|
||||||
|
y1="4.9023495"
|
||||||
|
x2="13.928401"
|
||||||
|
y2="6.0808802"
|
||||||
|
id="line116004"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-2"
|
||||||
|
x1="13.926593"
|
||||||
|
y1="8.5021305"
|
||||||
|
x2="13.923687"
|
||||||
|
y2="12.134048"
|
||||||
|
id="line116006"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.42125, 2.42125" />
|
||||||
|
<polyline
|
||||||
|
class="cls-1"
|
||||||
|
points="12.993 12.245 12.992 13.745 14.364 14.352"
|
||||||
|
id="polyline116008"
|
||||||
|
transform="matrix(0.78568708,0,0,0.78568708,3.7143908,3.723819)"
|
||||||
|
style="fill:none;stroke:#545454;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-3"
|
||||||
|
x1="17.033438"
|
||||||
|
y1="15.898983"
|
||||||
|
x2="20.084024"
|
||||||
|
y2="17.24785"
|
||||||
|
id="line116010"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.22365, 2.22365" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="21.100861"
|
||||||
|
y1="17.69742"
|
||||||
|
x2="22.178823"
|
||||||
|
y2="18.173941"
|
||||||
|
id="line116012"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="5.6778231"
|
||||||
|
y1="18.173941"
|
||||||
|
x2="6.7554712"
|
||||||
|
y2="17.696793"
|
||||||
|
id="line116014"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
<line
|
||||||
|
class="cls-4"
|
||||||
|
x1="8.7851362"
|
||||||
|
y1="16.797966"
|
||||||
|
x2="11.829438"
|
||||||
|
y2="15.449804"
|
||||||
|
id="line116016"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2.21972, 2.21972" />
|
||||||
|
<line
|
||||||
|
class="cls-1"
|
||||||
|
x1="12.844232"
|
||||||
|
y1="15.000393"
|
||||||
|
x2="13.92188"
|
||||||
|
y2="14.523245"
|
||||||
|
id="line116018"
|
||||||
|
style="fill:none;stroke:#545454;stroke-width:0.785687;stroke-linecap:round;stroke-linejoin:round" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="layer4"
|
||||||
|
style="display:inline">
|
||||||
|
<rect
|
||||||
|
class="cls-2"
|
||||||
|
x="0"
|
||||||
|
y="1"
|
||||||
|
width="17"
|
||||||
|
height="9"
|
||||||
|
id="rect27311"
|
||||||
|
style="stroke-width:0.945904" />
|
||||||
|
<path
|
||||||
|
class="cls-3"
|
||||||
|
d="M 2.0688,7.9416479 H 0.99590004 V 6.8772203 H 2.0688 Z"
|
||||||
|
id="path27313"
|
||||||
|
style="stroke-width:1" />
|
||||||
|
<g
|
||||||
|
aria-label="wrl"
|
||||||
|
id="text909"
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:8px;line-height:1.25;font-family:'Noto Sans';-inkscape-font-specification:'Noto Sans, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none">
|
||||||
|
<path
|
||||||
|
d="m 7.0226811,6.5196418 q -0.032,-0.136 -0.096,-0.4 -0.056,-0.272 -0.128,-0.576 -0.072,-0.312 -0.136,-0.568 -0.064,-0.264 -0.088,-0.384 h -0.032 q -0.024,0.12 -0.088,0.384 -0.056,0.256 -0.128,0.568 -0.072,0.304 -0.136,0.576 -0.064,0.272 -0.096,0.416 l -0.352,1.512 h -1.28 l -1.24,-4.368 h 1.184 l 0.504,1.936 q 0.056,0.2 0.096,0.48 0.048,0.28 0.088,0.544 0.04,0.256 0.056,0.408 h 0.032 q 0.008,-0.112 0.032,-0.296 0.024,-0.192 0.056,-0.392 0.04,-0.2 0.064,-0.36 0.032,-0.168 0.048,-0.224 l 0.536,-2.096 h 1.312 l 0.512,2.096 q 0.032,0.112 0.072,0.36 0.048,0.248 0.08,0.504 0.04,0.256 0.04,0.408 h 0.032 q 0.016,-0.136 0.056,-0.392 0.04,-0.264 0.088,-0.552 0.056,-0.288 0.112,-0.488 l 0.52,-1.936 h 1.168 l -1.256,4.368 h -1.296 z"
|
||||||
|
id="path895" />
|
||||||
|
<path
|
||||||
|
d="m 13.054673,3.5996418 q 0.088,0 0.208,0.008 0.12,0.008 0.192,0.024 l -0.088,1.12 q -0.056,-0.016 -0.168,-0.024 -0.104,-0.016 -0.184,-0.016 -0.304,0 -0.584,0.112 -0.28,0.104 -0.456,0.344 -0.168,0.24 -0.168,0.656 v 2.224 h -1.192 v -4.368 h 0.904 l 0.176,0.736 h 0.056 q 0.192,-0.336 0.528,-0.576 0.336,-0.24 0.776,-0.24 z"
|
||||||
|
id="path897" />
|
||||||
|
<path
|
||||||
|
d="m 15.438662,8.0476418 h -1.192 v -6.08 h 1.192 z"
|
||||||
|
id="path899" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 7.0 KiB |
|
|
@ -300,7 +300,7 @@ deps = '{\
|
||||||
"extra_arch": null,\
|
"extra_arch": null,\
|
||||||
"extra_deb": null,\
|
"extra_deb": null,\
|
||||||
"help_option": "--version",\
|
"help_option": "--version",\
|
||||||
"importance": 110003,\
|
"importance": 120003,\
|
||||||
"in_debian": false,\
|
"in_debian": false,\
|
||||||
"is_kicad_plugin": false,\
|
"is_kicad_plugin": false,\
|
||||||
"is_python": false,\
|
"is_python": false,\
|
||||||
|
|
@ -432,6 +432,17 @@ deps = '{\
|
||||||
0\
|
0\
|
||||||
]\
|
]\
|
||||||
},\
|
},\
|
||||||
|
{\
|
||||||
|
"desc": null,\
|
||||||
|
"mandatory": true,\
|
||||||
|
"max_version": null,\
|
||||||
|
"output": "vrml",\
|
||||||
|
"version": [\
|
||||||
|
2,\
|
||||||
|
1,\
|
||||||
|
0\
|
||||||
|
]\
|
||||||
|
},\
|
||||||
{\
|
{\
|
||||||
"desc": null,\
|
"desc": null,\
|
||||||
"mandatory": true,\
|
"mandatory": true,\
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Example KiBot config file
|
||||||
|
kibot:
|
||||||
|
version: 1
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
- name: 'VRML export Test'
|
||||||
|
comment: "Example of VRML export"
|
||||||
|
type: vrml
|
||||||
Loading…
Reference in New Issue