Contact US

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!

*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

Journal help needed, I want to measure the mass of solid body in part and apply it to the expression

Journal help needed, I want to measure the mass of solid body in part and apply it to the expression

Journal help needed, I want to measure the mass of solid body in part and apply it to the expression

I want to make a journal that will measure the mass of the solid body in part and apply it to the expression p3000000. I can record Journal clicks, but I do not know VB more than to edit few lines.
Two issues during the journal recording, the first is that when I use to measure body I can't use Selec All to select solids in part, how to do that?
The second is that I do not know how to make a measure to save mass in p3000000 instead of default pX (X=next available number)?

Enjoy your work and have fun!

RE: Journal help needed, I want to measure the mass of solid body in part and apply it to the expression

below C# code will create a body measurement in a part file. It will create a single measurement for all the bodies in the part file.
It will exclude sheet bodies and use solids only. Please let me know if this solve your purpose or not. incase if u run any issue you can compile and create a dll. file attached.

using System;
using System.Collections.Generic;
using NXOpen;
using NXOpenUI;

namespace Mass_Solid
public class Weight_link
public static void Main(string[] args)
Session theSession = Session.GetSession();
UI theUi = UI.GetUI();
Part workPart = theSession.Parts.Work;
Part displayPart = theSession.Parts.Display;
ListingWindow lw = theSession.ListingWindow;

BodyCollection ball = workPart.Bodies; //Collect all bodied in the part

List<Body> slds = new List<Body>(); //Solid bodies list

//Checking the body is soldi or not


foreach (Body b in ball)
if (b.IsSolidBody == true)



if (slds.Count > 0)
int ctr = slds.Count;
NXObject nu = null;

MeasureBodyBuilder mb = workPart.MeasureManager.CreateMeasureBodyBuilder(nu);

BodyDumbRule bdr = workPart.ScRuleFactory.CreateRuleBodyDumb(slds.ToArray());

SelectionIntentRule[] scr = new SelectionIntentRule[1];
scr[0] = bdr;
mb.BodyCollector.ReplaceRules(scr, false);

Unit[] massUnits1 = new Unit[5];
Unit unit1 = (Unit)workPart.UnitCollection.FindObject("SquareInch");
massUnits1[0] = unit1;
Unit unit2 = (Unit)workPart.UnitCollection.FindObject("CubicInch");
massUnits1[1] = unit2;
Unit unit3 = (Unit)workPart.UnitCollection.FindObject("PoundMass");
massUnits1[2] = unit3;
Unit unit4 = (Unit)workPart.UnitCollection.FindObject("Inch");
massUnits1[3] = unit4;
Unit unit5 = (Unit)workPart.UnitCollection.FindObject("PoundForce");
massUnits1[4] = unit5;

MeasureBodies mbd = workPart.MeasureManager.NewMassProperties(massUnits1, .99, mb.BodyCollector);

Measure measure1;
measure1 = mbd.CreateFeature();





theUi.NXMessageBox.Show("Message", NXMessageBox.DialogType.Information, "This part is not having Solid bodies");


public static int GetUnloadOption(string dummy) { return (int)Session.LibraryUnloadOption.Immediately; }


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! Already a Member? Login


Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close