Change lines with a VB prgramm
Change lines with a VB prgramm
(OP)
Hello,
first i`m new to VB.net. I recorded a journal to select all hidden lines in a drawing sheet, change them from dashed to solid and give them a colour. This works but only in the part i recorded it.
My question is how I must change the journal(gruen_machen_1.txt) to select all hidden linesin all drafting views at once in a part.
In my second Journal(gestrichel_machen_2) i have the same problem. I want to select all lines and arcs with a special colour and change them into dashed lines.
If someone could help me that would be great!
Im working with NX 8.0.2.2
first i`m new to VB.net. I recorded a journal to select all hidden lines in a drawing sheet, change them from dashed to solid and give them a colour. This works but only in the part i recorded it.
My question is how I must change the journal(gruen_machen_1.txt) to select all hidden linesin all drafting views at once in a part.
In my second Journal(gestrichel_machen_2) i have the same problem. I want to select all lines and arcs with a special colour and change them into dashed lines.
If someone could help me that would be great!
Im working with NX 8.0.2.2





RE: Change lines with a VB prgramm
A journal will only record some of the steps that you make while recording in NX. If you look at your journal, you will see entries that refer to menu selections, such as:
CODE
and then nothing explicit after it. This means that journaling didn't record that entry and you need to learn how to code the actual method to perform that function. Unfortunately, I don't speak German so I can't figure out exactly what the steps are that the Journal went through.
If you look through this forum and other places on the Web, as well as the .Net reference and samples in the UG/NX Documentation, you can start to piece together how to edit your journal so that it performs the functions you want.
I know this doesn't exactly tell you how to do what you want, but hopefully it sends you in the right direction.
Jeff
RE: Change lines with a VB prgramm
CODE --> NX8
Option Strict Off Imports System Imports NXOpen Module organize_file Dim s As Session = Session.GetSession() Dim workPart As Part = S.Parts.Work Dim dispPart As Part = s.Parts.Display Dim lw As ListingWindow = s.ListingWindow Sub Main() Dim linename As String = "Line" Dim arcname As String = "Arc " Dim curvecolour As Integer = 134 ' Change this colour number as required Dim curves As CurveCollection = workPart.Curves Dim curvesubstring As String = Nothing Dim line1 As Line = Nothing Dim arc1 As Arc = Nothing Dim objects1(0) As DisplayableObject Dim displayModification1 As DisplayModification = Nothing displayModification1 = s.DisplayManager.NewDisplayModification() displayModification1.NewFont = DisplayableObject.ObjectFont.Dashed Dim markId1 As Session.UndoMarkId markId1 = s.SetUndoMark(Session.MarkVisibility.Visible, "Edit Curves") For Each crve As Curve In curves curvesubstring = crve.ToString.Substring(0, 4) If curvesubstring = linename Then line1 = DirectCast(crve, Line) If line1.Color = curvecolour Then objects1(0) = line1 displayModification1.Apply(objects1) End If ElseIf curvesubstring = arcname Then arc1 = DirectCast(crve, Arc) If arc1.Color = curvecolour Then objects1(0) = arc1 displayModification1.Apply(objects1) End If End If Next displayModification1.Dispose() 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 ModuleFrank Swinkels