Support Forum

Setting "user units" via macro

Michael

Tuesday 11th January 2022
Attachments:
(only for registered users)

Screenshot 2022-01-11 150730.jpg


clipboard-202201111251-ri9hp.png


clipboard-202201111251-iivrv.png

Hello Mr Thies, We are using the "WebViewer" component and when we have an unusual Database unit (0.00025 um) the tool is setting the user units to "other: 2.5e-7 m". This looks odd, as all measured values gets "2.5e-7" appended and needs to be multiplied by the unit value. Here are two screenshots where the user unit is "2.5e-z". ![clipboard-202201111251-ri9hp.png](/api/img.php?thread=20220111-9c5c&file=clipboard-202201111251-ri9hp.png)![clipboard-202201111251-iivrv.png](/api/img.php?thread=20220111-9c5c&file=clipboard-202201111251-iivrv.png) (It looks very strange, if there is no space between value and unit "2.42.5e-7 m") Setting user units to "µm" manually in the menu shows correct values and a common unit ("µm") :). So now I am looking for a way to set the "user units" to "µm" (microns) on start up using a setup macro. Or is there a better way to do that for the Web Viewer? ![Screenshot_2022-01-11 150730.jpg](/api/img.php?thread=20220111-9c5c&file=Screenshot_2022-01-11_150730.jpg) I tried to use the built-in feature which generates macros automatically. This generates something like this: ``` #!/usr/bin/layout #name=setup macro #help=setup macro automatically generated at Tue Jan 11 2022 int main(){ setup::defaultShapeConstraint=0; setup::defaultPolygonFixSelfintersectingPolygons=true; setup::defaultPolygonRemoveNotNeededPoints=true; ... } ``` I wasn't able to identify the setting for the user units. If this setting can be changed via macro, could you please advice me which command I have to use to set user units to "µm"? That would be useful for us. Thank you very much.
Jürgen
LayoutEditorFull
Tuesday 11th January 2022
Thanks for pointing to this issue. It will be fixed with the next update by adding a * sign between the the value and unit in case a non standard user unit is used. The *userunit* as well as the *database-units* is a per design setting. So its value is stored in the drawingField class and loaded from the file with any GDS, OASIS file. It can be adjusted by macro with the line ```layout->drawing->userunits=0.001;```. Please aware that the *userunits* is entered in *database-units*. So with a usuerunits-value of 1 the *userunits* and *database-units* are identical. A value of 0.001 for userunits with a database unit of 1nm will result in 1µm userunits.
Jürgen
LayoutEditorFull
Tuesday 11th January 2022
Attachments:
(only for registered users)

Screenshot_20220111_161927.png

The WebViewer was just fixed: ![Screenshot_20220111_161927.png](/api/img.php?thread=20220111-9c5c&file=Screenshot20220111161927.png)
Michael

Wednesday 12th January 2022
Attachments:
(only for registered users)
 test_DBU_0_00025um.oas

Screenshot_2022-01-12_181557.jpg


Screenshot_2022-01-12_181925.jpg


Screenshot_2022-01-12_182148.jpg

Hello Juergen, thank you for this hint. It works well in my tests with the client. I have following macro running as an "autostart" macro on layout loading: ``` #!/usr/bin/layout #name=autostartMacro.layout #help=An automatic start macro, runs after layout is loaded. int main(){ // Set User Unit to micron for measurements. // To do so, the user unit has to match the DBU, but DBU is in m (meter) and to get measurement in microns // the user unit has to be multiplied with 1e6 (=10^6). layout->drawing->userunits=layout->drawing->databaseunits * 1e6; // Hide non-used layers. layers::disableUnusedLayers(layout->drawing); } ``` When I check the menu the user unit is now set to "µm" whatever DBU is used in the layout file. ![Screenshot 2022-01-12 182148.jpg](/api/img.php?thread=20220111-9c5c&file=Screenshot_2022-01-12_182148.jpg) And measurements now have "µm" unit behind the measured value. That was my goal. :) ![Screenshot 2022-01-12 181557.jpg](/api/img.php?thread=20220111-9c5c&file=Screenshot_2022-01-12_181557.jpg) Without this code the values are displayed like this (same layout, user unit not set via macro) ![Screenshot 2022-01-12 181925.jpg](/api/img.php?thread=20220111-9c5c&file=Screenshot_2022-01-12_181925.jpg) The Web Viewer is a local server in our company, I guess we need to update ourself. Thank you and greetings from Dresden.
Michael

Wednesday 12th January 2022
PS: I don't know why the images are not shown in the post correctly. They were displayed correctly in the preview of the post. :(
Jürgen
LayoutEditorFull
Wednesday 12th January 2022
Yes, if you run your own WebViewer server you need to upgrade the LayoutEditor package on that server to release 20220111 or newer. The latest development release containing the fix can be downloaded here: [https://layouteditor.com/download?release=latest](https://layouteditor.com/download?release=latest) That is a development version and not yet as intensive tested as a regular release. Of course, the change will also part of the next regular release. Image files containing a space were not correctly displayed here in the forum. I have fixed you post accordingly.