Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

macro for sending objects to layers 2

Status
Not open for further replies.

berri2

Mechanical
Apr 6, 2010
139
Hi all,

How can I create a macro, to send model objets, solids, splines, points, datums etc. To selected layers with a macro or .dll.

For example,

Solids to layer_1, Points to layer_2, Splines to layer_3 etc.

I want a customized macro o a .DLL file. But I am not a programmer.

Some help.

Thanks.
 
Replies continue below

Recommended for you

A macro follows whatever keystrokes you used when creating it, so as far as sending model objets, solids, splines, points, datums etc to specific layers use you masks to turn make only the type of object selectable that you want put into a specific layer.

For example if you want to move splines into a specific layer:
Format > Move to Layer > type > toggle only curves "On" > detail filtering (at bottom of window) > spline > ok > ok > "select all" > ok > pick the layer that those splines will go into

You don't need to be any sort of programmer to do a macro, but it may take a little practice . . . just remember that it will follow whatever keystrokes you do after you select "start macro" unp until "stop record"
 
Actually this is the sort of thing which GRIP does a pretty good job with. Do you have a GRIP execute license? If so, please provide a complete list of what you want on which layer.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Hi John,

Yes I have open license on GRIP, .NET, API etc.
But I am quiet new user on NX programming.
I don't know yet, how to execute a GRIP program on NX. Usually I execute .VB macros and some . dll files.
Just simple program to change color to pieces, etc.
Just with some example I can try to customize it.

I am using NX 7.5.3

Thanks.
 
Attached is a simple GRIP program which will move a list of object types, each to a user designated layer. To execute the program, just go to...

File -> Execute -> GRIP...

...and select the GRIP executable (.grx) file.

Try it out and see if this was what you were looking for.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Hi John,

Your are right, I was looking for this.

I am going to pass this GRIP to VB.

I thik is more open .VB programing for loading on NX, with jounaling.

Thanks.
 
Hi John,

How can I pass this GRIP program to C++ or VB code?

Thanks.
 
You can spawn a program from GRIP and there are ways to pass data between them, but I would need more information as to what it is that you're looking to pass between programs.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Attached is a similar VB journal which moves the same types to similar layers as John's GRIP program. I have saved it as a .txt file in the zip. Just change the extension back to .vb.

Just for education purposes I have used three different methods for the object types. This should make it possible to extend it for any other types of displayable objects.

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=8c5f0bf4-a467-4c7a-b0b4-a96c922584cb&file=layermove.zip
Hi Frank,

This was I am looking for, one questions how can I customize this .VB, as John's GRIP that it takes a small window, for changing defined layers on the .VB.

I don't know with .VB how to take this small interface windows.

Thanks.
 
Attached is the modified journal which uses a BlockStyler dialog. Please note the following:

This dialog is only suitable for NX7.5. The dialog code means that to use it on say NX6 would throw an error.

Make sure the dlx file is in one of the following locations:
1.) From where NX session is launched
2.) $UGII_USER_DIR/application
3.) For released applications, using UGII_CUSTOM_DIRECTORY_FILE is highly recommended. This variable is set to a full directory path to a file containing a list of root directories for all custom applications. e.g., UGII_CUSTOM_DIRECTORY_FILE=$UGII_ROOT_DIR\menus\custom_dirs.dat

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=08d10490-3f57-4d50-988b-e5fa830cbb25&file=MoveToLayer.zip
Frankswinks

I am confused on your UGii_use_dir/application suggestion where to put the DLX file. Could you please explain a little bit better on how to set this up?

Will this work running NX out of teamcenter?

We very new to NX and this will work great for us. Thanks.
 
Here is one method to have access to the dialogs. My example is what I use. You can change the directories as needed.

1) Assume we have a directory structure.

C:\uguser\application
C:\uguser\startup
C:\uguser\udo

The application subdir contains all my dlx files (for Block Styler)

The startup subdir contains any tbr files (for toolbars) and any dll files which are loaded at startup (ie in the tbr files).

The udo subdir contains any udo dll files.

2)We now need to place an entry in an appropriate custom_dirs.dat file.

My custom_dirs.dat file (for NX6) is at:

C:\ugs\nx6\UGII\menus\

Edit the custom_dirs.dat file by adding a line which in my case is

C:/uguser/

Note do not use C:/uguser/application. NX would look for C:/uguser/application/application which of course does not exist.

3) Finally create an environment variable.

The variable name is UGII_CUSTOM_DIRECTORY_FILE

The variable value is C:\ugs\nx6\UGII\menus\custom_dirs.dat (based on the above example values)

Hope this helps.

Frank Swinkels
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor