Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Has anyone any idea why the circular pattern features add by definition line is failing within an assembly. Is this supported by the API? Sample assembly and part attached. The hole is created and the create definition works I think! Using Inventor 2020 so maybe newer versions this works.
' the part document variables
Dim Doc As AssemblyDocument = ThisApplication.ActiveDocument
Dim CompDef As AssemblyComponentDefinition = Doc.ComponentDefinition
Try
CompDef.Features.HoleFeatures(1).Delete
Catch
End Try
'Prompt user To Select cylinderical face
Dim StartFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAllPlanarEntities, "Select starting Face")
'Prompt user to select the starting point.
Dim StartingAxis As WorkAxis = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkAxisFilter, "Select Hole Center Axis")
'Prompt user to select the starting point.
Dim RevolveAxis As WorkAxis = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kWorkAxisFilter, "Select Revolve Axis")
'Get user input.
Dim HoleDiameter As Double = InputBox("Enter hole diameters", "Enter hole diameters as a decimal", 1)
Dim HoleDepth As Double = InputBox("Enter hole depth as a decimal. ", "Enter hole depth", 1)
'Create a new sketch on the X-Y work plane.
Dim Sketch As PlanarSketch = CompDef.Sketches.Add(StartFace)
'Create an object collection for the hole center points.
Dim HoleCenters As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
'Add two points as hole centers.
HoleCenters.Add(Sketch.AddByProjectingEntity(StartingAxis))
'Create the hole feature.
Dim HFeature As HoleFeature = CompDef.Features.HoleFeatures.AddDrilledByDistanceExtent(HoleCenters, HoleDiameter,HoleDepth, kPositiveExtentDirection)
'Create an object collection for the hole center points.
Dim ParentFeatures As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
ParentFeatures.Add(HFeature)
Dim HolesPatternDef As CircularPatternFeatureDefinition = CompDef.Features.CircularPatternFeatures.CreateDefinition(ParentFeatures, RevolveAxis, False, 2,"180 Deg",False)
Dim HolesCircularPattern As CircularPatternFeature = CompDef.Features.CircularPatternFeatures.AddByDefinition(HolesPatternDef)
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan
Solved! Go to Solution.