Halasox
Civil/Environmental
- Jun 5, 2016
- 16
I am trying to get the view alignment names of a view and then delete the associated alignments. I am currently doing it by known names but would like to avoid this due to possible issues if the views numbering changes ...
I understand that I need to use ViewAlignment.Name to get it, but not sure how!
I understand that I need to use ViewAlignment.Name to get it, but not sure how!
Code:
Dim viewAlignmentBuilder1 As NXOpen.Drawings.ViewAlignmentBuilder = Nothing
viewAlignmentBuilder1 = workPart.ViewAlignments.CreateViewAlignmentBuilder()
Try
Dim viewAlignment1 As NXOpen.Drawings.ViewAlignment = CType(workPart.ViewAlignments.FindObject("ViewAlignment 1"), NXOpen.Drawings.ViewAlignment)
viewAlignmentBuilder1.SelectedAlignment = viewAlignment1
viewAlignmentBuilder1.DeleteCurrentAlignment()
nXObject1 = viewAlignmentBuilder1.Commit()
Dim viewAlignment3 As NXOpen.Drawings.ViewAlignment = CType(workPart.ViewAlignments.FindObject("ViewAlignment 3"), NXOpen.Drawings.ViewAlignment)
viewAlignmentBuilder1.SelectedAlignment = viewAlignment3
viewAlignmentBuilder1.DeleteCurrentAlignment()
nXObject1 = viewAlignmentBuilder1.Commit()
viewAlignmentBuilder1.Destroy()
Catch ex As Exception
End Try