icon

[Frage] Gravity Center [Gelöst]

Schlagworte:
  • 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

Anhänge (3)

Typ: image/png
48-mal heruntergeladen
Größe: 66,33 KiB
Typ: image/png
37-mal heruntergeladen
Größe: 64,27 KiB
Typ: image/png
27-mal heruntergeladen
Größe: 57,86 KiB

Lösung anzeigen Lösung verbergen

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

Anhänge (2)

Typ: application/x-sqlite3
43-mal heruntergeladen
Größe: 132,00 KiB
Typ: image/png
33-mal heruntergeladen
Größe: 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 ?

Anhänge (1)

Typ: image/png
36-mal heruntergeladen
Größe: 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)

Anhänge (1)

Typ: application/x-7z-compressed
48-mal heruntergeladen
Größe: 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

Anhänge (1)

Typ: image/png
30-mal heruntergeladen
Größe: 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

Anhänge (1)

Typ: application/zip
47-mal heruntergeladen
Größe: 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

Anhänge (2)

Typ: application/x-sqlite3
43-mal heruntergeladen
Größe: 132,00 KiB
Typ: image/png
33-mal heruntergeladen
Größe: 62,42 KiB