09-04-2019
06:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-04-2019
06:14 PM
Hello Jef_E,
This code will refresh the first hole feature in the active part document.
Option Explicit
Sub test()
Dim pCompDef As PartComponentDefinition
Set pCompDef = ThisApplication.ActiveEditDocument.ComponentDefinition
Dim holeFt As HoleFeature
Set holeFt = pCompDef.Features.HoleFeatures(1)
' Add/Remove methods of HoleFeature.HoleCenterPoints will be ignored.
' So we must create new ObjectCollection and then replace with it.
Dim centers As ObjectCollection
Set centers = ThisApplication.TransientObjects.CreateObjectCollection
Dim dot As SketchPoint
For Each dot In holeFt.Sketch.SketchPoints
If dot.HoleCenter Then
centers.Add dot
End If
Next
holeFt.HoleCenterPoints = centers
Debug.Print holeFt.HoleCenterPoints.Count
End SubBy the way, I do same thing by using Sketch Driven Pattern.
It automatically follows adding/removing hole centers, and can be used for Pattern Component in the assembly.
=====
Freeradical
Hideo Yamada