×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

weight of component

weight of component

weight of component

(OP)
I used this macro from mark to assign the part properties into drawing file...
option strict off
Imports System
Imports NXOpen
Imports NXOpen.Assemblies
imports system.windows.forms

Module NXJournal

    Dim thesession As Session = Session.GetSession()

sub Main
Dim thesession As Session = Session.GetSession()

Dim comp As ComponentAssembly = thesession.parts.work.ComponentAssembly
dim c as component = comp.rootcomponent
dim children as component() = c.getchildren
dim child as component
For Each child In children
dim prototype as part
if typeof child.prototype is part then
prototype = CTYPE(child.prototype,part)
messagebox.show(prototype.leaf)

end if
next
end sub


does anyone have an idea how to measure the weight of each component_? i am able to write a macro,that goes through all the components,but how to measure them???
thanks
vit

RE: weight of component


If you have advanced assemblies you will have access to the weight management system. It is under File>Properties, using the weight tab. You can also set customer defaults to have it maintained upon saving of parts.

Assemblies are assigned a mass of zero, under this system, but you could run a very conventional journal file to maintain that value possibly as an attribute, which you would then use to drive a note on the drawing.

There is also the ability to create and expression based on a mass measurement in the drawing file. I have used this in teh past and found it causes trouble when the underlying assembly content changes.

Regards

Hudson

RE: weight of component

Vit,

If you want to do this programmatically you need to use the command "ufs.weight.askprops(cur_part_tag,units,weight)"

If you look in the docs under uf_weight it's there.

here's an example that will return the current weight of the work part.

The weight has to be updated either manually or set to update on save under file->proporties under the weight tab.


Option Strict Off
Imports System
Imports NXOpen
imports nxopen.uf

Module NXJournal
Sub Main

Dim nxs As Session = Session.GetSession()
Dim ufs as UFSession = UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()

dim cur_part_tag as tag = nxs.parts.work.tag
dim weight as ufweight.properties
dim units as ufweight.unitstype


ufs.weight.askprops(cur_part_tag,units,weight)
msgbox(weight.mass)




End Sub
End Module

Mark Benson
Aerodynamic Model Designer

RE: weight of component


Hi,

adding to above threads, if you need to go on an assembly in a single shot, use ufs.Weight.EstabPartProps in which the recursive flag will do the work on the contributions from the individual components of the assembly..

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources