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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Control part level family table with assembly parameters

mferguson-3
4-Participant

Control part level family table with assembly parameters

Probably a bit of a newbie question but I am looking to have an assembly level parameter(s) that would define what instance of a part is used in the assembly.

 

Example of the use might be a piping selecting a pipe flange on a vessel. The flange part itself is driven by a family table and it is mated to a piece of pipe which is in turn mated to a vessel. I could replace the flange and pipe manually but I want to also drive multiple parts with one parameter change, i.e. I would like to set a parameter to select a 6" flange and have the flange part select the appropriate instance based on the parameter. This parameter would also update the pipe part, the hole in the vessel and the BOM on the drawing.

16 REPLIES 16

With Pro/PROGRAM I believe you can use statements to select members of a Family Table or Interchange Assembly based on parameter values.

 

Dave Martin - dmartin@creowindchill.com - https://www.mcaeconsulting.com

Hi Dave, Thanks for the reply.  Yeah you are probably right since pro/program can control most features in the model. I guess I was hoping for a cleaner parameter + relation type soluion but I'll start learning the syntax I think.

 

Time to dust off that pro engineer automation book I bought years ago!

@DaveMartin probably refers to the "LOOKUP_INST" functions.

 

You can use RELATIONS to let Creo select the correct instance of a family table (FT) based on the input of one or multiple parameters.

 

For example, let's say you have a FT of a bolt, called "bolt.prt". That FT has a parameter called "DIAMETER" and "LENGTH". You have added a bolt (M4x30) to your assembly, and now you want to drive that bolt.

 

If you know the distance/thickness of your construction (two plates bolted together), you can let Creo select the correct bolt length.

 

So, let's assume that you have a parameter called "BOLT_DIAMETER" and "CLAMP_THICKNESS".

The "BOLT_DIAMETER" holds the exact diameter your bolt needs to be, "CLAMP_THICKNESS" is the minimum value/length your bolt needs to be.

 

In your RELATIONS, add this code:

 

BOLT_INSTANCE = LOOKUP_INST("bolt.prt",1,"DIAMETER",BOLT_DIAMETER,"LENGTH",CLAMP_THICKNESS)

 

So how does the "LOOKUP_INST" work?

lookup_inst ("generic_name", match_mode, "param_name_1", match_value_1, "param_name_2", match_value_2,...) 

 

generic_name = the name of your FT, with the extension (.prt or .asm)

match_mode = one of these values

  • -1 (search for the closest instance where the paramater value is smaller or equal)
  • 0 (search for the instance where all the parameters match exactly)
  • 1 (search for the closts instance where the parameter value is equal or greater)

param_name_1 = The name of the FT parameter

param_value_1 = The value that you want to match (accoring to the match_mode)

 

!!! Pay attention to the quotes ("...")  !!!

 

Now, in your PRO/PROGRAM, replace a bit of code where you have added an instance of your bolt to your assembly:

 

ADD PART bolt_m4x30

...

END ADD

 

ADD PART (BOLT_INSTANCE)

...

END ADD

zwilson93
4-Participant
(To:HamsterNL)

UPDATE: 

After refreshing Creo it started to work.

 

 

I'm trying to do the same thing with a turnbuckle assembly, but I seem to be missing something because I am getting a relationship error.

 

This is my look up code

TURNBUCKLE_INSTANCE = LOOKUP_INST("TFAR-12133_TURNBUCKLE_ASSY1.ASM",-1,"INSTANCE", TURNBUCKLE)

 

and I replaced 

ADD SUBASSEMBLY TFAR-12133_TURNBUCKLE_ASSY1
...
END ADD

 

with

ADD SUBASSEMBLY (TURNBUCKLE_INSTANCE)
...
END ADD

 

I added pictures of the turnbuckle family table and some of the parameters from the assembly that the turnbuckles will be in. Can you tell what I may be missing?

 

Thanks,

Zach

The value for "INSTANCE" needs to match a number in the "INSTANCE" column. I think if you change it from zero it would help.

You have a "match_mode" of -1, which means that you are looking for an instance where the parameter "INSTANCE" is equal to 0 (the value of TURNBUCKLE) or lower.

 

There's no match, so the LOOKUP_INST should return the generic.

Hi Hamster,

 

Whether the match value should be a numeric one or can i use another parameter in that.

 

If parameter can be called, Kindly reply how to call it in relation?

 

Thanks in advance

Hari Prasanth 

Hi @HamsterNL,

 

Is it possible to widen the search within the nested family table children?

 

I have a setup like that:
Flange.prt has 1 parameter called type.

One of the types (children) is a "Weld Neck.prt" 

"Weld Neck.prt" has several parameters, one of them being "OD".

When I clear the workspace and open the assembly containing the right member of the "Weld Neck" Table, Creo sees it as a child of the very top "Flange.prt" and gives me an error upon "OD" lookup.

The error disappears only when I load "Weld Neck.prt" to memory.

 

Is there an option to load that automatically when the assembly gets open, or should I avoid nesting family tables?

 

Thanks,

Jakub

Seems that this functionality is limited in cases of multi-level family tables, for example see:

 

LOOKUP_INST issue 

 

Maybe a work-around is to package the sub-level generic "Weld neck.prt" in your assembly, in order to force it to be in session and thereby assuring that the relation does not fault.  But you'd need AAX for this and then you'd have to filter it out of the drawing's BOM table...

 

I think you should submit to PTC a product enhancement or bug ticket.

 

@pausob 

Thank you for the tip, we have AAX. We need that to edit PRO/PROGRAM anyways.

I did a bit of a research and I think you mean EXECUTE command, don't you?

 

The syntax to package a part in the assy without adding it is (in case of my WeldNeck.prt):

 

EXECUTE PART WELDNECK

 

END EXECUTE

 

I gave it an extra thought and I think I won't post it as a bug.

The thing is, at the same level as WeldNeck.prt, we have other flanges with exactly the same parameters of their children. The logic here is: if it's nested - find the right parent first and then look for a child. Otherwise, you don't really need nesting.

As a next step, I will modify the query to lookup the right flange on the Weldneck.prt level based on its parameters (flange material, flange type) and then use that queried flange as input to execution.

 

Thanks,

Jakub

Sorry, I misspoke.  I meant to say "include", not "package".

They are both under the "Assemble" flydown menu, in the component section of the model tab (in assembly mode)

I tried "include" and it worked in that the sub-generic is brought into session.

I didn't try to see if the INST_LOOKUP things work.

Also note nice thing about "include" is that the component isn't actually "there" (though, it does show up in BOM reports)

@pausob 

Oh man, you're so  fast to reply! I found a solution and modified my answer.

The command in Pro/program that works is EXECUTE

It loads my weldneck to memory.

Hmm, I thought EXECUTE had something to do with setting the component's parameters, but it seems like it is also a way to load the component into session - without it showing up in the model tree...  Cool, I learn something new.

Usually when I need to do this kind of thing I resort to family tables. The subcomponents of interest have family tables, so they have all the versions of each component that I will need. Then, in the assembly, I have the subcomponents as columns in the table. Add entries for all the versions of the assembly that I want. For each column of subcomponents, where it usually just has "Y" or "N", instead put in the name of each subcomponent's instance that I want for a particular version of the assembly. When you bring up one of the assembly instances, if you've done things right, you get the mix of subcomponents that you want.

It's not a picnic setting up, but it's reliable.

mferguson-3
4-Participant
(To:KenFarley)

Great information, thanks. Allows me to look for more things to learn.

 

Ulimately this is all going to be connected / run off a spreadsheet

I'd advise you to develop your model using Pro/Program, as @DaveMartin suggested.

 

Output your data (parameter values) from your spreadsheet to a formatted text file and regenerate your customised models using the 'Read File' option.

 

@KenFarley gave another piece of the jigsaw, "where it usually just has "Y" or "N", instead put in the name of each subcomponent's instance". You can make the selection of instances at regeneration time using the parameter values output from your spreadsheet.

Top Tags