×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Change lines with a VB prgramm

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

RE: Change lines with a VB prgramm

Sim77Son,

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

' ----------------------------------------------
'  Menü: Bearbeiten->Auswahl->Detailliertes Filtern...
' ---------------------------------------------- 

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

Here is an example journal for changing curve font. Note that you need to change the integer value for the curve color.

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 Module 

Frank Swinkels

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources