Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Deleting Principle Axis (Not Datum) in Journal

Status
Not open for further replies.

alj722

Aerospace
Nov 4, 2004
36
0
0
US
I am working on a script to automate the clean-up of large STEP imports into NX11. One thing I would like to clean up is a principle axis that is added to every part (not a datum CSYS which I want to keep). I would like to rid my imported model of these. There may be a way to turn it off during the import, but I have so much work into the model at this point, I would rather just script it. As part of the clean up journal I would like to select and delete them in each part/assembly but I can't figure out how to select these in the Journal file because they are not a feature or a body or a datum or anything else I can identify. I was looking for a way to simply dump out everything in the model and see if I can figure out how it is identified, but it doesn't seem to fit into any of the classes I am familiar with. Anyone dealt with selecting these in a journal file? I've attached a small assembly that has a few of them in case you'd like to give it a look.

Thanks in advance,

Drew
 
 https://files.engineering.com/getfile.aspx?folder=1bbf9813-9976-47b7-b396-69197834fdfb&file=Debug.zip
Replies continue below

Recommended for you

That is a coordinate system. You can create one in NX by going to menu -> format -> WCS -> save; a coordinate system object will be created at the location of the WCS.

An NX part has a .CoordinateSystems collection that you can iterate through to find these objects. Be aware that datum csys features also create a coordinate system object as part of the feature. You will need a way to differentiate the coordinate systems used by a datum csys feature and those used individually. The .AskObjectFeat method is one way to determine if the coordinate system object is used by a feature or not.

www.nxjournaling.com
 
That did it! Thank you. I was using .CoordinateSystem (Singular). I put together a rather clunky journal file to simply count coordinate systems (to make sure I was getting it to work) and it appears that it also counts the WCS as a coordinate system. With a CSYS and two additional coordinate systems, it counts 4 of them.

I really appreciate the help!

Drew

[pre]
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpenUI
Imports NXOpen.UF


Module NXJournal

Sub Main()
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
Dim intCartCount as integer = 0

lw.Open()

For Each aCart As CartesianCoordinateSystem In workPart.CoordinateSystems
lw.WriteLine(aCart.ToString())
intCartCount += 1

Next
lw.WriteLine("Number of Coordinate Systems = " & intCartCount.ToString())

End Sub

End Module
[/pre]
 
You can ask the type and subtype of the object. You are looking for UF_coordinate_system_type (45), with a subtype of UF_csys_normal_subtype (0). If you find an object with subtype = 1, that is the WCS.

The type definitions below are taken from the uf_object_types.h file (found in the UGOPEN directory).
Code:
#define UF_coordinate_system_type                45
#define    UF_csys_normal_subtype                      0
#define    UF_csys_wcs_subtype                         1
#define    UF_csys_cylindrical_subtype                 2
#define    UF_csys_spherical_subtype                   3

www.nxjournaling.com
 
Status
Not open for further replies.
Back
Top