Area label


#1

is there a way to display the area of an closed polygon dynamically so it updates as it is modified ? (without gh though)
thanks !


(Pascal Golay) #2

Hi Zunder - use DimArea for this,

-Pascal


#3

thanks for the hint ! if one would like to develop a more customize label eg with associative hatch and additional input values … what would be the best way to achieve this. i know little bit about python from grasshopper but would like to develop a basic room stamp (like in archicad) that can be used inside rhino (no gh). thanks !


#4

push :wink:


#5

Interesting question; looking forward to you getting an answer


(Tom) #6

Hello,

_DimArea and _Hatch, are both working with history. So its associative already.

If this is still not enough you need to code such functionality by yourself. Its not very difficult, but in my opinion nothing you can do within 30 minutes or with basic python scripting skills. This is because you need event driven coding for it. Something you shouldn’t do in scripts at all.


#7

thanks TomTom,

but in general this would be doable in python ? if not with a script - what is the alternative ?


(Tom) #8

If you like to code such things, you should write a custom plugin. In RH V5, C++/C# /VB.Net are supported languages. C++ is more challenging but it gives a bit more freedom and performance.
I prefer C#.There is a template for Visual Studio for Rhino.
On a plugin level, you can proper register and unregister events. So whenever a curve has changed, an response for instance OnCurveChanged updates your stamp . It could be that there is already such an event implemented, and you only have to subscribe to it, but in any case such dynamic feature needs some time to develop. Event driven programming is not very easy to understand in the beginning, but once you understand, it will turn out to be very effective for such tasks. As an alternative to it, you can force a manual recalculation, such as a Grasshopper solution would do.


#9

ok i see - thanks !


#10

one question though - i assume this is also true for upcoming rhino 6 ?


(Tom) #11

in rh 6 you can compile python code, but if this is the same as creating a plugin … I don’t know.

The reason why you should implement event driven coding on plugin-level is because of having a greater life-time. Scripts are usually limited to the lifetime of the command. Whenever you change code, and even if its just a whitespace, you completely loose track of your already registered events, which can lead to very weird behaviour, hard to debug and with bad performance.

You may ask that question in a separate thread or find other threads about this question.