Journal to list reference sets in a part
Journal to list reference sets in a part
(OP)
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.
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





RE: Journal to list reference sets in a part
John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Industry Sector
Cypress, CA
http://www.siemens.com/plm
http://www.plmworld.org/museum/
To an Engineer, the glass is twice as big as it needs to be.
RE: Journal to list reference sets in a part
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
RE: Journal to list reference sets in a part
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
RE: Journal to list reference sets in a part
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