×
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

nx journal user function for edit - component - move

nx journal user function for edit - component - move

nx journal user function for edit - component - move

(OP)
Hello, I have a journal to place a gap (user defined symbol "gap25") on a selected dimension line, if 2 lines are crossing. Depending on the dimension's orientation the correct position of the gap is not so easy to pick. A fine tuning with "File - Component - Move" is often required. This command has a good preview for the gap' position. It would be much easier, if automatically after placing the gap on the dimension line, the gap hangs on the mouse and can be moved on the dimension line for putting it on the right place. Now I am looking for a way to include this in my journal. Hopefully someone can say me the user function to hande this command.
Thanks in advance,
Carsten

RE: nx journal user function for edit - component - move

What code are you using to place the gap symbol? If the code is from here:
http://nxjournaling.com/content/break-dimension-ex...

I'd be interested in seeing an example file where you need to adjust the gap placement after running the journal. It is a bit tricky getting the placement correct for all cases, I'd like to improve the code if I can.

www.nxjournaling.com

RE: nx journal user function for edit - component - move

Hello,

maybe you need something like this?

Motion Callback VB Example

CODE --> VB

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
 
Module Module1
 
    Dim idSymbolBuilder1 As Annotations.IdSymbolBuilder
 
    Sub Main()
 
        Dim theSession As Session = Session.GetSession()
        Dim theUfSession As UFSession = UFSession.GetUFSession
        Dim workPart As Part = theSession.Parts.Work
        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()
 
        Dim myScreenPos(2) As Double
        Dim theViewTag As Tag = theSession.Parts.Display.Views.WorkView.Tag
        Dim theResponse As Integer
 
        Dim myIdSymbol As Annotations.IdSymbol
        If SelectIdSymbol("select ID Symbol", myIdSymbol) = Selection.Response.Cancel Then
            Exit Sub
        End If
 
        idSymbolBuilder1 = workPart.Annotations.IdSymbols.CreateIdSymbolBuilder(myIdSymbol)
 
        'lw.WriteLine("symbol type: " & idSymbolBuilder1.Type.ToString)
        'lw.WriteLine("symbol size: " & idSymbolBuilder1.Size.ToString)
        'lw.WriteLine("symbol text: " & idSymbolBuilder1.UpperText)
        'lw.WriteLine("symbol origin: " & idSymbolBuilder1.Origin.OriginPoint.ToString)
 
        theUfSession.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
 
        theUfSession.Ui.SpecifyScreenPosition("pick a point", AddressOf MotionCallback, Nothing, myScreenPos, theViewTag, theResponse)
 
        theUfSession.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
 
        idSymbolBuilder1.Destroy()
 
    End Sub
 
    Function SelectIdSymbol(ByVal prompt As String, ByRef selObj As TaggedObject) As Selection.Response
 
        Dim theUI As UI = UI.GetUI
        Dim title As String = "Select an ID Symbol"
        Dim includeFeatures As Boolean = False
        Dim keepHighlighted As Boolean = False
        Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
        Dim cursor As Point3d
        Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
        Dim selectionMask_array(0) As Selection.MaskTriple
 
        With selectionMask_array(0)
            .Type = UFConstants.UF_drafting_entity_type
            .Subtype = UFConstants.UF_draft_id_symbol_subtype
        End With
 
        Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
         title, scope, selAction, _
         includeFeatures, keepHighlighted, selectionMask_array, _
         selObj, cursor)
        If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
            Return Selection.Response.Ok
        Else
            Return Selection.Response.Cancel
        End If
 
    End Function
 
    Sub MotionCallback(ByVal pos() As Double, _
                       ByRef motion_cb_data As UFUi.MotionCbData, _
                       ByVal client_data As System.IntPtr)
 
        Dim point1 As Point3d = New Point3d(pos(0), pos(1), pos(2))
 
        idSymbolBuilder1.Origin.Origin.SetValue(Nothing, Nothing, point1)
        idSymbolBuilder1.Commit()
 
    End Sub
 
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
 
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
 
        '----Other unload options-------
        'Unloads the image immediately after execution within NX
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
 
        'Unloads the image explicitly, via an unload dialog
        'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
        '-------------------------------
 
    End Function
 
End Module 

RE: nx journal user function for edit - component - move

(OP)
Thanks for the answers,
I didn't use these journals from cowski for my work. They work very fine for the most cases, especially the first way to create the gap manually. One thing that is not regognised is the crossing of an extension line and an dimension line (as mentioned in the Infotext). Only extension lines are regognised, but especilly for angular gimensions you get somtimes this situation.
That's the major reason why we would prefer the optional way, to move the gap directly after placing it on the extension or dimension line.

Schellenbergj: I am looking for something like that, but I don't know how to move this user defined symbol attached to the dimension. A way to get in the "File - Component - Move" Commant would be very helpful. Maybe there is one way.

Best regards
Carsten

RE: nx journal user function for edit - component - move

I had some time to work on this today; I'm running out of time to work on it, so it isn't thoroughly tested or as tidy as I'd like, but it is in working condition. Let me know if you have any problems with it. Feel free to use any or all of it.

PlaceDimBreak

www.nxjournaling.com

RE: nx journal user function for edit - component - move

(OP)
Hello Cowski,
thanks for your work, but your new journal does not run on my NX8 or NX9 installation. It allways stops with errors.
I have created now a mixture of journal and macro to get nearly that what I need. The manual positioning could be a bit more comfortable but it works.
For the automatic creation of the gaps I used the journal from www.nxjournaling.com

Maybe someone else wants to use this for his work or further improvements.

Best regards
Carsten

RE: nx journal user function for edit - component - move

I tested with NX 8.5 and 9 with no errors. The code uses an API feature not available before 8.5, so an error in NX 8 (or earlier) is to be expected. But it should run in NX 9; what error message do you get with NX 9?

www.nxjournaling.com

RE: nx journal user function for edit - component - move

I updated the code to remove the reference that made it incompatible with versions lower than 8.5. I tested it against NX 7.5, 8, 8.5 and 9; it works as intended in those versions. Download from the same link as above.

www.nxjournaling.com

RE: nx journal user function for edit - component - move

(OP)
It works very well now and it is exactly what I need.
Thanks a lot.
Carsten

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