Avoid scaling unity models

There is no benefit to applying the identity transformation to models
when exporting the board to STEP

Fixes https://gitlab.com/kicad/code/kicad/issues/12036

(cherry picked from commit 98431eed79)

Fixes https://gitlab.com/kicad/code/kicad/issues/10232
This commit is contained in:
Seth Hillbrand 2022-07-19 10:35:31 -07:00
parent 8ee73903c6
commit 535982f245
8 changed files with 244 additions and 10 deletions

View File

@ -0,0 +1,145 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "# 1 - Full documentation\n"
"\n"
"The Eeschema documentation (*eeschema.html*) describes this intermediate netlist and gives examples(chapter ***creating customized netlists and bom files***).\n"
"\n"
"# 2 - The intermediate Netlist File\n"
"\n"
"BOM files (and netlist files) can be created from an *Intermediate netlist file* created by Eeschema.\n"
"\n"
"This file uses XML syntax and is called the intermediate netlist. The intermediate netlist includes a large amount of data about your board and because of this, it can be used with post-processing to create a BOM or other reports.\n"
"\n"
"Depending on the output (BOM or netlist), different subsets of the complete Intermediate Netlist file will be used in the post-processing.\n"
"\n"
"# 3 - Conversion to a new format\n"
"\n"
"By applying a post-processing filter to the Intermediate netlist file you can generate foreign netlist files as well as BOM files. Because this conversion is a text to text transformation, this post-processing filter can be written using *Python*, *XSLT*, or any other tool capable of taking XML as input.\n"
"\n"
"XSLT itself is a XML language suitable for XML transformations. There is a free program called `xsltproc` that you can download and install. The `xsltproc` program can be used to read the Intermediate XML netlist input file, apply a style-sheet to transform the input, and save the results in an output file. Use of `xsltproc` requires a style-sheet file using XSLT conventions. The full conversion process is handled by Eeschema, after it is configured once to run `xsltproc` in a specific way.\n"
"\n"
"A Python script is somewhat more easy to create.\n"
"\n"
"# 4 - Initialization of the dialog window\n"
"\n"
"You should add a new plugin (a script) in the plugin list by clicking on the Add Plugin button.\n"
"\n"
"## 4.1 - Plugin Configuration Parameters\n"
"\n"
"The Eeschema plug-in configuration dialog requires the following information:\n"
"\n"
" * The title: for instance, the name of the netlist format.\n"
" * The command line to launch the converter (usually a script).\n"
"\n"
"***Note (Windows only):***\n"
"*By default, the command line runs with hidden console window and output is redirected to \"Plugin info\" field. To show the window of the running command, set the checkbox \"Show console window\".*\n"
"\n"
"Once you click on the generate button the following will happen:\n"
"\n"
"1. Eeschema creates an intermediate netlist file \\*.xml, for instance `test.xml`.\n"
"2. Eeschema runs the script from the command line to create the final output file.\n"
"\n"
"## 4.2 - Generate netlist files with the command line\n"
"\n"
"Assuming we are using the program `xsltproc.exe` to apply the sheet style to the intermediate file, `xsltproc.exe` is executed with the following command.\n"
"\n"
"```\n"
"xsltproc.exe -o <output filename> <style-sheet filename> <input XML file to convert>\n"
"```\n"
"\n"
"On Windows the command line is the following.\n"
"\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O\" f:/kicad/bin/plugins/myconverter.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux the command becomes as following.\n"
"\n"
"```\n"
"xsltproc -o \"%O\" /usr/local/kicad/bin/plugins/myconverter .xsl \"%I\"\n"
"```\n"
"where `myconverter.xsl` is the style-sheet that you are applying.\n"
"\n"
"Do not forget the double quotes around the file names, this allows them to have spaces after the substitution by Eeschema.\n"
"\n"
"If a Python script is used, the command line is something like (depending on the Python script):\n"
"\n"
"```\n"
"python f:/kicad/bin/plugins/bom-in-python/myconverter.py \"%I\" \"%O\"\n"
"```\n"
"\n"
"or\n"
"\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/myconverter .xsl \"%I\" \"%O\"\n"
"```\n"
"\n"
"The command line format accepts parameters for filenames. The supported formatting parameters are:\n"
"\n"
" * `%B`: base filename of selected output file, minus path and extension.\n"
" * `%P`: project directory, without name and without trailing '/'.\n"
" * `%I`: complete filename and path of the temporary input file\n"
"(the intermediate net file).\n"
" * `%O`: complete filename and path (but without extension) of the user\n"
"chosen output file.\n"
"\n"
"`%I` will be replaced by the actual intermediate file name (usually the full root sheet filename with extension \".xml\").\n"
"`%O` will be replaced by the actual output file name (the full root sheet filename minus extension).\n"
"`%B` will be replaced by the actual output short file name (the short root sheet filename minus extension).\n"
"`%P` will be replaced by the actual current project path.\n"
"\n"
"## 4.3 - Command line format:\n"
"\n"
"### 4.3.1 - Remark:\n"
"\n"
"Most of time, the created file must have an extension, depending on its type.\n"
"Therefore you have to add to the option ***%O*** the right file extension.\n"
"\n"
"For instance:\n"
"\n"
" * **%O.csv** to create a .csv file (comma separated value file).\n"
" * **%O.htm** to create a .html file.\n"
" * **%O.bom** to create a .bom file.\n"
"\n"
"### 4.3.2 Example for xsltproc:\n"
"\n"
"The command line format for xsltproc is the following:\n"
"\n"
"```\n"
"<path of xsltproc> xsltproc <xsltproc parameters>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O.bom\" f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"xsltproc -o \"%O.bom\" /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"The above examples assume `xsltproc` is installed on your PC under Windows and xsl files located in `<path_to_kicad>/kicad/bin/plugins/`.\n"
"\n"
"\n"
"### 4.3.3 Example for Python scripts:\n"
"\n"
"Assuming python is installed on your PC, and python scripts are located in\n"
"\n"
" `<path_to_kicad>/kicad/bin/plugins/bom-in-python/`,\n"
"\n"
"the command line format for python is something like:\n"
"\n"
"```\n"
"python <script file name> <input filename> <output filename>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"python.exe f:/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.html\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.csv\"\n"
"```\n"
"" );

View File

@ -0,0 +1,11 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "### Bridged Tee Attenuator\n"
"___a___ is attenuation in dB<br>\n"
"___Z<sub>in</sub>___ is desired input impedance in &#x2126;<br>\n"
"___Z<sub>out</sub>___ is desired output impedance in &#x2126;<br>\n"
"___Z<sub>0</sub> = Z<sub>in</sub> = Z<sub>out</sub>___\n"
"\n"
"___L = 10<sup>a/20</sup>___<br>\n"
"___R1 = Z<sub>0</sub> &middot; (L&minus;1)___<br>\n"
"___R2 = Z<sub>0</sub> / (L&minus;1)___\n"
"" );

View File

@ -0,0 +1,12 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "### Pi Attenuator\n"
"___a___ is attenuation in dB<br>\n"
"___Z<sub>in</sub>___ is desired input impedance in &#x2126;<br>\n"
"___Z<sub>out</sub>___ is desired output impedance in &#x2126;<br>\n"
"\n"
"___L = 10<sup>a/20</sup>___<br>\n"
"___A = (L+1) / (L&minus;1)___<br><br>\n"
"___R2 = (L&minus;1) / 2&middot;&radic;(Z<sub>in</sub> &middot; Z<sub>out</sub> / L)___<br>\n"
"___R1 = 1 / (A/Z<sub>in</sub> &minus; 1/R2)___<br>\n"
"___R3 = 1 / (A/Z<sub>out</sub> &minus; 1/R2)___\n"
"" );

View File

@ -0,0 +1,9 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "### Split Attenuator\n"
"Attenuation is 6 dB \n"
"___Z<sub>in</sub>___ is desired input impedance in &#x2126; \n"
"___Z<sub>out</sub>___ is desired output impedance in &#x2126; \n"
"___Z<sub>0</sub> = Z<sub>in</sub> = Z<sub>out</sub>___\n"
"\n"
"___R1 = R2 = R3 = Z<sub>0</sub>/3___\n"
"" );

View File

@ -0,0 +1,12 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "### Tee Attenuator\n"
"___a___ is attenuation in dB<br>\n"
"___Z<sub>in</sub>___ is desired input impedance in &#x2126;<br>\n"
"___Z<sub>out</sub>___ is desired output impedance in &#x2126;<br>\n"
"\n"
"___L = 10<sup>a/20</sup>___<br>\n"
"___A = (L+1) / (L&minus;1)___<br><br>\n"
"___R2 = 2&middot;&radic;(L &middot; Z<sub>in</sub> &middot; Z<sub>out</sub>) / (L&minus;1)___<br>\n"
"___R1 = Z<sub>in</sub> &middot; A &minus; R2___<br>\n"
"___R3 = Z<sub>out</sub> &middot; A &minus; R2___\n"
"" );

View File

@ -0,0 +1,24 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "E-series are defined in IEC 60063.\n"
"\n"
"Available values are approximately equally spaced in a logarithmic scale.\n"
"\n"
" E24(5%): 1.0 1.1 1.2 1.3 1.5 1.6 1.8 2.0 2.2 2.4 2.7 3.0 3.3 3.6 3.9 4.3 4.7 5.1 5.6 6.2 6.8 7.5 8.2 9.1\n"
" E12(10%): 1.0 1.2 1.5 1.8 2.2 2.7 3.3 3.9 4.7 5.6 6.8 8.2\n"
" E6(20%): 1.0 - 1.5 - 2.2 - 3.3 - 4.7 - 6.8 -\n"
" E3(50%): 1.0 - - - 2.2 - - - 4.7 - - -\n"
" E1 : 1.0 - - - - - - - - - - -\n"
"\n"
"- This calculator finds combinations of standard E-series (between 10Ω and 1MΩ) to create arbitrary values.\n"
"- You can enter the required resistance from 0.0025 to 4000 kΩ.\n"
"- Solutions using up to 4 components are given.\n"
"\n"
"The requested value is always excluded from the solution set.<br>\n"
"Optionally up to two additional values can be excluded in case of component availability problems.\n"
"\n"
"Solutions are given in the following formats:\n"
"\n"
" R1 + R2 +...+ Rn resistors in series\n"
" R1 | R2 |...| Rn resistors in parallel\n"
" R1 + (R2|R3)... any combination of the above\n"
"" );

View File

@ -0,0 +1,18 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "If you specify the maximum current, then the trace widths will be calculated to suit.\n"
"\n"
"If you specify one of the trace widths, the maximum current it can handle will be calculated. The width for the other trace to also handle this current will then be calculated.\n"
"\n"
"The controlling value is shown in bold.\n"
"\n"
"The calculations are valid for currents up to 35 A (external) or 17.5 A (internal), temperature rises up to 100 °C, and widths of up to 400 mils (10 mm).\n"
"\n"
"The formula, from IPC 2221, is\n"
"<center>___I = K &middot; &Delta;T<sup>0.44</sup> &middot; (W &middot; H)<sup>0.725</sup>___</center>\n"
"where:<br>\n"
"___I___ is maximum current in A<br>\n"
"___&Delta;T___ is temperature rise above ambient in &deg;C<br>\n"
"___W___ is width in mils<br>\n"
"___H___ is thickness (height) in mils<br>\n"
"___K___ is 0.024 for internal traces or 0.048 for external traces\n"
"" );

View File

@ -1377,7 +1377,6 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source,
Handle( TDocStd_Document )& dest, TRIPLET aScale )
{
// transfer data from Source into a top level component of Dest
gp_GTrsf scale_transform;
scale_transform.SetVectorialPart( gp_Mat( aScale.x, 0, 0,
0, aScale.y, 0,
@ -1410,10 +1409,13 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source,
if ( !shape.IsNull() )
{
brep.Perform( shape, Standard_False );
TopoDS_Shape scaled_shape;
TopoDS_Shape scaled_shape( shape );
if ( brep.IsDone() )
if( aScale.x != 1.0 || aScale.y != 1.0 || aScale.z != 1.0 )
{
brep.Perform( shape, Standard_False );
if( brep.IsDone() )
{
scaled_shape = brep.Shape();
}
@ -1423,6 +1425,7 @@ TDF_Label PCBMODEL::transferModel( Handle( TDocStd_Document )& source,
scaled_shape = shape;
}
}
TDF_Label niulab = d_assy->AddComponent( component, scaled_shape, Standard_False );