Ifeature Placement Two different Position Geometries

Ifeature Placement Two different Position Geometries

austen_27_t
Contributor Contributor
334 Views
0 Replies
Message 1 of 1

Ifeature Placement Two different Position Geometries

austen_27_t
Contributor
Contributor

I am trying to place an ifeature into a part with a specific position. The postition needs to be defined by the Sketch Plane which i already have and then an axis that is centered in the middle.  I do not know how to add another case where it will allow an axis to be selected. 

I appreciate any help!

 




Public Sub directifeature()

'Activate part
On Error Resume Next
Dim partDoc As PartDocument
Set partDoc = ThisApplication.ActiveDocument

If Err Then
MsgBox "A part must be active"
Exit Sub

End If

Dim partDef As PartComponentDefinition
Set partDef = partDoc.ComponentDefinition

'Make sure face is selected


'Get the selected face to use as input for the iFeature.
Dim oFace As Face
Set oFace = ThisApplication.CommandManager.Pick(kAllPlanarEntities, "Pick a planar face")
Set oFace = partDoc.SelectSet.Item(1)


If Err Then
MsgBox "A planar face must be selected"
Exit Sub
End If
On Error GoTo 0

If Not oFace.SurfaceType = kPlaneSurface Then
MsgBox "A planar face must be selected"
Exit Sub
End If

 


Dim oFeat As PartFeatures
Set oFeat = partDef.Features

'Create iFeature Definition
Dim oIfeatDef As iFeatureDefinition


' Need to find a way to add revolve axis as selectable position geometry

'Set oIfeatDef = oFeat.iFeatures.CreateiFeatureDefinition("P:\Inventor\2014\iFeatures\Catalog\Slots\End_mill_curved.ide")
Set oIfeatDef = oFeat.iFeatures.CreateiFeatureDefinition("P:\Inventor\2014\iFeatures\Catalog\Slots\iFeature32.ide")

 


'Input data
Dim oInput As iFeatureInput
For Each oInput In oIfeatDef.iFeatureInputs
Dim ParaInput As iFeatureParameterInput
Select Case oInput.Name


'Will need to enter new case for the revolve axis here

Case "Sketch Plane1"
Dim oPlaneInput As iFeatureSketchPlaneInput
Set oPlaneInput = oInput
oPlaneInput.PlaneInput = oFace

Case "d2"
Set ParaInput = oInput
ParaInput.Expression = "1 in"
Case "d3"
Set ParaInput = oInput
ParaInput.Expression = "0.35 in"
End Select
Next

'Create Ifeature
Dim oiFeature As iFeature
Set oiFeature = oFeat.iFeatures.Add(oIfeatDef)

End Sub

0 Likes
335 Views
0 Replies
Replies (0)