PK
]. META-INF/ PK
].35D D META-INF/MANIFEST.MFManifest-Version: 1.0
Created-By: 1.3.0 (Sun Microsystems Inc.)
PK
:.w4
Make_BOM.java
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.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 Make_BOM {
static Session curSession;
static final String MSGFILE = "bom.txt";
public static void start() {
try {
curSession = pfcGlobal.GetProESession();
UICommand inputCommand = curSession.UICreateCommand("Make BOM", new Make_BOM_Listener(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 Make_BOM_Listener extends DefaultUICommandActionListener {
static Session session;
static Model curmodel;
static Assembly assy;
static Models models;
static String eol="
", eol2="
";
static String[][] Test;
public Make_BOM_Listener(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();
int modCnt = models.getarraysize();
String Test[][] = new String [modCnt][8];
for (int i = 0; i < modCnt; i++) {
Model model_i;
ModelType type;
ModelDescriptor desc;
Integer versionStamp;
String get_RL, get_REV, get_VER, GenName, InstName, typeString;
String name, mtypeString, path, fname, ftypeString, fstatusString;
String itemtypeString, feattypeString;
model_i = models.get(i);
name = model_i.GetFullName();
name = "Model Name: " + name;
Test [i][0] = name;
desc = model_i.GetDescr();
path = desc.GetPath();
path = "File Directory/Folder Path: " + path;
Test [i][1] = path;
get_RL = model_i.GetReleaseLevel();
get_RL = "Release Level: " + get_RL;
Test [i][2] = get_RL;
get_REV = model_i.GetRevision();
get_REV = "Revision Level: " + get_REV;
Test [i][3] = get_REV;
get_VER = model_i.GetVersion();
get_VER = "Version: " + get_VER;
Test [i][4] = get_VER;
type = model_i.GetType();
mtypeString = pfctypeclass.pfcModelType[type.getValue()];
mtypeString = "Model Type: " + mtypeString;
Test [i][5] = mtypeString;
InstName = model_i.GetInstanceName();
InstName = "Instance Name: " + InstName;
Test [i][6] = InstName;
GenName = model_i.GetGenericName();
GenName = "Generic Name: " + GenName;
Test [i][7] = GenName;
}
String inf_name = full_name + "." + DateStg + ".htm";
try {
PrintStream vf = new PrintStream(new FileOutputStream(inf_name));
vf.println( "
" + inf_name + " BOM" ); vf.println( " | |
| " );
for (int u = 0; u < modCnt; u++) {
for (int v = 0; v < 8; v++) {
vf.println( Test[u][v] + " " ); } vf.println( " ********** " ); } vf.println( " | |