DRAWEXE for OCC 7.3 on Linux

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
wandererfan
Posts: 3981
Joined: Tue Nov 06, 2012 5:42 pm

DRAWEXE for OCC 7.3 on Linux

Postby wandererfan » Tue Sep 10, 2019 12:03 pm

Does anybody know how to use DRAWEXE for OCC 7.3 as installed via the daily ppa?

I can get DRAW to execute with
wandererfan@huxley ~ $ /usr/share/opencascade/bin/draw.sh

But I get an error message right after start up.
couldn't read file "/usr/src/DrawResources/DrawDefault": no such file or directory

I imagine my CASROOT environment variable is wrong, but I have no idea what it should be.

Do I need to download and build OCC 7.3 locally to get this to work? That's how I got DRAW to work with 7.0 and 7.1.

Thanks,
wf
User avatar
tanderson69
Posts: 1536
Joined: Thu Feb 18, 2010 1:07 am

Re: DRAWEXE for OCC 7.3 on Linux

Postby tanderson69 » Tue Sep 10, 2019 12:31 pm

wandererfan wrote:
Tue Sep 10, 2019 12:03 pm
Does anybody know how to use DRAWEXE for OCC 7.3 as installed via the daily ppa?

I can get DRAW to execute with
wandererfan@huxley ~ $ /usr/share/opencascade/bin/draw.sh

But I get an error message right after start up.
couldn't read file "/usr/src/DrawResources/DrawDefault": no such file or directory

I imagine my CASROOT environment variable is wrong, but I have no idea what it should be.

Do I need to download and build OCC 7.3 locally to get this to work? That's how I got DRAW to work with 7.0 and 7.1.

Thanks,
wf
I ran into something like this trying to get cadrays to run. I had to set 2 environment variables with the appropriate paths to fix the problem. Maybe that will work for you?

Code: Select all

export DRAWDEFAULT=/usr/local/share/opencascade/resources/DrawResources/DrawDefault
export DRAWHOME=/usr/local/share/opencascade/resources/DrawResources
User avatar
wandererfan
Posts: 3981
Joined: Tue Nov 06, 2012 5:42 pm

Re: DRAWEXE for OCC 7.3 on Linux

Postby wandererfan » Tue Sep 10, 2019 12:56 pm

tanderson69 wrote:
Tue Sep 10, 2019 12:31 pm
I ran into something like this trying to get cadrays to run. I had to set 2 environment variables with the appropriate paths to fix the problem. Maybe that will work for you?

Code: Select all

export DRAWDEFAULT=/usr/local/share/opencascade/resources/DrawResources/DrawDefault
export DRAWHOME=/usr/local/share/opencascade/resources/DrawResources
Different error message ("couldn't open "": no such file or directory"), but still won't run.
User avatar
tanderson69
Posts: 1536
Joined: Thu Feb 18, 2010 1:07 am

Re: DRAWEXE for OCC 7.3 on Linux

Postby tanderson69 » Tue Sep 10, 2019 1:25 pm

wandererfan wrote:
Tue Sep 10, 2019 12:56 pm
Different error message ("couldn't open "": no such file or directory"), but still won't run.
Did you find the path to the directory and file of your installation and put them into the variables?
User avatar
kkremitzki
Posts: 2032
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: DRAWEXE for OCC 7.3 on Linux

Postby kkremitzki » Tue Sep 10, 2019 3:44 pm

Unfortunately the DRAWEXE setup is a little busted, I've been looking into it lately trying to get autopkgtests set up. What I did to get it working was:

Code: Select all

sudo ln -s /usr/share/opencascade/resources /usr/share/opencascade/src
export CASROOT=/usr/share/opencascade
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
wandererfan
Posts: 3981
Joined: Tue Nov 06, 2012 5:42 pm

Re: DRAWEXE for OCC 7.3 on Linux

Postby wandererfan » Tue Sep 10, 2019 8:20 pm

tanderson69 wrote:
Tue Sep 10, 2019 1:25 pm
Did you find the path to the directory and file of your installation and put them into the variables?
I've just built OCC7.3.0 from source and installed in my home directory and set CASROOT to "home/wandererfan/OCC730-install". Now I can run DRAWEXE from home dir.

Would be nice to have instructions on how to do it with the PPA version for those that don't compile, though.

Thanks for helping.
vocx
Posts: 4334
Joined: Thu Oct 18, 2018 9:18 pm

Re: DRAWEXE for OCC 7.3 on Linux

Postby vocx » Tue Sep 10, 2019 10:41 pm

wandererfan wrote:
Tue Sep 10, 2019 8:20 pm
...
Would be nice to have instructions on how to do it with the PPA version for those that don't compile, though.
I don't think this is possible at the moment. It seems that OCCT needs to be packaged differently.

I'm reading about this here https://www.opencascade.com/doc/occt-7. ... index.html

As you see, they assume a bunch of files. I presume this is how you see OCCT compiled from their official sources.

Code: Select all

opencascade/
    adm/    This folder contains administration files, which allow rebuilding OCCT;
        cmake/    This folder contains files of CMake building procedure;
        msvc/    This folder contains Visual Studio projects for Visual C++ 2010, 2012, 2013, 2015 and 2017 which allow rebuilding OCCT
    data/    This folder contains CAD files in different formats, which can be used to test the OCCT functionality;
    doc/    This folder contains OCCT documentation in HTML and PDF format;
    dox/    This folder contains sources of OCCT documentation in plain text (MarkDown) format;
    inc/    This folder contains copies of all OCCT header files;
    samples/    This folder contains sample applications.
    src/    This folder contains OCCT source files. They are organized in folders, one per development unit;
    tests/    This folder contains scripts for OCCT testing.
    tools/    This folder contains sources of Inspector tool.
    win64/
        vc10/    This folder contains executable and library files built in optimize mode for Windows platform by Visual C++ 2010;
But the directory created under Ubuntu is like this

Code: Select all

/usr/share/opencascade/
                       bin/
                       resources/
                           DrawResources/
                           TObj/
As Kremitzki says, I did this

Code: Select all

sudo ln -s /usr/share/opencascade/resources /usr/share/opencascade/src
A src/ symbolic link is created that just points to the resources/ directory.

Then you can run the executable /usr/bin/occt-draw by setting the CASROOT variable.

Code: Select all

CASROOT=/usr/share/opencascade occt-draw
There is no immediate error reported in the terminal, but when you try to pload ALL, or any other sample, you get the error:

Code: Select all

Draw[1]> Draw[2]> An exception was caught 0x55ab0292d450 : Draw_Failure: Could not open: TKTopTest; reason: libTKTopTest.so: cannot open shared object file: No such file or directory
bgerror failed to handle background error.
    Original error: ** Exception ** 0x55ab0292d450 : Draw_Failure: Could not open: TKTopTest; reason: libTKTopTest.so: cannot open shared object file: No such file or directory
    Error in bgerror: 
The requested file is there but is not being found

Code: Select all

/usr/lib/x86_64-linux-gnu/libTKTopTest.so.7
/usr/lib/x86_64-linux-gnu/libTKTopTest.so.7.3.0
Maybe you need to create a symbolic link with the exact name libTKTopTest.so, as setting the environmental variable doesn't help either.

Code: Select all

export CASROOT=/usr/share/opencascade
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
/usr/bin/occt-draw
To me this sounds like the Debian package occt-draw is a very stripped down version of what you are supposed to have with the entire OCCT distribution. Or it's just that the dependencies aren't being found in the expected locations. Maybe this can be solved by more clever packaging, moving the directories around, and creating some symlinks.

The documentation say this
The DRAWEXE executable is delivered with the installation procedure on Windows platform only.
I was confused by DRAWEXE as it doesn't seem to be present in Ubuntu. I guess in Linux the executable is /usr/bin/occt-draw.
Always add the important information to your posts if you need help.
To support the documentation effort, and code development, your donation is appreciated: paypal.
User avatar
wandererfan
Posts: 3981
Joined: Tue Nov 06, 2012 5:42 pm

Re: DRAWEXE for OCC 7.3 on Linux

Postby wandererfan » Wed Sep 11, 2019 12:42 am

vocx wrote:
Tue Sep 10, 2019 10:41 pm
As you see, they assume a bunch of files. I presume this is how you see OCCT compiled from their official sources.
that looks more like my source directory.

build looks like this

Code: Select all

CMakeFiles
    3.10.2
    CMakeTmp
     Export
 doc
     overview
 dox
     CMakeFiles
 include
     opencascade
 lin64
     gcc
  src
     DRAWEXE
     TKBin
     ...
     TKXSBase
     TKXSDRAW
and install looks like this:

Code: Select all

 bin
 include
     opencascade
 lib
     cmake
         opencascade
  share
     doc
         opencascade
     opencascade
         data
         resources
         samples