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!

Journal to list reference sets in a part 1

Status
Not open for further replies.

DQuick

Aerospace
Dec 8, 2010
8
Is there any way to create a list of reference sets in a part?

We are in the process of taking ~2000 models from a customer and reformatting them to our standards which requires replacing the existing reference sets with our own along with a few other cleaning operations. I have been able to automate most of the cleaning operations using a journal file, but as of yet I cannot handle reference sets. Our current method requires going through each part and manually deleting each refernece set, then adding at least one reference set for the solid.

I have gone though the .net api reference as far as I can follow but cant figure out where to pull a list of reference sets from a part. I have found how to add and removed them and how to add items to them, but nothing to list them.

referenceSet1 = workPart.CreateReferenceSet()
referenceSet1.SetName("model")
referenceSet1.AddObjectsToReferenceSet(components1)
workPart.DeleteReferenceSet(referenceSet1)

Any suggestions would be gratefully appreciated.

UG NX 6.0.4.3
 
Replies continue below

Recommended for you

Make sure the Reference Set column is enabled in the Assembly Navigator and then export it to the Spreadsheet.

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.
 
This is being done on the detail level, not the assembly. The assemblies that they feed into currently use various reference sets or entire part and we will be replacing them all to use a single model reference set.

Is there a way to list each reference set in a detail part or just delete all existing ones, which our ultimate goal?

UG NX 6.0.4.3
 
Attached are two programs. The first is a c program which was created some time ago (ChangeReferenceSets.c) I have compiled it for NX7.5. It has been compiled and signed to run as executing a NXOpen program. It allows you to change all components reference set to either model or empty. If this is along the lines of what you are looking for I can rewrite it using a .NET language. You can decide if you wanted a different reference set (such as lightweight) also included.

The second program simply reports the reference sets for all components. This has been written more recently and is in VB. I have also compiled it and signed it.

Frank Swinkels
 
 http://files.engineering.com/getfile.aspx?folder=d5c1f471-b29e-4cba-9a5b-50ec731c0893&file=ReferenceSetProgs.zip
@FrankSwinks

The programs are similar to what I was looking for but from looking at them i found the CycleObjsInPart function which has allowed me to accomplish what I was looking for. Thanks

Below is what i cam up with:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UF.UFObj
imports nxopen.utilities

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim WorkPart As Part = theSession.Parts.Work
Dim TheUFsession As UFSession = UFSession.GetUFSession()
Dim NULLTAG As Tag = NXOpen.Tag.Null
Dim objectTag As Tag = NXOpen.Tag.Null

theUfSession.Obj.CycleObjsInPart(workpart.Tag, NXOpen.UF.UFConstants.UF_reference_set_type, objectTag)

Do

Dim myrefset As referenceset = Nothing
Dim myObject As NXObject = Nothing

myObject = NXObjectManager.Get(objectTag)
myrefset = CType(myObject, referenceset)

MsgBox("Name = " & myrefset.name)

theUfSession.Obj.CycleObjsInPart(workPart.Tag, NXOpen.UF.UFConstants.UF_reference_set_type, objectTag)


Loop While objectTag <> NULLTAG

End Sub
End Module

UG NX 6.0.4.3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor