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.

Pro/E and Jlink ?’s

pageld

New member
Alright. After many hours of toil and trouble, I would like to find out if this is even possible. Keep in mind, I'm a programmer, not an engineer and I don't use pro/E regularly at all.

The goal is to find and replace custom part numbers in a pro/E drawing.

Right now what happens is someone selects specific parameters about a product. This information is then used to create a trail file by doing some text replacing of a base trail file.

The trail file is then run through an automated process that makes the drawing for the product. This process adds parts needed to manufacture this product and some of these parts are custom, they have widths and heights that change based on the selected parameters.

These 'custom' parts have part numbers that start with the product name so they can be found inside the drawings and logic that is built.

Is it possible to find these 'custom' parts, go to an already built java program to get a list of part numbers and replace the original name of the part with the actual part number? If it is, how is it done?

Hopefully I kept everything simple enough to be understood. Maybe it was too simple
smiley1.gif
.

I did try the supplied tutorial; I took many Excedrin trying to understand it. If there are any other tutorials I can
 
Dave,


I'm not sure exactly what you are asking. Are you asking to replace parts on a drawing or just rename existing ones?


Why are you using a trail file to create the drawing? Pro/TOOLKIT has API's to do that and everything else you want to do. For a couple simple tutorials go to www.frotime.com.
 
the goal is to rename existing parts.


The trail file method is just the method that has been used before I even got here. I will check out that site tutorial site and see what I can find.


Thanks
Dave
 
actually, no we don't. That kinda explains the whole craptacular way we're doing things right now. According to ptc.com this renaming of parts is possible in jlink, i just am having a terrible time reading the documentation. Ptc's support knowdedge base is a bit easier on the 'non-engineer', but it still doesn't totally help.

Thanks!
Dave
 
I figured something out and thought I'd share. To replace parts with part numbers, here is a method:

Code:
 public static void start()
 {
  //set up the item number assigner. Since this is not running through tomcat
  // we can't use the connection pool and have to connect to each database
  // seperately
  ItemNumber itemnum = new ItemNumber();
  itemnum.useConnectionPool(false);
  
  try
  {
   //get the session that holds the open model
   BaseSession session = (BaseSession)pfcGlobal.GetProESession();
   //get all the models (parts) from the open body
   Models mods = session.ListModels();
   //declaration/initialization of variables
   Model mod;
   ArrayList ptips = new ArrayList();

   //loop through all the parts that are in this particular model
   for (int x=0; x<mods.getarraysize(); x++)
   {
    //get the model out of the vector
    mod = (Model)mods.get(x);  
    //if the parameter standard exists...
    if (mod.GetParam("STANDARD") != null)
     //if the value of standard is C as in custom
     if  (mod.GetParam("STANDARD").GetValue().GetStringValue().equals ("C"))
      //add the custom part to the custom part vector
      ptips.add(mod);
   }
   //get a vector of part numbers out of the item number assigner that equal the amount of 
   // custom parts there are in the model
   Vector nums = itemnum.getQuickItemNumbers("1000", "proe", "", true, true, ptips.size());
   //make sure everything is all equaled out
   if (nums.size() == ptips.size())
   {
    //loop through all the numbers from the item number estimator
    for (int x=0; x<nums.size(); x++)
    {
     //get the model
     mod = (Model)ptips.get(x);
     //rename the title of the part to be the value found by the item number assigner
     mod.Rename(nums.get(x).toString(), new Boolean(false));
    }
   }
  }
  catch(Exception e)
  {
   //if something goes wrong, output a pop up with the error code
   displayMessage(e);
  }
  
  stop();
 }

hope that's commented well enough so that it's useful to someone.

Just as a note, that item number assigner object is an object used to get some part numbers generated out of a database.
 

Sponsor

Articles From 3DCAD World

Back
Top