For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

DRAW.EXE howto...

Andrew's picture
Forums: 

Hi.

I've downloaded and installed OCCT6.6 without serious problems.
I'm on a Slackware linux platform, and the only compile issues I had were that the DRAW.EXE command line shell doesn't accept backspace or delete, without becoming confused/lockup; and secondly that the startup scripts had minor bugs in them.

So, I wrote a python shell to wrapper all functions dynamically and allow me to use interactive mode python to run DRAW.EXE. (Attached for your Linux enjoyment) That's works fine, now. Since it's based on "help", converting it to __doc__ under python, and I have regular expressions -- I can do neat searches, and the module is actually OCCT version independent.
(Now if only the documentation were useful...!)

FYI: On my system, I did a local install into my home directory; and all my binaries are on a fake root directory called .local; So, OCCT6.6 created .local/bin : .local/res/DrawResources : .local/res/src : .local/res/.... etc.etc.etc. and my linker finds the libraries in .local/lib because I set the bash shell variable LD_LIBRARY_PATH=${HOME}/.local/lib
I tried to isolate all directory paths to the top of my python module, so if you do things differently it can be easily changed. Also, Linux uses PTY's - but I don't know if windows does; so that's a possible gotcha.

Once I had it all working, I tried to do the bottle creation example on the opencascade.org website. http://www.opencascade.org/org/gettingstarted/appli/

Of course the draw interface is differnt than C++, but I was able to figure out from the draw help how to do most of it.

Here's a shell dump of how far I got:

Python 2.7.3 (default, Jul 3 2012, 21:16:07)
[GCC 4.7.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import occt
>>> occt.connect()
executing:/home/andrew3/.local/bin/occt.rc
Hint: use "pload" command to load standard commands

>>> occt.pio("pload")
pload
>>> occt.importWrappers()
>>> myHeight=70
>>> myWidth=50
>>> myThickness=30
>>> occt.pers()
'pers '
>>> #Perspective window just came up... now to compute the points.
...
>>> aPnt1=(-myWidth / 2. , 0 , 0)
>>> occt.point( 'aPnt1', aPnt1 )
'point aPnt1 -25.0 0 0'
>>>
... aPnt2=(-myWidth / 2. , -myThickness / 4. , 0)
>>> occt.point( 'aPnt2', aPnt2 )
'point aPnt2 -25.0 -7.5 0'
>>>
... aPnt3=(0 , -myThickness / 2. , 0)
>>> occt.point( 'aPnt3', aPnt3 )
'point aPnt3 0 -15.0 0'
>>>
>>> aPnt4=(myWidth / 2. , -myThickness / 4. , 0)
>>> occt.point( 'aPnt4', aPnt4 )
'point aPnt4 25.0 -7.5 0'
>>>
>>> aPnt5=(myWidth / 2. , 0 , 0)
>>> occt.point( 'aPnt5', aPnt5 )
'point aPnt5 25.0 0 0'
>>>
>>> occt.fit()
'fit '
>>>
>>> occt.gcarc( 'aArcOfCircle', 'cir', 'aPnt2', 'aPnt3', 'aPnt4' )
'gcarc aArcOfCircle cir aPnt2 aPnt3 aPnt4'
>>> occt.segment( 'aSegment1', 'aPnt1', 'aPnt2' )
'segment aSegment1 aPnt1 aPnt2'
>>> occt.segment( 'aSegment2', 'aPnt4', 'aPnt5' )
'segment aSegment2 aPnt4 aPnt5'
>>>
>>> occt.edge( 'edge1', aPnt1, aPnt3 )
'edge edge1 -25.0 0 0 0 -15.0 0'
>>> occt.edge( 'edge2', 'aArcOfCircle' )
'edge edge2 aArcOfCircle'
>>> occt.edge( 'edge3', aPnt4, aPnt5 )
'edge edge3 25.0 -7.5 0 25.0 0 0'
>>>
>>> occt.wire( 'aWire', 'edge1', 'edge2', 'edge3' )
'wire aWire edge1 edge2 edge3\nWire not done\n'
>>> occt.line( 'xAx', (0,0,0), (1,0,0) )
'line xAx 0 0 0 1 0 0'
>>> # And this is where I get stuck.... How do I mirror?
...
>>> occt.doc("mirror",subShow=False)
N2dlmirror
N2dpmirror
lmirror
pmirror
smirror
tmirror
>>> print occt.lmirror.__doc__
lmirror : lmirror name [ names... ] x y z dx dy dz
>>> occt.lmirror("mirror1",(0,0,0),(1,0,0) )
'lmirror mirror1 0 0 0 1 0 0\nmirror1 '
>>>

But, when I get to the part about mirroring the wire frame, I don't see anything happen in the perspective view.

I looked for the TK/DRAW examples supposedly in the resources directory; ~/.local/res/DrawResources ... but the documentation is wrong; they aren't there in occt6.6.0.

So, I don't see any way how to figure this out without disassembling the source code... :(

Also, when watching the perspective view, I noticed that it will draw the arc -- and the points -- and they will stay there permanently; But when I draw a line-segment, nothing shows up at all; And if I draw a "line", it shows up at first -- but then disappears if I do another line. What's that all about?

:)

Andrew's picture

Oops... I made a typo, the circle requires a mkedge, not just an edge command. This gets rid of the wire not made error.
>>> occt.gcarc( 'aArcOfCircle', 'cir', 'aPnt2', 'aPnt3', 'aPnt4' )
'gcarc aArcOfCircle cir aPnt2 aPnt3 aPnt4'
>>> occt.segment( 'aSegment1', 'aPnt1', 'aPnt2' )
'segment aSegment1 aPnt1 aPnt2'
>>> occt.segment( 'aSegment2', 'aPnt4', 'aPnt5' )
'segment aSegment2 aPnt4 aPnt5'
>>> occt.edge( 'edge1', aPnt1, aPnt3 )
'edge edge1 -25.0 0 0 0 -15.0 0'
>>> occt.mkedge( 'edge2', 'aArcOfCircle'
... )
'mkedge edge2 aArcOfCircle'
>>> occt.edge( 'edge3', aPnt4, aPnt5 )
'edge edge3 25.0 -7.5 0 25.0 0 0'
>>> occt.wire( 'aWire', 'edge1', 'edge2', 'edge3' )
'wire aWire edge1 edge2 edge3'
>>>

But, I still can't figure out how to get it to mirror. :(

Andrey BETENEV's picture

Hello Andrew,

> I looked for the TK/DRAW examples supposedly in the resources directory; ~/.local/res/DrawResources ... but the documentation is wrong; they aren't there in occt6.6.0.

The samples have been moved to samples/tcl, please check especially bottle.tcl which implements the steps described in tutorial.
Thank you for highlighting error in documentation, now recorded as issue #24021.

Andrey

Andrew's picture

Thanks, Andrey.
You might want to note, also, that when I looked:
andrew3@darkstar:~/.local/res$ find . -name samples
andrew3@darkstar:~/.local/res$ find . -name bottle.tcl
andrew3@darkstar:~/.local/res$ cd ~/Downloads/ros/ # 6.6.0's untarred dir
andrew3@darkstar:~/Downloads/ros$ find . -name samples
./tests/demo/samples
./samples
andrew3@darkstar:~/Downloads/ros$ find . -name bottle.tcl
./samples/tcl/bottle.tcl
andrew3@darkstar:~/Downloads/ros$

So, as you can see -- the examples are in the source code, but the make system did not install them.

I hope to look at the bottle file, itself, tomorrow and get a better understanding of the system. :) I appreciate the help.

--Andrew.