### Area measurement

Posted:

**Tue Feb 09, 2010 4:28 am**is there a way to draw something and measure:

a) length

b) area

c) angle

thank you very much!

a) length

b) area

c) angle

thank you very much!

User community support forum for Apache OpenOffice, LibreOffice and all the OpenOffice.org derivatives

https://user.services.openoffice.org/en/forum/

https://user.services.openoffice.org/en/forum/viewtopic.php?f=11&t=27311

Page **1** of **1**

Posted: **Tue Feb 09, 2010 4:28 am**

is there a way to draw something and measure:

a) length

b) area

c) angle

thank you very much!

a) length

b) area

c) angle

thank you very much!

Posted: **Tue Feb 09, 2010 5:01 am**

Not really, although you can get some of those values, with some restrictions.

If you want to describe a specific situation, maybe we can make some specific suggestions.

If you want to describe a specific situation, maybe we can make some specific suggestions.

Posted: **Tue Feb 09, 2010 10:08 am**

autocad has a measure area measure length measure angle feature

is there a way to maybe transform drawing to .dwg and measureitwith the autocad reader?

is there a way to maybe transform drawing to .dwg and measureitwith the autocad reader?

Posted: **Tue Feb 09, 2010 6:39 pm**

Ok; thanks for the sample.

Draw is really not good for CAD or engineering drawing. I would consider any sort of analysis done with it as "approximate". It just isn't designed for that kind of work and there are still problems with its coordinate system and scaling that can give incorrect values.

That said, it is possible to do some simple calculations on Draw figures, as you've done, or using extensions that are available. Here's one that I've heard of, but not tried myself:

http://extensions.services.openoffice.o ... ect/cadooo

You may also want to look at these previous threads:

viewtopic.php?f=11&t=21044

viewtopic.php?f=11&t=24101

There's another extension linked there that allows you to extract information from Draw into a spreadsheet, where you can do whatever calculations you want.

BTW, in your diagram, are you interested in the entire area of the large, 4-sided shape, or of (some subset of) the smaller colored polygons within the larger one? I find an area of about 117 m^2 for the large area.

Draw is really not good for CAD or engineering drawing. I would consider any sort of analysis done with it as "approximate". It just isn't designed for that kind of work and there are still problems with its coordinate system and scaling that can give incorrect values.

That said, it is possible to do some simple calculations on Draw figures, as you've done, or using extensions that are available. Here's one that I've heard of, but not tried myself:

http://extensions.services.openoffice.o ... ect/cadooo

You may also want to look at these previous threads:

viewtopic.php?f=11&t=21044

viewtopic.php?f=11&t=24101

There's another extension linked there that allows you to extract information from Draw into a spreadsheet, where you can do whatever calculations you want.

BTW, in your diagram, are you interested in the entire area of the large, 4-sided shape, or of (some subset of) the smaller colored polygons within the larger one? I find an area of about 117 m^2 for the large area.

Posted: **Wed Jan 23, 2019 2:22 pm**

I can offer the procedure for area measurement of polypolygon (i use it in OpenOffice Draw):

Lubos Raus

Lubos Raus

- Code: Select all Expand viewCollapse view
`Option Explicit`

' Copyleft 2019 Lubos Raus

' Procedure is based on https://forum.openoffice.org/en/forum/viewtopic.php?f=11&t=86532

Sub PolygonArea

Dim oDoc As Object, PolyPolygonShape As Object

Dim StartPoint As New com.sun.star.awt.Point

Dim Value as Long, PointsNumber as integer, i as Integer, InputStr as String

oDoc = ThisComponent

If IsNull(oDoc) Then

Exit Sub

EndIf

PolyPolygonShape = MyGetCurrentlySelectedSingleShape(oDoc, False)

If IsNull(PolyPolygonShape) then

exit sub

End if

If PolyPolygonShape.getShapeType() <> "com.sun.star.drawing.PolyPolygonShape" Then

MsgBox "Selected shape is not PolyPolygonShape", 48, "Info"

exit sub

End if

PointsNumber = UBound(PolyPolygonShape.PolyPolygon(0))

Dim Points(PointsNumber) As New com.sun.star.awt.Point

Dim Coordinates(0 to PointsNumber, 0 to 1) as Long

Array(Points()) = PolyPolygonShape.PolyPolygon

For i= 0 to PointsNumber

Coordinates(i,0) = PolyPolygonShape.PolyPolygon(0)(i).x

Coordinates(i,1) = PolyPolygonShape.PolyPolygon(0)(i).y

next i

Dim x(PointsNumber) as Double, y(PointsNumber) as Double, Area as Double

Area = 0

For i= 0 to PointsNumber

x(i) = Coordinates(i,0)/1000

y(i) = Coordinates(i,1)/1000

next i

For i= 0 to PointsNumber-1 ' algortimus based on mathworld.wolfram.com/PolygonArea.html

Area = Area + x(i)*y(i+1)-x(i+1)*y(i) ' (CRC Standard Mathematical Tables and Formulas 33E (2018).pdf pg. 212)

next i

Area = Area/2

MsgBox "Polygon Area is: " & Area & " cmÂ².",0 , "Polygon Area"

End sub

'___________________________________________________________________________________________________________________

'**************************************************************************************

' Next functions based on Danny B's macro collection downloaded from the old oooForum.

' a version of the original code is available from this topic of the AOO forum:

' https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=15217&start=0

' and on this place:

' http://nab.pcug.org.au/20090204_bas_source/dannyb.bas

'**************************************************************************************

Function MyDrawingGetSelection(ByVal oDrawDocCtrl as object) as object

Dim oSelectedShapes as object

Dim oDrawDocCtrl2 as object

If Not HasUnoInterfaces( oDrawDocCtrl, "com.sun.star.frame.XController" ) Then

'xray oDrawDocCtrl

oDrawDocCtrl2 = MyGetDocumentController( oDrawDocCtrl )

else

oDrawDocCtrl2 = oDrawDocCtrl

EndIf

If IsEmpty( oDrawDocCtrl2.getSelection() ) Then

oSelectedShapes = createUnoService( "com.sun.star.drawing.ShapeCollection" )

else

oSelectedShapes = oDrawDocCtrl2.getSelection()

EndIf

MyDrawingGetSelection() = oSelectedShapes

End Function

'___________________________________________________________________________________________________________________

Function MyGetCurrentlySelectedSingleShape(ByVal oDrawDoc, Optional bSilent ) As Object

Dim oSelectedShapes as object

Dim oSingleSelectedShape as object

If IsMissing( bSilent ) Then

bSilent = False

EndIf

oSelectedShapes = MyDrawingGetSelection(oDrawDoc)

If oSelectedShapes.getCount() <= 0 Then

If Not bSilent Then

MsgBox "There is not object selected", 48, "Info"

Exit Function

EndIf

ElseIf oSelectedShapes.getCount() > 1 Then

If Not bSilent Then

MsgBox "Please select one shape only", 48, "Info"

Exit Function

EndIf

Else

oSingleSelectedShape = oSelectedShapes.getByIndex(0)

myGetCurrentlySelectedSingleShape() = oSingleSelectedShape

EndIf

End Function

'___________________________________________________________________________________________________________________

Function MyGetDocumentController( oDoc As Object ) As Object

Dim oCtrl As Object

If oDoc.supportsService( "com.sun.star.document.OfficeDocument" ) Then

oCtrl = oDoc.getCurrentController()

ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XController" ) Then

oCtrl = oDoc

ElseIf HasUnoInterfaces( oDoc, "com.sun.star.frame.XFrame" ) Then

oFrame = oDoc

oCtrl = oFrame.getController()

Else

MsgBox( "GetDocController called with incorrect parameter." )

EndIf

MyGetDocumentController() = oCtrl

End Function

Posted: **Wed Jan 23, 2019 3:38 pm**

There are many free CAD packages which will calculate areas. Google for them.

See How to measure areas in map [using LibreCAD] - export an image and insert it into LibreCAD.

If you can break the area into triangles you can calculate it easily. If the sides are a, b and c, calculate S = (a+b+c)/2. The area is now sqrt[s * (s-a) * (s-b) * (s-c)]. See Heron's Formula.

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.

See How to measure areas in map [using LibreCAD] - export an image and insert it into LibreCAD.

If you can break the area into triangles you can calculate it easily. If the sides are a, b and c, calculate S = (a+b+c)/2. The area is now sqrt[s * (s-a) * (s-b) * (s-c)]. See Heron's Formula.

Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.

Posted: **Thu Jan 24, 2019 1:10 am**

I would not resort to Heron's formula here. In the context of drawing software e.g. polygons will next to always be described by coordinates of points and/or vectors, and next to never by side lengths (and angles). This should even hold for software accepting angles an lengths for input as soon as the input is processed.

Sticking to 2D the oriented area of a triangle is half the determinant of the 2 x 2 matrix formed by the 2 (column-) vectors describing two sides of the triangle in ordinary succession. For polygons without any pair of intersecting edges you don't need a triangulation at all.

See attached example. (Disclaimer: Errors expected.)

Sticking to 2D the oriented area of a triangle is half the determinant of the 2 x 2 matrix formed by the 2 (column-) vectors describing two sides of the triangle in ordinary succession. For polygons without any pair of intersecting edges you don't need a triangulation at all.

See attached example. (Disclaimer: Errors expected.)