Deleting sketch points in derived sketch

Deleting sketch points in derived sketch

Jef_E
Collaborator Collaborator
848 Views
2 Replies
Message 1 of 3

Deleting sketch points in derived sketch

Jef_E
Collaborator
Collaborator

Hi,

I am working on a 'configurator' for a tube heat exchanger. For this I generate a point cloud using XY coordinates. Then I add the points to a sketch in the 'Master' part. Lets say there are 500 points.

 

Then the sketch is derived to the tubesheet part and used by a hole feature that consumes all centermark points. Until here all is going great.

 

Now I am testing the ability to change the tubesheet hole pattern and adding holes is also working great, but when a smaller tubesheet pattern is generated there are more point in the base sketch in the master than in the derived sketch.

 

How can I delete these excessive points by code? 

        Dim oPatternSketch As PlanarSketch = _Tubesheet.ComponentDefinition.Sketches.Item("Tubesheet pattern")
        Debug.Print(oPatternSketch.SketchPoints.Count)
        For Each oPoint As SketchPoint In oPatternSketch.SketchPoints
            Debug.Print(oPoint.HasReferenceComponent)
            Try
                oPoint.Delete()
            Catch ex As Exception

            End Try

        Next

I can delete them by hand just by selecting and press delete, but when I use the code above they are generating a error..

 



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
Accepted solutions (1)
849 Views
2 Replies
Replies (2)
Message 2 of 3

HideoYamada
Advisor
Advisor

Hello Jef_E,

 

Could you upload the minimum data set that cause error with your code written in the 1st post?

 

=====

Freeradical

 Hideo Yamada

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes
Message 3 of 3

Jef_E
Collaborator
Collaborator
Accepted solution

You should update before trying to remove.. o wait thats my own questio lal



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes