[VRML][Added] Option to use the auxiliary origin as reference
Closes #420
This commit is contained in:
parent
5e80a1e150
commit
3c749719dd
|
|
@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Check for value and fields/properties.
|
||||
- SCH print:
|
||||
- Support for title change
|
||||
- VRML:
|
||||
- Option to use the auxiliary origin as reference. (#420)
|
||||
|
||||
### Fixed
|
||||
- Makefile: don't skip all preflights on each run, just the ones we generate
|
||||
|
|
|
|||
|
|
@ -4770,8 +4770,10 @@ Notes:
|
|||
- `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.
|
||||
- `ref_x`: [number=0] X coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled.
|
||||
- `ref_y`: [number=0] Y coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled.
|
||||
- `use_aux_axis_as_origin`: [boolean=false] Use the auxiliary axis as origin for coordinates.
|
||||
Has more precedence than `use_pcb_center_as_ref`.
|
||||
- `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.
|
||||
|
|
|
|||
|
|
@ -3418,13 +3418,16 @@ outputs:
|
|||
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
|
||||
# [number=0] X coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled
|
||||
ref_x: 0
|
||||
# [number=0] Y coordinate to use as reference when `use_pcb_center_as_ref` is disabled
|
||||
# [number=0] Y coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled
|
||||
ref_y: 0
|
||||
# [list(string)|string=all] [none,all] List of components to draw, can be also a string for `none` or `all`.
|
||||
# Unlike the `pcbdraw` output, the default is `all`
|
||||
show_components: all
|
||||
# [boolean=false] Use the auxiliary axis as origin for coordinates.
|
||||
# Has more precedence than `use_pcb_center_as_ref`
|
||||
use_aux_axis_as_origin: false
|
||||
# [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
|
||||
|
|
|
|||
|
|
@ -36,10 +36,13 @@ class VRMLOptions(Base3DOptionsWithHL):
|
|||
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.use_aux_axis_as_origin = False
|
||||
""" Use the auxiliary axis as origin for coordinates.
|
||||
Has more precedence than `use_pcb_center_as_ref` """
|
||||
self.ref_x = 0
|
||||
""" X coordinate to use as reference when `use_pcb_center_as_ref` is disabled """
|
||||
""" X coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled """
|
||||
self.ref_y = 0
|
||||
""" Y coordinate to use as reference when `use_pcb_center_as_ref` is disabled """
|
||||
""" Y coordinate to use as reference when `use_pcb_center_as_ref` and `use_pcb_center_as_ref` are disabled """
|
||||
self.ref_units = 'millimeters'
|
||||
""" [millimeters,inches'] Units for `ref_x` and `ref_y` """
|
||||
self.model_units = 'millimeters'
|
||||
|
|
@ -75,9 +78,14 @@ class VRMLOptions(Base3DOptionsWithHL):
|
|||
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:
|
||||
if not self.use_pcb_center_as_ref or GS.ki5 or self.use_aux_axis_as_origin:
|
||||
if self.use_aux_axis_as_origin:
|
||||
offset = GS.get_aux_origin()
|
||||
x = GS.to_mm(offset.x)
|
||||
y = GS.to_mm(offset.y)
|
||||
units = 'millimeters'
|
||||
# KiCad 5 doesn't support using the center, we emulate it
|
||||
if self.use_pcb_center_as_ref and GS.ki5:
|
||||
elif self.use_pcb_center_as_ref and GS.ki5:
|
||||
x, y = self.get_pcb_center()
|
||||
units = 'millimeters'
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue