Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Issues editing crosshatch settings NX1980/2000 2

Status
Not open for further replies.

BCE75

Industrial
Dec 6, 2018
10
0
0
US
My employer just made the switch from NX11 to NX1980. My department uses NX to edit drawing sheets to use in Adobe Illustrator. I used to use a macro that would let me edit the appearance of all crosshatching in every view of the drawing sheet. Unfortunately, the same method doesn't seem to work anymore in the new version of NX. The settings we change on the crosshatch are the distance and color. I have found how to make these changes, but I haven't found how to make the changes to every view on the drawing sheet. Right now I am having to find and select every instance of crosshatch because detailed filtering isn't finding them all. In NX 11 I used to be able to select the crosshatch in filtering, do a "select all", and that would highlight every instance of crosshatch on the drawing sheet. That doesn't seem to work now.

As of now, my method of changing the settings is- Select each instance of crosshatch, right click on it, select "settings", make my changes, then click "close". I feel that there must be a better, more efficient way to do this.

Thanks!
 
Replies continue below

Recommended for you

Are you using the same settings for every drawing that you create? If so, I suggest editing your template file to the desired crosshatch settings (drafting preferences -> annotation -> crosshatch/area fill). When you create a new file, the cross hatches will be created with your desired settings, no editing needed.

If you set your main selection filter to "symbol" and the detailed filter to "crosshatch" and press "Ctrl + A", all the crosshatches should be selected unless they are on a "visible only" layer. If this isn't working in NX 1980, you might want to open a case with GTAC.

www.nxjournaling.com
 
cowski,

We don't usually create the drawing sheets. Those come from engineering and we manipulate them to work for our parts and service books. Will changing this work for when I load the drawing?

I assumed "Ctrl + A" would work as normal, but it hasn't been. I can select them all individually just fine though. It's weird.
 
Changing that setting in an existing part won't affect any existing crosshatches, but it will apply to newly created ones.

Do you always use the same distance and spacing values? Sounds like a task that could be handled by a small journal.

I don't have NX 1980 installed to test with, but changing the detailed filtering and using "Ctrl + A" works for me on NX 1919 and NX 2206. If it doesn't work for you, I'd suggest opening a case with GTAC.

www.nxjournaling.com
 
Copy the following to a plain text file (notepad), change the values for the distance and color number, and save the file with a ".vb" extension. In NX, use menu -> tools -> journal -> play (or Alt + F8) to run the journal.

Code:
'NXJournaling.com
'July 28, 2022

'Change the color and distance values of all cross hatch objects in the current work part

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()

    Dim theUI As UI = UI.GetUI()
    Dim lw As ListingWindow = theSession.ListingWindow

    Sub Main()

        Dim markId1 As Session.UndoMarkId
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Crosshatch")

        lw.Open()

        '*******************************************************************************
        'Edit the following values to your desired settings before running the journal
        Const myHatchDistance As Double = 0.25
        Const myHatchColor As Integer = 103
        '*******************************************************************************


        For Each tempHatch As Annotations.Hatch In theSession.Parts.Work.Annotations.Hatches
            Dim editSettingsBuilder1 As NXOpen.Annotations.EditSettingsBuilder = Nothing
            editSettingsBuilder1 = theSession.Parts.Work.SettingsManager.CreateAnnotationEditSettingsBuilder({tempHatch})

            Dim editsettingsbuilders1(0) As NXOpen.Drafting.BaseEditSettingsBuilder
            editsettingsbuilders1(0) = editSettingsBuilder1
            theSession.Parts.Work.SettingsManager.ProcessForMultipleObjectsSettings(editsettingsbuilders1)

            editSettingsBuilder1.AnnotationStyle.HatchStyle.Color = theSession.Parts.Work.Colors.Find(myHatchColor)

            editSettingsBuilder1.AnnotationStyle.HatchStyle.HatchDistance = myHatchDistance

            Dim nXObject1 As NXOpen.NXObject = Nothing
            nXObject1 = editSettingsBuilder1.Commit()

            editSettingsBuilder1.Destroy()

        Next

        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

www.nxjournaling.com
 
I've been testing this journal today and I haven't had any issues. It catches every instance of crosshatch and changes every one.

Thanks again!
 
Status
Not open for further replies.
Back
Top