Hi Thomas, Thank you for your answers.
Following your advices, I had a look to the 52 posts on the OCC forum that are returned when searching with the keyword "unit", but none are interesting. They are either irrelevant, or without answer. I had however a look to the *.cdl file in Units and UnitsAPI folder. UnitsAPI.cdl is quite interesting and describes a large number of method to achieve conversion. However, I cannot use it in PythonOCC and don't know why. I am quite sure it is because I am unfamiliar with Python at the moment. For instance, typing: from OCC.UnitsAPI import * if __name__ == '__main__': u = UnitsAPI() u.CurrentUnit("LENGTH") returns: Traceback (most recent call last): File "L:\[coding]\python\pythonOCC_units\unitManagementTest.py", line 13, in <module> u.CurrentUnit("LENGTH") RuntimeError: Standard_NoSuchObject I have understood that 2 "configuration" files are needed so that UnitsAPI and Units work: Lexi_Expr.dat => a file into which are defined math symbols and unit prefixes so that the math parser can work. It looks pretty interesting, but I am not sure it is really useful, except maybe for parametric values. I don't know how pyOCC PAF works, but if you need to set for the parameter A a value of "B+C", this tool should be able to understand the mathematical meaning of this. It is also able to understand for instance the k in "10 km" as an indication to multiply the value by a factor 10e3, and this for the miscellaneous prefixes for each defined units. Units_Sentence.cdl, Units_UnitSentence.cdl and Units_MathSentence.cdl are the files indicating the methods to use it. Units.dat => a file defining the unit. Fortunately, the concept of unit signature is already implemented actually: a very interesting surprise! Thomas, I understandd that to work in a normal OCC environment, the variable "CASROOT" needs to be defined so that OCC is able to retrieve these files through the following variables: set CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat set CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat How does it work with PythonOCC? I have installed PythonOCC all in one, but I couldn't find those file where I installed PythonOCC: where are the OCC sources installed? And do you think that I should define manually these environment variables so that PythonOCC is able to find them? I thank you in advance for your help. Have a good day. Bests, Pierre PS: if we succeed using this API, would you be interested that I write a python sample to include in PythonOC?
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users