How to edit/update/change dimension of a feature or sketch in a part

How to edit/update/change dimension of a feature or sketch in a part

Anonymous
Not applicable
649 Views
2 Replies
Message 1 of 3

How to edit/update/change dimension of a feature or sketch in a part

Anonymous
Not applicable

I want to modify/edit/update/change few dimensions in certain features and certain sketches of a part.

 

I can retrieve the name and value of the dimension of the features using the following code

oFeatureDim.Parameter.ModelValue is a Readonly property . How to change ModelValue?

 

Sub QueryAndShowFeatureDimensions()
Try
Dim oDoc As Document
oDoc = InventorApplication.ActiveDocument


' Get the component definition. This owns the part specific info for the part.
Dim partDef As PartComponentDefinition
partDef = oDoc.ComponentDefinition
Dim partSketches As PlanarSketches
partSketches = partDef.Sketches
'For Each partFeature In oDoc.


' Set a reference to the selected feature.
Dim oFeature As PartFeature
Dim oFeatures As PartFeatures
oFeatures = partDef.Features

Dim oFeatureDim As FeatureDimension
Dim i As Long
Dim j As Long
i = 0
j = 0
' Iterate over all dimensions of the feature.
MessageBox.Show("Number of features in part is >" + oFeatures.Count.ToString + "<")
For Each oFeature In oFeatures
j = j + 1
i = 0
For Each oFeatureDim In oFeature.FeatureDimensions
i = i + 1
MessageBox.Show(" Feature " + CStr(j) + ". Dimension " + CStr(i) + ". Name >" + oFeatureDim.Parameter.Name + "< . Model Value >" + CStr(oFeatureDim.Parameter.ModelValue) + "<")

Next
' Show all the feature dimensions
oFeature.FeatureDimensions.Show()
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
MessageBox.Show(ex.StackTrace)
End Try
End Sub

0 Likes
Accepted solutions (1)
650 Views
2 Replies
Replies (2)
Message 2 of 3

adam.nagy
Autodesk Support
Autodesk Support
Accepted solution

Hi,

 

You can modify it through Parameter.Expression - see e.g. http://adndevblog.typepad.com/manufacturing/2014/07/create-dimension-relative-to-other-dimension.htm...

 

Cheers, 



Adam Nagy
Autodesk Platform Services
Message 3 of 3

Anonymous
Not applicable

Hi Adam,

   Yes. This answered my question and after modification my code worked like a charm for updating dimensions of features and sketches

Thanks

PV Subramanian 

0 Likes