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.

Jlink debugging

smartanand

New member
package com.ptc.ParamExample;
import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcGlobal.pfcGlobal;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcModelItem.Parameter;
import com.ptc.pfc.pfcModelItem.ParamValue;
import javax.swing.JOptionPane;


public class ParamEx
{


private static Session cursession;


public static void start()
{
String path = "C:\\ptc\\jlink\\jlink_appls\\ParamExample";
ModelDescriptor descr;
Model model;
String modelname = "Test.prt";
try
{
descr = pfcModel.ModelDescriptor_Create (ModelType.MDL_PART, modelname, null);
descr.SetPath(path);
cursession = pfcGlobal.GetProESession ();
model = cursession.RetrieveModel(descr);
Parameter diameter = model.GetParam("Diameter");
ParamValue diaValue = diameter.GetStringValue();
msgBox(diaValue);
model.Display();

}
catch (jxthrowable e)
{

e.printStackTrace();
}


}


public static void msgBox (String msg)
{
String title = "ProE";
JOptionPane.showMessageDialog (new java.awt.Frame (),msg,title + " Error",JOptionPane.ERROR_MESSAGE);
}



public static void stop ()
{
printMsg ("stopped");
}


private static void printMsg (String msg)
{
System.out.println ("ParamEditor: " + msg);
}


}


my protk.dat file has,


name&n bsp; Password
startup&nbsp ; java
java_app_class com.ptc.PasswordExample.Password
java_app_start start
java_app_stop stop
allow_stop true
delay_start false
text_dir $PRO_DIRECTORY/jlink/jlink_appls/ParamExample/text
end



while starting ProE, I am getting a application start up failed error message.


Please tell whether there is any problem with my code.


If any one know how to debug this jlink application, please tell me.


I am in great need to solve this problem.


Please help me.


Thanks


Anand.C
 
Sorry , I missed to mention what I am trying to accompolish with this code.


While opening ProE, it should open the model Test.prt and should display the value of the parameter Diameter and then the model


I have this code in ProE start in directory and I have class path also well set.


I am able to run the install_test application also.


Hope this helps in understanding the doe.
 

Sponsor

Back
Top