Hello everyone,
I am trying to create bidirectional Linear Pattern feature using API code in opposite and parallel direction but I am unable to do so.
I cant figure out what's wrong with the code or what am I missing in my code to make that happen.
The "Axis1" and "Right plane" are correct and in the direction that I want to create pattern in and the feature also gets selected alrigth which I want to pattern, but nothing happens at
Set swFeat = swModel.FeatureManager.CreateFeature(swLPattFeatData)
here is the piece of code for what I am trying to achieve.
Any help would be massively appreciated!
'feature to patterm
swModel.Extension.SelectByID2 swFeat.name, "BODYFEATURE", 0, 0, 0, False, 4, Nothing, 0
'plane and axis to pattern along
swModel.Extension.SelectByID2 "Axis1", "AXIS", 0, 0, 0, True, 1, Nothing, 0
swModel.Extension.SelectByID2 "Right Plane", "PLANE", 0, 0, 0, True, 2, Nothing, 0
Dim swLPattFeatData As SldWorks.LinearPatternFeatureData
Set swLPattFeatData = swFeatMgr.CreateDefinition(swFmLPattern)
swLPattFeatData.D1EndCondition = 0
swLPattFeatData.D1ReverseDirection = False
swLPattFeatData.D1Spacing = CDbl(tbToothPitch) / 1000
swLPattFeatData.D1TotalInstances = groovesNoL1
swLPattFeatData.D2EndCondition = 0
swLPattFeatData.D2PatternSeedOnly = True
swLPattFeatData.D2ReverseDirection = True
swLPattFeatData.D2Spacing = CDbl(tbToothPitch) / 1000
swLPattFeatData.D2TotalInstances = groovesNoL2
swLPattFeatData.GeometryPattern = False
swLPattFeatData.VarySketch = False
Set swFeat = swModel.FeatureManager.CreateFeature(swLPattFeatData) 'nothing happens after this line
