Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Fixing this Journal Please 1

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
I recorded a journal where I select points and move them to layer 230

I have been trying to merge it with another journal so that it will let the user select the points that will be moved. I know this is an easy enough task to do without a journal, but my goal is, once it is done, it will also filter so only points with the color 60, 66 & 75 can be selected. This is something I do quite often when on particular jobs and it grows tiring always having to set the filters. Over and over. So I figured I would create a journal that makes it all much easier.

However, the journal I have keeps erring out on the same line. (where the recorded journal selects points form a particular components. I need it to let me select from any component in the assembly. I have been trying to figure out how to rewrite this line but my knowledge is simply far too restricted.

The line in question (To my belief) is now bracketed by two long lines of dashes to help it stand out in the code.

If someone can please give me the fix, I would greatly appreciate it.

Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
 
Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim displayPart As NXOpen.Part = theSession.Parts.Display

        Dim thePoints() As NXObject



        If SelectPoints("Select points", thePoints) = Selection.Response.Cancel Then
            Return
        End If



        Dim objectArray1(0) As NXOpen.DisplayableObject
-------------------------------------------
         Dim point1 As NXOpen.Point = CType(component4.FindObject("PROTO#.Features|WELD_POINTMARK_ELEMENT(7)|POINT 1"), NXOpen.Point)
-------------------------------------------
        objectArray1(0) = point1
        workPart.Layers.MoveDisplayableObjects(230, objectArray1)


    End Sub


    Function SelectPoints(ByVal prompt As String, byRef selObj() as NXObject) As Selection.Response
 
        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select points"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific

       Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
       'Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart

        Dim selectionMask_array(0) As Selection.MaskTriple
 
        With selectionMask_array(0)
            .Type = UFConstants.UF_point_type
            .Subtype = UFConstants.UF_point_subtype
        End With
 
        Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selobj)
        If resp = Selection.Response.Ok Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If
 
    End Function
 
 
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
 
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
 
    End Function
 
End Module



Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Replies continue below

Recommended for you

Is the goal to get all the points with color 60, 66, and 75 moved to layer 230? If so, it might actually be easier to write code that does it without a user selection.

www.nxjournaling.com
 
I definitely need to be able to select specific ones. We have a file with hundreds of spots. Sometimes well over a thousand. All spots are just points with attributes assigned to them. We have to create templates for surfaces showing where the spots are. Each time I create a new template, which could have 1 to 50 spots, I like to move the points I used to layer 230 which will be turned off. This way the spots I have already done will not still be showing up and making the job confusing. Quite often we will have a bunch of templates where there are only 2 to 5 spots on each. So I have to move them to layer 230 quite often to get them out of the way.

I used to just have this button working with a macro, but when we upgraded, something went wrong I believe. Now when I record a macro with a user entry, it errors out on playback. I currently have a couple people in other companies who are going to record the same macro when they get the chance. I am hoping that the problem is in the recording and I can compare them to ours and see something I can change manually. IF not, then at least I will be able to tell IT that it records them right, but doesnt play them back right for some reason. But with this problem, I am forced to spend a lot of time that I dont have to figuring out how to make the same buttons with Journal. Which I am slowly, ever so slowly getting better at, but still really suck. lol

Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Crap. I am usually so good at adding that and I have been forgetting lately. At the top it says NX1872. Not sure if that is equivalent to NX13 or what.

Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Hey Cowski,

I dont know if it will make any difference or not, but I just happened to notice in a macro I tried to record, that it listed us at NX1969. I just checked and that is the version we have. For some reason it lists the last version at the top of our sessions. lol

Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
I don't think it will matter. I asked because one of the new versions (1980?) has some new selection filters that I was going to try out.

www.nxjournaling.com
 
Awesome as always Cowski.

My mind is a bit burnt out on this today, so tomorrow or Monday I will need to look closer at how this works compared to the other journals that allow user selection. This one looks different with the extra functions.

Thank you very much.



Ken
My brain is like a sponge. A sopping wet sponge. When I use it, I seem to lose more than I soak in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor