- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to see the maximum dimensions of an assembly. How can I do this with iLogic?
Solved! Go to Solution.
I would like to see the maximum dimensions of an assembly. How can I do this with iLogic?
Solved! Go to Solution.
Here is the code I found on another forum post that will do this for you.
Dim dims(0 To 2) As Decimal dims(0) = Measure.ExtentsLength dims(1) = Measure.ExtentsHeight dims(2) = Measure.ExtentsWidth MessageBox.Show("Complete" & vbLf & "Length: " & dims(0).ToString & vbLf & "Width: " & dims(1).ToString & vbLf & "Height: " & dims(2).ToString, "Get Size")
Hi,
Try this:
Public Sub Main() Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim i As Integer 'Use i as a counter. Dim param As Parameter Dim CurrentValue As Double Dim BigValue As Double = 0 Dim ParamName As String ' loop through all parameters For Each param In oDoc.ComponentDefinition.Parameters CurrentValue = param.Value If CurrentValue > BigValue BigValue = CurrentValue ParamName = param.Name End If Next MessageBox.Show(ParamName & " is the biggest parameter with a value of: " & BigValue * 10 & "mm", "Test123") 'I do BigValue * 10 to convert from cm to mm. End Sub
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
___________________________The question is meant to be in regards to the overall lengths of an assembly. Sorry for not clarifying that...
I think it's a little cleaner and less code to just show the maximum of an array than to use an if loop to find the largest value. However, this approach does not work in some instances.
Dim dimensionArray(0 To 2) As Decimal dimensionArray(0) = Measure.ExtentsLength dimensionArray(1) = Measure.ExtentsHeight dimensionArray(2) = Measure.ExtentsWidth MessageBox.Show("The maxiumum size of this assembly is: " & dimensionArray.Max.ToString & " in")