this is my routine
i call this routine just for modify the last exagon, this routine should be used for many different exagon.
MANY THANKS
Private Sub CreaSmussoAEsagonoGirevole(ByVal oInvApp As Application, ByVal Estrusione As ExtrudeFeature, ByVal oPartDoc As PartDocument, ByVal DefinizioneParte As PartComponentDefinition, ByVal oTG As TransientGeometry, ByVal M_Chiave As Double, ByVal OffsetDaCentroX As Double, ByVal OffsetDaCentroY As Double)
M_Chiave = M_Chiave / 10
Dim AltezzaEstrusione As Double
Dim extrudeDef As ExtrudeDefinition ' calcolo ' altezza del esagono
extrudeDef = Estrusione.Definition
If extrudeDef.ExtentType = PartFeatureExtentEnum.kDistanceExtent Then
Dim distanceEx As DistanceExtent
distanceEx = extrudeDef.Extent
AltezzaEstrusione = CDbl(distanceEx.Distance.Value)
End If
Dim A As Point2d
Dim B As Point2d
Dim C As Point2d
Dim Linea1 As SketchLine
Dim Linea2 As SketchLine
Dim Linea3 As SketchLine
Dim oRaccordo As PlanarSketch
OffsetDaCentroX = OffsetDaCentroX \ 10
OffsetDaCentroY = OffsetDaCentroY \ 10
Dim AggiuntaPerInizio As Double = ((M_Chiave * 0.05)) ' con quest0 parametro aumento in % il valore di uscita dall'ingombro del dado
' Dim InizioY As Double = ((M_Chiave * 0.49) + AggiuntaPerInizio + OffsetDaCentroY) ' questo punto è la distanza fuori ingombro della rivoluzione nell asse Y
Dim InizioY As Double = ((M_Chiave / 2) + OffsetDaCentroY) ' questo punto è la distanza fuori ingombro della rivoluzione nell asse Y
Dim InizioX As Double = (AltezzaEstrusione / 2) + OffsetDaCentroX
Dim RadicediTre As Double = 1.73
Dim AltezzaSfaccio As Double
AltezzaSfaccio = M_Chiave * RadicediTre
AltezzaSfaccio = AltezzaSfaccio / 3
AltezzaSfaccio = (M_Chiave) - AltezzaSfaccio
AltezzaSfaccio = AltezzaSfaccio / 10 '" = diametro x radice di tre diviso 3
Dim Cateto As Double = (((M_Chiave / 100) * 3.5)) ' la misura dei lati del triangolo
oRaccordo = DefinizioneParte.Sketches.Add(DefinizioneParte.WorkPlanes.Item(2))
A = oTG.CreatePoint2d(InizioX, InizioY + AltezzaSfaccio + AltezzaSfaccio)
B = oTG.CreatePoint2d(InizioX, InizioY)
C = oTG.CreatePoint2d(InizioX - Cateto, InizioY + AltezzaSfaccio + AltezzaSfaccio)
Linea1 = oRaccordo.SketchLines.AddByTwoPoints(A, B)
Linea2 = oRaccordo.SketchLines.AddByTwoPoints(Linea1.EndSketchPoint, C)
Linea3 = oRaccordo.SketchLines.AddByTwoPoints(Linea2.EndSketchPoint, Linea1.StartSketchPoint)
Dim oWorkAx As Object
Dim oProfile01 As Profile
Dim oElbowAngle As Double
Dim pi As Double = Math.Acos(-1)
oElbowAngle = (360 * pi / 180)
oWorkAx = DefinizioneParte.WorkAxes.Item(1)
oProfile01 = oRaccordo.Profiles.AddForSolid
Dim oFeatures As PartFeatures
oFeatures = DefinizioneParte.Features
Dim objects As ObjectCollection = oInvApp.TransientObjects.CreateObjectCollection
For Each body As SurfaceBody In DefinizioneParte.SurfaceBodies
objects.Add(body)
Next
Dim revolveFeatRemove2 As RevolveFeature
revolveFeatRemove2 = DefinizioneParte.Features.RevolveFeatures.AddByAngle(oProfile01, oWorkAx, oElbowAngle, PartFeatureExtentDirectionEnum.kNegativeExtentDirection, PartFeatureOperationEnum.kCutOperation)
revolveFeatRemove2.SetAffectedBodies(objects)
'' ''Dim oPDC As Inventor.PartComponentDefinition = oPartDoc.ComponentDefinition
'' ''Dim oFeatures As Inventor.PartFeatures = oPDC.Features
'' ''Dim oYZPlane As WorkPlane
'' ''oYZPlane = DefinizioneParte.WorkPlanes.Item(1)
'' ''Dim oBjColExtrude As Inventor.ObjectCollection = oInvApp.TransientObjects.CreateObjectCollection
' '' ''Dim oBjColSweep As Inventor.ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
'' ''oBjColExtrude.Add(oRevFeature)
'' ''Dim oMirs As Inventor.MirrorFeatures = oFeatures.MirrorFeatures
'' ''Dim oMirFeatDef As Inventor.MirrorFeatureDefinition
'' ''oMirFeatDef = oFeatures.MirrorFeatures.CreateDefinition(oBjColExtrude, oYZPlane, PatternComputeTypeEnum.kIdenticalCompute)
'' ''Dim oMirFeat As Inventor.MirrorFeature
'' ''oMirFeat = oMirs.AddByDefinition(oMirFeatDef)
' '' '' oMirFeat.Name = "Testing"
End Sub