Select to view content in your preferred language

Shape perimeter

1098
7
Jump to solution
10-07-2013 05:36 AM
AleksandarLalovic
Deactivated User
Is there a way to calculate shepe/block perimeter?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MatthiasBuehler1
Deactivated User
after thinking for a minute, you could do something like this :


@Hidden attr perimeter = 0  Lot -->     extrude(1)     set (perimeter, geometry.area() - 2 * (geometry.area(bottom))     comp(f) { bottom : reverseNormals Gotcha. }


the idea of course being that you take the full surface after the extrusion, subtracting the bottom and top area, then dividing again by the extrusion height.


cheers !

matt

View solution in original post

0 Kudos
7 Replies
MatthiasBuehler1
Deactivated User
Hi,

In CGA, you can use geometry.area() to find a shape's area.

Check the docs on how to precisely use it.

If you report the area and select all shapes, the Reports tab in the Inspector will show the sum of all areas.

But since CGA operates only on single shapes, CGA has no way to 'collect' reported data of it's neighbor shapes in the same Block.

Python scripting may give you a few workflow options though.

Ok ?

matt
0 Kudos
AleksandarLalovic
Deactivated User
Im not talking about area. Im trying to find shepe perimeter/circumference, sum of the length of all edges.
0 Kudos
MatthiasBuehler1
Deactivated User
Ah.

that's currently not directly queryable with a function.

I recommend :

comp(e) { all : report("edgeLength", scope.sx) NIL }

ok ?

m.
0 Kudos
AleksandarLalovic
Deactivated User
For the reporting this works just fine but if i would like to use this value in a rule file i guess its not possible?
0 Kudos
MatthiasBuehler1
Deactivated User
Hi,

there's one more, much more complex way to obtain directly in CGA.

otherwise, I'd recommend to use Python to quickly take the reports and write them as an object attribute.

let me know if you're interested in the complex way. I'll need to adapt an other existing rule for this, will take a bit of time.


matt
0 Kudos
MatthiasBuehler1
Deactivated User
after thinking for a minute, you could do something like this :


@Hidden attr perimeter = 0  Lot -->     extrude(1)     set (perimeter, geometry.area() - 2 * (geometry.area(bottom))     comp(f) { bottom : reverseNormals Gotcha. }


the idea of course being that you take the full surface after the extrusion, subtracting the bottom and top area, then dividing again by the extrusion height.


cheers !

matt
0 Kudos
AleksandarLalovic
Deactivated User
Wow, great. Didnt see that coming. Realy nice trick with the area. Thanks
0 Kudos