icon

[Вопрос] Gravity Center [Решен]

Теги:
  • Allplan
  • 2025
  • Visual
  • Scripting
  • Bug
  • Issue
  • Code
  • 3dmodel

Hello there,

I've made a visual script to try and get the gravity center but get error every time (cf pictures) and i don't know what to do to resolve the issue. If you have any idea i take it !

Thanks for answering

Вложения (3)

Type: image/png
Загружено 48 раз
Size: 66,33 KiB
Type: image/png
Загружено 37 раз
Size: 64,27 KiB
Type: image/png
Загружено 27 раз
Size: 57,86 KiB

Show solution Hide solution

Hi

Here a starting point for your script (ALLPLAN 2025)

The idea is to select by mouse the objects, then I made a filter based on the geometry (I made it in Python, maybe can be done with nodes....)

import NemAll_Python_Geometry as Geometry

def function_to_execute(ele_list) -> list[Geometry.Polyhedron3D]:
    """ implement the script code here """
    polyh_list = []
    for ele in ele_list:
        if isinstance(ele, Geometry.Polyhedron3D):
            polyh_list.append(ele)
    return polyh_list

Then Union and finally CalculateMass

Christophe

Вложения (2)

Type: application/x-sqlite3
Загружено 43 раз
Size: 132,00 KiB
Type: image/png
Загружено 33 раз
Size: 62,42 KiB

The CalcMass-Node and also the underlaying function accepts only 3D-Solids, like Polyhedron3D, BRep3D and others shown in the message. You have obviously select a 2D-Line!
If you want the Centerpoint of the line, please use other Node to get it!

I need to find the gravity center of this 3D model what node should I use to get CalcMass to function correctly ?

Вложения (1)

Type: image/png
Загружено 36 раз
Size: 10,39 KiB

Maybe filter the Elements with Geometry of Polyhedron3D or BRep3D first!

If I may ask: What is the point of gravity needed for?

Doesn't the center of the bounding box do the same thing?

I did try with bounding box but got the exact same problems.

I tried something else but i think i miss something (Cf video)

Вложения (1)

Type: application/x-7z-compressed
Загружено 48 раз
Size: 3,84 MiB

Hi,

Here an example

1) you select the objects
2) the script make an union of the objects
3) then it calculates the gravity point

Best
Christophe

Вложения (1)

Type: image/png
Загружено 30 раз
Size: 62,84 KiB

I copy what you did but i get : "Union: Attemting to append an invalid type"

Is it because I selected multiple objects or not ?

I tried with some 3D objects, but not with arch elements.

Can you post your drawing file with your objects?

I hope this is helpful

Вложения (1)

Type: application/zip
Загружено 47 раз
Size: 1,80 MiB

Hi

Here a starting point for your script (ALLPLAN 2025)

The idea is to select by mouse the objects, then I made a filter based on the geometry (I made it in Python, maybe can be done with nodes....)

import NemAll_Python_Geometry as Geometry

def function_to_execute(ele_list) -> list[Geometry.Polyhedron3D]:
    """ implement the script code here """
    polyh_list = []
    for ele in ele_list:
        if isinstance(ele, Geometry.Polyhedron3D):
            polyh_list.append(ele)
    return polyh_list

Then Union and finally CalculateMass

Christophe

Вложения (2)

Type: application/x-sqlite3
Загружено 43 раз
Size: 132,00 KiB
Type: image/png
Загружено 33 раз
Size: 62,42 KiB