Measure - Area of multiple faces at once

roloNCC
Advocate

Measure - Area of multiple faces at once

roloNCC
Advocate
Advocate

Is there a way to measure the are of multiple faces at once? I can easily select multiple faces, but when the measure feature is on, I can only seem to be able to select one face at a time. 

 

 

0 Likes
Reply
Accepted solutions (1)
4,900 Views
17 Replies
Replies (17)

johnsonshiue
Community Manager
Community Manager

Hi! It looks like you can select up to two faces and hit Measure tool. The tool should report the area measurement for the two selected faces.

Many thanks!



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes

Curtis_Waguespack
Consultant
Consultant

Hi @roloNCC 

 

I think we lost the ability to get accumulate totals with the measure tools as we could in the past (I don't recall exactly how things worked in the past though) ... but I had an iLogic rule on hand from a recent topic here on this forum where someone was wanting to total the selected edge selections... I took a minute to modify that code to get the total of the selected faces.

 

This should work in a part or assembly file. Post back if you have any issues with it.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

oPrecision = 3
Dim TotalLength As Double
Dim oHighLight As Inventor.HighlightSet
oHighLight = ThisDoc.Document.CreateHighlightSet
On Error GoTo EndRule
oUOM = ThisDoc.Document.UnitsOfMeasure
oLUnits = oUOM.LengthUnits
oUnitString = oUOM.GetStringFromType(oLUnits)
oArea = " "
Dim oPrompt1 As String 
oPrompt1 = "Select Faces, then press Escape to end..."
While True

	selectFace = ThisApplication.CommandManager.Pick _
		(SelectionFilterEnum.kAllPlanarEntities, oPrompt1 & oPrompt2 )
		
		'if nothing then exit
	If IsNothing(selectFace) Then Exit While
   
   		Dim oEval As SurfaceEvaluator = selectFace.Evaluator
        	oArea = oEval.Area

		Call oHighLight.AddItem(selectFace)
		TotalArea = TotalArea + oArea	
		
		oPrompt1 = Round(oUOM.ConvertUnits(oArea	, "cm", _
			oLUnits), oPrecision) & " " & oUnitString & "^2"
		
		oPrompt2 = Round(oUOM.ConvertUnits(TotalArea, "cm", _
			oLUnits), oPrecision) & " " & oUnitString & "^2"
			
		If oPrompt2 = oPrompt1 Then
			oPrompt2 = ""
		Else
			oPrompt1 = "[ " & oPrompt1 & " ]   Sum: " 
			
		End If
		

End While
InputBox("Total:", "ilogic", oPrompt2)

EndRule :
oHighLight.Clear

 

roloNCC
Advocate
Advocate

Correct, and I want to be able to do more than 2 faces at once. Im looking to do about 15 faces at once and get the area of all together rather than doing one at a time and having to add. I know I can do this by setting up the BOM to read that, but Im talking about a quick measure here at part/assembly level. 

0 Likes

MattEds
Enthusiast
Enthusiast

Within the measure command there will be a small + button to the right hand of the window. As the tooltip will show you this is a "add to accumulated value" which will allow you to select other faces and come up with a total value.

 

Measure.png

roloNCC
Advocate
Advocate

It seems to only do 2 at a time. It doesn't allow you to do more than two faces. 

 

https://autode.sk/3a4LDTB

0 Likes

MattEds
Enthusiast
Enthusiast
Accepted solution

Rand, the correct workflow would be:

measure -> select face or surface -> hit add to accumulative value.

select new face or surface -> hit add to accumulative value.

repeat for each selection you want to accumulate.

 

hope this helps.

0 Likes

roloNCC
Advocate
Advocate

Yup, just like you predicted. I was looking for all selected faces to stay highlighted, which would be helpful as a visual check, but it does add them up. 

 

Maybe this is a good one for the Autodesk engineers, allow for all faces added to stay highlighted in order to keep track of what has been selected. 

ajremillard
Contributor
Contributor

This code works well but the conversion needs to take into account that you are converting area, and not simply length. 

 

Therefore you have an error of one time the conversion from cm to whatever the model's length unit is. I checked it and this is indeed the case with the current code. 

 

The workaround is to convert from "cm cm" to oLUnits where oLUnits is twice the string of the model's length unit, for example "in in".

 

0 Likes

R.nnie
Contributor
Contributor

Hi @Curtis_Waguespack 
Is there a way to modify this for round surfaces eg. cylindrical surface? I can't select them using this rule.
Thanks!

0 Likes

Curtis_Waguespack
Consultant
Consultant

Hi @R.nnie 

 

I think you can change the line as shown to kAllCircularEntities or kAllEntitiesFilter to meet your needs.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Curtis_Waguespack_0-1675864912968.png

 

R.nnie
Contributor
Contributor

@Curtis_Waguespack 
Thanks a million, this seems to work the charm!
I have another issue as @ajremillard mentioned the units conversion throws my result off by a decimal place (working in mm). 
I'm still fairly green when it comes to ilogic but would it work if I chose a different function for the ConvertUnits which could just get the value as is in mm?

 

0 Likes

Curtis_Waguespack
Consultant
Consultant

Hi @R.nnie ,

 

I think just adding /10 as in this example should do it.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

		oPrompt2 = Round(oUOM.ConvertUnits(TotalArea, "cm", _
			oLUnits), oPrecision) / 10 & " " & oUnitString & "^2"

 

ajremillard
Contributor
Contributor

Hi, here's how I modified @Curtis_Waguespack 's code to fix the unit conversion:

Select Case oLUnits

	Case 11272 'Inch units
	oLUnits = "in in"
	
	Case 11269 'Millimeter units
	oLUnits = "mm mm"
	
	Case 11270 'Meter units
	oLUnits = "m m"
	
	Case 11273 'Feet units
	oLUnits = "ft ft"
	
	Case 11275 'Mile units
	oLUnits = "mil mil"

End Select

 

 

oPrompt2 = Round(oUOM.ConvertUnits(TotalArea, "cm cm", oLUnits), oPrecision) & " " & oUnitString & "^2"

 

 

R.nnie
Contributor
Contributor

@ajremillard @Curtis_Waguespack thanks for the help!

 

Michael.RostZ454J
Contributor
Contributor

Hello everyone.
Regardless of the solution above, I have been working on a similar function to work around a problem that the code above also has.
If an area is accidentally selected multiple times, it will also be counted multiple times and due to the highlighting, you will unfortunately not notice the multi-selection.
It also shows the same strange behavior as my function. If each selected area is selected again, the highlighting disappears. 🙈

 

"highlightset is not highlighted after second pick of the same face" 

 

0 Likes

bartlomiej.nowak2SCUW
Participant
Participant

Hi,

i find your solution works great but i some cases i have assembly with hundreds of faces and i want to know if there is a way to change code to not pick faces one by one but to sum area for hold and drag (best way if it would be working left to right and right to left dragging and marking faces as it works in inventor)

 

i don't use ilogic in that level so sorry if it is ridiculous question and iLogic don't allow that

0 Likes

valdas_kulikajevasYW7SV
Contributor
Contributor

That is such a frustrating system to use...

0 Likes