Inventor Customization

Posts: 22
Registered: ‎03-20-2009
Message 1 of 2 (279 Views)

Show parameters in a textbox on a VBA form

279 Views, 1 Replies
06-18-2009 05:58 AM

How can I read out a parameter and show it in a textbox on a VBA-form?

The code below gives nothing in my textbox.


Private Sub ModelParameters()

Set oPartDoc = ThisApplication.ActiveDocument

Set oParams = oPartDoc.ComponentDefinition.Parameters

Set oModelParams = oParams.ModelParameters

Set oUserParams = oParams.UserParameters

TextBoxP.Value = oUserParams.Item("Thickness").Value

End Sub

Distinguished Contributor
Posts: 119
Registered: ‎10-09-2008
Message 2 of 2 (279 Views)

Re: Show parameters in a textbox on a VBA form

06-18-2009 11:02 AM in reply to: wpepping
Here is a sample I use. Hope it helps.

Dim oDoc As PartDocument
Dim oParams As Parameters
Dim omodParams As ModelParameters
Dim oUserParams As UserParameters

Set oDoc = ThisApplication.ActiveEditObject
Set oParams = oDoc.ComponentDefinition.Parameters
Set omodParams = oParams.ModelParameters
Set oUserParams = oParams.UserParameters

TextBox6.Value = omodParams.Item("thickness").Expression


You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor