×
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

Collect all Curves in part - except FlatPattern Curves

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

'==============================================================================================

RE: Collect all Curves in part - except FlatPattern Curves

The flat pattern feature has a .GetCurves method that will return an array of flat pattern curves. So, one possible solution would be to add all the curves in the part to your list, then iterate through the features looking for flat pattern features; when a flat pattern feature is found, use the .GetCurves method and .Remove each flat pattern curve from the curves list.

www.nxjournaling.com

RE: Collect all Curves in part - except FlatPattern Curves

(OP)
Hi Cowski -

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 Function 

RE: Collect all Curves in part - except FlatPattern Curves

Looks good to me.

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