User Parameter Formula / Ilogic

User Parameter Formula / Ilogic

AIA-CAD
Observer Observer
196 Views
3 Replies
Message 1 of 4

User Parameter Formula / Ilogic

AIA-CAD
Observer
Observer

Hi,

 

is there a way for a parameter formula or a Ilogic rule to be set after the part is drawn to look at the extents of the part's Length x Width x Height? Still very new to utilising formulas within the drawing space. 

I have looked at a couple other forum posts and everything that I've seen points to the fact that you need to draw from the start with the intention on setting the keywords up at the start, i.e changing d1 > length.

 

https://forums.autodesk.com/t5/inventor-forum/equations-in-parameters/td-p/7174389

https://forums.autodesk.com/t5/inventor-forum/please-help-a-noob-with-creating-a-parts-list-with-len...

0 Likes
197 Views
3 Replies
Replies (3)
Message 2 of 4

andrewiv
Advisor
Advisor

Are you looking to create a parameter formula to calculate the volume or an iProperty formula?  If you have a part that is 10 long, 10 wide and 10 high do you want the value to show "1000" or do you want it to show "10 x 10 x 10"?  With iLogic this is possible because you can read the values of the bounding box.  Without iLogic this would need to be set in the template and the dimension names changed like you already found.

Andrew In’t Veld
Designer / CAD Administrator

Message 3 of 4

AIA-CAD
Observer
Observer

"10 x 10 x 10" if possible.

0 Likes
Message 4 of 4

andrewiv
Advisor
Advisor

Here is a simple rule that will add a custom property named Size and show the extents of the active part in inches rounded to three decimal places.

Dim oDoc As Document = ThisApplication.ActiveEditDocument
Dim oCustProps As PropertySet = oDoc.PropertySets.Item("Inventor User Defined Properties")
Dim oDecimal As Integer = 3
Dim oBox As Box = oDoc.ComponentDefinition.PreciseRangeBox
Dim oBBX As Double = oBox.MaxPoint.X - oBox.MinPoint.X
Dim oBBY As Double = oBox.MaxPoint.Y - oBox.MinPoint.Y
Dim oBBZ As Double = oBox.MaxPoint.Z - oBox.MinPoint.Z
Dim oBBXin As Double = Math.Round(oDoc.UnitsOfMeasure.ConvertUnits(oBBX, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits), oDecimal)
Dim oBBYin As Double = Math.Round(oDoc.UnitsOfMeasure.ConvertUnits(oBBY, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits), oDecimal)
Dim oBBZin As Double = Math.Round(oDoc.UnitsOfMeasure.ConvertUnits(oBBZ, UnitsTypeEnum.kDatabaseLengthUnits, UnitsTypeEnum.kInchLengthUnits), oDecimal)
Dim oBBXYZin As String = oBBXin & " x " & oBBYin & " x " & oBBZin

Try
	oProp = oCustProps.Item("Size")
	oProp.Value = oBBXYZin
Catch
	oCustProps.Add(oBBXYZin, "Size")
End Try

 

Andrew In’t Veld
Designer / CAD Administrator