<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can i  Get  block center value in ArcGIS CityEngine Questions</title>
    <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230353#M10733</link>
    <description>&lt;P&gt;I have&amp;nbsp; many blocks&lt;/P&gt;&lt;P&gt;In each blocks , i would like to get center corrdinate x&amp;nbsp; z&lt;/P&gt;&lt;P&gt;How can i that ?&lt;/P&gt;</description>
    <pubDate>Thu, 10 Nov 2022 09:52:58 GMT</pubDate>
    <dc:creator>JeoCho</dc:creator>
    <dc:date>2022-11-10T09:52:58Z</dc:date>
    <item>
      <title>How can i  Get  block center value</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230353#M10733</link>
      <description>&lt;P&gt;I have&amp;nbsp; many blocks&lt;/P&gt;&lt;P&gt;In each blocks , i would like to get center corrdinate x&amp;nbsp; z&lt;/P&gt;&lt;P&gt;How can i that ?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 09:52:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230353#M10733</guid>
      <dc:creator>JeoCho</dc:creator>
      <dc:date>2022-11-10T09:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can i  Get  block center value</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230452#M10734</link>
      <description>&lt;P&gt;Hi JeoCho,&lt;/P&gt;&lt;P&gt;If your intent is only to know the centre points, you can run the following python script on any selected block:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;'''
Created on 10 Nov 2022

@author: Plfontes
'''
from scripting import *

# get a CityEngine instance
ce = CE()

@noUIupdate
def getBlockCentroid():
    # get selected blocks
    blocks = ce.getObjectsFrom(ce.selection(),ce.isBlock)
    for block in blocks:
        # get/print centroid
        print(ce.getOID(block), ce.getPosition(block))

if __name__ == '__main__':
    getBlockCentroid()&lt;/LI-CODE&gt;&lt;P&gt;This will print to the console the block ID and its centroid (x, y, z) position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 15:15:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230452#M10734</guid>
      <dc:creator>plfontes</dc:creator>
      <dc:date>2022-11-10T15:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: How can i  Get  block center value</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230487#M10735</link>
      <description>&lt;P&gt;Really thank you for reply&lt;/P&gt;&lt;P&gt;really&amp;nbsp; sorry&amp;nbsp; ,I have a other question&lt;/P&gt;&lt;P&gt;Example)&lt;/P&gt;&lt;P&gt;I would like to make this cga&amp;nbsp; , but your code&amp;nbsp;is python&lt;/P&gt;&lt;P&gt;If i have&amp;nbsp; 3&amp;nbsp; block&amp;nbsp; &amp;nbsp;a&amp;nbsp; , b ,c&lt;/P&gt;&lt;P&gt;&amp;nbsp;Dist&amp;nbsp; &amp;nbsp;=&amp;nbsp; The value of distance between a&amp;nbsp; block center and lot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if dist&amp;nbsp; &amp;lt; 1000&amp;nbsp; &amp;nbsp; &amp;nbsp;-&amp;gt;&amp;nbsp; high building&lt;/P&gt;&lt;P&gt;&amp;nbsp;If dist&amp;nbsp; &amp;gt;&amp;nbsp;1000&amp;nbsp; &amp;nbsp; -&amp;gt;&amp;nbsp; residental house&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I make this process&lt;/P&gt;&lt;P&gt;How can i make in cga?&lt;/P&gt;</description>
      <pubDate>Thu, 10 Nov 2022 16:17:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1230487#M10735</guid>
      <dc:creator>JeoCho</dc:creator>
      <dc:date>2022-11-10T16:17:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can i  Get  block center value</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1241044#M10799</link>
      <description>&lt;P&gt;I assume you are working with dynamic shapes, meaning blocks and lots that are automatically created by CityEngine in a street network.&amp;nbsp; I assume you want CityEngine to automatically divide the blocks into lots.&amp;nbsp; In this case, unfortunately, I can't think of a way in cga for each Lot to know the centroid or any information about the block it belongs to.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only way I can think of is to start with the dynamically created blocks, do not subdivide them automatically (select blocks, set Subdivision Type = "No Subdivision" in Inspector), and subdivide them in your cga rule instead.&amp;nbsp; Here is some code that calculates the block's centroid, places an invisible cube at the centroid, and subdivides the block into lots.&amp;nbsp; Each lot queries its &lt;FONT face="courier new,courier"&gt;minimumDistance&lt;/FONT&gt; to the invisible cube at the centroid.&amp;nbsp; If you don't need the exact centroid, it would be simpler to skip the centroid calculation and &lt;FONT face="courier new,courier"&gt;center&lt;/FONT&gt; the invisible cube in the block's scope instead.&amp;nbsp; You can replace the &lt;FONT face="courier new,courier"&gt;SubdivideIntoLots&lt;/FONT&gt; rule with any algorithm you prefer.&amp;nbsp; I know it's not ideal, but maybe this gives you some ideas of how to proceed.&lt;/P&gt;&lt;LI-CODE lang="c"&gt;const numBlockVertices = geometry.nVertices

const sumOfBlockVertices =
	[ sum(comp(v) { all: convert(x, scope, world, pos, 0, 0, 0) }),
	  sum(comp(v) { all: convert(y, scope, world, pos, 0, 0, 0) }),
	  sum(comp(v) { all: convert(z, scope, world, pos, 0, 0, 0) }) ]

const centroidInWorld = sumOfBlockVertices./numBlockVertices

const cubeWidth = 1
const blockCentroidLabel = "BlockCentroid"

const splitDist = 30

const tallBuildingThres = 10


Block --&amp;gt;
	BlockCenter
	SubdivideIntoLots
	
BlockCenter
	with(
		centroidInScope := convert(world, scope, pos, centroidInWorld)
	) --&amp;gt;
	primitiveCube
	s(cubeWidth, cubeWidth, cubeWidth)
	t(centroidInScope[0]-0.5*cubeWidth, centroidInScope[1]-0.5*cubeWidth, centroidInScope[2]-0.5*cubeWidth)
	label(blockCentroidLabel)
	NIL
	
SubdivideIntoLots --&amp;gt;
	splitAndSetbackPerimeter(0) { splitDist: splitDist: Lot }*
								{ remainder: SubdivideIntoLots }
	
Lot
	with(
		distToCentroid := minimumDistance(intra, blockCentroidLabel)
	) --&amp;gt;
	case distToCentroid &amp;lt; tallBuildingThres:
		TallBuilding
	else:
		House&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 14:22:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1241044#M10799</guid>
      <dc:creator>CherylLau</dc:creator>
      <dc:date>2022-12-14T14:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can i  Get  block center value</title>
      <link>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1241455#M10801</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;This is what i was looking for&lt;/P&gt;&lt;P&gt;Really really thank you&lt;/P&gt;</description>
      <pubDate>Thu, 15 Dec 2022 05:20:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-cityengine-questions/how-can-i-get-block-center-value/m-p/1241455#M10801</guid>
      <dc:creator>JeoCho</dc:creator>
      <dc:date>2022-12-15T05:20:33Z</dc:date>
    </item>
  </channel>
</rss>

