Model builds differently depending upon which edge is "First Edge"

2694
4
Jump to solution
12-16-2015 08:37 AM
ChrisHolmes
Occasional Contributor III

Hello everyone,

I have a cga rule (attached) which builds a model differently depending upon which edge of the shape has been set as the first edge (Shapes > Set First Edge). In only 1 of the 4 cases does it build the model correctly (see attached image). I think that in the Topside procedure there is a different corner of the red shape being used for the origin and therefore when the line s(zLength,'1,xLength) is executed the base of the blue shape is oriented correctly or not. If I can figure out how to set the origin to where it is for the first case (see attached image) then hopefully I can get this to work correctly for all cases.

Appreciate any and all help with this. Thanks,

Chris

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Chris,

I added a little code into your rule (attached). This is what I did to fix the first edge issue:

getDimensions-->

  useThisShape     # I added this line.

  splitParcel

useThisShape-->  # Added this rule to get shape you need for Topside.

  t(0,15,0)             # Translate footprint shape up to starting height.

  Topside

So getDimensions has the footprint shape before you split it into 3 parts. I sent that shape to a rule called useThisShape. That rule moves the shape up 15 meters, to the height you wanted it. Then I just sent it to your Topside rule, and the first edge has no effect now.

To explain further:  If you call another rule, halfway thru a rule, and more code within the same rule follows, then the rule keeps operating on the same shape... but if you need the results of that continuing code, you need to either call another rule or name the shape (like X. ).

Also, I commented out GSrule.GreenSpace, and the import statement so it would compile on my machine. You would need to uncomment those, or just see what I did and work that into your copy.

View solution in original post

0 Kudos
4 Replies
by Anonymous User
Not applicable

Chris,

I added a little code into your rule (attached). This is what I did to fix the first edge issue:

getDimensions-->

  useThisShape     # I added this line.

  splitParcel

useThisShape-->  # Added this rule to get shape you need for Topside.

  t(0,15,0)             # Translate footprint shape up to starting height.

  Topside

So getDimensions has the footprint shape before you split it into 3 parts. I sent that shape to a rule called useThisShape. That rule moves the shape up 15 meters, to the height you wanted it. Then I just sent it to your Topside rule, and the first edge has no effect now.

To explain further:  If you call another rule, halfway thru a rule, and more code within the same rule follows, then the rule keeps operating on the same shape... but if you need the results of that continuing code, you need to either call another rule or name the shape (like X. ).

Also, I commented out GSrule.GreenSpace, and the import statement so it would compile on my machine. You would need to uncomment those, or just see what I did and work that into your copy.

0 Kudos
ChrisHolmes
Occasional Contributor III

Hi Chris,

Thanks for your time. Your modifications work great. Helps sometimes to have a different set of eyes look at a problem. Can you explain to me a little better just what t(0,15,0) accomplishes? If I comment out splitParcel in getDimensions just to test, I see the following:

Shape.PNG

So is it essentially saying move up 15 metres in Y then execute Topside, but while it's doing all of this does focus remain down at the base/ground level shape so that you can then splitParcel to break in into the 3 pieces and build up the 2 outside columns?

Thanks,

Chris

0 Kudos
by Anonymous User
Not applicable

Yes,  t(0,15,0) means translate up 15. (move in y direction 15 meters)

Here's an easier way to code it, to understand better:

getDimensions-->    # getDimensions rule receives a shape.

  splitParcel               # it sends a copy of that shape to split parcel.

  t(0,15,0)                  # it moves the current shape up 15 in y direction.

  Topside                    # it sends a copy of that moved shape to Topside.

                                   # the rule is over and the current shape is no longer processed.

That shape left at the end of the rule remains in the "shape tree", but is not shown in the final model.

You can see the shape tree in the Model Hierarchy window (THE tool for debugging CGA).

For the official explanation of this, look in the CE help documentation, in the section pointed to in this image:

CEManual.JPG

In fact, reading everything in the Rule-based Modeling section will help understand CGA a lot.

Chris

0 Kudos
ChrisHolmes
Occasional Contributor III

Great, thanks very much Chris!

0 Kudos