×
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

NX9 Journal - Weight as reported in assembly navigator

NX9 Journal - Weight as reported in assembly navigator

NX9 Journal - Weight as reported in assembly navigator

(OP)
I've seen this thread http://www.eng-tips.com/viewthread.cfm?qid=342629 from 2013 which tries to answer ways to get the weight from components in an assembly.

Now I see that the weight can be reported out as a column in the assembly navigator, so I have assumed there is a simple component property that I can query in an NX Journal. However, I can't figure out what that would be.

Am I out to lunch, or is this possible? Note, I tried:

CODE

CPTMASS=ufs.weight.askprops(c.tag,units,weight) 

But I just get the error that "Expression does not produce a value".

Thanks in advance,
Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

Try this instead:

CODE

ufs.weight.askprops(c.tag,units,weight) 

The value(s) will be returned via the properties variable that was passed into the function (in this case, the one named "weight"). Be aware that the "weight" variable will need to be declared as a "UFWeight.Properties" structure as opposed to a simple "double" type variable.

www.nxjournaling.com

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
Right, that makes sense...but now I noticed that when I report weight.mass I get 0.0 for the value even though the assembly navigator shows the actual value.

I also ran the Weight Management function through the NX menus it gives me 0.0 - so from where is the assembly navigator getting the value?

Thanks,
Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

What value is returned in the "cache_state" property? If it is something other than "Cached" or "Asserted", you will need to calculate/assert the weights first (with .EstabCompProps1, .EstabPartProps1, and/or .EstabSolidProps) before asking for the result.

www.nxjournaling.com

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
Yup, it isn't cached (cache_state=0) - but then what is the navigator showing me? I guess I can't trust the navigator results...

Okay, so here is what I tried - I'm missing something again, cause it doesn't work still (it always reports "MASS NOT FOUND"):

CODE

try
ufs.weight.InitExceptions(wexpect) ufs.weight.EstabPartProps(c.tag,0.99,1,units,weight,wexpect) ufs.weight.askprops(c.tag,units,weight) MASS=weight.mass ufs.weight.FreeExceptions(wexpect) catch e as exception MASS = "MASS NOT FOUND"
end try

(I don't really know what the InitExceptions and FreeExceptions are there for, I just read that I need them)

I'm also realizing that I am locking myself into having an advanced assemblies license available when running this journal...I was hoping that wouldn't be the case...

Thanks,
Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

What exception is returned? Check e.message for some more information on the exception type.

Unfortunately, I don't currently have access to an advanced assembly license to do any testing.

www.nxjournaling.com

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
Cool! I didn't even know there was an e.message property!

Anyways, it reports "SafeArray cannot be marshaled to this array type because it has either nonzero lower bounds or more than one dimension."

I commented out the other lines and just left the first one 'InitExceptions' so I would know which line is triggering. As I said, I don't even know what these are for...

Thanks,
Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

If you are using a .net language (VB, C#, etc) try using the EstabPartProps1 method (note the number 1 at the end of the name); it looks like it was added specifically for the .net languages.

Quote (API reference)

In order to provide appropriate .NET binding for UF_WEIGHT_estab_part_props, UF_WEIGHT_estab_part_props1 is introduced.
Note: C/C++ users can continue to use UF_WEIGHT_estab_part_props

www.nxjournaling.com

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
Okay, now I'm learning something. The EstabPartProps1 got me around the weird exceptions marshaling error.

I've got it working now.

Thanks cowski!

Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
So now I've discovered another issue...one of the child components in my assembly somehow is using a different reference set for the weight management ("ENTIRE PART" instead of "PART"). So I figure, okay, I got this, just use:

CODE

ufs.weight.SetPartRefSet(child.owningpart.tag,"PART") 

But it seems that unless I make this component the work part and then set the weight management reference set, it doesn't update correctly. While I guess I could make each component the work part before I set the reference set, that seems like a very inefficient way to go about the problem.

So if there are other ideas how to do this, I'm all ears.

Thanks,
Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

I have two comments:
  1. The code: {component}.OwningPart is going to return a reference to the assembly part; I don't think this is what you want. To get a reference to the component part file, try: {component}.Prototype.OwningPart.
  2. The part may need to be fully loaded for the change to take effect. You can fully load all the parts by changing your load options (if necessary) or you can load them individually with the following code:
    {component part reference}.LoadFully
    or
    {component part reference}.LoadThisPartFully

www.nxjournaling.com

RE: NX9 Journal - Weight as reported in assembly navigator

(OP)
Thanks again cowski! I already realized the LoadFully was needed (is there a difference between LoadFully and LoadThisPartFully?), but I didn't notice the Prototype handle was needed. Once again, that seems to do the trick.

Now if only there was a way to do this without Advanced Assemblies...sigh...

Jeff

RE: NX9 Journal - Weight as reported in assembly navigator

The difference between .LoadFully and .LoadThisPartFully is really only important when the part that you are loading has components. The .LoadFully method will attempt to load any components according to your current load options. The .LoadThisPartFully will not load any of the components no matter what load options are currently in effect.

www.nxjournaling.com

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