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.
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 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.