How can I make framework or simple program with JAVA

Hi

I want to make 3D modeler with java.

I couldn't understand wok, cdl, JCAE, wrapping although I have read wok and cdl documentations and found JCAE web-site.

What should I do first?

And How can I make a simple Java 3D modeler using wok in Opencascade.

please please !!

Would you explain me~~?

regards

gukho

giuseppe's picture

Dear Gukho,
I have the same problem: i'm trying to develop a finite element
program with pre and post processing capabilities.
I use Java to wrap vtk for the visualization.
It is about two years that I plan to use OCC for the pre-processing features of my software: you can check in this forum my help requests.
I think that this forum will not help you (I don't know why ..... or it is better I don't tell you my opinion!).
Everybody say: see the java examples in OCC distribution (it is almost impossible to understand something in these examples).
Or: see wok manual. (In my windows env the wok procedure does not execute the link phase to obtain the dll for java !!)
If you want I can tell you something about the process to obtain dll or so libraries for java wrapping using wok on Linux or Windows.
For linux wok works (after several tuning operations).
For windows I use msvtoolkit and codeblock for the compiling and linking operations.
But the problem is: now that I have the dlls how can I setup a simple java application that display and handle OCC shapes ?
Tis is a question that nobody answered to me (and to you I think).
I hope that you have better luck !

Giuseppe

Gukho Gil's picture

Dear Giuseppe

Thank you for your response!!!
I have being done nothing for a few weeks.
I feel terrible!!
I think of the same as you.
I just want to know the beginning of JAVA application.
Hmmm...
Thank you so much...

I have a problem that I don't know how I can start.
Would you tell me about that?

I only think about wok or cdl. But there is no accurate exmple..

Anyway I shall check your previous requests....

Thank you Giuseppe...@^_^@

Gukho...

giuseppe's picture

Dear Gukho,
in the wok user guide of OCC 6.1 make a search with "java" or "jni".
Here you can find something about the procedure to create the dll
for java wrapping: it is not so clear but working around it you can
make something.
Try to run the java examples distributed with OCC: take a look at the java sources (for me it is too much difficult to understand the examples but...I hope they can help you)

Regards

Giuseppe

Gukho Gil's picture

Dear giuseppe

Thank you so much....!!

I installed OCC program and ran a OCC java example..

However, I couldn't understand that program because its size was too big and I have a few idea of JAVA. That's why I just look at....

And I ran Java example with eclipse but I couldn't compile that example...

Anyway I have many problem...

I'll try again...again...

Thank you giuseppe...

GUKHO

Jerome Robert's picture

You may also have a look at http://jcae.sf.net

Jerome

Jerome Robert's picture

Oops forget the previous post.

occjava-swig (the Java Opencascade wrapper used in jCAE) do not use Wok but swig (http://www.swig.org). It provide a more Java like API (use more Java existing API and less rely on OCC services). It's also faster because in handle the fact that JNI is slow and try to reduce the number of JNI calls.

occjava-swig only wrap a small subset of the Opencascade API but is easily extendable. It currently contains everything needed to do a 3D viewer with Java3d (jCAE include such viewer). It also contains some class for modeling solids and creating plates.

Jerome Robert

Gukho Gil's picture

Dear Robert..

Thank you for your response..

I got the jCAE..few weeks ago.. but I couldn't understand that program..

I shall check the swig...

I need study more...

Thank you..

GUKHO

Saya Aldo's picture

Hello,

I'm new to Jcae, and opencascade.
I tried to use occjava indipendently from netbeans and jcae,
but I had some difficulties to understand the way to do it.

I created a new java applications, under Windows Netebeans ide (not using netbeans platform),
I added libraries occjava.jar and jcae-viewer3d.jar to the project
I put occjava.dll, all occ TK****.dll in java.library.path and I have set
MMGT_OPT=0 among system enviroment vars.
Finally I added example source code to the project, from repository:
jcae\trunk\occjava\src-java\org\jcae\opencascade\test

compiling was successful, but not running (CircleExtrudeQuilt.java class )
I started to debug
but this is my log :

init:
deps-jar:
Compiling 15 source files to C:\giovanni\JavaProjects\proveJCAE\provaOCCJAVA\occjavaisolato\build\classes
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
compile:
org.jcae.opencascade.jni.TopoDS_Wire@b05c9c9
org.jcae.opencascade.jni.TopoDS_Wire@b05ce71
org.jcae.opencascade.jni.TopoDS_Wire@b058f81
org.jcae.opencascade.jni.TopoDS_Wire@b054dc9
ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]
debug:
BUILD SUCCESSFUL (total time: 9 seconds)
----

This error appears at breakpoint:
Listening on 1111
User program running
Breakpoint hit at line 107 in class org.jcae.opencascade.test.CircleExtrudeQuilt by thread main.
Thread main stopped at CircleExtrudeQuilt.java:107.

corresponding to code line (CircleExtrudeQuilt.java class ):

//Create a holed cylinder
TopoDS_Edge circleB=createCircle(0, 0, -1E-3, 0, 0, 1, 4E-3);

May anyone help me? How should be this error interpreted? Is it an error concerning jni wrapping?

My goal is using A simple Java3D canvas3D panel populated by opencascade native geometries without building
again the swig wrapper occjava.

I observed also this code behavior outside the debug enviroment:

I've not JVM crashes and no JVM error logs.

If I run all my project outside the debugging enviroment (setting CircleExtrudeQuit as Main class)
I receive this output:

init:
deps-jar:
Compiling 15 source files to C:\giovanni\JavaProjects\proveJCAE\provaOCCJAVA\occjavaisolato\build\classes
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
compile:
run:
org.jcae.opencascade.jni.TopoDS_Wire@4e82cd9
org.jcae.opencascade.jni.TopoDS_Wire@4e83181
org.jcae.opencascade.jni.TopoDS_Wire@4e7edb1
org.jcae.opencascade.jni.TopoDS_Wire@4e7fe51
BUILD SUCCESSFUL (total time: 0 seconds)
-----
It seems correctly create 4 TopoDS_Wire objects . It's that true?
----

If I run single file CircleExtrudeQuit I receive this:

init:
deps-jar:
Compiling 1 source file to C:\giovanni\JavaProjects\proveJCAE\provaOCCJAVA\occjavaisolato\build\classes
Note: C:\giovanni\JavaProjects\proveJCAE\provaOCCJAVA\occjavaisolato\src\src-java\org\jcae\opencascade\test\CircleExtrudeQuilt.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
compile-single:
run-single:
java.lang.NoClassDefFoundError: src-java/org/jcae/opencascade/test/CircleExtrudeQuilt
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

-------

Thanks in advance.

(cross posting from https://sourceforge.net/forum/forum.php?thread_id=1832683&forum_id=253752 jcae developer forum)

Saya Aldo's picture

Hi,
using opencascade Java samples code I was able to display some sample interactive objects wrapping a modified CASCADEView3d Canvas viewer (native paint exported by TKNativePaint.dll) without SamplePanel architecture. Many sample JNI DLLs are exporting viewing opencascade tools. Occjava.dll exports many jni other useful opencacascade feature. My question is how is possible to integrate in a single Java application?
CASCADESamplesJNI.dll exports a TopoDS_Shape which is hiearchical incompatible with org.jcae.opencascade.jni.TopoDS_Shape exported by occjava.dll through occjava.jar.
Does anybody know any idea if is possible to made them compatible?

I compiled samples JNI DLLs from source code and I used them successfully. But adding new jni export functions using the same jni code architecture of "MakeBox" native method (SamplesTopologyPackage.hxx SamplesTopologyPackage.cxx SamplesTopologyJNI_Java.h, SamplesTopologyJNI_Java.cxx and SamplesTopologyPackage.java files involved) compiling, building and linking are succesful but new DLLs does not work.

Thanks in advance.
Giovanni

hamouzZammel_135254's picture

hi every body i have a problem about stp file reading and display it i am using java spring mvc . after a long search i found nothing  just this idea about opencascade but i didnt understand how to use it 

anyone can help me or show me a solution 

thankx in advance