Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 516

Get parameters of iFeature

$
0
0

By Xiaodong Liang

Each iFeature is defined by the iFeatureDefinition. The collection iFeatureInputs of iFeatureDefinition stores the parameters which defined the iFeature. Each parameter is an iFeatureInput type.

The following code assumes we are checking the sample ide of ide. It dumpes the parameters of the ide.

C:\Users\Public\Documents\Autodesk\Inventor 2014\Catalog\Punches\keyway.ide

image

image

Public Sub GetiFeaturesParameters()

Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument

Dim oRefComps As ReferenceComponents
Set oRefComps = _
    oDoc.ComponentDefinition.ReferenceComponents

' get file of the ide
Dim oiFeatureComp As iFeatureComponent
For Each oiFeatureComp In oRefComps.iFeatureComponents

    Debug.Print "Feature Name: " + _
            oiFeatureComp.Name
    Debug.Print "Generated by iFeature: " + _
            oiFeatureComp.iFeatureTemplateDescriptor. _
                LastKnownSourceFileName + vbCrLf
Next

'assume this ide is
' C:\Users\Public\Documents\Autodesk\Inventor 2013\Catalog\Punches\keyway.ide

Dim oiF As iFeature
Set oiF = oDoc.ComponentDefinition.Features.iFeatures(1)

Dim oiFeatInput As iFeatureInput
For Each oiFeatInput In _
    oiF.iFeatureDefinition.iFeatureInputs
   
  Debug.Print "******"
  Debug.Print "name: " & oiFeatInput.Name
 
Select Case oiFeatInput.Prompt
   
    Case "Pick Profile Plane"
   
        Dim oPlaneInput As iFeatureSketchPlaneInput
        Set oPlaneInput = oiFeatInput
   
    Case "Enter diameter"
        Dim oParamInput As iFeatureParameterInput
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    Case "Enter keyway width"
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    Case "Enter keyway depth"
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    Case "Enter top fillet"
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    Case "Enter bottom fillet"
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    Case "Enter Thickness"
        Set oParamInput = oiFeatInput
        Debug.Print oParamInput.Value
   
    End Select
Next
 
End Sub


Viewing all articles
Browse latest Browse all 516

Trending Articles