Corner lot test not working

3910
7
Jump to solution
05-05-2015 08:32 AM
curtedmonds
New Contributor III

imports fail to load

reports "no such function" : ? streetWidth()

file Colors.cga contains:

SNOW -->color("#FFFAFA")

real bummer if this is the case, as you cant test a corner lots if you have imports

this code was the default example to test corners, WHY this is not a standard "geometry.isCorner" is beyond me...

version "2014.0"

import col  : "Colors.cga"  <<<<< error "no such function" : ? streetWidth()

#BuildingVariables

attr    BldMasterHeightMin = 10

attr    BldMasterHeightMax = 30

attr BldIsCorner =  false

attr streetWidth(i) =  0  <<<<<the offending line needed for index Recursion

Lot-->

    CornerRecursion(geometry.nVertices - 1, 0)

CornerRecursion ( edgeID, nStreetEdges ) -->

    case edgeID >= 0 :

        case streetWidth(edgeID) > 0 :

            #print (edgeID)

            CornerRecursion ( edgeID - 1, nStreetEdges + 1 )

        else:

            #print (edgeID)

            CornerRecursion ( edgeID - 1, nStreetEdges )

    else:

        case nStreetEdges >= 2 :

            #set(BldIsCorner, true)

            doLot #corner Lot

        else:

            #set(BldIsCorner, false)

            doLot #Not corner lot

doLot-->

    extrude(rand(BldMasterHeightMin, BldMasterHeightMax))

    comp(f) { top: doTop | all: doFacard }

doTop-->

    roofHip(20)

    col.PINK

doFacard-->

    col.PINK

0 Kudos
1 Solution

Accepted Solutions
ChrisWilkins
Regular Contributor

I was wrong. This code does work. It is StartRules that cannot have parameters, not attributes.

So I tested it and it seems to work in version 2014.1 and 2015.0.

I am glad to see this, because I did not know about it. 

Thanks,

Chris

View solution in original post

0 Kudos
7 Replies
ChrisWilkins
Regular Contributor

Hi,

Can you rephrase this as a question? I'm not sure what you are saying/asking.

Chris

0 Kudos
curtedmonds
New Contributor III

Sure.

normally the recursive test "CornerRecursion ( edgeID, nStreetEdges ) -->" should function correctly

However (in testing 2014) the same method for testing a corner Lot produces a strange error when the import function is also used.

I have included  the recursion test source code and where the error occurs

My question is: has the structure or method for testing a corner lot changed? and if not

why does attr streetWidth(i) =  0 produce an error when simultaneously using an import function

I have tried stripping out the import of source code and still be exists, it is only when I don't use import or don't  use the function attr streetWidth(i) =  0.

Has anyone else had experience in "2014" when testing for a  corner lot with this problem or is there a new solution.

perhaps the heading should have said:

import function producers an error...when using attr streetWidth(i) =  0 function. to test corner lots

Hope that helps clarify the issue

Cheers

C

0 Kudos
ChrisWilkins
Regular Contributor

The problem is here:

attr streetWidth(i) =  0

Attributes can not be parameterized in CGA. The import has nothing to do with it.

Where did you find this strange code?

0 Kudos
curtedmonds
New Contributor III

lol, nice Chris.

I know this is causing the failure, but what then is the the solution to test for a corner lot?

or

an alternative to this usage..

see Re: How to test whether a lot is on a corner?

this also has attr streetWidth(i) =  0

cheers

0 Kudos
ChrisWilkins
Regular Contributor

I was wrong. This code does work. It is StartRules that cannot have parameters, not attributes.

So I tested it and it seems to work in version 2014.1 and 2015.0.

I am glad to see this, because I did not know about it. 

Thanks,

Chris

View solution in original post

0 Kudos
ChrisWilkins
Regular Contributor

Also, it does not work in 2013 or 2014.0. I think that was a feature that got pulled for a few versions. Not sure. So definitely upgrade to version 2015. It has other improvements...

0 Kudos
curtedmonds
New Contributor III

k, good to know .

As doubting ones sanity is only fun at parties

thanks

C

0 Kudos