mdfathmi
Mechanical
- Apr 22, 2016
- 7
Hi,
I need help removing selection Stickiness from a Recorded NX Journal to "Add bend lines on Flat Pattern view in NX Drafting". Below is my recorded Journal Code for selecting that view and add bend lines through flat pattern setting. I want user to select the view using an UI and automatically add bend lines on that view selected by user. Need help modifying this code below. Thanks in advance.
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: Edit->Style...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start")
theSession.SetUndoMarkName(markId1, "Class Selection Dialog")
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Class Selection")
theSession.DeleteUndoMark(markId2, Nothing)
theSession.SetUndoMarkName(markId1, "Class Selection")
theSession.DeleteUndoMark(markId1, Nothing)
' ----------------------------------------------
' Dialog Begin View Style
' ----------------------------------------------
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "View Style")
Dim baseView1 As Drawings.BaseView = CType(workPart.DraftingViews.FindObject("FLAT-PATTERN#1@18"), Drawings.BaseView)
Dim flatPatternSettings1 As SheetMetal.FlatPatternSettings
flatPatternSettings1 = baseView1.Style.FlatPattern.GetPropertiesObject()
Dim displaydata1 As SheetMetal.FlatPatternSettings.FlatPatternObjectTypeDisplay
displaydata1.Type = SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendUpCenterLine
displaydata1.IsEnabled = 1
displaydata1.Color = workPart.Colors.Find("Background")
displaydata1.Font = ViewDependentDisplayManager.Font.Dashed
displaydata1.Width = -1
flatPatternSettings1.SetFlatPatternObjectTypeDisplay(SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendUpCenterLine, displaydata1)
Dim displaydata2 As SheetMetal.FlatPatternSettings.FlatPatternObjectTypeDisplay
displaydata2.Type = SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendDownCenterLine
displaydata2.IsEnabled = 1
displaydata2.Color = workPart.Colors.Find("Background")
displaydata2.Font = ViewDependentDisplayManager.Font.Dashed
displaydata2.Width = -1
flatPatternSettings1.SetFlatPatternObjectTypeDisplay(SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendDownCenterLine, displaydata2)
baseView1.Style.FlatPattern.Commit()
baseView1.Commit()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
Thanks
FJ
I need help removing selection Stickiness from a Recorded NX Journal to "Add bend lines on Flat Pattern view in NX Drafting". Below is my recorded Journal Code for selecting that view and add bend lines through flat pattern setting. I want user to select the view using an UI and automatically add bend lines on that view selected by user. Need help modifying this code below. Thanks in advance.
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: Edit->Style...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Start")
theSession.SetUndoMarkName(markId1, "Class Selection Dialog")
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Class Selection")
theSession.DeleteUndoMark(markId2, Nothing)
theSession.SetUndoMarkName(markId1, "Class Selection")
theSession.DeleteUndoMark(markId1, Nothing)
' ----------------------------------------------
' Dialog Begin View Style
' ----------------------------------------------
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "View Style")
Dim baseView1 As Drawings.BaseView = CType(workPart.DraftingViews.FindObject("FLAT-PATTERN#1@18"), Drawings.BaseView)
Dim flatPatternSettings1 As SheetMetal.FlatPatternSettings
flatPatternSettings1 = baseView1.Style.FlatPattern.GetPropertiesObject()
Dim displaydata1 As SheetMetal.FlatPatternSettings.FlatPatternObjectTypeDisplay
displaydata1.Type = SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendUpCenterLine
displaydata1.IsEnabled = 1
displaydata1.Color = workPart.Colors.Find("Background")
displaydata1.Font = ViewDependentDisplayManager.Font.Dashed
displaydata1.Width = -1
flatPatternSettings1.SetFlatPatternObjectTypeDisplay(SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendUpCenterLine, displaydata1)
Dim displaydata2 As SheetMetal.FlatPatternSettings.FlatPatternObjectTypeDisplay
displaydata2.Type = SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendDownCenterLine
displaydata2.IsEnabled = 1
displaydata2.Color = workPart.Colors.Find("Background")
displaydata2.Font = ViewDependentDisplayManager.Font.Dashed
displaydata2.Width = -1
flatPatternSettings1.SetFlatPatternObjectTypeDisplay(SheetMetal.FlatPatternSettings.FlatPatternObjectType.BendDownCenterLine, displaydata2)
baseView1.Style.FlatPattern.Commit()
baseView1.Commit()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
Thanks
FJ