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
Thanks in advance,
Carsten





RE: nx journal user function for edit - component - move
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
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 ModuleRE: nx journal user function for edit - component - move
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
PlaceDimBreak
www.nxjournaling.com
RE: nx journal user function for edit - component - move
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
www.nxjournaling.com
RE: nx journal user function for edit - component - move
www.nxjournaling.com
RE: nx journal user function for edit - component - move
Thanks a lot.
Carsten