SALOME'S GEOM Module ported to WIN32 using BORLAND Compiler

SALOME'S GEOM Module ported to WIN32 using BORLAND Compiler

Fotis Sioutis

2007/12/06 19:39

I have succesfully ported the salome's GEOM module to win32 using BDS (Borland Developer Studio).
Only the core functionality concerning OCAF services and Geometry drivers have been selected.
Also the Import and Export plugin mechanism has been ported.As it concerns the usability as much
i have managed to test seems to work fine.Now for Visual Studio or any other compiler if anyone can
translate the project files i would be glad to include them in the package.You can expect a downloadable
archive from monday on http://occ.borland.googlepages.com .Also i will try to find some time to create
a demo project on how to use the geom package.

With many greetings

Sioutis Fotis

Fotis Sioutis

2007/12/07 14:58

It has been uploaded a bit sooner than i thought !! Anyone who wants to give it a try can visit http://occ.borland.googlepages.com and see the Download section.Also there is a page with a small HOWTO.Also i say again if someone wants to work on VC porting of GEOM i would be glad.

With owner

Sioutis Fotis

P Dolbey

2007/12/07 18:01

Sioutis,

I'd be interested to try merging the GEOM port onto the Qt4 based QtOCC platform under VS2005 if you can the source available.

Pete

Fotis Sioutis

2007/12/07 19:19

Hello Peter

I was thinking to post to your sf project forum , in order to propose the use of GEOM for QtOCC, but you caught me on time !.You can visit the site mentioned on my previous post and download the last file on the Download Section.The package follows OCC rules for the directory layout.You can find the source in ./src folder , OCAF resources in ./win32/resources folder, ./project files in ./adm/win32 and precompiled dll's in ./win32/bin,bind,lib,libd folders, with only the first two concerning you.Unfortunatelly i cannot help much since instead of Qt i use VCL and Borland.Also have a look at the http://occ.borland.googlepages.com/salome%27sgeommoduleforbds for a little HOWTO.Do not hesitate to contact me for any question you might have (i can be found at sfotis at gmail.com).I believe with the use of QT tools you will be able to compile it also on linux or any other platform you are working with.

Greetings

Fotis

P Dolbey

2007/12/07 22:40

Fotis,

I've got the GEOM source and I think I know what needs to be done now - thanks for such a starting point.

It is now quite well known that TrollTech included support for Visual Studio 2005 Express (and other variants of MSVC) in the open source GPL edition of Qt4. What is less known, unless you read the "changes" file in the distribution is, and I quote....

* Enabled MSVC and Borland project generators for the Qt Open Source
edition.

The Borland build files can also be seen in the distribution, but I can't test them. But it might be worth the effort. Oh and Qt 4.3.3 is out now.

Pete

Fotis Sioutis

2007/12/08 00:01

Hello Pete

I have tried in the past to compile Qt 4.3.2 with BDS without success.I think it must be working out of the box for the free 5.5 compiler version (C++ Builder ver. 6) which uses STLport (BDS uses Dinkumware and compiler at version 5.8).Anyway i will give it another try with 4.3.3 version and if i fail again i will try it with C++ Builder 6.Anyway ... if you manage to compile the GEOM package i can give some chunks of code from my application for some things that might not be so clear for you.A good way to discover things is to search the salome code and see how things are done.Also under work is a modification of the GEOM library to support named variables and functions(using the expression package of OCC) as parameters for coordinates and dimensions (this will give some parametric design capabilities).I plan to (or i have to by LGPL rules) release this code also but it is not ready yet.

Greets
Fotis

P Dolbey

2007/12/08 12:49

Fotis,

I've compiled one of the simplest GEOM sub-projects, ARCHIMEDE.dll, in both debug & release mode on VS2005. This has given me a template that should allow a bit of "find & replace" to get a reasonable starting point for the other .vcproj project files.

Pete

Fotis Sioutis

2007/12/08 15:52

Good news pete !
Archimede is a tool for the calculation of waterline plane (check the salome documentation).I have to notify you that upon compiling the NMTTools package you might encounter an error concerning the NMTDS_Iterator prototype.This is because a SALOME src error and it seems they forgot old version of NMTDS_Iterator.hxx header file in the NMTTools folder.Just delete it and everything should work ok (compiler should use the NMTDS_Iterator.hxx file from NMTDS folder).Also in order to understand the dependencies between the subprojects (in order to define the used libs and the compilation order) you can use the dependency walker tool from microsoft on my precompiled dll's.

Handle_NMTDS_IndexedDataMapNodeOfIndexedDataMapOfIntegerIndexedDataMapOfShapeInteger.hxx
(look at this class name !!!!) :)

Greets

Fotis

P Dolbey

2007/12/08 17:21

Thanks for the warning - I haven't got to that one yet. But I have now compiled the GEOM.dll. However, on the GetCreatedLast functions in GEOM_PythonDump.cpp I had to move the __declspec' to the header file for fix a compile error . Actually I used Standard_EXPORT instead in the header like this

As you can tell in Salome, the use of Standard_EXPORT is significant evidence of an existing Win32 port. We know its been built, but it isn't being made available to the open source community. However, the original Salome files didn't export these functions at all using Standard_EXPORT - I was just wondering why we need to.

Anyway 2 down , 12 to go.

Pete

Fotis Sioutis

2007/12/08 18:27

I remember doing this modification !! Borland did not complain about this and it just exported the function ! (although declaring as exported the function in the header is better).Indeed there is some evidence that OCC can or tries to build salome under windows ! I modified the function to be exported cause as far as i had undestood OCC created single dll for the whole GEOM library (in the same module every function and class is mangled internally in .obj, and callers do not have to search the export table of module, and so, only interface classes have to be exported).I have chosen to keep the linux library layout in order to have better control of distinct modules that do a diferent job.

Greets
Fotis

P Dolbey

2007/12/12 17:42

Nearly there - just the 4 import/export projects to go.

Pete

P Dolbey

2007/12/12 17:45

Nearly there - just the 4 little import/export projects to go.

Pete

P Dolbey

2007/12/12 17:45

Nearly there - just the 4 import/export projects to go.

Pete

P Dolbey

2007/12/12 17:48

Nearly there - just the 4 little import/export projects to go.

Pete

Fotis Sioutis

2007/12/12 18:55

Hello Peter !

So ... you are almost there :)

I have noticed also couple of things you have to propably change in order to have the Import-Export plugin mechanism work as it should.In the GEOMImpl_ExportDriver.cpp and GEOMImpl_ImportDriver.cpp of GEOM_IMPL you should remove the underscore from the following

I added these in order to be Borland compatible (Best thing would be to check for both underscored and not symbol like i did in the main OCC Borland port).

Also i removed the UnLoadLib calls cause i had problem on the finalization of my application.(Tried to destroy Handles created in the Plugin and since they were not available any more i had Access Violations).You can give it a try and use the UnLoadLib calls(Maybe somehow it works with VC ..).

Greets

Fotis

Fotis Sioutis

2007/12/17 15:34

Version 2 of modified GEOM library is out which now supports variables as input data of Functions and drivers (giving some parametric design capabilities).

Modifications in the original source include the :

1.Modified GEOM_Engine and added
a.SetInterpreterConstant//sets a constant
b.GetInterpreterEquationValue//gets a double from an expression
c.GetInterpreterConstantArray//gets an array of the used constants
d.SetInterpreterConstantArray//sets an array of constants

2.Added GEOM_Parameter class at GEOM module which is an object passed as input to GEOM_IOperations descendants (Operations).It can be constructed with any double or char* and TCollection_AsciiString.Passes its value correctly to GEOM_Function.

3.Modified the DF in GEOM so that in label 1 of doc. lie all the Functions,Shapes and Sub-Shapes and in label 2 all the stored variables.

4.Modified the GEOM_Function in order to accept also strings(variables or expressions) as parameters instead of doubles and ints.

5.Modified the GEOMImpl_I***Operations classes in order to take GEOM_Parameter object as parameter where necessary.

I am trying to find some time to create a small starter application for BDS but i cannot say when this will be ready ! If there is a specific question or issue on the use of GEOM then you can post here and i would be glad to answer.Specifically for the integration of GEOM and OCC Viewer this is done via standard TPrsStd_AISPresentation attributes attached to the OCAF tree and reading TNaming_NamedShape (See the code on the link i attached above [RegisterPresentation]).Before presenting an attribute you must attach your viewer and aiscontext to the root of the DF.If you will have a look at the OCAF MFC example you can see how this is done.This is how attach the already created myViewer and myAISContext.

I'm working on it. I was playing with Dirk's OCAF mods to QtOCC last night and I've nearly got the architecture for building an OCAF document and coupling it to the widget - I emailed Dirk a candidate modification. Next I want to try coupling the GEOM engine to the OCAF document, widget and the GUI but I need to get a better understanding of "Drivers" first.

Pete

Fotis Sioutis

2008/01/03 19:18

One thing that may clarify a little bit the architecture of GEOM is that it is already an OCAF framework containing :

1)TDocStd_Application descentant , so there is no need to create one
2)TDocStd_Document are handled by GEOMImpl_Gen and parent GEOM_Engine, so there is no need to manage TDocStd_Document objects in qtocc, for document management GEOM_Engine exposes all functions to handle the documents.
3)Every operation in GEOM_IMPL is implemented as TFunction_Driver descentant, so you don't have to mess with Drivers complexity ! This is only in case you want to add extra functionality in the GEOM_IMPL.

For beginning with GEOM all you need to understand is :
1)Attaching presentation attributes to Functions results (see previous posts)
2)Itterating the DF in order to update the presentation of objects when necessary (eg when loading a document from disk). (See ocaf example)
3)Attach viewer to the DF (ocaf example)

A good thing for you would be to start playing with GEOM and attach the OCAF DebugBrowser in the DF.It will give some clue on how data is organized.

Greets
Fotis

Fotis Sioutis

2008/02/08 17:51

I updated the sourceforge GEOM project file with a new release.It now contains linux makefiles and some drivers added, like ThickSolid , Planar offsets, Variable fillets, VRML export, and csfdb files support.Also some issues were corrected concerning Boolean operations etc.In case one wants, can check the development history via svn at:

Many thanks to Dirk and Peter for their valuable help for the Visual Studio port (Peter) and Linux backport (Dirk).

With owner

Sioutis Fotios

Fotis Sioutis

2008/08/04 11:19

A new version of the standalone GEOM library for WIN32 and linux is available.It is still based on GEOM version 3.2.6 and contains new features (bug fixes, new OCAF drivers etc).The change log can be seen only in the svn subsystem of the project.In general the changes include :

A new version of the standalone GEOM library for WIN32 and linux is available.It is based on GEOM version 4.1.4 and contains new features (bug fixes, new OCAF drivers etc) plus all the new capabilities that were added in 3.2.6 based releases.In general the changes include :

I noticed that the parameter ( Geom_Egine.SetInterpreterConstant ) doesnt support Undo / Redo.
Is it an oversight from my side?
Would be quite useful to have this ability.

Cheers,

-jelle

Fotis Sioutis

2009/06/11 08:57

Hello Jelle

You can have the undo - redo capability provided by OCAF on any change of a label of the data tree.Since SetInterpreterConstant adds or modifies labels under the document tree , then of course you can use the undo redo capability on SetInterpreterConstant.The key is to tell the OCAF framework when you will start an operation , when it finishes and when if it aborts.You can do this in two ways which are :

1)Instanciate a GEOM_IOperations object and use its StartOperation(), FinishOperation(), and AbortOperation() as explained above.(In my case i keep it in a singleton class bound with the document (with this class i access also the GEOM_Solver class).).

2)Using GEOM_Engine->GetDocument(_docID)->NewCommand(), CommitCommand() and AbortCommand() which to tell truth is exactly what GEOM_IOperations does.

Fotis

jelle

2009/06/11 19:27

Ah! Cool, thanks for the heads up!

Robert Hill

2009/06/11 18:12

Is there a small demo program available, preferrably for Visual Studio, using this module? It looks very interesting and I would like to learn more about it.

Best regards, R. Hill

jelle

2009/06/11 19:26

I've just made a program in pythonOCC that is pretty educational.
( see: jelleferinga.com/files/20090610-155332.mov for a screencast )

A new version of the standalone GEOM library is available.It is based on GEOM version 5.1.2 and contains new features (bug fixes, new OCAF drivers etc) plus all the new capabilities that were added in 5.1.2 upstream release.In general the changes include :

1)Engine and objects provide a label for user stored data.
2)ID of objects in script can be a simple identifier than a label entry.
3)Fixed bug with the processing of subshape entities by functions.
4)Fixed issues with function management in objects.
5)Fixed issues with solver class.
6)Translation along a rail driver added.
7)Label creation mechanism of engine fixed to create consequtive labels.
8)Added close glag parameter in polylines.
9)Added support for 64 bit compilation in autoconf capable systems.
10)Fixed issues in thick solid driver.
11)Variables can have descriptions attached to them.
12)Source base has been updated with the latest 5.1.2 salome geom release.

The project can be compiled on any major Linux system, MacOSX and in general any autoconf capable system that is supported by occ.For win32 there are provided msvc2008 , msvc2005 and borland project files.

Guys thank so much for this project, it has been tremendous help for me to use in Architecture Design.
I am Butchering your code, to make a simple parametric modeler for my self to play with.

I currently work with Catia , so i have been able to do very simple things with your library that opens up the door for me in terms what it can achieve.

I have a couple of questions in regards to the library that i don't understand why i cant make them work , i know it has more to do with the implementation of OCAF.

for some reason i cannot save files in any format.
i used the other save function in the Stddocument_application that takes a message reference, it responds that the driver specified is not installed.

i also grabbed the Resource_Manger and check the name of the resource, and its correct.

and i have the 2 environment variables : CSF_PluginDefaults , CSF_ResourcesDefaults
set to the resources folder in my debug and release folders where i copied the resource files in the salomegeom folder.

i even tried setting the enviroment variables every time the application runs just like the ocaf exmaple in mfc in occ. like this:

Im wondering if anyone can explain the resource/plugin system, i mean how to use the existing resources and existing plugins not how to create your won.

i just need to know which path should be placed in the enviroment files if the path of occ or salome or your own path with your won resources.

and if possible is there a way of installing the drivers manually through code without enviroment files.

or any ohter alterantive.

Best.

Thank You very much for the code, this is golden.

Alexander Pena de Leon

Valeriu Catina

2011/07/06 09:29

Hello,

will there be a GEOM library based on SALOME's GEOM version 6.3.0 ?

Regards,

V. Catina

Valeriu Catina

2011/04/27 14:48

Hello,

calling

GEOM_Engine::GetInterpreterEquationValue(someDocID, someEquation)

causes a crash at

return anInterpreter->Expression()->EvaluateNumeric();

when someEquation is a variable that has not been added to the engine (e.g. someEquation == "a" and "a" has not been added to the engine). If someEquation represents a math expression (e.g. someEquation == "a+c/2") involving variables not added to the engine, the function behaves correctly, i.e. a Standard_Failure exception is thrown.

Any ideas ?

Regards,

Vali

Fotis Sioutis

2011/04/27 15:18

Hello ,

Under win32, bcc environment this bug cannot be reproduced ... Maybe if you could provide some more information (platform, compiler etc...), then maybe someone could check for the validity of this error.