Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing edge blends with lost references 1

Status
Not open for further replies.

SiW979

Mechanical
Nov 16, 2007
804
When creating complicated castings, we often get the lots of edge blends where the edges have been consumed by another feature or similar and our part navigator ends up with lots of warning triangles on those specific blends. Other than editing each edge blend separately and clicking the delete button inside the command, is there a way of deletin these enmasse? Using a journal perhpas? I thought part clean up might do it, but it doesn't.

Cheers

Si



Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8
 
Replies continue below

Recommended for you

Hi JCBCAD,
i was just wondering if you can use CheckMate (Buried Features check)results (Visual Reporting) to filter all these blends and then delete it in one shot (right click the top-node of the reult and selecting SELECT ASSOCIATED OBJECTS and delete it).
Or maybe using FILTER SETTINGS in part navigator to filter down features " features with warning" and then delete them.
Best Regards
Kapil Sharma
 
JBCAD Did you ever find a good solution to this question? Thanks
 
SDETERS

Nothing other that what you see here.

Happy New Year :)

Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8
 
Using selection intent (tangent curves, connected curves, face edges etc) instead of selecting multiple edges would minimise the number of consumed edges, although the feature would fail if the seed edge is consumed upon editing.

Khimani Mohiki
Design Engineer - Aston Martin
NX8.5
 
It's fixed in NX9, it basically deletes any lost edges for you :)


Best regards

Simon NX 7.5.4.4 MP8 and NX 8.5 (native) - TC 8
 
Thanks gives us another reason to push for upgrading to NX 9 in spring time.
 
Hi Simon,
I'm testing NX9 and I don't find this fix.
Is it an information arrived from SIEMENS or have you tested personally ?

Thank you...

Using NX 8 and TC9.1
 
Here's some code, but it is not thoroughly tested. Post back if/when you encounter a problem.

Code:
[COLOR=green]'[URL unfurl="true"]http://www.eng-tips.com/viewthread.cfm?qid=356772[/URL][/color]
[COLOR=green]'clean invalid edge references from edge blends[/color]
[COLOR=green]'not thouroughly tested for variable radius blends[/color]
[COLOR=green]'February 10, 2014[/color]

[COLOR=blue]Option Strict Off[/color]  
[COLOR=blue]Imports[/color] System  
[COLOR=blue]Imports[/color] System.Collections.Generic  
[COLOR=blue]Imports[/color] NXOpen  

[COLOR=blue]Module[/color] BlendCleaner  

    [COLOR=blue]Sub[/color] Main()  

        [COLOR=blue]Dim[/color] theSession [COLOR=blue]As[/color] Session [COLOR=blue]=[/color] Session.GetSession()  
        [COLOR=blue]Dim[/color] workPart [COLOR=blue]As[/color] Part [COLOR=blue]=[/color] theSession.Parts.Work  

        [COLOR=blue]Dim[/color] lw [COLOR=blue]As[/color] ListingWindow [COLOR=blue]=[/color] theSession.ListingWindow  
        lw.Open()  

        [COLOR=blue]Const[/color] undoName [COLOR=blue]As String =[/color] "Blend Cleaner"  
        [COLOR=blue]Dim[/color] markId1 [COLOR=blue]As[/color] Session.UndoMarkId  
        markId1 [COLOR=blue]=[/color] theSession.SetUndoMark(Session.MarkVisibility.Invisible, undoName)  

        [COLOR=blue]Dim[/color] numCleaned [COLOR=blue]As Integer =[/color] 0  

        [COLOR=blue]Dim[/color] nullFeature [COLOR=blue]As[/color] Features.Feature [COLOR=blue]= Nothing[/color]  
        [COLOR=blue]Dim[/color] currentFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]=[/color] workPart.CurrentFeature  

        [COLOR=blue]Dim[/color] prevFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]= Nothing[/color]  
        [COLOR=blue]For Each[/color] tempFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]In[/color] workPart.Features  

            [COLOR=blue]If[/color] tempFeat.FeatureType [COLOR=blue]=[/color] "BLEND" [COLOR=blue]Then[/color]  

                [COLOR=blue]Dim[/color] myBlend [COLOR=blue]As[/color] Features.EdgeBlend [COLOR=blue]=[/color] tempFeat  
                [COLOR=blue]Dim[/color] blendWarnings() [COLOR=blue]As String =[/color] myBlend.GetFeatureWarningMessages()  
                [COLOR=blue]Dim[/color] needsCleaning [COLOR=blue]As Boolean = False[/color]  

                [COLOR=blue]For Each[/color] myLine [COLOR=blue]As String In[/color] blendWarnings  
                    [COLOR=blue]If[/color] myLine.ToLower.Contains("consumed") [COLOR=blue]Then[/color]  
                        needsCleaning [COLOR=blue]= True[/color]  
                    End [COLOR=blue]If[/color]  
                [COLOR=blue]Next[/color]  

				[COLOR=green]'make previous feature the current feature[/color]
                prevFeat.MakeCurrentFeature()  

				[COLOR=green]'edit blend feature with rollback[/color]
                workPart.Features.SetEditWithRollbackFeature(myBlend)  

                [COLOR=blue]Dim[/color] blendBuilder [COLOR=blue]As[/color] Features.EdgeBlendBuilder [COLOR=blue]=[/color] workPart.Features.CreateEdgeBlendBuilder(myBlend)  

                [COLOR=blue]Dim[/color] validEdges [COLOR=blue]As New[/color] List(Of Edge)  

                [COLOR=blue]Dim[/color] myCollector [COLOR=blue]As[/color] ScCollector  
                [COLOR=blue]Dim[/color] myExp [COLOR=blue]As[/color] Expression  
                [COLOR=blue]Dim[/color] valid [COLOR=blue]As Boolean[/color]  
                [COLOR=blue]For[/color] i [COLOR=blue]As Integer =[/color] 0 [COLOR=blue]To[/color] blendBuilder.GetNumberOfValidChainsets [COLOR=blue]-[/color] 1  
                    blendBuilder.GetChainsetAndStatus(i, myCollector, myExp, valid)  

                    [COLOR=blue]Dim[/color] myObjects() [COLOR=blue]As[/color] TaggedObject [COLOR=blue]=[/color] myCollector.GetObjects  

                    [COLOR=blue]For Each[/color] temp [COLOR=blue]As[/color] Edge [COLOR=blue]In[/color] myObjects  
                        [COLOR=blue]Try[/color]  
                            temp.GetLength()  
                            validEdges.Add(temp)  

                        [COLOR=blue]Catch[/color] ex [COLOR=blue]As[/color] NXException  
						[COLOR=green]'edge has been consumed or suppressed[/color]
                        End [COLOR=blue]Try[/color]  
                    [COLOR=blue]Next[/color]  

                    [COLOR=blue]Dim[/color] edgeMultipleSeedTangentRule1 [COLOR=blue]As[/color] EdgeMultipleSeedTangentRule  
                    edgeMultipleSeedTangentRule1 [COLOR=blue]=[/color] workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(validEdges.ToArray, 0.5, [COLOR=blue]True[/color])  

                    [COLOR=blue]Dim[/color] rules1(0) [COLOR=blue]As[/color] SelectionIntentRule  
                    rules1(0) [COLOR=blue]=[/color] edgeMultipleSeedTangentRule1  
                    myCollector.ReplaceRules(rules1, [COLOR=blue]False[/color])  

                    [COLOR=blue]Dim[/color] csIndex1 [COLOR=blue]As Integer[/color]  
                    csIndex1 [COLOR=blue]=[/color] blendBuilder.AddChainset(myCollector, myExp.Value.ToString)  

                [COLOR=blue]Next[/color]  

                blendBuilder.CommitFeature()  
                blendBuilder.Destroy()  

                numCleaned [COLOR=blue]+=[/color] 1  

                currentFeat.MakeCurrentFeature()  
                workPart.Features.SetEditWithRollbackFeature(nullFeature)  

            End [COLOR=blue]If[/color]  

            prevFeat [COLOR=blue]=[/color] tempFeat  

        [COLOR=blue]Next[/color]  

        [COLOR=blue]If[/color] numCleaned > 0 [COLOR=blue]Then[/color]  
            theSession.SetUndoMarkVisibility(markId1, undoName, Session.MarkVisibility.Visible)  
        End [COLOR=blue]If[/color]  
        lw.Close()  

    End [COLOR=blue]Sub[/color]  

End [COLOR=blue]Module[/color]


www.nxjournaling.com
 
I get this error Cowski.

Line 49 "SetEditwithrollbackfeature" is not a member of "NXopen.Features.FeatureCollection".
LINE 91 "SetEditwithrollbackfeature" is not a member of "NXopen.Features.FeatureCollection".
 
I should have mentioned that I tested it on NX 8.5. "SetEditWithRollbackFeature" is new to NX 8, I'll see if there is an alternative to use in NX 7.5...

www.nxjournaling.com
 
Ok, this version tested with NX 7.5.

Code:
[COLOR=blue]Option Strict Off[/color]  
[COLOR=blue]Imports[/color] System  
[COLOR=blue]Imports[/color] System.Collections.Generic  
[COLOR=blue]Imports[/color] NXOpen  

[COLOR=blue]Module[/color] BlendCleaner_75  

    [COLOR=blue]Sub[/color] Main()  

        [COLOR=blue]Dim[/color] theSession [COLOR=blue]As[/color] Session [COLOR=blue]=[/color] Session.GetSession()  
        [COLOR=blue]Dim[/color] workPart [COLOR=blue]As[/color] Part [COLOR=blue]=[/color] theSession.Parts.Work  

        [COLOR=blue]Dim[/color] lw [COLOR=blue]As[/color] ListingWindow [COLOR=blue]=[/color] theSession.ListingWindow  
        lw.Open()  

        [COLOR=blue]Const[/color] undoName [COLOR=blue]As String =[/color] "Blend Cleaner"  
        [COLOR=blue]Dim[/color] markId1 [COLOR=blue]As[/color] Session.UndoMarkId  
        markId1 [COLOR=blue]=[/color] theSession.SetUndoMark(Session.MarkVisibility.Invisible, undoName)  

        [COLOR=blue]Dim[/color] numCleaned [COLOR=blue]As Integer =[/color] 0  

        [COLOR=blue]Dim[/color] nullFeature [COLOR=blue]As[/color] Features.Feature [COLOR=blue]= Nothing[/color]  
        [COLOR=blue]Dim[/color] currentFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]=[/color] workPart.CurrentFeature  

        [COLOR=blue]Dim[/color] prevFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]= Nothing[/color]  
        [COLOR=blue]For Each[/color] tempFeat [COLOR=blue]As[/color] Features.Feature [COLOR=blue]In[/color] workPart.Features  

            [COLOR=blue]If[/color] tempFeat.FeatureType [COLOR=blue]=[/color] "BLEND" [COLOR=blue]Then[/color]  

                [COLOR=blue]Dim[/color] myBlend [COLOR=blue]As[/color] Features.EdgeBlend [COLOR=blue]=[/color] tempFeat  
                [COLOR=blue]Dim[/color] blendWarnings() [COLOR=blue]As String =[/color] myBlend.GetFeatureWarningMessages()  
                [COLOR=blue]Dim[/color] needsCleaning [COLOR=blue]As Boolean = False[/color]  

                [COLOR=blue]For Each[/color] myLine [COLOR=blue]As String In[/color] blendWarnings  
                    [COLOR=blue]If[/color] myLine.ToLower.Contains("consumed") [COLOR=blue]Then[/color]  
                        needsCleaning [COLOR=blue]= True[/color]  
                    End [COLOR=blue]If[/color]  
                [COLOR=blue]Next[/color]  

                [COLOR=blue]If[/color] needsCleaning [COLOR=blue]Then[/color]  
                   [COLOR=green]'make previous feature the current feature[/color]
                    prevFeat.MakeCurrentFeature()  

                   [COLOR=green]'edit blend feature with rollback[/color]
                   [COLOR=green]'workPart.Features.SetEditWithRollbackFeature(myBlend)[/color]

                    [COLOR=blue]Dim[/color] blendBuilder [COLOR=blue]As[/color] Features.EdgeBlendBuilder [COLOR=blue]=[/color] workPart.Features.CreateEdgeBlendBuilder(myBlend)  

                    [COLOR=blue]Dim[/color] validEdges [COLOR=blue]As New[/color] List(Of Edge)  

                    [COLOR=blue]Dim[/color] myCollector [COLOR=blue]As[/color] ScCollector  
                    [COLOR=blue]Dim[/color] myExp [COLOR=blue]As[/color] Expression  
                    [COLOR=blue]Dim[/color] valid [COLOR=blue]As Boolean[/color]  
                    [COLOR=blue]For[/color] i [COLOR=blue]As Integer =[/color] 0 [COLOR=blue]To[/color] blendBuilder.GetNumberOfValidChainsets [COLOR=blue]-[/color] 1  
                        blendBuilder.GetChainsetAndStatus(i, myCollector, myExp, valid)  

                        [COLOR=blue]Dim[/color] myObjects() [COLOR=blue]As[/color] TaggedObject [COLOR=blue]=[/color] myCollector.GetObjects  

                        [COLOR=blue]For Each[/color] temp [COLOR=blue]As[/color] Edge [COLOR=blue]In[/color] myObjects  
                            [COLOR=blue]Try[/color]  
                                temp.GetLength()  
                                validEdges.Add(temp)  

                            [COLOR=blue]Catch[/color] ex [COLOR=blue]As[/color] NXException  
                               [COLOR=green]'lw.WriteLine("  error: " & ex.Message)[/color]
                               [COLOR=green]'edge has been consumed or suppressed[/color]
                            End [COLOR=blue]Try[/color]  
                        [COLOR=blue]Next[/color]  

                        [COLOR=blue]Dim[/color] edgeMultipleSeedTangentRule1 [COLOR=blue]As[/color] EdgeMultipleSeedTangentRule  
                        edgeMultipleSeedTangentRule1 [COLOR=blue]=[/color] workPart.ScRuleFactory.CreateRuleEdgeMultipleSeedTangent(validEdges.ToArray, 0.5, [COLOR=blue]True[/color])  

                        [COLOR=blue]Dim[/color] rules1(0) [COLOR=blue]As[/color] SelectionIntentRule  
                        rules1(0) [COLOR=blue]=[/color] edgeMultipleSeedTangentRule1  
                        myCollector.ReplaceRules(rules1, [COLOR=blue]False[/color])  

                        [COLOR=blue]Dim[/color] csIndex1 [COLOR=blue]As Integer[/color]  
                        csIndex1 [COLOR=blue]=[/color] blendBuilder.AddChainset(myCollector, myExp.Value.ToString)  

                    [COLOR=blue]Next[/color]  

                    blendBuilder.CommitFeature()  
                    blendBuilder.Destroy()  

                    numCleaned [COLOR=blue]+=[/color] 1  

                    currentFeat.MakeCurrentFeature()  
                    [COLOR=green]'workPart.Features.SetEditWithRollbackFeature(nullFeature)[/color]

                End [COLOR=blue]If[/color]  


            End [COLOR=blue]If[/color]  

            prevFeat [COLOR=blue]=[/color] tempFeat  

        [COLOR=blue]Next[/color]  

        [COLOR=blue]If[/color] numCleaned > 0 [COLOR=blue]Then[/color]  
            theSession.SetUndoMarkVisibility(markId1, undoName, Session.MarkVisibility.Visible)  
        End [COLOR=blue]If[/color]  
        lw.Close()  

    End [COLOR=blue]Sub[/color]  

End [COLOR=blue]Module[/color]


www.nxjournaling.com
 
This works great. Slow to rebuild the model but it could be an issue with my model. Nice One hundered stars to Coswki.
 
It looks for blends with missing references, if these occur early in the file it will essentially rebuild the entire solid. On large files, this can be a long process.

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor