world space scope split

1737
4
06-30-2020 09:34 AM
DaveLajoie
New Contributor

Hello Everyone,

is there a way to split using world space slicer position instead if using the local scope?

I want restrict the split() on X and Y along specific world space modulo ( for example: at each 3.455 on X and 3.455 on Y ) This is what I would expect as result

however as soon as the shape isn't regular, all break loose, and the local scope kicks, and the slicing axis realigns to the local scope.

How can i force the local scope to be aligned with the world XYZ axis when splitting?

Tx

Dave.

GenerateThis -->
    split(x, noAdjust)
    {
        Width :
            split(z, noAdjust)
            {
                Length:
                        Test
            }*
    }*

Test -->
    s('1,0,'1)
    center(z)
    setColor( Color )
    X.
0 Kudos
4 Replies
DaveLajoie
New Contributor

Note: I did try to use alignAxesSelector() and alignScopeToGeometry() without much success.

0 Kudos
DaveLajoie
New Contributor

Always happens... I am writing a question, and find the answer as soon as the question is posted.

GenerateThis() -->
    alignScopeToAxes()
    split(x, noAdjust)
    {
        BlockWidthModulo :
            split(z, noAdjust)
            {
                BlockLengthModulo:
                        alignScopeToAxes()
                        Test
            }*
    }*

Now my problem is the scope is not fully aligned with world space modulo value. I am close... but still not quite there yet...

0 Kudos
CherylLau
Esri Regular Contributor

Yes, alignScopeToAxes() will align the scope to the world coordinate system.  You can then convert the scope origin to world coordinates and figure out how much you need to split out the first piece so that the rest will align to your desired grid.

convert function—ArcGIS CityEngine Resources | Documentation 

const w=10

getScopeOriginInWorld =
   [convert(x, scope, world, pos, 0, 0, 0),
    convert(z, scope, world, pos, 0, 0, 0)]
	 
getOffset(x) = case x<0: abs(x) else: w-x

Lot -->
   alignScopeToAxes()
   Split(getScopeOriginInWorld)
	
Split(point) -->
   split(x, noAdjust) { getOffset(point[0]%w): SplitZ(point)
                      | { w: SplitZ(point) }* }
					   
SplitZ(point) -->
   split(z, noAdjust) { getOffset(point[1]%w): Cell.
                      | { w: Cell. }* }
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
DaveLajoie
New Contributor

Tx you very much, this works much better!

0 Kudos