Create Pattern along Helical Curve in iLogic

Create Pattern along Helical Curve in iLogic

TobFischer94
Enthusiast Enthusiast
696 Views
2 Replies
Message 1 of 3

Create Pattern along Helical Curve in iLogic

TobFischer94
Enthusiast
Enthusiast

Yoooyoyoyoyoyooyoyoyyyyooyoyooyo

friends,

 

i need help creating a rectangular / linear pattern along a helical curve with a solution in iLogic.

I attached an .ipt file and two pictures for easier understanding

 

Simply put, i created a hole on a cylinder, and now i want to create a pattern of this hole along a helical curve (which was created via a 3D-Sketch).

 

im no VBA expert, but i found some code snippets online which work towards the goal.

The following code works in creating patterns, but only along an Axis, not a helical curve

 

 

Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oPartComp As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oHole As HoleFeature = oPartComp.Features.HoleFeatures.Item("Bohrung1")
Dim oBjCol As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
Call oBjCol.Add(oHole)
Dim oAxis As WorkAxis = oPartComp.WorkAxes.Item(1)
oRectFeat = oPartComp.Features.RectangularPatternFeatures.Add(oBjCol, oAxis, False, 3, 5, PatternSpacingTypeEnum.kDefault)

 

 

 

this thread had a similar problem:

https://forums.autodesk.com/t5/inventor-forum/ilogic-to-change-a-helical-curve-in-a-3d-sketch/td-p/4...

 

Help would be very appreciated.

Regards

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

WCrihfield
Mentor
Mentor
Accepted solution

Here you go.  That was both interesting and fun.

If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
	MsgBox("A Part Document must be active for this rule (" & iLogicVb.RuleName & ") to work. Exiting.",vbOKOnly+vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oPDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPDef As PartComponentDefinition = oPDoc.ComponentDefinition
Dim oHole As HoleFeature = oPDef.Features.HoleFeatures.Item(1)
Dim oHCurve As HelicalCurve = oPDef.Sketches3D.Item(1).HelicalCurves.Item(1)
Dim oPath As Path = oPDef.Features.CreatePath(oHCurve)
Dim oGeomIntent As GeometryIntent = oPDef.CreateGeometryIntent(oPath)
Dim oFeatsToPattern As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
oFeatsToPattern.Add(oHole)
Dim oRPattDef As RectangularPatternFeatureDefinition = oPDef.Features.RectangularPatternFeatures.CreateDefinition(oFeatsToPattern, oGeomIntent, True, 105, 3)
'oRPattDef.Operation = PartFeatureOperationEnum.kCutOperation
oRPattDef.XDirectionSpacingType = PatternSpacingTypeEnum.kDefault
oRPattDef.ComputeType = PatternComputeTypeEnum.kIdenticalCompute
oRPattDef.OrientationMethod = PatternOrientationEnum.kAdjustToDirection1
Dim oPattern As RectangularPatternFeature = oPDef.Features.RectangularPatternFeatures.AddByDefinition(oRPattDef)

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click (LIKE or KUDOS) 👍.

If you want and have time, I would appreciate your Vote(s) for My IDEAS 💡or you can Explore My CONTRIBUTIONS

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3

TobFischer94
Enthusiast
Enthusiast

WCrihfield Thank you very much!!! Works like a charm

0 Likes