06-12-2023
07:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
06-12-2023
07:28 AM
Hi @chris
edit: see @WCrihfield's post below to add a reference parameter
To make it a reference dimension, I think you would need to have or add a sketch dimension and set it to be driven.
To pass the result to a user parameter, you could use something like this to look for the parameter and create it if not found.
Dim num1 As Double = 7 Dim num2 As Double = 9 Dim oResult As Double = Math.Sqrt(num1 + num2) oName = "My_SQRT_Result" Dim oUserParams As UserParameters If ThisDoc.Document.DocumentType = DocumentTypeEnum.kDrawingDocumentObject Then oUserParams = ThisDoc.Document.Parameters.UserParameters Else oUserParams = ThisDoc.Document.ComponentDefinition.Parameters.UserParameters End If Dim oTest As String = "" Try : Parameter(oName) = oResult : Catch : oTest = "not found" : End Try If oTest = "not found" Then oUserParams.AddByValue(oName, oResult, UnitsTypeEnum.kUnitlessUnits) 'oUserParams.AddByValue(oName, oResult, UnitsTypeEnum.kInchLengthUnits) End If 'assumes Length is an inch based parameter 'use * 1 in to convert untiless to inches Parameter.Param("Length").Expression = oName & "* 1 in" InventorVb.DocumentUpdate()
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com