Cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Mass-Attribute in an Assembly

Builder
Builder

Hello,

 

I´m currently searching for a solution, to get a mass-attribute of all it´s components mass in an assembly. I would like it in top-level-assembly and all subassemblies. I know, I can make the values visible in the ANT - column "Weigth (kg)" or "Weight (lb)" ... But there are some disadvantages:

  • I need the value as an attribute, e.g. for a assembly-drawing.
  • The word "Weight" is wrong! The dimension "kg" is for the mass, not the weight.Weight is the force in "N". In germany many people say "Gewicht", but they mean the mass.

For my purposes, I have created in all single parts some expressions and attribute, which gives me the possiblility to view german or english keywords as column-headings and attributes. All of my body-attributes (surface, density, mass, volume, weight) have the dimension behind it in the same attribute-string. Here as an example for the mass-attribute (english only):

Expressions:Mass-Expr.jpg

 Attribute:

Mass-Attr.jpg

 

In the ANT I can make the column for this attribute visible:

Mass.jpg

 

 

 

 

 

 Both rows with values are from the components. The empty row above is from the assembly.

NX has a System-Value in the ANT - "Weight(kg)":

Weight_kg.jpg

 

 

 

 

 

Here we see in the upper row above the component-values the value of the assembly. But without dimension - only in the column-header (with the wrong word).

So for me to understand is, what type of attribute is displayed here? I searched in the log-file an found a line with this:

NAV3.jpg

 

On the right side we see some entries for "MASS_LB", "MASS_GM" and "MASS_KG". These entries are the alias-names for the headers for "Weight (xx)" in the ANT.

Can I get these attributes - or whatever it is - to make them accessable for me, to create new attributes with dimensions? They should also be automatically updatet as the original-values of them.

I don´t want a program as a solution, cause this means, the user has to do it manually, which can end in unwanted failures. I found a solution for that in an other post.

 

I hope of many answers and a good and practical solution.

 

Michael

 

Michael Eichelberg, CAD-Consultant, Dr. Wallner Engineering Nord GmbH
Production: NX10.0.3 MP16, NX11.0.1 MP4
Development: Batch and VB Testing: NX12
10 REPLIES

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

I can't speak for NX11, but in NX9 I haven't found any solution for this other than running a program

as suggested in PR 7328190 Resolution Letter, which I suggest you to read and also explains why we are not going to have a solution for this problem anytime soon.

My program calls UF_WEIGHT_estab_part_props to extract the weight value (which is basically  the same as in the Weight column of the Assembly Navigator) and put it into a new user attribute CACHED_MASS  created for this, which is referenced in the weight tabular note on the drawing.

As I don't want users to intervene manually either, I embedded scripts in NX commands (by Menuscript)  to keep such attribute up to date (prior to Plot, Print, PDF-Export, and Save the script is run and the attribute is updated).

 

Re: How to get the Mass-Attribute in an Assembly

Builder
Builder

Hi Maurizio,

 

I read the PR, but the workaround in that don´t look to be my solution. NX must have an - mybe internal - attribute withe the name "MASS_KG" (e.g.). I think Siemens will not give this attribute to anyone, because it normaly needs the advanced assembly license.

But can you show me your program, which creates you the attribute and how you implement it e.g. in the "Save"-function?

I my case I would like to have or to create a program, where I can select all components which should be included in the calculation for the assembly mass. The selction can be useful, cause we have sometimes components with WAVE-Geometrie, Reference-Componentes ...., which can give us wrong values.

 

Michael

Michael Eichelberg, CAD-Consultant, Dr. Wallner Engineering Nord GmbH
Production: NX10.0.3 MP16, NX11.0.1 MP4
Development: Batch and VB Testing: NX12

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

here is the script I use, which is mostly taken from the aforementioned PR letter.

I suppose you could change the unit, by studying the UFWeight documentation

 

   Public s As Session = Session.GetSession()
   Public ufs As UFSession = UFSession.GetUFSession()


   Sub Main()

      Dim workPart As Part = s.Parts.Display

      ' check the system cached mass value
      Dim wprops As UFWeight.Properties
      Dim wtype As UFWeight.UnitsType
      wtype = UFWeight.UnitsType.UnitsKmm
      Dim exceptions() As UFWeight.Exceptions = Nothing     
      
      Try
         ufs.Weight.EstabPartProps1(workPart.Tag, 0.9, True, wtype, wprops, exceptions)  'accuracy must be low in order to get the cached value (a full scale weight recalculation would occur otherwise)
      Catch ex As Exception
            MsgBox("The weight note on this drawing didn't update."  & vbCrLf  & vbCrLf , MsgBoxStyle.Exclamation, "Weight note didn't update" )
      End Try

    If Not wprops.mass_state.ToString = "NoCache" Then
       ' if there is a valid cached value, set it into the user attribute CACHED_MASS (mass system value is still not accessible, so we have to rely on a user attribute for title block)
       workPart.SetUserAttribute("CACHED_MASS", -1, wprops.mass, Update.Option.Now)
    Else
       MsgBox("Mass is out of date", MsgBoxStyle.Exclamation, "Check the part mass")
    End If

   'here put the code to force the update of your tabular notes containing the weight

End Sub

 

the script is embedded within a few NX commands via menuscripting, that is a .men file is created which makes the script to automatically run before o after a regular NX command

 

VERSION 120

EDIT UG_GATEWAY_MAIN_MENUBAR

MODIFY

  BUTTON UG_FILE_PRINT
  ACTIONS/PRE update_weight_note.vb

  BUTTON UG_FILE_PLOT
  ACTIONS/PRE update_weight_note.vb

  BUTTON UG_FILE_EXPORT_PDF
  ACTIONS/PRE update_weight_note.vb

...

END_OF_MODIFY

 

To me, selecting components is looking for trouble.

This topic has been previously debated a lot of times on this forum (and bbsnotes) , and examples have been provided (for example by John B.) of what can go wrong.

I would let Weight Management, which can do that, to take care of this nasty issue and just interface it by the code, as the PR letter suggests to do.

Re: How to get the Mass-Attribute in an Assembly

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

Hi Maurizio 

 

Thanks for posting this information. I am able to establish weight of assemblies through a NX open custom utility that we call during PDF generation. So with the utility we get the assembly weight populated in the title block of the PDF but title block of drawing itself does not have this value. Is there a way i can call the custom utiltiy on save operation from NX? Do you have an exmaple of this or have any tips for me? 

 

Thanks!

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

hello Satish,

 

sorry for replying late, I have just come back from my holidays.

If you don't have an actual weight note on your drawings and you

need one, that's an ordinary tabular note containing reference

to the mentioned CACHED_MASS attribute, it just needs to be

updated before plotting, exporting, etc. (for the sake of simplicity I have

omitted the code for this in my previous example, but I can post that

if you want).

If you want to invoke a custom utility prior to save, this is Menuscripting and

you should modify your add-on .men file to add a

BUTTON UG_FILE_SAVE_PART
ACTIONS/PRE your custom utility

as in previous .men example.

 

I'm not sure I have understood your workflow though, would you explain that in detail ?

 

 

Re: How to get the Mass-Attribute in an Assembly

Siemens Experimenter Siemens Experimenter
Siemens Experimenter

Hi Maurizio 

 

i was able to figure out the menu override. As per your  example we used the save operation pre extension point for placing our customization. The customization is triggered as expected and the weight is also calcualted with one caveat. The total weight includes the weight of referenced components where as we do not want weight of references components in our calcualtions. Do you know a way to solve this issue? 

 

for e.g. our assembly has 2 components 

Name---------QTY------- Weight (kg)

ASM 01------------------- 150  

- Cmp 011---1----------- 50

- *Cmp 02---1------------100

 

*Cmp02 is a reference component and we do not want its weight rolled up into the assembly. 

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

Satish,

 

there is a Customer Default option for this, try

 

Customer Defaults -> Analysis -> Weight Management > Exclude Ref. Only Components from Weight Calc.

 

 

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

@Maurizio wrote:

Satish,

 

there is a Customer Default option for this, try

 

Customer Defaults -> Analysis -> Weight Management > Exclude Ref. Only Components from Weight Calc.

 

 


Hi Maurizio,

the option works only on parts and not on sub-assembly.

Thank you...

Using NX 11 / RuleDesigner PDM

Re: How to get the Mass-Attribute in an Assembly

Phenom
Phenom

it is the opposite actually, and this is as designed.

You are expected to select sub assemblies and components as well.