Combine faces

2039
9
01-25-2012 12:58 AM
by Anonymous User
Not applicable
Original User: plambert75

Does anyone know if it's possible to combine to adjacent and planar faces into one single face? I can't find anything in the CGA grammar reference.
It'd be helpful to be able to combine the red and blue faces:
[ATTACH=CONFIG]11416[/ATTACH]

Into a single face:
[ATTACH=CONFIG]11417[/ATTACH]

I can then make an L-shaped hip roof on top of the building.

If this is not possible then I'll use the shapeL shape but it'd be handy to just adapt an existing rule.

Thanks

Paul
0 Kudos
9 Replies
by Anonymous User
Not applicable
Original User: matthiasbuehler

hi Paul.


in CGA, combining 2 separate shapes is not (yet) possible, e.g. after a split.

the only option which goes in that direction is to put the resulting geometry of an operation into the same shape, not separate.

example :

comp(f) {side = X. | all : Y.} #this puts all sides in 1 shape "X", all the other shapes will become separate shapes.



if it's imported footprints, you may want to merge them e.g. in ArcGIS.
0 Kudos
PaulLambert1
New Contributor
Thanks for your reply Matthias. As I'll have to use a shapeL command I have a follow on question - is there any way of querying the lot width? I'd like to create an L-shape with relative sizes for the frontWidth and leftWidth but the CGA requires absolute values. If I know the lot width then I can calculate the absolute values required to give me the relative proportions. I've done this on other occasions by starting with the built-in cube with a height of 1 and getting the area of the front face which equates to the width of the lot. I can't do this if I'm using a shapeL.

Thanks
0 Kudos
by Anonymous User
Not applicable
Original User: matthiasbuehler

hi Paul !


yes, the magic value is :

scope.sx


I recommend yo have a precise look at the concept of the 'scope'.
Here's a thread that links to the archived ex-procedural forum :
http://forums.arcgis.com/threads/44417-CGA-Understanding-the-concept-of-the-scope

check out the video you'll find.



once you know how to access the dimensions of the scope, you'll be able to create some intelligent rules to work on.


let me know if you hit a roadblock !


matt
0 Kudos
PaulLambert1
New Contributor
Thanks again Matthais. It's obvious when you point it out. I've even been using it when texturing polygons.

One last question...Is there any way you can set a variable attribute that you can update later in the rule file? e.g.

attr lotWidth = 0
attr lotLength = 0
attr height = 5

Lot --> lotWidth = scope.sx
           lotLength = scope.sz
           i("builtin:cube")
           s(lotWidth/2,height,lotLength/3)

This would make code more readable and make lotWidth and LotLength available to other shapes later on in the rule file.
0 Kudos
by Anonymous User
Not applicable
Original User: matthiasbuehler

yo, good news.


this is now possible since 2011.1 with 'generic attributes' :

just set the attribute values like this :

attr myValue = 0 # initialize attr

.. (rules) ..

set(myAttr, scope.sx)




try this, ok ?
0 Kudos
PaulLambert1
New Contributor
Yet another answer! Thanks Matthais.

If I can ask one more question please...

I have created a number of buildings in individual cga files. Is there a way to use a stochastic rule to place buildings from within seperate cga files? I've found the import command but I'm not clear on how to apply it. I'd like to do something like this:
[ATTACH=CONFIG]11663[/ATTACH]
0 Kudos
by Anonymous User
Not applicable
Original User: matthiasbuehler

hi !


this is an easy one, once you know all the aspects. as with all the things in life .. 😉


IMPORTS :
----------

import a rule as follows :

import XYZ : "ruleFileName.cga"


call a rule from an imported rule :

e.g.

Rule -->
    XYZ.StartRuleName


so basically what you do is you give an imported rule file a name to use. in the case above, I just used XYZ.
secondly, when you want to call a specific rule from within that cga file, you first write :

givenRuleFileName(dot)RuleYouWantToCall





STOCHASTIC DISTRIBUTION :
----------------------------

An example based on what we just learned :

import t1 : "buildingType1.cga"
import t2 : "buildingType2.cga"
import t3 : "buildingType3.cga"

(let's assume each of those rules contains a rule body called "ExtrudeThisBuilding")

Lot -->
    33% :
        t1.ExtrudeThisBuilding
    33% :
        t2.ExtrudeThisBuilding
    else :
        t3.ExtrudeThisBuilding





ADDITIONAL KNOWLEDGE :
--------------------------

the rule file into which you import is the MASTER rule

the rule file you import is the SLAVE rule

if you have an attr which you want to use also in the slave rule, you have to initialize the attr in the slave rule too :
e.g.
myValue = 0

the value from the master rule 'wins' and overrides any prior definition of the attr value in the slave rule.




ok ?
0 Kudos
PaulLambert1
New Contributor
Superb stuff Matthais, that works a treat. My city is starting to look pretty good now.

Thanks for all your help.
0 Kudos
by Anonymous User
Not applicable
Original User: matthiasbuehler

we'd love to have a glimpse .. 🙂
0 Kudos