Skip to main content
13-Aquamarine
May 10, 2024
Question

PARAMETER FOR NUMBER OF COMPONENTS PRESENT IN AN ASSEMBLY

  • May 10, 2024
  • 5 replies
  • 7492 views

Hello everyone,

there is one function, in relation, wich returns a parameter  representing the number of components in an assembly. 

It would be the equivalent of the &rpt.qty parameter present in the table
report or the %$quantity parameter present in the BOM configuration file.

Many thanks for your time, greetings Luca.

 

 

5 replies

24-Ruby III
May 10, 2024

Hi,

unfortunately, there is no such parameter on assembly level.

13-Aquamarine
May 10, 2024

Hi Martin,

it seems impossible, it is a parametric software!

Luca.

tbraxton
22-Sapphire II
22-Sapphire II
May 10, 2024

This may be useful for you.

 

Use the Search Tool:

Click on Search > Component > Name.
Define the name or leave it blank to search for all components.
Click Find Now to get the number of items found

13-Aquamarine
May 10, 2024

Hi, 

I’ve already tried this
I need a function, within relationships, I can’t do manual operations for what I need.

Same as these:
VOLUME=mp_volume("")
CODE=rel_model_name

etc...

for example invented : NUMBER_PARTS=rel_moldel_assembly_parts

Luca.

tbraxton
22-Sapphire II
22-Sapphire II
May 10, 2024

I believe @MartinHanak is correct, I am not aware of any function to support what you are asking for. You may be able to do it with a Creo Toolkit app assuming there is a function call to get the total # of components. I am not sure if such a function is available in toolkit.

tbraxton
22-Sapphire II
22-Sapphire II
May 10, 2024

If you are able to use repeat regions in a drawing table, then you can use this method.

 

  • The total sum quantity of all parts can be obtained if the following settings are made in the Relation section of the Repeat Region of drawing
    • IF asm_mbr_type == "ASSEMBLY"
      NUM= 0
      ELSE
      NUM=rpt_qty
      ENDIF
13-Aquamarine
May 10, 2024

Hi,

many thanks for the soluction, bat 
I already know this, in drawing tables,

I need to have a number inside the assembly file to handle relationships.

Luca

 

18-Opal
May 12, 2024

You can use any parameter of your repeat region in that relation, but as far I read, you know that.

And I’m pretty sure that with „exist“ and the model name you are capable to increase a parameter of your own.
The only thing, I don’t know, to create a new integer var in a relation, and use it later for increase.

 

The assignment of a

  model_name_tag = appearance count,

by not knowing the variable, is an issue. I never tried to init a variable by using name, type and a tag by creating the names string upfront. For a static self created var, this should work.


You also may need a second table to filter and display the result.

 

Search in a string may work, to get an idea, and I would try to use the run time ID, this is unique (for flexible comp, this must be checked). 

 

I have Never tried 
LHS: A+itos(comp.id) = FooBar …

To create a var like A1234

 

I guess Creo will blame on you😉 with this LHS.

 

For the default relation, is there not an array a() or c() available? The index could be the search position of all run time ids.

 

The first component may have a component parameter, and a global statement, which will set the var to zero on Regen start.

 

To make that clear, this is a hack, and your colleagues will start crying 😢

 

So, write the Bom to file, parse it by a script, prepare and run a mapkey, may much easierヤ 

 

In Tookit this is quite simple, I would guess 1 day, depends of the requirement from your site, and how to identify the quantity vars later.

 


My 2 🪙

 

10-Marble
May 13, 2024

Hi,

as the others already mentioned, I don't think there is a OOTB solution. But there are two Modelcheck Check Names, called

 

NUM_COMPONENTS
UNQ_COMPONENTS

 

which represent the number of components (sum and unique) in an assembly.

 

Years ago I wrote a nested mapkey (1. regenerate modelcheck 2. OS-script: iterate through the newest modelcheck .xml file, look for the lines with these check names and their values 3. create these parameters in the assembly accordingly 4...) to get number of components in my assemblies. It is possible, but a really dirty solution.

 

Here is a PTC Tutorial to get the OVERALL_SIZE Modelcheck Check Name as a parameter:
https://www.youtube.com/watch?v=W1WAMeK-NNc

18-Opal
May 15, 2024

I like this kind of a riddle, but if I understand your request, you want to have the parameter within your assembly, because you have no relations in a drawing.

 

Do you need a component parameter, in that case which component hold the summary.

 

Example relation line in an assembly:

count_of_com_box = compcount(“box.prt”,no) 

with the args, name of component and a recursive Boolean yes or no for flat.

 

But if you have this, there is no automation. Because the parameter name and the model name must be given by you. 

And again, you can format your own BOM output and parse that file.

13-Aquamarine
May 15, 2024

Hi RPN,

I want to do what I do with the table in the drawing

(example relations used:

value_rtp_qty=rpt_qty*asm_mbr_valore
&rpt.rel.value_rtp_qty)
directly together without doing the drawing.

One system could be the BOM, but I want to manage it directly from the assembly.

Best Regards Luca.

 

 

15-Moonstone
May 20, 2024

I think this is useful and a sensible thing to ask for two reasons.

It's a common thing that CAD users might need to perform and that a CAD package should make it easier to perform.

 

When the software lacks functionality, a needed task might be done with a "workaround". In this case, it is putting notes manually, and having to review and very attentive to design changes. So, there might be lots of companies making this manually since there is (almost) no other option. For a CAD package that has PARAMETRIC in its name, this tarnishes a little bit the parametric nature of it for certain tasks.

 

The other option, to implement it via toolkit, which would be apparently a simple task for large to middle sizes companies, this might guarantee the parametric nature of results. But for small to medium sized companies, who lack knowledge with programming skills to use one of the toolkits available this is out of the question. And the other workaround of having to process modelcheck XML output files or processing trail text files is very cumbersome, and probably also not parametric in nature, since if the user changes the assembly and forgets to run the script, the results will not be updated.

 

It's better to add a simple and easy to add internal Creo function to the relation repertoire, to allo the user to call said function in a post regeneration relation.

 

Since MBD tables do not allow yet repeat regions, this request can be one way to enhance the possibility to add repeat regions inside an assebly level MBD table.

 

At least three functions would be useful:

 

1. One to count the component quantity in the current assembly level.

2. One to count the component in the current assembly level or any of sub-assembly levels.

3. One to count the component total instances in the top level assembly that the current assembly might be a member of.

 

The 3rd option would imply first an upward search to identify the top level assembly in which the assembly is a member of and then traversing down again to count the total number of instances. This option would have to be trated more carefully to avoid excessive regeneration times or repetitive loops.

 

Currently we have the problem of having to manually specify the number of quantity that a certain part is needed for a project to put it in the drawing legend. This is not possibile to be achieved without manual intervention. The user adds drawings for parts, not for components, so, at part level, there is no way to have the "quantity" available. This implies to have to perform manual editing of quantities for such drawings, which is error prone. There should be a way for Creo to automatically treat a drawing part as a component part in the context of an assembly, or a top level assembly to transfer those parameters to the part drawing. For companies that use Windchill this is solved problem, but for small companies, this remains an unsolved problem. We have drawings in different folders, that even if the drawing is for the same part, the quantities of said part will be different for different projects. Creo could update the quantities automatically for drawings saved locally on the same folder as an assembly or top level assembly.