I've this journal, but doesn't work.
Can someone adjust this Journal ?
Option Strict Off Imports System Imports NXOpen Imports NXOpen.Assemblies Imports NXOpen.UI Imports NXOpen.UF Module NXJournal Sub Main Dim theSession As Session = Session.GetSession() Dim workPart As Part = theSession.Parts.Work Dim displayPart As Part = theSession.Parts.Display Dim lw As ListingWindow = theSession.ListingWindow Dim component1 As Component = nothing If SelectAComponent(component1) = Selection.Response.Ok Then If (component1.GetStringAttribute("REFERENCE_COMPONENT")).Length Then component1.DeleteAttributeByTypeAndTitle(NXObject.AttributeType.String,"REFERENCE_COMPONENT") lw.Open lw.WriteLine(component1.ToString & " is no reference anymore.") Else component1.SetAttribute("REFERENCE_COMPONENT", "1") lw.Open lw.WriteLine(component1.ToString & " is now reference.") End If Else lw.Open lw.WriteLine("Nothing selected.") End If End Sub Function SelectAComponent(ByRef obj As Component) As Selection.Response Dim ui As UI = GetUI() Dim mask(0) As Selection.MaskTriple With mask(0) .Type = UFConstants.UF_component_type .Subtype = 0 .SolidBodySubtype = 0 End With Dim cursor As Point3d = Nothing Dim resp As Integer resp = ui.SelectionManager.SelectObject("Select a component", "Select a component", _ Selection.SelectionScope.WorkPart, _ Selection.SelectionAction.ClearAndEnableSpecific, _ False, False, mask, obj, cursor) If resp = Selection.Response.ObjectSelected Or _ resp = Selection.Response.ObjectSelectedByName Then return Selection.Response.Ok Else return Selection.Response.Cancel End If End Function End Module
I'm using NX 8 and the journa must run in NX 8, but I hope that if will be correct, I can use in NX 9 or NX 10.
When something is marked as deprecated it means it will be removed in a future release of NX. So these calls might not be available in NX9/NX10.
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX184.108.40.206 MP11 64bit Testing: NX220.127.116.11
I tested it on NX 9 and it is working fine. Yes it gives error if you donot have attribute called "REFERENCE_COMPONENT".
I want to set the attribute at assembly level not at component level.