×
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 wavelink body

journal wavelink body

RE: journal wavelink body

(OP)
Cowski, I have have not figured this one out yet.

RE: journal wavelink body

Are you working with an assembly file and linking components up to the assembly level, or creating linked bodies between component files, or something else?

In any case, I'd recommend recording a journal while creating the linked bodies you want. When you get a journal that does what you want when you replay it, we can edit it to generalize it and trim out the unnecessary stuff the recorder throws in.

www.nxjournaling.com

RE: journal wavelink body

(OP)
I have an assembly file filled with different types of components.
I have code to link over components. I select a component as a workpart, and run the journal. It gives me a selection scope, I choose another part and it creates and unassociated wavelink. I would to make this wavelink associative because that is how I need to run it in order for everything to work.

This is the code that recorded when I ran the wavelink command but I cannot get it to replicate the command through journal.

CODE --> vb

' ----------------------------------------------
'   Menu: Insert->Associative Copy->WAVE Geometry Linker...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")

Dim nullFeatures_Feature As Features.Feature = Nothing


If Not workPart.Preferences.Modeling.GetHistoryMode Then
    Throw(New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."))
End If

Dim waveLinkBuilder1 As Features.WaveLinkBuilder
waveLinkBuilder1 = workPart.BaseFeatures.CreateWaveLinkBuilder(nullFeatures_Feature)

Dim waveDatumBuilder1 As Features.WaveDatumBuilder
waveDatumBuilder1 = waveLinkBuilder1.WaveDatumBuilder

Dim compositeCurveBuilder1 As Features.CompositeCurveBuilder
compositeCurveBuilder1 = waveLinkBuilder1.CompositeCurveBuilder

Dim waveSketchBuilder1 As Features.WaveSketchBuilder
waveSketchBuilder1 = waveLinkBuilder1.WaveSketchBuilder

Dim waveRoutingBuilder1 As Features.WaveRoutingBuilder
waveRoutingBuilder1 = waveLinkBuilder1.WaveRoutingBuilder

Dim wavePointBuilder1 As Features.WavePointBuilder
wavePointBuilder1 = waveLinkBuilder1.WavePointBuilder

Dim extractFaceBuilder1 As Features.ExtractFaceBuilder
extractFaceBuilder1 = waveLinkBuilder1.ExtractFaceBuilder

Dim mirrorBodyBuilder1 As Features.MirrorBodyBuilder
mirrorBodyBuilder1 = waveLinkBuilder1.MirrorBodyBuilder

extractFaceBuilder1.FaceOption = Features.ExtractFaceBuilder.FaceOptionType.FaceChain

waveLinkBuilder1.Type = Features.WaveLinkBuilder.Types.BodyLink

compositeCurveBuilder1.AllowSelfIntersection = True

extractFaceBuilder1.FaceOption = Features.ExtractFaceBuilder.FaceOptionType.FaceChain

extractFaceBuilder1.TraverseInteriorEdges = True

extractFaceBuilder1.AngleTolerance = 45.0

waveDatumBuilder1.DisplayScale = 2.0

compositeCurveBuilder1.AllowSelfIntersection = True

extractFaceBuilder1.ParentPart = Features.ExtractFaceBuilder.ParentPartType.OtherPart

theSession.SetUndoMarkName(markId1, "WAVE Geometry Linker Dialog")

extractFaceBuilder1.Associative = True

extractFaceBuilder1.FixAtCurrentTimestamp = False

extractFaceBuilder1.HideOriginal = False

extractFaceBuilder1.InheritDisplayProperties = False

Dim selectObjectList1 As SelectObjectList
selectObjectList1 = extractFaceBuilder1.BodyToExtract

' ----------------------------------------------
'   Menu: Edit->Selection->Select All
' ----------------------------------------------
' Refer to the sample NXOpen application, Selection for "Select All" alternatives.
Dim objects1(0) As TaggedObject
Dim component1 As Assemblies.Component = CType(displayPart.ComponentAssembly.RootComponent.FindObject("COMPONENT_REV_PLATE"), Assemblies.Component)

Dim body1 As Body = CType(component1.FindObject("PROTO#.Bodies|BLOCK(3)"), Body)

objects1(0) = body1
Dim added1 As Boolean
added1 = selectObjectList1.Add(objects1)

Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "WAVE Geometry Linker")

Dim nXObject1 As NXObject
nXObject1 = waveLinkBuilder1.Commit()

theSession.DeleteUndoMark(markId2, Nothing)

theSession.SetUndoMarkName(markId1, "WAVE Geometry Linker")

waveLinkBuilder1.Destroy()

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

RE: journal wavelink body

Where you able to get this to work?

RE: journal wavelink body

Finally had some time to look at this. Below is some code to create an associative linked body. Before you run it you should have an assembly as the display part and one of the components as the work part. The journal will prompt you to select a solid and it will associatively link the body into the work part. The code is just to test the wave linking and does no error checking; if it is run when the display part is the same as the work part, you may get unexpected results or errors.

CODE

'journal to create associative wave linked body
'with an assembly as the displayed part, make one of the components the work part (this component will receive the linked body)
'run the journal, you will be prompted to select a solid body
'the selected body will be associatively linked into the current work part

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 mySolid As NXObject  
        If SelectSolid("Select a solid", mySolid) = Selection.Response.Cancel Then  
            Exit Sub  
        End If  

        Dim markId1 As Session.UndoMarkId  
        markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Start")  

        Dim nullFeatures_Feature As Features.Feature = Nothing  

        If Not workPart.Preferences.Modeling.GetHistoryMode Then  
            Throw (New Exception("Create or edit of a Feature was recorded in History Mode but playback is in History-Free Mode."))  
        End If  

        Dim waveLinkBuilder1 As Features.WaveLinkBuilder  
        waveLinkBuilder1 = workPart.BaseFeatures.CreateWaveLinkBuilder(nullFeatures_Feature)  

        Dim extractFaceBuilder1 As Features.ExtractFaceBuilder  
        extractFaceBuilder1 = waveLinkBuilder1.ExtractFaceBuilder  

        extractFaceBuilder1.FaceOption = Features.ExtractFaceBuilder.FaceOptionType.FaceChain  

        waveLinkBuilder1.Type = Features.WaveLinkBuilder.Types.BodyLink  

        extractFaceBuilder1.FaceOption = Features.ExtractFaceBuilder.FaceOptionType.FaceChain  

        waveLinkBuilder1.CopyThreads = False  

        extractFaceBuilder1.ParentPart = Features.ExtractFaceBuilder.ParentPartType.OtherPart  

        theSession.SetUndoMarkName(markId1, "WAVE Geometry Linker Dialog")  

        extractFaceBuilder1.Associative = True  

        extractFaceBuilder1.FixAtCurrentTimestamp = False  

        extractFaceBuilder1.HideOriginal = False  

        extractFaceBuilder1.InheritDisplayProperties = False  

        Dim selectObjectList1 As SelectObjectList  
        selectObjectList1 = extractFaceBuilder1.BodyToExtract  

        extractFaceBuilder1.CopyThreads = False  

        Dim added1 As Boolean  
        added1 = selectObjectList1.Add(mySolid)  

        Dim nXObject1 As NXObject  
        nXObject1 = waveLinkBuilder1.Commit()  

        theSession.SetUndoMarkName(markId1, "WAVE Geometry Linker")  

        waveLinkBuilder1.Destroy()  

    End Sub  

    Function SelectSolid(ByVal prompt As String, ByRef selObj As NXObject) As Selection.Response  

        Dim theUI As UI = UI.GetUI  
        Dim title As String = "Select a solid"  
        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.AnyInAssembly  
        Dim selectionMask_array(0) As Selection.MaskTriple  

        With selectionMask_array(0)  
            .Type = UFConstants.UF_solid_type  
            .SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY  
        End With  

        Dim resp As Selection.Response = theUI.SelectionManager.SelectObject(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  

End Module 

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