Jump to content

Accessing the default units in the project file through script


---
 Share

Recommended Posts

Hello everyone,

I want to learn if it is possible to access the default units in an open project file through script. I have a package and I want to upload it to different computers for the use of different inspectors. However, before the program that package includes starting, it is important for us  to  make sure about the unit. If it is not set as it should be in default, then change it. Is there a way to do that through script?

Many thanks,

Canset

Link to comment
Share on other sites

Hello Nanno,

Thanks for the quick help. Now, I can access the default unit, but the conversion is still a problem. I want to set the default setting, but before any element is created and even before model is imported. Is there way to change the default settings without using gom.app.project.inspection and comparing with elements ?By using some kind of function like gom.app.set_unit_length etc.?

Many thanks,

Canset

 

 

Link to comment
Share on other sites

Hi,

one important hint: The internal units in our software are not changing!!! For instance a "length" or a "coordinate" is always stored in mm. The default units are only used for reporting, sometimes for export (but usually you can specify for some exports/imports the unit how the value in the file shall be interpreted or exported).

If you want to change the units than this is usually only necessary for creating reports from visualized labels. But may be you rethink your approach and create the reports manually and store the project as project template? 

Regards,

Bernd 

Link to comment
Share on other sites

Hi Bernd,

I got your point but in my case, I solved with checking the unit in the open project through script and adding a warning window in my script. If it is not mm in active user settings, the warning window guides the user to change the default setting manually .

Many thanks for help,

Canset

Link to comment
Share on other sites

  • 1 month later...

Please sign in to view this quote.

 Hi Bernd,

I'm also intersted to check each time i open a project, if the unit (ie 'Volume') is in cm3 for reports and digits are set up to 3.

And I need to do this by python.

 

Is there any command that could help like "gom.set_units(...)" and "gom.set_units_digits(...)" ?

I can do like @cansetm, but still :

  • the user have to change the unit
  • the user have to change the numbers of digits
  • I can't test with python if the number of digits set for a type of unit is good...

 

Thanks for your answers

Link to comment
Share on other sites

Hello,

unfortunately there is no way to script unit preferences or to access these settings. An issue for this already exists.

A possible workaround may be to start all new projects from a template. Project templates store the unit preferences like projects do. But this will not help for existing projects.

Regards,

Frank

Link to comment
Share on other sites

Ok, thanks...

I just script a dialog box if the unit is not the good one choosed for the report...

I mentionned to check also the number of digits and ask to the user to reconfigure the reports pages until the unit changes are made

It's NOT as usefull than I was epected, but still, there is at least a warning...

 

Link to comment
Share on other sites

  • 1 year later...

Please sign in to view this quote.

Hello everybody... 

I'm following this topic for 1 year now and no news or any update...

 

Do you know if the issue which already exist could be improved in the future in gom software ?

It could be really usefull to be able to change with script, the unit in a report page.

 

Thanks, 

Link to comment
Share on other sites

  • 1 year later...
---

Adding another use case to this thread, my workplace is divided into departments that work in either English or Metric units, but our scan techs work with each of these departments and have to occasionally toggle between the English and Metric systems during scan review as they (and I) have an easier time visualizing thousands of an inch versus millimeters. Earlier today I looked into scripting a toggle button for the our scan PC's toolbar that could swap between two presets of default units with a single click, but as in the above posts I discovered there appears to be no available scripting command to change the project's default units, only the manual method of Edit-->Preferences-->Default Units. We will continue using the preferences menu as necessary, but having the ability to both query and set the current default units of an open project via script in a future release would be a nice touch to help us move between systems more fluidly.

Link to comment
Share on other sites

 Share

×
×
  • Create New...