Meccanista
Aerospace
- Sep 11, 2008
- 2
New PostMeccanista (Aerospace)
30 Jun 09 9:48
I am trying to create a journal in NX-Open – Visual Basic to automatically change the Solid Density of a given set of part files.
It seems that the following simple piece of code has no effect while it is expected to set the density of each solid body in the workpart.
I am currently working with UG NX 4, .Net Framework 1.1, Windows 2000.
' NX 4.0.4.2
' Journal created by ...
'
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 length As Int32 = 0
Dim displayPart As Part = theSession.Parts.Display
theSession.ListingWindow.Open
For Each obj As Body In theSession.Parts.Work.Bodies
If TypeOf obj Is Body Then
obj.Density = 1000
length = length + 1
theSession.ListingWindow.WriteLine(length & ": " & Ctype(obj.Density, String))
End If
Next
End Sub
End Module
30 Jun 09 9:48
I am trying to create a journal in NX-Open – Visual Basic to automatically change the Solid Density of a given set of part files.
It seems that the following simple piece of code has no effect while it is expected to set the density of each solid body in the workpart.
I am currently working with UG NX 4, .Net Framework 1.1, Windows 2000.
' NX 4.0.4.2
' Journal created by ...
'
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 length As Int32 = 0
Dim displayPart As Part = theSession.Parts.Display
theSession.ListingWindow.Open
For Each obj As Body In theSession.Parts.Work.Bodies
If TypeOf obj Is Body Then
obj.Density = 1000
length = length + 1
theSession.ListingWindow.WriteLine(length & ": " & Ctype(obj.Density, String))
End If
Next
End Sub
End Module