Journal Record.

To All,



I have recorded below journel, When I try to play the same journel it gives me warning saying that Object not found. Here I am trying to put the thread callout on the drawing.

Request to suppout in this regard.




Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main

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

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
' Menu: Insert->Dimension->Feature Parameters...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Origin")

Dim radiusDimension1 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 5 1"), Annotations.RadiusDimension)

radiusDimension1.IsOriginCentered = False

Dim origin1 As Point3d = New Point3d(7.46252623574144, 14.9874887198986, 0.0)
radiusDimension1.AnnotationOrigin = origin1

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Origin")

Dim radiusDimension2 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 1 1"), Annotations.RadiusDimension)

radiusDimension2.IsOriginCentered = False

Dim origin2 As Point3d = New Point3d(2.2681536121673, 14.1217599493029, 0.0)
radiusDimension2.AnnotationOrigin = origin2

Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

Dim scaleAboutPoint1 As Point3d = New Point3d(-8.64845373891001, 3.33040557667934, 0.0)
Dim viewCenter1 As Point3d = New Point3d(8.64845373891001, -3.33040557667934, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)

Dim scaleAboutPoint2 As Point3d = New Point3d(-6.91876299112801, 2.66432446134347, 0.0)
Dim viewCenter2 As Point3d = New Point3d(6.91876299112801, -2.66432446134348, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)

Dim scaleAboutPoint3 As Point3d = New Point3d(-5.69331508238276, 2.22191939163498, 0.0)
Dim viewCenter3 As Point3d = New Point3d(5.69331508238276, -2.22191939163498, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3)

Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Origin")

Dim radiusDimension3 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 4 1"), Annotations.RadiusDimension)

radiusDimension3.IsOriginCentered = False

Dim origin3 As Point3d = New Point3d(3.71480405576679, 14.1716541951838, 0.0)
radiusDimension3.AnnotationOrigin = origin3

Dim nErrs3 As Integer
nErrs3 = theSession.UpdateManager.DoUpdate(markId3)

Dim scaleAboutPoint4 As Point3d = New Point3d(-3.66814580481622, 1.90417926489226, 0.0)
Dim viewCenter4 As Point3d = New Point3d(3.66814580481622, -1.90417926489227, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint4, viewCenter4)

Dim scaleAboutPoint5 As Point3d = New Point3d(-4.58518225602028, 2.38022408111533, 0.0)
Dim viewCenter5 As Point3d = New Point3d(4.58518225602028, -2.38022408111534, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint5, viewCenter5)

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

welcome to this exciting forum!

The effect you realise is that during record, NX also records the exact positions and especially objects you have selected.
So when you try to replay a recorded journal "as is" it will only reproduce the desired results if you provide the exact same situation you had durint record. Of course, this does not make any sense.

What you need to do is remove the "selection stickiness" (along with a few more steps to develop your recorded journal into some kind of generally useful programme).


The tutorial "Beginning Journaling" gives you a very good example on how this can be done, so I would recommend you to go into that; it will explain a lot of questions to get you going.


Have success & enjoy,

Cheers,

/UdoMM

Hello,

Thank you very much for the reply. Request to all to help me solve the below mentioned problem.

I tried to record the Journal while adding the thread callout and am unsuccessful.

Thread Callout :

Threaded callout placed in the drawing. using the command Inser- Dimension-Feature Parameters.

Thread Callout GD&T:

When added GD&T symbol to the threaded callout, The spaces are automatically created,
The objective here is to bring the callout parametric and spaces should not be created when adding the GD&T Symbol. I also noticed that thread dimension (9/16-12), type (UNC) and Class (-2B) are independently can be moved within the callout, This need to be restricted.

Since I have no results while recording the jounal when adding the threaded callout to the views,hence I do not have code right now.

Currently I am adding the threaded callout as a note, this is where there is a possibality of human error and leading to quality issue.

Request for help in developing a journal which will solve above described problem.

Appreciate your quick support.

Software used : NX7.5

Have a good day!

Thanks and Regards,
PPOOJAR

The callout format is defined internally in NX. One user reported that he eliminated the extra space in the callout by modifying the threaded hole .XML file (see http://www.eng-tips.com/viewthread.cfm?qid=318756). The individual elements of the callout can be moved, this behavior will not change whether the callout is created with the interactive commands or with a journal.

You may be able to create a note formatted to your liking with a journal, but then the values will not be associative to the threaded hole.

Hello All,

Thank you for the support.
I am successful in showing the parametric threaded callout using expression in the drawing.
This is working fine with the threads made from threaded hole. Expression for thread size for threaded hole is available in the expressions. But for symbolic threads expression of thread size is not showing up in the expression dialog box.

Please help me, how to find the expression of thread size (callout) for symbolic threads. So that my code can be robust for both threads made from threaded hole and symbolic thread.

Appreciate your support.

Thanks and Regards,
ppojar

What version of NX are you using and how are you creating the symbolic thread?

In NX 8.5, when I use the "thread" command (Insert -> Design Feature -> Thread) and use the "symbolic" type, expressions are created.

Thank you for the reply.

I use NX 7.5 version.

I use the "Symbolic thread" command (Insert -> Design Feature -> Thread) and used the "symbolic" type,

The following expressions are created,

P130 (Symbolic Thread(5) length)

P131 (Symbolic Thread(5) Pitch)

P132 (Symbolic Thread(5) Angle)

P133 (Symbolic Thread(5) Major Diameter)

P134 (Symbolic Thread(5) Minor Diameter)

P135 (Symbolic Thread(5) Tapped Drill Size)

Need some more expression like, the thread size. ex " 1/2-13" and Thread Standard ex: "INCH UNC"

Thread size and Thread standard expression are created by default when used Threaded hole command.

Please help me how to get the thread size and thread standard expression when used symbolic thread command.

Appreciate your kind support.

In the modeling application, run the journal below and select the symbolic thread feature; some information about the thread will be written to the information window.


Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module2

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

Dim lw As ListingWindow = theSession.ListingWindow

Dim threadFace As Face

Sub Main()

If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
lw.Open()

Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim myThreadParms As UFModl.SymbThreadData

Dim mySymThread As NXObject

If SelectAnObject("select symbolic thread", mySymThread) = Selection.Response.Cancel Then
Return
End If

Try
theUfSession.Modl.AskSymbThreadParms(mySymThread.Tag, myThreadParms)
lw.WriteLine("callout: " & myThreadParms.callout)
lw.WriteLine("form: " & myThreadParms.form)
If myThreadParms.rotation = UFConstants.UF_MODL_RIGHT_HAND Then
lw.WriteLine("right hand thread")
Else
lw.WriteLine("left hand thread")
End If

Catch ex As NXException
theSession.UndoToMark(markId1, undoMarkName)
MsgBox(ex.Message)

Finally

End Try

lw.Close()

End Sub

Function SelectAnObject(prompt As String, _
ByRef selObj As NXObject) As Selection.Response

Dim theUI As UI = UI.GetUI
Dim cursor As Point3d
Dim typeArray() As Selection.SelectionType = _
{Selection.SelectionType.Features}

Dim resp As Selection.Response = theUI.SelectionManager.SelectObject( _
prompt, "Selection", _
Selection.SelectionScope.AnyInAssembly, _
False, typeArray, selObj, cursor)

If resp = Selection.Response.ObjectSelected Or _
resp = Selection.Response.ObjectSelectedByName Then
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If

End Function

End Module

Thank you very much. Code worked fine.

Is it possible to show above information as a note (parametric - symbolic thread is edited the note must update the new callout) on the drawing? if yes, kindly help me.

Thanks and Regards,
ppoojar

Request to correct the below code, the intent here is to place a threaded call out parametrically on the drawing. I dont know much about the coding but this problem is bothering me a lot hence in search of the solution. Using NX7.5, Insert-Dimension-Feature Parameters, we can place a callout. but the problem here is if I add GD&T symbol the there is lot of space created between the callout members. Request all of you to help me in this regard.

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main

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

Dim displayPart As Part = theSession.Parts.Display

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

Dim radiusDimension1 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 5 1"), Annotations.RadiusDimension)

radiusDimension1.IsOriginCentered = False

Dim origin1 As Point3d = New Point3d(7.46252623574144, 14.9874887198986, 0.0)
radiusDimension1.AnnotationOrigin = origin1

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Origin")

Dim radiusDimension2 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 1 1"), Annotations.RadiusDimension)

radiusDimension2.IsOriginCentered = False

Dim origin2 As Point3d = New Point3d(2.2681536121673, 14.1217599493029, 0.0)
radiusDimension2.AnnotationOrigin = origin2

Dim nErrs2 As Integer
nErrs2 = theSession.UpdateManager.DoUpdate(markId2)

Dim scaleAboutPoint1 As Point3d = New Point3d(-8.64845373891001, 3.33040557667934, 0.0)
Dim viewCenter1 As Point3d = New Point3d(8.64845373891001, -3.33040557667934, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)

Dim scaleAboutPoint2 As Point3d = New Point3d(-6.91876299112801, 2.66432446134347, 0.0)
Dim viewCenter2 As Point3d = New Point3d(6.91876299112801, -2.66432446134348, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)

Dim scaleAboutPoint3 As Point3d = New Point3d(-5.69331508238276, 2.22191939163498, 0.0)
Dim viewCenter3 As Point3d = New Point3d(5.69331508238276, -2.22191939163498, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3)

Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Edit Object Origin")

Dim radiusDimension3 As Annotations.RadiusDimension = CType(workPart.FindObject("ENTITY 26 4 1"), Annotations.RadiusDimension)

radiusDimension3.IsOriginCentered = False

Dim origin3 As Point3d = New Point3d(3.71480405576679, 14.1716541951838, 0.0)
radiusDimension3.AnnotationOrigin = origin3

Dim nErrs3 As Integer
nErrs3 = theSession.UpdateManager.DoUpdate(markId3)

Dim scaleAboutPoint4 As Point3d = New Point3d(-3.66814580481622, 1.90417926489226, 0.0)
Dim viewCenter4 As Point3d = New Point3d(3.66814580481622, -1.90417926489227, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint4, viewCenter4)

Dim scaleAboutPoint5 As Point3d = New Point3d(-4.58518225602028, 2.38022408111533, 0.0)
Dim viewCenter5 As Point3d = New Point3d(4.58518225602028, -2.38022408111534, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint5, viewCenter5)

End Sub
End Module

The spacing between the callouts is handled internally by NX. I suggest you contact GTAC to see if there is any way to adjust/control the spacing to what you desire.