Hmm..
I modified the code, but there is problem with the difinition of the facetedbody1
' NX 5.0.4.1
' Journal created by llu on Wed May 27 11:11:17 2009 W. Europe Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen
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 basePart1 As BasePart
Dim partLoadStatus1 As PartLoadStatus
Dim markId1 As Session.UndoMarkId
Dim markId2 As Session.UndoMarkId
Dim markId3 As Session.UndoMarkId
Dim markId4 As Session.UndoMarkId
Dim markId5 As Session.UndoMarkId
Dim markId6 As Session.UndoMarkId
Dim objects1(0) As DisplayableObject
Dim facetedBody1 As Facet.FacetedBody = CType(workPart.FacetedBodies.FindObject("HANDLE R-96"), Facet.FacetedBody)
Dim displayModification1 As DisplayModification
Dim partSaveStatus1 As PartSaveStatus
Dim partCloseResponses1 As PartCloseResponses
For Each fileName As String In My.Computer.FileSystem.GetFiles(C:\Documents and Settings\llu\Desktop\BLK10\BLK10)
' ----------------------------------------------
' Menu: File->Open...
' ----------------------------------------------
basePart1 = theSession.Parts.OpenBaseDisplay(fileName, partLoadStatus1)
partLoadStatus1.Dispose()
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Enter Gateway")
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Open Part Navigator")
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Enter Gateway")
' ----------------------------------------------
' Menu: View->Operation->Fit
' ----------------------------------------------
workPart.ModelingViews.WorkView.Fit()
' ----------------------------------------------
' Menu: Edit->Object Display...
' ----------------------------------------------
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start")
theSession.SetUndoMarkName(markId4, "Class Selection")
' Refer to the sample NXOpen application, Selection for "Select All" alternatives.
markId5 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Class Selection")
theSession.DeleteUndoMark(markId5, Nothing)
theSession.DeleteUndoMark(markId4, Nothing)
' ----------------------------------------------
' Dialog Begin Edit Object Display
' ----------------------------------------------
markId6 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Display")
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = False
displayModification1.NewColor = 128
objects1(0) = facetedBody1
displayModification1.Apply(objects1)
displayModification1.Dispose()
' ----------------------------------------------
' Menu: File->Save
' ----------------------------------------------
partSaveStatus1 = workPart.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.False)
partSaveStatus1.Dispose()
partCloseResponses1 = theSession.Parts.NewPartCloseResponses()
workPart.Close(BasePart.CloseWholeTree.False, BasePart.CloseModified.UseResponses, partCloseResponses1)
workPart = Nothing
displayPart = Nothing
partCloseResponses1.Dispose()
Next
End Sub
End Module
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP