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: 

Create Pattern along Helical Curve in iLogic

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
TobFischer94
426 Views, 2 Replies

Create Pattern along Helical Curve in iLogic

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

Labels (1)
2 REPLIES 2
Message 2 of 3
WCrihfield
in reply to: TobFischer94

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 :light_bulb:or you can Explore My CONTRIBUTIONS

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 3
TobFischer94
in reply to: TobFischer94

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

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

Post to forums  

Autodesk Design & Make Report