turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Navigation
- Tecnomatix
- Forums
- Blogs
- Knowledge Bases
- Groups

- Siemens PLM Community
- Tecnomatix
- Tecnomatix Developer Forum
- Volume calculation of 3D Geometry

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

07-11-2018 04:14 AM

Hello,

is there any way to calculate the volume of the 3D geometry with API?

Thank you in advance,

Witalij.

Solved! Go to Solution.

4 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

a month ago

You can access the TxOject geometry using **ITxGeometry.Approximation **

(provided the object has Geometry, some objects don't have...).

This returns a class called **TxApproximationData** which contains the vertices (Points), Normals and faces (Primitives).

From the mesh geometry you can calculate the volume yourself. Not all meshes have trivial volume or a volume at all.

See this for example:

how-to-calculate-the-volume-of-a-3d-mesh-object

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

4 weeks ago

How would you approximate a volume when you only have points data (like in collision contour data)? I've seen convex hull solution, but have not tried to implement yet.

Regards

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

4 weeks ago

Thank you!

I put here my function to calculate the volume of the 3D body based on the approximation (may be somebody else will required it also):

#Region "GetVolume" ''' <summary> ''' Calculate the volume of the <see cref="ITx2Or3DimensionalGeometry"/> based on the aprroximation data. ''' </summary> ''' <param name="geometry">The <see cref="ITx2Or3DimensionalGeometry"/>.</param> ''' <returns>The calculated volume value.</returns> <Extension> Public Function GetVolume(geometry As ITx2Or3DimensionalGeometry) As Double Dim primitives() As TxPrimitiveData = geometry.Approximation.Primitives.ToArray() Return (From p As TxPrimitiveData In primitives Select GetSignedVolume(p)).Sum() End Function ''' <summary> ''' Calculates the signed volume value for a <see cref="TxPrimitiveData"/>. ''' </summary> ''' <param name="primitive">The <see cref="TxPrimitiveData"/>.</param> ''' <returns>The signed volume value.</returns> Private Function GetSignedVolume(primitive As TxPrimitiveData) As Double Dim sideA As TxVector = primitive.Approximation.Points(primitive.Indices(1)) - primitive.Approximation.Points(primitive.Indices(0)) Dim sideB As TxVector = primitive.Approximation.Points(primitive.Indices(2)) - primitive.Approximation.Points(primitive.Indices(0)) Dim normal As TxVector = TxVector.CrossProduct(sideA, sideB) Dim sign As Double = 1 If normal.GetAngle(primitive.Approximation.Normals(primitive.Indices(0))) > Math.PI / 2.0R Then sign = -1 Return sign * TxVector.DotProduct(primitive.Approximation.Points(primitive.Indices(0)), TxVector.CrossProduct(primitive.Approximation.Points(primitive.Indices(1)), primitive.Approximation.Points(primitive.Indices(2)))) / 6.0R End Function #End Region

The usage is straight forward:

Dim geometrie As ITx2Or3DimensionalGeometry = TxApplication.ActiveSelection.GetItems()(0) MsgBox(geometrie.GetVolume())

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

Convex hull is easy to calculate and yields an upper bound on the volume, yet it does not consider e.g., cavities.

There are many spatial algorithms which attempt to create an estimate, but since point cloud is partial information, there can always be some case of error.

You can check this goolge search.

Watch Replays of Previous Topics

- Tecnomatix 12
- Tecnomatix Video library on YouTube
- Plant Simulation Free Trial
- Jack Free Trial
- RobotExpert Free Trial
- Plant Simulation Student Download
- Teamcenter Manufacturing video tutorials

Follow Siemens PLM Software

© 2018 Siemens Product Lifecycle Management Software Inc