import com.ptc.cipjava.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcCommand.*;
import com.ptc.pfc.pfcModel.*;
import com.ptc.pfc.pfcModelItem.*;
import com.ptc.pfc.pfcSolid.*;
import com.ptc.pfc.pfcModelItem.*;
import com.ptc.pfc.pfcAssembly.*;
import com.ptc.pfc.pfcComponentFeat.*;
import com.ptc.pfc.pfcFeature.*;
import com.ptc.pfc.pfcBase.*;
import com.ptc.pfc.pfcDimension.*;
import com.ptc.pfc.pfcGeometry.*;
import com.ptc.pfc.pfcLayer.*;
import com.ptc.pfc.pfcExceptions.*;
import java.io.*;
import java.util.*;
import java.text.*;
public class Test_BOM2 {
static Session curSession;
static final String MSGFILE = "bom.txt";
public static void start() {
try {
curSession = pfcGlobal.GetProESession();
UICommand inputCommand = curSession.UICreateCommand("Make BOM", new Test_BOM_Listener2(curSession));
curSession.UIAddButton(inputCommand,
"Applications",
"Applications.psh_util_pproc",
"Make_BOM",
"Create_BOM",
MSGFILE);
}
catch(jxthrowable x) {
System.out.println("Exception:"+x);
}
}
public static void stop() {}
}
class Test_BOM_Listener2 extends DefaultUICommandActionListener {
static Session session;
static Model curmodel;
static Assembly assy;
static Models models;
static Vector [] modelData;
static String eol="
", eol2="
";
public Test_BOM_Listener2(Session sess) {
session = sess;
}
public void OnCommand () {
try {
SimpleDateFormat df = new SimpleDateFormat ("MMddyy_HHmmss", Locale.getDefault());
Date tm = new Date();
String DateStg = df.format(tm);
session=pfcGlobal.GetProESession();
curmodel=session.GetCurrentModel();
String full_name = curmodel.GetFullName();
models = session.ListModels();
//models = curmodel.ListModels();
int modelCount = models.getarraysize();
modelData = new Vector [modelCount];
for (int i = 0; i< modelCount; i++) {
getModelInfo(i);
}
String inf_name = full_name + "." + DateStg + ".htm";
try {
PrintStream vf = new PrintStream(new FileOutputStream(inf_name));
vf.println( "
" + inf_name + " BOM | |
| " );
for (int i =0; i ********** " ); } vf.println( " | |