I very little experience with programing and even less with VBA but I found this:
Centerlines.AddCenteredPattern Method
Parent Object: Centerlines
Description
Method that creates a new centerline pattern. The centerline created with this method is kCenteredPatternCenterline type.
Syntax
Centerlines.AddCenteredPattern( PatternCenter As GeometryIntent, CenterEntities As ObjectCollection, [CentermarkStyle] As Variant, [Layer] As Variant, [Closed] As Boolean ) As Centerline
Parameters
Name | Type | Description |
PatternCenter | GeometryIntent | Input GeometryIntent that defines the a circular or elliptical drawing curve that defines the center of the pattern. |
CenterEntities | ObjectCollection | Input ObjectCollection object that contains the set of entities that define the points the centerline passes through. Valid objects for input are GeometryIntent objects that reference circular or elliptical drawing curves, and center marks. |
CentermarkStyle | Variant | Object that specifies the center mark style to use for the centerline. If not specified, the style defined by the active standard is used. |
Layer | Variant | Object that specifies the layer to use for the centerline. If not specified, the layer defined by the active standard is used. |
Closed | Boolean | Input B oolean that indicates if the centerline should be closed or not. |
DrawingView.DrawingCurves Property
Parent Object: DrawingView
Description
Property that returns all the drawing curves within the drawing view optionally filtered to the input model object. This property returns Nothing for draft views.iew object represents a drawing view on a sheet.
Syntax
DrawingView.DrawingCurves( [ModelObject] As Variant ) As DrawingCurvesEnumerator
Property Value
This is a read only property whose value is a DrawingCurvesEnumerator.
Parameters
Name | Type | Description |
ModelObject | Variant | Optional input object that specifies the object from the model for which the corresponding drawing view curves need to be retrieved. This could be an Edge, Face, PartFeature, Sketch, SketchEntity, Sketch3D, SketchEntity3D, ComponentOccurrence, or the proxies to any of these. If not specified, all the edges from the drawing view are returned. |
____________________________________________________________________________________________________
Conclusion:
So it seems It's possible to get lines according to part feature (I assume that pattern is PartFeature), and these pass as argument to add.CenteredPattern()
I see these problems:
- I don't know how to address the PartFeature
- I don't know how to get proper intent from it
- I don't know how to even extract previous from selected geometry in a drawing (In case of this approach: Run macro, select center hole, OK, all holes around center hole in rectangle)
Thanks for any advice.
Inventor 2022, Windows 10 Pro
Sorry for bad English.