Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help With Creating Circularpattern VBA

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
r.hubregsen
576 Views, 2 Replies

Help With Creating Circularpattern VBA

Does Anybody know how to create a circular pattern around the predefined Z axis. 

 

 

Private Sub createpattern()


Dim oCompdef As ComponentDefinition
Dim oDoc As PartDocument
Dim oSketch As PlanarSketch
Dim oPart As PartFeatures
Dim oProfile As Profile
Dim oExtrusion As ExtrudeFeature
Dim oDef As PartComponentDefinition
Dim objGeometry As TransientGeometry

Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject, , True)
Set oCompdef = oDoc.ComponentDefinition
Set oSketch = oCompdef.Sketches.Add(oCompdef.WorkPlanes.Item(3))
Set objGeometry = ThisApplication.TransientGeometry

Call oSketch.SketchLines.AddAsTwoPointRectangle(objGeometry.CreatePoint2d(1, 1), objGeometry.CreatePoint2d(7, 5))


Set oProfile = oSketch.Profiles.AddForSolid
Set oExtrusion = oCompdef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 10, kSymmetricExtentDirection, kJoinOperation)


Call oPart.CircularPatternFeatures.Add(oPart.ExtrudeFeatures.Item(1), oDef.WorkAxes.Item(3), True, 3, 360, True)


End Sub

2 REPLIES 2
Message 2 of 3
jonbrabbs
in reply to: r.hubregsen

Hi mate,

 

Here you go...

 

Cheers

 

Jon

 

Private Sub createpattern()

Dim oDoc As PartDocument
    Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject, , True)

Dim oCompdef As ComponentDefinition
    Set oCompdef = oDoc.ComponentDefinition

Dim objGeometry As TransientGeometry
    Set objGeometry = ThisApplication.TransientGeometry

Dim oSketch As PlanarSketch
    Set oSketch = oCompdef.Sketches.Add(oCompdef.WorkPlanes.Item(3))

    Call oSketch.SketchLines.AddAsTwoPointRectangle(objGeometry.CreatePoint2d(1, 1), objGeometry.CreatePoint2d(7, 5))

Dim oProfile As Profile
    Set oProfile = oSketch.Profiles.AddForSolid

Dim oExtrusion As ExtrudeFeature
    Set oExtrusion = oCompdef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 10, kSymmetricExtentDirection, kJoinOperation)


Dim objCol As ObjectCollection
    Set objCol = ThisApplication.TransientObjects.CreateObjectCollection
'Feature to be patterned
    objCol.Add oCompdef.Features(1)
    oCompdef.Features.CircularPatternFeatures.Add objCol, oCompdef.WorkAxes.Item(3), True, 3, 360, True

End Sub

///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Message 3 of 3
r.hubregsen
in reply to: jonbrabbs

Many thanks for the help Kind Regards Tech2Sea R. Hubregsen Tel: +31 (0)172 748046 [Beschrijving: Beschrijving: Tech2sea logo]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report