Submitted by ftamod on Mon, 05/25/2015 - 15:46
Forums:
I want to delete the lightweight representations from a large list of Assembly Drawings but there is not way to record that option into a Journal with NX 7.5. I have to do it manually.
Is there a way to remove lightweight representations usign Jorunal ?
Thank,
FT.
re: lightweight reps
What steps do you take in interactive NX to remove the lightweight representations?
re: lightweight reps
Here are the steps :
In Modeling, I go to the Menu: Assemblies - > Advance -> Representations -> Delete -> Select All -> OK -> (Question) = Yes
re: lightweight reps
I don't seem to have this option; does it require an advanced assembly license?
re: lightweight reps
No Sr. , that option is available on Modeling without special license. -> NX7.5
I found the following information from Siemens PLM Software Community :
Representations lightweight bodies and the relevent functions mostly reside in the following classes:
NXOpen.UF.UFFacet
NXOpen.Facet.FacetedBodyCollection
NXOpen.Facet.FacetedBody
re: representations
It seems that my install of NX disagrees with you. When I go to Assemblies -> Advanced -> representations..., I get the message: "module not licensed, unable to obtain an advanced assembly modeling license".
Unfortunately, I don't think that I'll be of much help on this one...
re: lightweight reps
Ok, I was poking around the API docs a little bit...
Below is some code for you to test, it attempts to delete any faceted bodies in the work part. I can't test if the result is the same as Assemblies -> advanced -> representations... -> delete all, because I do not have access to that command.
Let me know how it goes...
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Const undoMarkName As String = "delete facet bodies"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
Dim theFacetBodies As New List(Of Facet.FacetedBody)
For Each temp As Facet.FacetedBody In workPart.FacetedBodies
theFacetBodies.Add(temp)
Next
'lw.WriteLine("number of facet bodies: " & theFacetBodies.Count.ToString)
Try
Dim notifyOnDelete1 As Boolean
notifyOnDelete1 = theSession.Preferences.Modeling.NotifyOnDelete
theSession.UpdateManager.ClearErrorList()
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(theFacetBodies.ToArray)
Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId1)
Catch ex As NXException
theSession.UndoToMark(markId1, undoMarkName)
MsgBox(ex.Message)
Finally
End Try
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module
re: lightweight reps
This journal works very well..... lol
Tks,
ftamod