Collect all Curves in part - except FlatPattern Curves
Collect all Curves in part - except FlatPattern Curves
(OP)
Hi -
I am trying to put all curves in a nx part into a array , except the curves from Flat Pattern Feature, if such feature excist in part.
But I am not sure how to ask each curve , and see of it belong to Flat pattern or not.
Any one have a suggest ???
lklo
(attached Function which also will handle FlatPattern curves:)
'==============================================================================================
'MOVE CURVE FUNCTION
Public Function MoveCurve_outside(ByVal minRangeLayer As Integer, ByVal maxRangeLayer As Integer, ByVal DestLayer As Integer)
'set undo mark
Dim theMarkId6 As Session.UndoMarkId = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Move Curves to layer" & " " & DestLayer) ' undo flag
'set arraylist for objects to move
Dim objectsToMove As New List(Of DisplayableObject) ' new list
'prepare and do cycle of objects
For Each tempCurve As Curve In workPart.Curves
'put Objects outside defined range into arraylist
If tempCurve.Layer > 0 = True And tempCurve.Layer < minRangeLayer = True Or tempCurve.Layer > maxRangeLayer = True And tempCurve.Layer < 256 = True Then
objectsToMove.Add(tempCurve)
'put objects into counter
Report_count_to_Layer(10) = (Report_count_to_Layer(10) + 1) ' count of objects
End If
'End If
Next
'here we move collected objects
Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = False
displayModification1.NewLayer = DestLayer
displayModification1.Apply(objectsToMove.ToArray)
displayModification1.Dispose()
Try
theSession.UpdateManager.DoUpdate(theMarkId6)
Catch ex As Exception
NX("Exception")
End Try
Report_count_to_Layer(11) = DestLayer ' set destination Layer in
Return Report_count_to_Layer 'return updated array prepared for final user info
End Function
'==============================================================================================
I am trying to put all curves in a nx part into a array , except the curves from Flat Pattern Feature, if such feature excist in part.
But I am not sure how to ask each curve , and see of it belong to Flat pattern or not.
Any one have a suggest ???
lklo
(attached Function which also will handle FlatPattern curves:)
'==============================================================================================
'MOVE CURVE FUNCTION
Public Function MoveCurve_outside(ByVal minRangeLayer As Integer, ByVal maxRangeLayer As Integer, ByVal DestLayer As Integer)
'set undo mark
Dim theMarkId6 As Session.UndoMarkId = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Move Curves to layer" & " " & DestLayer) ' undo flag
'set arraylist for objects to move
Dim objectsToMove As New List(Of DisplayableObject) ' new list
'prepare and do cycle of objects
For Each tempCurve As Curve In workPart.Curves
'put Objects outside defined range into arraylist
If tempCurve.Layer > 0 = True And tempCurve.Layer < minRangeLayer = True Or tempCurve.Layer > maxRangeLayer = True And tempCurve.Layer < 256 = True Then
objectsToMove.Add(tempCurve)
'put objects into counter
Report_count_to_Layer(10) = (Report_count_to_Layer(10) + 1) ' count of objects
End If
'End If
Next
'here we move collected objects
Dim displayModification1 As DisplayModification
displayModification1 = theSession.DisplayManager.NewDisplayModification()
displayModification1.ApplyToAllFaces = False
displayModification1.NewLayer = DestLayer
displayModification1.Apply(objectsToMove.ToArray)
displayModification1.Dispose()
Try
theSession.UpdateManager.DoUpdate(theMarkId6)
Catch ex As Exception
NX("Exception")
End Try
Report_count_to_Layer(11) = DestLayer ' set destination Layer in
Return Report_count_to_Layer 'return updated array prepared for final user info
End Function
'==============================================================================================





RE: Collect all Curves in part - except FlatPattern Curves
www.nxjournaling.com
RE: Collect all Curves in part - except FlatPattern Curves
Thanks a lot for your quick reply to this thread...
I did something similar to your proposal...
Collected FP curves in a list.
Then afterwards only allowing moving of curves, if each curve not has a tag, that are present in the list of FP curves.
Seems like to work - Do you have any comments on this solution.?
lklo
CODE -->
'MOVE CURVE FUNCTION Public Function MoveCurve_outside(ByVal minRangeLayer As Integer, ByVal maxRangeLayer As Integer, ByVal DestLayer As Integer) 'set undo mark Dim theMarkId6 As Session.UndoMarkId = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Move Curves to layer" & " " & DestLayer) ' undo flag 'set arraylist for objects to move Dim objectsToMove As New List(Of DisplayableObject) ' new list '#################################################################### 'in this section we put all FlatPattern object into arrayList 'set arraylist for curve objects that not should be moved Dim myList As ArrayList = New ArrayList() ' for test For Each tempFP As Features.Feature In workPart.Features If TypeOf (tempFP) Is Features.FlatPattern Then NX("list tags Of flat pattern curves") ' listwindow -only during constr Dim tempFPFeature As Features.Flatpattern = tempFP Dim tempFPCurves() As NXObject = tempFPFeature.GetCurves For Each tempDispObjcurve As DisplayableObject In tempFPCurves myList.Add(tempDispObjcurve.Tag) 'put flatpattern tags into list NX(tempDispObjcurve.Tag) ' listwindow - only during constr Next End If Next '##########################################t########################## 'prepare and do cycle of objects For Each tempCurve As Curve In workPart.Curves NX("Curve tag before sort:" & " " & tempCurve.tag) 'listwindow - only during constr ' check if curve is a Flat Pattern Curve If Not myList.Contains(tempCurve.Tag) Then NX("Curve tag after sort:" & " " & tempCurve.tag) 'listwindow - only during constr NX("_______") ' listwindow -only during constr 'put Objects outside defined range into arraylist If tempCurve.Layer > 0 = True And tempCurve.Layer < minRangeLayer = True Or tempCurve.Layer > maxRangeLayer = True And tempCurve.Layer < 256 = True Then objectsToMove.Add(tempCurve) 'put objects into counter Report_count_to_Layer(10) = (Report_count_to_Layer(10) + 1) ' count of objects End If End If Next 'here we move collected objects Dim displayModification1 As DisplayModification displayModification1 = theSession.DisplayManager.NewDisplayModification() displayModification1.ApplyToAllFaces = False displayModification1.NewLayer = DestLayer displayModification1.Apply(objectsToMove.ToArray) displayModification1.Dispose() Try theSession.UpdateManager.DoUpdate(theMarkId6) Catch ex As Exception NX("Exception") End Try Report_count_to_Layer(11) = DestLayer ' set destination Layer in Return Report_count_to_Layer 'return updated array prepared for final user info End FunctionRE: Collect all Curves in part - except FlatPattern Curves
www.nxjournaling.com