how to add the user parameter to Sketch using vb.net

how to add the user parameter to Sketch using vb.net

Anonymous
Not applicable
728 Views
3 Replies
Message 1 of 4

how to add the user parameter to Sketch using vb.net

Anonymous
Not applicable

Hi all

I am karthick

I am created user parameter in inventor using vb.net.

I want add that parameters newly created sketch (line or circle) 

Sketch parameters not visualizing in fx table

 

REFER BELOW IMAGE

image.png

how can i trier this using vb.net any code available for this list parameter 

regards 

Karthick

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

Anonymous
Not applicable

No one this there for above condition 

0 Likes
Message 3 of 4

dgreatice
Collaborator
Collaborator
Accepted solution

Hi,

 

Can you share you first VBa Code.

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 4 of 4

Anonymous
Not applicable

Sub extru()
Dim aa, bb, cc, dd, ee, ff, gg, hh As Integer
Dim i As Integer = 1
Dim ii As Integer

oTG = inventorApp.TransientGeometry
partDoc = inventorApp.ActiveDocument
oPartCompDef = inventorApp.ActiveDocument.ComponentDefinition
oPositionMatrix = inventorApp.TransientGeometry.CreateMatrix
DataGridView1.DataSource = DtSet.Tables(0)
Dim oUserParam As UserParameter

oUserParam = oPartCompDef.Parameters.UserParameters.AddByValue("length", 6, UnitsTypeEnum.kCentimeterLengthUnits)

For Each iDataRow As DataRow In DtSet.Tables(0).Rows
aa = iDataRow.Item(4)
bb = iDataRow.Item(5)
ff = iDataRow.Item(6)
oSketch = partDoc.ComponentDefinition.Sketches.Add(partDoc.ComponentDefinition.WorkPlanes.Item(ff))
oSkPnts = oSketch.SketchPoints
oCircule = oSketch.SketchCircles
Call oSkPnts.Add(oTG.CreatePoint2d(aa, bb))
On Error Resume Next
cc = iDataRow.Item(1)
oCircule = oCircule.AddByCenterRadius(oSkPnts(1), cc)
dd = iDataRow.Item(2)
dd = cc - dd
oCircule = oCircule.AddByCenterRadius(oSkPnts(1), dd)
ee = iDataRow.Item(3)



 

 


' hear i need to add the parameter value for 2D skitch

 

 

 


oProfile = oSketch.Profiles.AddForSolid
oSketch.Edit()
oSketch.DimensionConstraints.Parameter(oUserParam)
oExtrude = oPartCompDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, ee, PartFeatureExtentDirectionEnum.kPositiveExtentDirection, PartFeatureOperationEnum.kJoinOperation)
On Error GoTo 0
Next

End Sub

0 Likes