& Construction

Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
& Manufacturing

Professional CAD/CAM tools built on Inventor and AutoCAD
Integrated BIM tools, including Revit, AutoCAD, and Civil 3D
Professional CAD/CAM tools built on Inventor and AutoCAD
I am trying to capture the the total area of sign boards mounted to a structure. The structure can have 1, 2 or 3 sign mounted to it. Below is my ilogic formula based on user parameters. I captured the current values above and below the formula
D1 = 2440 mm B1 = 5 m D2 = 3050 mm B2 = 5 m D3 = 610 mm B3 = 7 m Sign_Count = 2 ul Sign_Area = D1 * B1 + (D2 * B2 * (Sign_Count >= 2)) + (D3 * B3 * (Sign_Count >= 3)) Sign_Area = -3.05 m^2
I was expecting the area to be 27.45. When I use the same structure formula in Excel is gives the answer of 27.45.
I was trying to avoid
If Sign_Count = 1 then
Sign_Area = D1*B1
ElseIF Sign_Count = 2 then
Sign_Area = D1*B1+D2*B2
ElseIF Sign_Count = 3 then
Sign_Area = D1*B1+D2*B2+D3*B3
endif
Solved! Go to Solution.
Not sure why it's evaluating like that - I don't have an answer for the logic end. This may not be of use to you, but if you have the signs modeled and want to pull the area of them straight out of the model, you can:
Sub Main()
Dim signFace As Face
Dim signArea As Double
'Use this is you have named components and faces
Dim signComp As ComponentOccurrence = Component.InventorComponent("Sign1")
signFace = GetFace(signComp.ComponentDefinition, "Front")
'Use this is you want to pick the sign and face
signFace = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Click the front of the sign").NativeEntity
signArea = signFace.Evaluator.Area / 10000
End Sub 'Main
Function GetFace(def As PartComponentDefinition, faceName As String) As Face
For Each bod As SurfaceBody In def.SurfaceBodies
For Each f As Face In bod.Faces
Dim attSets = f.AttributeSets
If attSets.NameIsUsed("iLogicEntityNameSet") Then
Dim attSet As AttributeSet = attSets.Item("iLogicEntityNameSet")
For Each at As Attribute In attSet
If at.Name = "iLogicEntityName" Then
If at.Value = faceName Then
Return f
End If
End If
Next
End If
Next
Next bod
Return Nothing
End Function
Interesting. nice to see an demonstration of interacting with the model with picks. Oddly enough, the signs themselves and the support structure for the signs are two different contracts. The signs themselves actually never show up in the design drawing other in a table to give their position for mounting, and over all dimension for determining the structural requirements of the sign support components. My basic check is to ensure the total sign board size is either under 45 m^2 of perform a special location calculation to determine a new sign limit. So for the time being no signs in the assembly I am working on. Though nothing to say I won't add it later as a follow up.
@dwerner, I think this would work for you.
Hope that helps, Curtis
Sign_Count = 2 For i = 1 To Sign_Count Sign_Area = Sign_Area + Parameter("D" & i) * Parameter("B" & i) Next Sign_Area = Sign_Area + 3.05 m^2 MsgBox(Sign_Area)
Sign_Count = 2 For i = 1 To Sign_Count Sign_Area = Sign_Area + Parameter("D" & i) * Parameter("B" & i) Next MsgBox(Sign_Area)
After setting this part up I noticed this actually did return 27.45 for me though
Sign_Count = 2 Sign_Area = D1 * B1 + (D2 * B2 * (Sign_Count >= 2)) + (D3 * B3 * (Sign_Count >= 3)) MsgBox(Sign_Area)
I think you meant i instead of 1 within the for loop. minor typo.
What perplexes me is why the +3.05 m^2 requirement seems strange.
Thank you for confirming that there is something amuck with my model since my formula is working for you! Apparently Inventor just hates me 8)
@dwerner wrote:
I think you meant i instead of 1 within the for loop. minor typo.
What perplexes me is why the +3.05 m^2 requirement seems strange.
Doh!
You're exactly right. That explains the +3.05 m^2 part also, which seemed odd to me too... not sure what it was doing, but this works
@dwerner wrote:
Thank you for confirming that there is something amuck with my model since my formula is working for you! Apparently Inventor just hates me 8)
it could be the Length units for your document? Maybe
Tools tab > Options panel > Document Settings > units tab
Is there something off in my model?
so I did a wee bit of msgbox debugging since i could not step through or watch the evaluation. On my system I found a strange result.
Sign_Count = 2
msgbox(Sign_Count >=2)
'result "TRUE"
msgbox(1*(Sign_Count >=2))
'result "-1"
I would have thought the results of TRUE x 1 would have been 1, not -1. When I adjust the formula with - put before the bracket for the boolean check, it works for me. Wonder what setting causes TRUE to convert to -1?
Further research into the matter shows that VB.net uses -1 for TRUE and 0 for FALSE. Further reading also highly suggests not to rely on the numeric value for True or False in a formula but instead to deal with the True or False cases in other ways.
How to buy
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © 2025 Autodesk Inc. All rights reserved
Type a product name