Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX3/winXp, Macro question

Status
Not open for further replies.

jackley

Automotive
Sep 2, 2004
263
This may be really out there, but I figured I would ask.

I am wondering if I would be able to create a macro that would do the following;

-Get volume of part
-Save volume
-Go into expressions and rename 2 of them
-v for volume
-sa for surface area
-Move the point that volume creates to a layer (usually layer 10)

It's one of your tedious tasks and looking to make this more efficient. Like I said, I am certain it's out there. But maybe some ideas are out there?



Justin Ackley
Designer
 
Replies continue below

Recommended for you

That is actually not a problem. Every time the surface area expression is p13 and volume is p14.

We put the body measurement into our drawing formats. They are consistently those two values.

I figured my biggest problem would be selecting the solid since it'll be different everytime.

Justin Ackley
Designer
 
My comment about the expression was based on the assumption that this macro could be run anytime during the life of a model which means that there would be no way to predict the expression names.

As for selecting the body, give it a name and select by name.


John R. Baker, P.E.
Product 'Evangelist'
NX Design
Siemens PLM Software Inc.
Cypress, CA
 
There was a macro question earlier, that I described a solution about exporting DXF files. The solution in your case might be similar. You need either to isolate your geometry before you run the Macro and use select all solid bodies for the mass calculation, or make use of "Pause for User input" when you create the macro, so that each time it is played back it will stop and allow you the select the geometry that you want to analyze.

If you are going to capture the results as an expression added to a note on the face of the drawing please beware that you may have problems with out of date data upon opening the drawing files later on.

Regards

hudson
 
I am going to bring this back up to the top with a new question.

Can you make a macro that renames some expressions? Based on my previous questions, about renaming the measurements (typically p13 to sa and p14 to v).


Justin Ackley
Designer
 
Justin,

Macro's have a range of functions which are very limited. My feeling on this is that renaming will probably be possible and that any macro you create may work on the part it was created with, but for any other part where the expressions differ then it will have trouble selecting the correct expression to rename. I think you can probably test this for yourself.

Now the modern day compliment of macros would be journals which so far as I can see don't have the ability to do "pause for user input". Perhaps by trying a macro the calls a journal or vice-versa you may be able to get a fully workable result. Brief testing didn't yield too much joy for me so don't be surprised if you have to resort to programming solutions to get what you actually want.

For components being those part which contain the solid models the assembly weight management is the way to go, but only if you have an advanced assemblies license.

For assemblies we haven't had as much luck. In the past if we wanted to get a total mass then we have to do pretty much what Justin is suggesting. I wonder if upcoming versions of NX will provide better results.

Best Regards

Hudson
 
Hudson,

Journals can effectively have pauses for user input.
If you call a selection dialogue in the journal the user can select anything from the session that's on screen like any normal UG command.
If you wanted a user input box you can call a form up with a text input on the form.
Basically they can be as complex as you like and have as much user interaction as you need.
I'm pretty sure renaming expressions would be supported in journals but may be a UF command and might not be supported from recording a journal.




Mark Benson
Aerodynamic Model Designer
 
9 times out of 10, our expressions are always named the same. We have drawings that we save the volume into and it's always p13 for surface area and p14 for volume.

I guess the simplest way is just to use the p13 and p14.

Justin Ackley
Designer
 
Mark,

You clearly know more about this than I do which is why we're here on the forum. I had a half hearted go at testing this by recording both journals and macros without much luck. I was hoping somebody like yourself could come in with a better idea. If you could possibly point us at a good example of what you're talking about then I'm sure we'd all be grateful.

Best Regards

Hudson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor