Hi there folks,
Might seem a bit basic but I can not get this little code snippet to work for some reason ?
All I need is for the float, Top_Height, to be set to the highest elevation that the scope reaches during some operations
ScopeHeight (n) -->
case (scope.elevation > Top_Height 😞
set (Top_Height, scope.elevation)
else:
NIL
I'm splitting up a base dae shape into it's component faces (4 in this case) and extruding these to random heights.
Each of these in turn simply report back the scope elevation, in this case... 7,19,5,9.
When I then run the code above, per each extrusion, the float simply get's set to 7, then 19, then 5 then 9?
Is this simply me misunderstanding the way cga flows ?
Hi,
1] scope.elevation reports the lowest height of the current scope.
2] I assume you want to find out which part of the 4 extruded ones is the highest, right?--> This is not possible in CGA alone. You need to report, get the reports in Python and then compare each result to find out which one was the highest.
Matt
Matthias Buehler
Head of 3D Technologies
twitter: @MattB3D
------------------------------------
Garsdale Design Limited
Hi Matthias,
Thanks a lot for the quick reply. Much appreciated.
Yes, that's exactly what I'm trying to do, moving a small step forward along the idea in this thread ..
https://community.esri.com/thread/115670
Maybe I should ask the question another way, excluding the scope.elevation from the equation ...
Say I have four volumes that are to be extruded to known, yet different heights. For arguments sake 2m,4m,6m,4m. All I want to do in this case is test each height against it's predecessor. If it's higher, then set that as the value of an appropriate float, if lower do nothing. 6m in this example .... would that scenario work ?
Can one get the ceiling from a defined and known range of attributes ?
What do you mean by 'test each height against it's predecessor' ?
Can you write the functionality in pseudo code?
Matthias Buehler
Head of 3D Technologies
twitter: @MattB3D
------------------------------------
Garsdale Design Limited
Hi Matthias
"What do you mean by 'test each height against it's predecessor' ?"
Maybe this graphic + explanation will be a bit better.
I have a base footprint DAE that I split into it's components (red, green & blue in this case).
Each of these are then extruded to a certain height set via attributes (5,10 & 15m in this case)
On top of the highest point of this massing I want to place another, tower, DAE, split that into it's components ( the rest of the funky colours),
and extrude those to different heights set via other attributes.
In order to place the tower DAE on top of the podium massing I need to know the highest extruded height (15m in this case).
I can set/adjust for this manually, as I did per the second flat DAE shape, or I could perform a "test" during the extrusions.
The "test" as it works so far simply involves aligning the scope to the first extruded podium volume, checking the scope.elevation against a value, and if it's larger then it I set that as the new value. Then do the same for the remaining podium volumes, hence checking them against their predecessor. Apologies about my confusing explanation.
The scope elevation works fine and reports the right numbers, it's the setting of the value which has me confused as it just doesn't behave like I would expect.
Anyway ... I have another bit of code, just some nested case logic, that works and should be able to take care of this.
It's just my amateurish trials at some slightly different building massing.
PS: How does one include a code block here on geonet ? Is it via Insert > Syntax Highlight ?
Hey ..
there's no real code block function here .. *sigh* .. just copy paste it in. but post only the essentials to make it as short and clear as possible.
I think I understand this right:
On top of the highest point of this massing I want to place another, tower, DAE, split that into it's components ( the rest of the funky colours),
and extrude those to different heights set via other attributes.
What I would do is the following:
1] use a comp(f) to cut up the first dae into it's components
2] for each resulting shape, report the comp.index
3] for each resulting shape, report the extrusion height (scope.sy) after the extrusion. DON'T report rand(..), cos this will be a DIFFERENT random value.
4] Use Python to get the reports and sort the entries to how you need them (this is the trickiest part)
5] Make sure the 2nd collada has according face indices so that e.g. the second dae's face component '3' is vertically above the first dae's face component '3'.
6] Create a separate rule that is assigned to the second shape that you can inform:
- Create an object attribute with the 'winning' component index
- Hook the attribute source to that object attr via Python
- Let the rule generate that second extrusion on just that face index based on an other attribute.
This whole thing - if I understood it right - can be scripted as ONE python scripts that does all in one step.
You need a bit of experience with Python scripting and the script based exporter though.
Is this approximately what you were going for?
Matt
Matthias Buehler
Head of 3D Technologies
twitter: @MattB3D
-----------------------------------
Garsdale Design Limited
Thanks a bunch for the pointers Matthias and yes it all makes sense. Just a shame I can't attempt this all in CGA. It gives me an excuse to dive into Python sooner rather than later