Rectangular Pattern using a SketchLine for direction

Rectangular Pattern using a SketchLine for direction

Raider_71
Collaborator Collaborator
568 Views
2 Replies
Message 1 of 3

Rectangular Pattern using a SketchLine for direction

Raider_71
Collaborator
Collaborator

Hi I am having an issue trying to create a simple rectangular pattern by using a SketchLine as the direction indicator. The routine works if I use an edge or WorkAxis but not a sketchline.

pattern.jpg

 

Here is my code:

 

    Private Sub BtnPatternFeature_Click(sender As Object, e As EventArgs) Handles BtnPatternFeature.Click

        Dim oDoc As Inventor.PartDocument = oApp.ActiveDocument
        Dim oCompdef As Inventor.PartComponentDefinition = oDoc.ComponentDefinition
        Dim oFeatures As PartFeatures = oCompdef.Features

        Dim OselectSet As Inventor.SelectSet = oDoc.SelectSet

        Dim oSketchLine As SketchLine = OselectSet.Item(1)

        Dim oFeature As Inventor.PartFeature = oFeatures.Item(2)

        Dim oFeatObjCollection As Inventor.ObjectCollection = oApp.TransientObjects.CreateObjectCollection
        oFeatObjCollection.Add(oFeature)
        Dim Count As Object = 3
        Dim oSpacing As Object = 2

        Dim oRPFD As RectangularPatternFeatureDefinition

        Dim oGeom As GeometryIntent = oCompdef.CreateGeometryIntent(oSketchLine)

        oRPFD = oCompdef.Features.RectangularPatternFeatures.CreateDefinition(oFeatObjCollection, oGeom, True, Count, oSpacing)

        oCompdef.Features.RectangularPatternFeatures.AddByDefinition(oRPFD)

    End Sub

 

I have tried using just the SketchLine and also by creating a GeometryIntent but neither worked.

 

Any pointers?

 

Thanks chaps!

 

 

0 Likes
Accepted solutions (1)
569 Views
2 Replies
Replies (2)
Message 2 of 3

wgraham
Advocate
Advocate
Accepted solution

Instead of a geometry intent, try using a path.

 

Dim oGeom as Path = oCompDef.Features.CreatePath(oSketchLine)

 

It works on some of my older code.

 

Thanks,

William

0 Likes
Message 3 of 3

Raider_71
Collaborator
Collaborator

Thanks that's working like a charm!

The Geometry intent had me going in the wrong direction there...

I saw the path option but thought it was only for patterning along a 3D path...

0 Likes