×
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

Journal For Moving Component

Journal For Moving Component

Journal For Moving Component

(OP)
Hi,

I Have following conditions to be Changed to Code.

1. I have a Axis and movement value along the axis I want Translation Vector for this.
2. I have a axis Which need to be converted to Double in this format "Dim MyAxis as Double ={Axis.XXX, Axis.YYY, Axis.ZZZ}" it is to find Rotation Matrix for DragbyTransform method.


If MovementType = "Fixed" Then
Continue For
ElseIf MovementType = "Alongaxis" Then
Dim NewAxis As NXOpen.Axis = Nothing
For Each Myaxis As NXOpen.Axis In workPart.Axes
Try
If Myaxis.GetStringAttribute("Curve Name") = "MovementReference" Then
NewAxis = Myaxis
End If
Catch ex As NXException
End Try
Next

componentPositioner1.BeginMoveComponent()
Dim allowInterpartPositioning1 As Boolean
allowInterpartPositioning1 = theSession.Preferences.Assemblies.InterpartPositioning
Dim network1 As Positioning.Network
network1 = componentPositioner1.EstablishNetwork()
Dim componentNetwork1 As Positioning.ComponentNetwork = CType(network1, Positioning.ComponentNetwork)
componentNetwork1.MoveObjectsState = True
Dim nullAssemblies_Component As Assemblies.Component = Nothing
componentNetwork1.DisplayComponent = nullAssemblies_Component
componentNetwork1.NetworkArrangementsMode = Positioning.ComponentNetwork.ArrangementsMode.Existing
componentNetwork1.NonMovingGroupGrounded = True
componentNetwork1.MoveObjectsState = True
componentNetwork1.RemoveAllConstraints()
componentNetwork1.SetMovingGroup(GroupObjects)
Dim loaded1 As Boolean
loaded1 = componentNetwork1.IsReferencedGeometryLoaded()
componentNetwork1.BeginDrag()
Dim translation1 As Vector3d = New Vector3d(0.1, 0, 0) 'Instead of New Vector3D, This Should Be generated from Newaxis and input value like 25 mm in NewAxis
componentNetwork1.DragByTranslation(translation1)
componentNetwork1.EndDrag()
componentNetwork1.ResetDisplay()
componentNetwork1.ApplyToModel()
componentNetwork1.Solve()
componentPositioner1.ClearNetwork()
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(componentNetwork1)
componentPositioner1.DeleteNonPersistentConstraints()
componentPositioner1.EndMoveComponent()
Dim nullAssemblies_Arrangement As Assemblies.Arrangement = Nothing
componentPositioner1.PrimaryArrangement = nullAssemblies_Arrangement

ElseIf MovementType = "Aboutaxis" Then
Dim NewAxis As NXOpen.Axis = Nothing

For Each Myaxis As NXOpen.Axis In workPart.Axes
Try
If Myaxis.GetStringAttribute("Curve Name") = "MovementReference" Then
NewAxis = Myaxis
End If
Catch ex As NXException
End Try
Next
MsgBox("Got the Axis")
Dim AboutPoints() As String = Split(MovementPivot, " ", 3)
Dim RotPoint() As Double = {AboutPoints(0), AboutPoints(1), AboutPoints(2)}
Dim RotAxis() As Double = {NewAxis.DirectionVector.X, NewAxis.DirectionVector.Y, NewAxis.DirectionVector.Z} 'This I want to get from New Axis
Dim RotAngle As Double = MovementValue
Dim RotMatr4D(15) As Double
Dim RotMatr3D(8) As Double
Dim TransVec(2) As Double
ufs.Mtx4.Rotation(RotPoint, RotAxis, RotAngle, RotMatr4D)
ufs.Mtx4.AskRotation(RotMatr4D, RotMatr3D)
ufs.Mtx4.AskTranslation(RotMatr4D, TransVec)
Dim RotMatr As Matrix3x3 = convertToMatrix3x3(RotMatr3D)
componentPositioner1.BeginMoveComponent()
Dim allowInterpartPositioning1 As Boolean
allowInterpartPositioning1 = theSession.Preferences.Assemblies.InterpartPositioning
Dim network1 As Positioning.Network
network1 = componentPositioner1.EstablishNetwork()
Dim componentNetwork1 As Positioning.ComponentNetwork = CType(network1, Positioning.ComponentNetwork)
componentNetwork1.MoveObjectsState = True
Dim nullAssemblies_Component As Assemblies.Component = Nothing
componentNetwork1.DisplayComponent = nullAssemblies_Component
componentNetwork1.NetworkArrangementsMode = Positioning.ComponentNetwork.ArrangementsMode.Existing
componentNetwork1.NonMovingGroupGrounded = True
componentNetwork1.MoveObjectsState = True
componentNetwork1.RemoveAllConstraints()
componentNetwork1.SetMovingGroup(GroupObjects)
Dim loaded1 As Boolean
loaded1 = componentNetwork1.IsReferencedGeometryLoaded()
componentNetwork1.BeginDrag()
Dim translation1 As Vector3d = New Vector3d(TransVec(0), TransVec(1), TransVec(2))
componentNetwork1.DragByTransform(translation1, RotMatr)
componentNetwork1.EndDrag()
componentNetwork1.ResetDisplay()
componentNetwork1.ApplyToModel()
componentNetwork1.Solve()
componentPositioner1.ClearNetwork()
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.AddToDeleteList(componentNetwork1)
componentPositioner1.DeleteNonPersistentConstraints()
componentPositioner1.EndMoveComponent()
Dim nullAssemblies_Arrangement As Assemblies.Arrangement = Nothing
componentPositioner1.PrimaryArrangement = nullAssemblies_Arrangement
End If

RE: Journal For Moving Component

Quote (Altojoe)

Dim translation1 As Vector3d = New Vector3d(0.1, 0, 0) 'Instead of New Vector3D, This Should Be generated from Newaxis and input value like 25 mm in NewAxis

The Axis object type has a .DirectionVector property. You can query the vector components, calculate the unit vector and multiply each component by the total distance to move along the vector. This will give you the translation vector.

www.nxjournaling.com

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