Hi, everyone.
Here is some of Inventor's Design Accelerator models with attached IFeature parameters:
C:\Program Files\Autodesk\Inventor 2014\Design Accelerator\Models\
For instance, I want to change values of IFeature params of SpurGear model: FD-SpurGearMM.ipt using VBA macro, where
da_aw is work Center Distance
da_b is width
da_beta is angle Beta
da_d Pitch is diameter
da_da is Outside Diameter
da_df is Root Diameter
da_dw is work pitch diameter
da_z is number of teeth for Gear1
da_z2 is number of teeth for Gear2
da_lefttooth 1/0 Yes/No Allow is left helix teeth
da_righttooth 1/0 Yes/No Allow is rigth helix teeth
da_straigthtooth 1/0 Yes/No Allow is straigth teeth
My search brings me to such source-code:
Sub Edit_iFeature_Parameters_Sample() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument 'reference to the first iFeature object Dim oiFeature As iFeature Set oiFeature = oDoc.ComponentDefinition.Features.iFeatures.Item(1) 'reference to the definition Dim iDef As iFeatureDefinition Set iDef = oiFeature.iFeatureDefinition 'inputs collection Dim oInputs As iFeatureInputs Set oInputs = iDef.iFeatureInputs 'root name Dim iName As String iName = oiFeature.Name & ":" 'iterate inputs collection Dim oInput As iFeatureInput For Each oInput In oInputs 'Debug.Print oInput.Name If oInput.Type = kiFeatureParameterInputObject Then Dim oParInput As iFeatureParameterInput Set oParInput = oInput Dim oPar As Parameter Set oPar = oParInput.Parameter Select Case UCase(oParInput.Name) Case UCase(iName + "Diameter") oPar.Expression = "1006 in" Case UCase(iName + "Depth") oPar.Expression = "0.6 in" End Select End If Next oDoc.Update Beep End Sub
Please, help me modify this for my case, or suggest your own way of solving issue.
P.S. Thanks in advance and excuse me for my english
Solved! Go to Solution.