Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Where am I wrong?

metin_mehel

New member
View attachment 5438hello,


I try to learn j-link. I downloaded eclipse and tried to run exercise5. But in my oppinion there is no problem as you see in the screen, the program is not running or I can say nothing happen.


Could you please tell me whereI am wrong? I think in this platform someone passed the steps that I am having.


Thanks for all repplies!
 
Hi,
what do you have in your protk.dat? Could you paste it here? Is there anything in the trail file that can help?
 
name FeautureOp


startup java


java_app_class StartExercise5


java_app_start start


java_app_stop stop


allow_stop true


delay_start true


end
 
/*********************************************************** ******************\


FILE: StartExercise5.java


PURPOSE: Start the J-Link program for Exercise 5. Uses the static method


"Exercise5.executeOperation()" which is the solution to this exercise.


09-Apr-99 I-01-34 JCN $$1 Created.


\*********************************************************** ******************/


import com.ptc.cipjava.*;


import com.ptc.pfc.pfcSession.*;


import com.ptc.pfc.pfcGlobal.*;


import com.ptc.pfc.pfcModel.*;


import com.ptc.pfc.pfcFeature.*;


import com.ptc.pfc.pfcExceptions.*;


import com.ptc.pfc.pfcSolid.*;


import com.ptc.pfc.pfcWindow.*;


/**


* Test application class for Exercise 5.


*/


public class StartExercise5 {


private static Model test_model;


/**


* Model name for test application


*/


private static String model = "EXERCISE5";


private static Session session;


/**


* J-Link start method


*/


public static void start ()


{





try {


session = pfcGlobal.GetProESession();


test_model = session.GetModel (model, ModelType.MDL_PART);


}





catch (jxthrowable x)


{


printMsg("Error initializing test program: "+x);


x.printStackTrace();


return;


}


if (test_model == null)


{


printMsg("Please load 'Exercise5.prt' and rerun the program");


return;


}


executeOperations();


}





/**


* J-Link stop method.


*/





public static void stop ()


{


printMsg("Stopped");


}


/**


* Executes the bulk of the operations needed to set up the exercise.


*/


public static void executeOperations()


{


Features features;


String suppress = "SUPP";


String resume = "RES";


String delete = "DEL";


String name;


Feature suppress_feat = null;


Feature resume_feat = null;


Feature delete_feat = null;


Solid test_solid = (Solid) test_model;


Window model_window;


try {





features = ((Solid)test_model).ListFeaturesByType(Boolean.FALSE, null);





for (int i =0; i < features.getarraysize(); i++)


{


if (features.get(i).GetName() != null)


{


name = features.get(i).GetName();


if (name.equalsIgnoreCase(suppress))


{


printMsg("Found 'SUPP'!");


suppress_feat = features.get(i);


}


if (name.equalsIgnoreCase(resume))


{


resume_feat = features.get(i);


printMsg("Found 'RES'!");


}


if (name.equalsIgnoreCase (delete))


{


printMsg("Found 'DEL'!");


delete_feat = features.get(i);


}


}


}








}


catch (jxthrowable x)


{


printMsg("Exception caught :"+x);


x.printStackTrace();


}


// Check if null required for compilation. Utility method


// 'executeOperation' is the solution to exercise 5.


if (suppress_feat != null)


{


Exercise5.executeOperation (suppress_feat, 0);


}


if (resume_feat != null)


{


Exercise5.executeOperation (resume_feat, 1);


}


if (delete_feat != null)


{


Exercise5.executeOperation (delete_feat, 2);


}


try {


// CreateModelWindow returns the window which contains the model


// if it already exists.


model_window = session.CreateModelWindow (test_model);





// Needed to show the changes in the window and on the Model Tree


model_window.Repaint();


model_window.Activate();


}


catch (jxthrowable x)


{


printMsg("Execption caught: "+x);


x.printStackTrace();


}





}


public static void printMsg(String Msg)


{


System.out.println("StartExercise5 :"+Msg);


}


}
 
So, what has come of this?

I've just started with JLink too (using Netbeans) but i
find the Jlink manual much more crappy then the VB API
manual (but i need Java this time :( )

Do i miss any Environment variables or stuff? I've found
that the library was located at <PROENGINEER>\text\java ,
which is also never mentioned in that manual, so i'm
guessing i might be missing some other basic stuff to get a
program running.
 

Sponsor

Articles From 3DCAD World

Back
Top