Adding points to holefeature HoleCenterPoints

Adding points to holefeature HoleCenterPoints

Jef_E
Collaborator Collaborator
768 Views
1 Reply
Message 1 of 2

Adding points to holefeature HoleCenterPoints

Jef_E
Collaborator
Collaborator

Hi,

I have a sketch containing 10 points, all these points are consumed by hole feature:1, In some cases I add 5 points to the sketch, but how can I add these 5 points to the holefeature HoleCenterPoints.

 

If you do it by hand you can select and deselect points for the feature. But I can't figure out how to do this by code.

HoleFeature Object

Derived from: PartFeature Object

Description

The HoleFeature object represents hole modeling features.

Methods

NameDescription
AddParticipantMethod that adds the specified participant to the assembly feature. This method fails for features in a part.
DeleteMethod that deletes the feature. The arguments allow control over which dependent objects are also deleted.
GetReferenceKeyMethod that generates and returns the reference key for this entity.
GetRenderStyleThis method returns the render style currently used for this object. The used for an object can be specified in two ways. First, the object can inherit the RenderStyle defined for the part. Second, a RenderStyle can be explicitly assigned to the object (feature, face..).
GetSuppressionConditionMethod that gets the suppression condition for the feature. The method returns False if no condition has been applied.
RemoveParticipantMethod that removes the specified participant from the assembly feature. This method fails for features in a part.
SetAffectedBodiesMethod that sets a collection of SurfaceBody objects affected by this feature.
SetCBoreMethod that changes the hole to be a counterbore hole type. If the hole is already a counterbore type you can access and modify the counterbore parameters using the CBoreDiameter and CBoreDepth properties of the HoleFeature object.
SetCSinkMethod that changes the hole to be a countersink hole type. If the hole is already a countersink type you can access and modify the counterbore parameters using the CSinkDiameter and CSinkAngle properties of the HoleFeature object.
SetDistanceExtentMethod that specifies the termination type for the hole feature. Hole features can be specified to terminate at a particular distance or object, or can be specified as "through all," which means it extends through all faces of the feature. This method defines the hole's termination at a particular distance.
SetDrilledMethod that changes the hole to be a drilled hole type.
SetEndOfPartMethod that repositions the end-of-part marker relative to the object this method is called from.
SetRenderStyleThis method sets the render style to use for this object (feature, face, etc.). The used for an object can be specified in two ways. The object can inherit the RenderStyle defined for the part, or a RenderStyle can be explicitly assigned to the object.
SetSpotFaceMethod that changes the hole to be a spotface hole type. If the hole is already a spotface type you can access and modify the spotface parameters using the SpotFaceDiameter and SpotFaceDepth properties of the HoleFeature object. This method will fail of the hole contains a tapered thread.
SetSuppressionConditionMethod that sets the suppression condition for the feature.
SetThroughAllExtentMethod that specifies the termination type for the hole feature. Hole features can be specified to terminate at a particular distance or object, or can be specified as "through all," which means it extends through all faces of the feature. This method defines a through-all termination type.
SetToFaceExtentMethod that specifies the termination type for the hole feature. Hole features can be specified to terminate at a particular distance or object, or can be specified as "through all," which means it extends through all faces of the feature. This method defines the hole's termination at a particular face.

Properties

NameDescription
AdaptiveProperty that indicates whether the feature is adaptive or not. A value of True indicates it is adaptive.
AppearanceRead-write property that gets and sets the current appearance of the feature. The appearance asset being used when setting this property must be from the current document’s AppearanceAssets collection, otherwise an error will occur. Setting this property with an asset will result in setting the AppearanceSourceType to kOverrideAppearance. Setting this property to Nothing removes the override and results in setting the AppearanceSourceType to kBodyAppearance so that the feature will display using the appearance associated with the owning body.
AppearanceSourceTypeGets and sets the source of the appearance for the feature.
ApplicationReturns the top-level parent application object. When used the context of Inventor, an Application object is returned. When used in the context of Apprentice, an ApprenticeServer object is returned.
AttributeSetsProperty that returns the AttributeSets collection object associated with this object.
BottomTipAngleProperty that returns the Parameter that defines the included angle of the tip of a blind hole, one that has been specified by a distance extent or 'to face' extent . If this is a Flat Bottomed hole then the property will return Nothing.
CBoreDepthProperty that returns the parameter controlling the CBore depth. This property will return Nothing in the case where the HoleType is not kCounterBoreHole.
CBoreDiameterProperty that returns the parameter controlling the CBore diameter. This property will return Nothing in the case where the HoleType is not kCounterBoreHole.
ConsumeInputsGets and sets whether the inputs to this feature should be nested under this feature in the browser.
CSinkAngleProperty that returns the parameter controlling the CSink angle. This property will return Nothing in the case where the HoleType is not kCounterSinkHole.
CSinkDiameterProperty that returns the parameter controlling the CSink diameter. This property will return Nothing in the case where the HoleType is not kCounterSinkHole.
EndFacesProperty that returns the set of that cap the end of the hole. In the cases where there aren't any such end faces this property will return Nothing.
ExtendedNameRead-only property that returns the full feature name including any extended information.
ExtentProperty that returns the object that defines how the extent of the feature is defined. The type of extent object that this property will return can be determined by using the ExtentType property.
ExtentTypeProperty that returns an enum indicating how the extent of the feature is defined. This indicates the type of object returned by the Extent property.
FacesProperty that returns a collection that provides access to all of the faces of the feature. The Faces collection object will return the faces that still currently exist in the part. For example, if a face has been consumed by additional modeling operations it will not be returned.
FeatureDimensionsProperty that returns the FeatureDimensions collection object.
FlatBottomProperty that is meaningful only if the hole's extent has been defined by distance (blind depth). In that case this property returns a True if a non-zero bottom tip angle has been specified.
HealthStatusProperty that returns an enum indicating the current state of the object.
HoleCenterPointsProperty that returns the set of points that define the centers of the holes of this feature.
HoleDiameterProperty that returns the parameter controlling the diameter of the hole. This property will return Nothing if the diameter is being read off a value from the HoleTapInfo, when this hole is tapped.
HoleTypeProperty that returns the type of hole. Can be kDrilledHole, kCounterBoreHole, kCounterSinkHole, or kSpotFaceHole. The hole type can be set by using the SetToCBore, SetToCSink, SetDrilled, and SetToSpotFace methods.
IsOwnedByFeatureProperty that returns whether this object is owned by a feature. If True, the OwnedBy property returns the owning feature.
NameProperty that indicates the name of this object or instance.
OwnedByProperty that returns the owning PartFeature object. This property returns Nothing if the IsOwnedByFeature property returns False.
ParametersProperty that returns all the parameters associated with the feature.
ParentProperty that returns the parent of the feature.
ParticipantsProperty that returns the list of participants for an assembly feature. This list is empty for features in a part.
PlacementDefinitionProperty that gets and sets the placement type for the hole feature
PlacementTypeProperty that returns a constant indicating the type of hole placement.
RangeBoxProperty that returns a Box object which contains the opposing points of a rectangular box that is guaranteed to enclose this object.
SharedGets and sets whether the feature is shared or not, applies only to surface features.
SideFacesProperty that returns a object that provides access to all of the faces created around the perimeter of the feature.
SketchProperty that returns the Sketch object that contains the points the hole is based on.
SpotFaceDepthProperty that returns the parameter controlling the SpotFace depth. This property will return Nothing in the case where the HoleType is not kSpotFaceHole.
SpotFaceDiameterProperty that returns the parameter controlling the SpotFace diameter. This property will return Nothing in the case where the HoleType is not kSpotFaceHole.
SuppressedProperty that indicates whether the feature is suppressed or not. A value of True indicates the feature is suppressed.
SurfaceBodiesProperty that returns the bodies that this feature has created or modified.
TapInfoProperty that gets and sets the HoleTapInfo or TaperedThreadInfo object associated with the hole.
TappedProperty that returns the Boolean flag indicating whether the hole is tapped or not.
TypeReturns an ObjectTypeEnum indicating this object's type.

Version

Introduced in Inventor version 5



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
0 Likes
769 Views
1 Reply
Reply (1)
Message 2 of 2

HideoYamada
Advisor
Advisor

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 Sub

By 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

 

=====
Freeradical
 Hideo Yamada
https://www.freeradical.jp
0 Likes