cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Creo Jlink: Surface Names

mmartinez-2
1-Newbie

Creo Jlink: Surface Names

Hi all,

I'm new to Creo Jlink, and have been examining the assembleByDatums example function (and commenting with my understanding) provided by PTC. And I came across this snippet of code:

// instantiate array with datum names for component and assembly

  String [] asmDatums = {"ASM_D_FRONT", "ASM_D_TOP", "ASM_D_RIGHT"};

  String [] compDatums = {"COMP_D_FRONT","COMP_D_TOP", "COMP_D_RIGHT"};

  // Place the component initially (just placing it in free space)

  ComponentFeat asmcomp = (ComponentFeat) assembly.AssembleComponent (componentModel,transf);

  //find assembly datum

  ComponentConstraints constrs = ComponentConstraints.create();

  for(int i=0; i<3; i++){

  ModelItem asmItem = assembly.GetItemByName(ModelItemType.ITEM_SURFACE, asmDatums[i]);

  if(asmItem == null){

  iflag = true;

  continue;

  }

  ModelItem compItem = componentModel.GetItemByName(ModelItemType.ITEM_SURFACE, compDatums[i]);

  if(compItem == null){

  iflag = true;

  continue;

  }

After having run the code successfully, I'm confused as to why LINE 11 and LINE 16 in the snippet above return surfaces and not null. The names (ei ASM_D_FRONT and COMP_D_FRONT) provided in the asmDatums and compDatums arrays seem arbitrary to me, and somehow they manage to correctly reference the datum planes in any part and assembly. Do parts and assemblies have a default underlying naming structure for their initial datums? If this is the case can someone point me to where I can find the standard datum names.

If anyone could please explain how LINES 11 and 16 are able to reference the datums planes it would help tremendously!

Cheers

thanks in advance!

0 REPLIES 0
Top Tags