Autodesk Inventor Customization
- Start Article
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Convert model parameter to reference parameter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I need to convert a model parameter to a reference parameter thru the API.
I saw this item discussed in the group before, but I cant find the thread.
Can anyone help me out?
Solved! Go to Solution.
Re: Convert model parameter to reference parameter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Property Driven() As VARIANT_BOOL
Please mark this response as "Accept as Solution" if it answers your question.
James Letcher
2012 Factory Design Suite ( will not load 2013)
What happen to my Inventor :-(
Re: Convert model parameter to reference parameter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry, I didn't get that answer.
Has anyone put the " ModelParameter.Convert to Reference Parameter" Method?
Re: Convert model parameter to reference parameter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
ConvertToReferenceParameter method works fine but not for built-in model parameters. See help. If you create model parameter programmatically then you are free to call this method. Try the following VBA sample.
Private Sub Model2Refs_1()
Dim oDef As PartComponentDefinition
Set oDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oPars As Parameters
Set oPars = oDef.Parameters
Dim oModelPars As ModelParameters
Set oModelPars = oPars.ModelParameters
Dim oModelPar As ModelParameter
'create model parameter (not built-in)
Set oModelPar = oModelPars.AddByExpression("333 mm", "mm", "NonBuiltIn")
'change its type to reference
Call oModelPar.ConvertToReferenceParameter
End Sub
You may control Boolean Driven property of dimension constraints. Create new part with the rectangle on the first sketch + create pair of dimensions (so you will get pair of model parameters). The following VBA code convert parameter which controls the first dimension constraint to reference type.
Private Sub Model2Refs_2() Dim oDoc As PartDocument Set oDoc = ThisApplication.ActiveDocument Dim oDef As PartComponentDefinition Set oDef = oDoc.ComponentDefinition Dim oSketch As PlanarSketch Set oSketch = oDef.Sketches.Item(1) Dim oDims As DimensionConstraints Set oDims = oSketch.DimensionConstraints Dim oDim As TwoPointDistanceDimConstraint Set oDim = oDims.Item(1) oDim.Driven = True End Sub
Hope the idea is clear.
Cheers,

Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network
Re: Convert model parameter to reference parameter
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Excellent answer, thank you

