Hi all,
please check the below code I need some tweaks in this
1. remove parameters of extracted bodies
2. add color and transparency to bodies
3. rotate bodies about user input axis at user input angle
' NX 10.0.1.4
' Journal created by gashaik on Sat Jun 27 14:16:08 2016 India Standard Time
' Extracts Body from wavelink to work prat without link
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 mySolids() As NXObject
If SelectObjects("Select Solids to Link", mySolids) = 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 = False
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(mySolids)
Dim nXObject1 As NXObject
nXObject1 = waveLinkBuilder1.Commit()
theSession.SetUndoMarkName(markId1, "WAVE Geometry Linker")
waveLinkBuilder1.Destroy()
End Sub
Function SelectObjects(ByVal prompt As String, byRef selObj() as NXObject) As Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Selection"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = _
Selection.SelectionAction.ClearAndEnableSpecific
Dim scope As Selection.SelectionScope = Selection.SelectionScope.AnyInAssembly
Dim selectionMask_array(1) As Selection.MaskTriple
With selectionMask_array(0)
.Type = UFConstants.UF_solid_type
.subtype=0
.SolidBodySubtype = UFConstants.UF_UI_SEL_FEATURE_SOLID_BODY
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectObjects( _
prompt, title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, selObj)
If resp = Selection.Response.Ok
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
End Module
re: extract bodies
I'd suggest incrementally adding new features to your existing code. It looks like your existing code takes care of wave-linking a body; now start the journal recorder and use "menu -> edit -> features -> remove parameters...". Clean up the resulting code and incorporate it into your existing journal. Test your updated journal and refine the code until it works to your satisfaction. Repeat the process for adding color, transparency, and the move operation.
Post specific questions on any issues that you encounter and I'll be glad to help.