icon

Support Forum

Computing


Hello Allplan family
I need to compute the whole building I create.
is there any chance to use a python code to compute every single object that I need for every new and old buildings on Allplan?

thankyou

Hilfreichste Antwort anzeigen Hilfreichste Antwort verbergen

Hi,

I still need some information, but I will just assume some. Let me list my assumptions:

  • the computation is done on an element-level -> the price results from properties of that particular element, not e.g. neighboring elements
  • the computation involves some data, stored in a defined place (the price list, published by the government)

I think, for this use case, I would suggest to use formula attribute, that uses python function.

In std/scripts/functions.py, define a function for your computation.

def calculate_price(area: float) -> float:
    price_per_square_meter = 123.0
    return area * price_per_square_meter

of course, you don't want to hardcode the prices in this file, because you have a list of prices somewhere.
Please make sure, when reading the prices, that this process is not too expensive. According to my observations, this function will be executed very often
and an expensive process e.g. reading from a remote database may slow down ALLPLAN. Reading from a single csv file should be ok though.

A function like this can be used in formula editor in ALLPLAN, like:

p:calculate_price(@293@)

So create a formula attribute, named e.g. "Price" and assign it to all the elements, the price you want to calculate. Then you can adapt the report
to also include the price.

Is that a feasible solution?

Cheers,
Bart

Zitiert von: uid-464224
I need to compute the whole building I create.

HI,

can you give us more details, what do you mean by computing?

Cheers,
Bart

Zitiert von: bmarciniec

Quote by
uid-464224I need to compute the whole building I create.

HI,can you give us more details, what do you mean by computing?
Cheers,

Bart

Infact I want to calculate the price of the whole project and the price of a small part of the project with respect to the annual Price list issued by the government
for every single building when I export the report in excel I need to modify 4000 rows.

Hi,

I still need some information, but I will just assume some. Let me list my assumptions:

  • the computation is done on an element-level -> the price results from properties of that particular element, not e.g. neighboring elements
  • the computation involves some data, stored in a defined place (the price list, published by the government)

I think, for this use case, I would suggest to use formula attribute, that uses python function.

In std/scripts/functions.py, define a function for your computation.

def calculate_price(area: float) -> float:
    price_per_square_meter = 123.0
    return area * price_per_square_meter

of course, you don't want to hardcode the prices in this file, because you have a list of prices somewhere.
Please make sure, when reading the prices, that this process is not too expensive. According to my observations, this function will be executed very often
and an expensive process e.g. reading from a remote database may slow down ALLPLAN. Reading from a single csv file should be ok though.

A function like this can be used in formula editor in ALLPLAN, like:

p:calculate_price(@293@)

So create a formula attribute, named e.g. "Price" and assign it to all the elements, the price you want to calculate. Then you can adapt the report
to also include the price.

Is that a feasible solution?

Cheers,
Bart