2cityengin新手指导书
- 格式:doc
- 大小:1.71 MB
- 文档页数:16
Tutorial_01_CityEngine_Basics__2011_2This tutorial shows how to quickly create a city from scratch. It introduces the complete workflow through all the parts of the CityEngine. You will learn how to setup a new project, how to create a street network and setup the shape creation parameters. Finally, you will learn how to use the rule editor and generate the city’s building models.这个教程展示了怎样快速地从草稿中创建一个城市。
它介绍了完整的工作流程通过所有CityEngine的部分。
你将学到怎样建立一个新的工程,怎样建立一个街道网络及设置形状创建参数。
最后,你将学到怎样使用规则编辑器生成城市的建筑模型。
Table of Contents内容列表Part1: Prepare a new project第一部分:准备一个新工程Part2: Streets and Building Shapes第二部分:街道和建筑形状Part3: Assign CGA Rules and Generate Building Models第三部分:分配CGA规则生成建筑模型Setup new Project and SceneAs a first step, we will create a new CityEngine project.作为第一个步骤,我们将建立一个新的CityEngine工程。
•File→New…→CityEngine→CityEngien Project•Hit Next, name the project FirstCity and hit Finish•单击Next,命名工程为FirstCity然后单击FinishA new project has been created and shows up in the Navigator (by default located in the upper left corner of the CityEngine window). The default folders that store your project data like assets, rules and scenes are already present.一个新的工程已经被建立了并显示在导航器中(默认情况下位于CityEngine窗口的左上角)。
01基础教程本文档为Esri CityEngine学习文档,是CityEngine_2011_Tutorials官方示例教程1——“Tutorial_01_CityEngine_Basics_2011”的中文翻译稿,由网友冬冬翻译整理。
教程简介本教程讲解如何利用CityEngine快速地从无到有创建一个城市,通过对CityEngine各部分功能的讲解使读者了解完整的工作流程。
您将学习到怎样建立一个新的工程,创建道路网以及设置“形状创建参数”。
最后,您将学习使用规则编辑器并生成城市建筑模型。
第一部分:创建一个新的工程创建新工程和场景第一步,创建一个新的CityEngine工程。
选择【File】—>【New】—>【CityEngine】—>【CityEngine project】点击【Next】,将工程命名为“FirstCity”并单击【Finish】完成以上操作,一个新的工程便建立好了并出现在在文件导航窗口中(默认布局下文件导航窗口位于CityEngine界面的左上角)。
这些自动生成的文件夹用来存储你的工程数据,如assets文件夹(用以存储贴图和引用的模型部件数据),rules文件夹(用以存储规则文件)等。
第二步,创建一个新的场景:选择【File】—>【New】—>【CityEngine】—>【CityEnginescene】确认新场景所保存的文件夹位置(/FirstCity/scenes),将该场景命名为“firstcity_01.cej”并点击【Finish】我们的工作空间中现在包含了一个新的空工程以及一个场景文件:拷贝规则和资源在本教程的后面部分,我们需要使用规则文件和资源(assets)用以生成建筑物模型。
因此我们现在需要从教程配套的示例工程中拷贝这些文件。
首先,我们将教程1的示例工程导入到当前的工作空间下载并导入教程工程(教程1)到我们的工作空间中接下来,我们将所需要的文件从已下载的教程1工程中拷贝到我们的新建工程中。
cityengine水体规则-回复CityEngine水体规则的介绍CityEngine 是一款专业的城市建模软件,具有强大的建模能力和高度的自动化特性。
其中一个重要的功能就是水体规则,它可以帮助用户快速而有效地创建逼真的水体场景,无论是河流、湖泊还是海洋都可以轻松模拟。
本文将逐步介绍CityEngine水体规则的使用方法和技巧。
第一步:下载与安装CityEngine首先,你需要到Esri官方网站下载CityEngine软件并完成安装。
CityEngine有免费试用版本和商业版本可供选择。
一旦安装完成,你就可以开始使用这个强大的城市建模软件了。
第二步:了解水体规则的基本概念在CityEngine中,水体规则用于创建各种水体元素,如河流、湖泊和海洋。
它基于一系列规则和限制条件,可以帮助用户快速生成逼真的水体效果。
第三步:使用水体规则创建河流要在CityEngine中创建河流,首先需要生成地形模型。
可以利用CityEngine内置的地形生成规则,也可以导入现有的DEM数据。
接下来,选择“水体”工具箱中的“河流”选项,并按照提示设置河流的起点和终点、宽度和深度等参数。
CityEngine会自动生成一条模拟河流,并根据地形和其他参数调整其形状和属性。
第四步:应用水体规则创建湖泊与创建河流的方法类似,要在CityEngine中创建湖泊,首先需要生成地形模型。
然后,使用“水体”工具箱中的“湖泊”选项,并按照提示设置湖泊的位置、形状和深度等参数。
CityEngine会自动在指定区域生成一个逼真的湖泊。
第五步:模拟海洋场景如果你想模拟一个海洋场景,CityEngine也提供了相应的水体规则。
首先,生成地形模型,并确保地形边缘与海洋边缘相接。
然后,选择“水体”工具箱中的“海洋”选项,并设置海洋的形状、深度、颜色等参数。
CityEngine 会根据你的设置自动创建逼真的海洋效果。
第六步:自定义水体规则除了CityEngine内置的水体规则,你还可以根据自己的需求自定义水体规则。
Tutorial_06_Basic_Shape_Grammar__2011_11.构建简单建筑物;2.为简单建筑物贴纹理;3.添加LOD;4.建筑物属性随机变化。
一、构建简单建筑物本节学习最终要构建一个如下图的建筑物,该建筑物有地面一楼和其他楼层,一楼的正面有一个入口的门,其他窗口都使用的是一个提前做好的OBJ模型。
下面开始创建规则进行建模:为了更好的理解规则,我们自己创建一个新的规则,按照教程中的语句进行规则的书写。
1. 在规则文件的最开始处定义建筑的属性(也可以放在规则文件的其他位置)。
在CGA文件中,这些属性将对整个规则文件产生作用。
这些属性将显示在属性查看器(Inspector)中,可通过属性查看器修改这些属性。
attr groundfloor_height = 4 //地面一楼的高度attr floor_height = 3.5 //其他楼层的高度attr tile_width = 3 //将楼面按块划分的宽度attr height = 11 //楼高attr wallColor = "#fefefe" //墙面颜色2. 教程中构建的窗户是使用的一个已经建好的窗户模型window.obj,这个文件存放在assets文件夹中,使用之前也要先定义出来。
window_asset = "facades/window.obj" //指定obj文件3. 下面我们定义第一条规则为Lot. 在属性检查器中,该规则被指定为开始规则。
大量的模型是使用拉伸操作创建而来的://对shape使用height中定义的高度进行拉伸,并命名为BuildingLot -->extrude(height) Building拉伸之后如下图:4. 可以通过应用comp()将Building分解为多个面, 生成了正面(FrontFacade)、多个侧面(SideFacade)和一个顶面(Roof)Building-->comp(f){ front : FrontFacade | side : SideFacade | top: Roof}5. 分解完成之后,就开始开始对这些面进行外观造型。
CityEngine入门之五技巧
CityEngine可以很方便的建立起真实的城市风光。
在刚开始学习这个软件时会有无从下手的感觉,但随着学习的逐步深入你会发现它变得越来越简单。
在ArcGIS的资源中心有一些教程视频和数据模板会帮助我们更好的理解这个产品。
除此之外,在这里准备了CityEngine 里五个基本的功能与大家分享。
1 教程与事例数据的下载
通过菜单Help下的Download Tutorials and Examples打开Download Tutorials and Examples对话框,就可以选择你需要的教程与事例数据进行下载。
在下载数据状态窗口上可以选择后台运行使其不影响你正在进行的工作。
2 视图设置
在视图设置里可以很方便的使用场景灯光和一些参考信息如格网、坐标轴、指北针等;同样在视图设置里还列出了一些有关模型的显示设置如线框显示、实体显示、贴图显示等。
在这些设置的右面还给出了其快捷键以更方便地控制这些设置的开/关。
3 视图输出
通过视窗窗口的书签按钮下的保存快照功能可以保存场景快照。
导出的场景快照可以支持多种图片格式如PNG、JPG、TIFF等。
4 CityEngine 快捷键
通过菜单栏里help\Show Key Assist或者通过快捷键“CTRL + SHIFT + L”可以打开快捷的对话框列表。
5 窗口布局
在CityEngine里窗口菜单下的布局里提供了很多种已经设置好的界面布局以满足不同工作状态时的需求。
同时CityEngine也支持用户自定义页面布局。
1、打开2Dto3D.sxd文档在“2Dto3D\Maps and GDBs”下启动2Dto3D.sxd文档。
右键单击DEM图层,点击【属性】,在【基本高度】标签下启用【在自定义表面浮动】选项,如图2。
设置完成以后DEM可以看到高低起伏,而二维数据却在DEM下面。
我们可以通过设置图层属性(【基本高度】->【在自定义表面浮动】)来显示,但是如果你得到真实的三维要素,那需要将二维要素转化为基于DEM的三维要素。
2、二维线转化为三维线我们已经构建了一个创建好的模型来快速生成3D线。
右键点击“2Dto3Dlines”GP模型(位于CityData.gdb中Conversion工具箱中)并【编辑】。
通过模型我们可以看到要对“Streets”进行简化,去掉多余的曲线;然后,简化的街道数据被“Interpolate Shape”工具转化为3D街道数据。
点击【模型】->【验证整个模型】,然后【运行】。
定位到书签“3Dstreets”和“Bridges”查看分析结果。
3 、二维点转化为三维点我们同样构建了一个模型来快速生成3D点。
右键点击“2Dto3DPoints”GP模型(位于CityData.gdb中Conversion工具箱中)并【编辑】。
可以看到,“Street furniture”点数据直接被“Interpolate Shape”工具转化成3D点。
点击【模型】->【验证整个模型】,然后【运行】。
关闭模型后,双击“2Dto3DPoints”模型,选择“vegetation”图层并修改输出数据名称为“Vegetation3D”,【确定】将“vegetation”点数据生成3D点。
4 、二维的面转化为三维面首先,打开并编辑“2Dto3DPolygons”GP模型。
可以看到这个模型有2个输出结果:“Building1_footprints3D”、“Building1_footprints3D_bufferline”,让我们分析一下这个模型都做了哪些事情。
Tutorial 1: Essential skillsTable of ContentsTutorial 1: Essential skills . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Tutorial 1: Essential skillsDownload items•Tutorial data•Tutorial PDFSet up a new projectCreate a new project and sceneFirst, you'll create a new CityEngine project.Steps:1.Click File>New>CityEngine>CityEngine project.The Select a wizard dialog box appears.2.Click Next, name your project MyFirstCity, and click Finish.A new project is created and appears in the Navigator (by default, located in the upper left corner of the CityEnginewindow). The default folders that store your project data, such as assets, rules, and scenes, are already present, thoughempty.Next, you'll create a new scene.3.Click File>New>CityEngine>CityEngine scene.The CityEngine Scene dialog box appears.Copy rules and assetsLater in this tutorial, you'll need rule files and assets for the generation of the building models. You copy these files from the main Tutorial 1: Essential Skills project, which you should already have linked to your workspace.Now you'll copy all necessary files from the downloaded Tutorial 1 project into your new project.Steps:e copy paste(Windows and Linux:Ctrl-C and Ctrl-V/Mac OS:Command-C and Command -V) on your keyboard orfrom the right mouse button context menu.2.Copy the contents of both the assets and rules folders.Your Navigator should look like the following screen shot:First street layoutRandom street growAfter the new project has been set up, you’re ready to start creating the first street layout in your newly created scene.First, you'll create a street network.Steps:1.Click the viewport to make it the active window.2.Click Graph>Grow Streets.The Grow Streets dialog box appears.3.Keep the default settings for now.4.Click Apply, and close the dialog box.Approximately 500 streets were created, but you can't see them all in the viewport until you frame the view.5.Press the A key to frame all objects in the viewport. Your viewport should look similar to the following screen shot:Your Scene Editor should now contain a new Streetnetwork layer, containing a network of blocks, graph segments, andshapes. It should look similar to the following screen shot:Navigation and selectionNavigationNavigating in the viewport is one of the most essential skills a CityEngine user has to master. This section looks at the different navigation schemes available.Steps:1.Click Edit>Preferences>General>Navigation Devices>Mouse.The Current Mouse Scheme drop-down menu lists the available schemes of other 3D apps.Note:For those who have a 3D Connexion 3D Mouse (/), there are specificpreferences for that.You'll focus on the default navigation scheme. The options are shown in the following table:Tip:SelectionTo interact and edit the objects in your scene, you need to select them. Start the Selection Tool using the mouse button or (press the Q key). Select the objects by clicking in the viewport.Note:Selection typesThe selection types are described in the following table:Selection type ResultSingle click Selects a single objectRight-to-left rectangular selection Selects all objects inside or touching the selection rectangleLeft-to-right rectangular selection Selects all objects completely within the selection rectangleThe left-to-right rectangular selection is usually used to select tiny objects such as single Street Graph Nodes when there are many objects occupying the same space.Modifier keysThe Ctrl and Shift keys toggle the different selection modes. The modes are also listed in the Select Tool submenu in the toolbar.Selection context menuOnce you have a selection, the right mouse button context menu contains entries with which you can select additional elements.The selection items are described in the following table:Selection mode Selection element(s)Select Objects of Same Type Types: shapes, graph nodesSelect Objects of Same Group:In the same block/streetSelect Objects with Same Rule File Same rule file assigned (on all visible layers)Select Objects with Same Start Rule:Same start rule (on all visible layers)Model generation with rules3D model generationCityEngine is a procedural modeling application. This means that CityEngine uses rules to generate the 3D model.Assign rulesIn this tutorial, the rules are already provided. You'll use them now.Steps:1.Select one block, and change its subdivision parameters in the Inspector from Recursive Subdivision to OffsetSubdivision as shown in the following screen shot:For more information on block subdivision and dynamic city layouts, see Tutorial 2: Terrain and dynamic city layouts.2.Select one shape within the block, and use the context menu to Select Objects of Same Group.3.Drag and drop the building.cga rule file onto the selected shapes (highlighted orange).After dropping the rule onto the shapes, the model generation is automatically started. Your first buildings appear. Make sure the visibility of models is activated by toggling with F12.Generated models can also be deleted in the right mouse button context menu.4.Select the footprint shape again, and click Ctrl+G(Mac OS:Command+G) or use the Generate button on the toolbar togenerate the model on the selected shape.New variations of the buildings can be created by changing the seed value.e the Update Seed and Generate new Model button on the toolbar or click Ctrl+Shift+G(Mac OS:Command+Shift+G).The following image shows an example of different seed values:6.Manually edit the rule’s building height parameter in the Inspector:Once you manually change attributes in the Inspector it will become bold and override the definitions of the rule.7.Reset the attributes to the building.cga rule definitions by right-clicking the arrow next to the attribute in the Inspectorand choosing Reset user attributes.Rule editingExplore a rule fileCityEngine’s rule system uses CGA code, a dedicated scripting language unique to CityEngine. Because CGA is a scripting language, it offers you a generic and flexible tool to create 3D models for all types of cities. From modern to contemporary, from ancient to futuristic, anything’s possible.Explore the provided rule you've been using so far.Steps:1.Open the building.cga rule in the Rule Editor by either double-clicking the CGA rule file in the Navigator or using theRule File link in the Inspector.2.Start editing the building.cga rule in the Rule Editor.Edit the rule fileSteps:1.The building has a random height value of 22.82.2.The height is now defined as a random value between 15 and 80.3.Save the rule.4.Regenerate the building by clicking the Update Seed and Generate Models button or pressing Cntrl + Shift+ G on your keyboard.The building now has a random height value of 72.02.Note:The reason you use the Update Seed and Generate Models button is becauseregenerating the building.5.Add roof geometry by adding a new Rule named Roof to the building.cga rule. To do this, do the following:a.b.c.Save the rule.6.Regenerate the building, but this time, click the Generate Models button or press Cntrl + G on yourkeyboard. By doing this, you will keep the building height at 72.02 and see the new roof geometry.。
打开visual studio 2010,新建项目,选择visual C#下的windows窗体应用程序如下图打开左侧工具箱中的ArcGIS Windows Forms,分别单击MapControl,TOCControl,ToolbarControl控件。
拖动如下图所示打开解决方案资源管理器中的最后一个program.cs输入一串代码后,关闭窗口,打开工具箱中的ArcGIS Windows Forms,双击LicenseControl在Form1中有一个控件出现再次单击启动调试按钮。
有一个空白的Form1窗口单击停止调试按钮,右击ToolbarControl控件,选择属性,更改属性,并添加控件再右击TOCControl控件,选择属性,更改属性单击启动调试按钮,添加数据一、新建项目:二、Visual C#---→ArcGIS---→Extending Arcobjects(.net.Framework3.5)---→Classlibrary(ArcMap),单击确定三、DesktopArcMap---→ESRI.ArcGIS.SystemUI,单击添加(add)--→单击finish四、删除Class1.cs,右击ArcMapclassLibrary ----→添加--→新建项---→Visual C# 项--→ArcGIS--→Extending ArcObjects---→Base Command选择Mapcnntrol or Pagelayoutcontrol Command五、输入代码六、右击“引用”---→添加引用--→System.Windows.Forms添加语句之后,MessageBox.Show的下划线消失七、生成ArcMapClasslibrary , 全部保存。
我的梦想是利用所学的GIS知识,对我的家乡进行重新规划,使家乡的土地利用更加合理,缓解人地矛盾,加快城市化的发展。
上一节介绍了将二维数据转化为三维数据,并作为CityEngine的基础数据。
下面介绍的过程中建立三维费城的二维和三维地理信息系统数据。
使用的数据是虚拟城市模板的一部分。
1、下载数字城市模板
有两种方法下载数字城市的模板:
1、登录CityEngine模板库官方网站:
/home/group.html?owner=CityEngine&title=CityEngine%20templat es&content=all下载CityEngine: Philadelphia example;
2、启动CityEngine,菜单File -> Help -> Download Tutorials and Examples 在Examples选项卡中Philadelphia例子既可以,如图1所示
图1下载模板
2、加载数字城市模板
如果在CityEngine模板库中,下载模板则需要将模板导入到CityEngine工作空间中:
1、菜单File -> import -> Project -> existing project into workspace,如图2所示:
图2导入模板到工作空间中
2、在Select archive file选择项中选择Example_Philadelphia.zip文件。
在Project 选项卡中选择Example_Philadelphia__2011_1,点击Finish即可。
图3导入模板
3、创建新的场景
这个模板中已经有3个已经准备好的场景,您可以双击这些场景进行浏览,如图4所示:
图4现有场景
现在让我们从头开始,创建一个新的场景。
菜单File->New->CityEngine->CityEngine scene ,选择项目的场景目录,给它一个名称和设置坐标系统(EPGS:2272)如图5所示:
图5创建场景
4、添加地形和影像
在Example_Philadelphia__2011_1/data/DEM目录下面找到DEM_burn.tif,选中它然后将它拖动到视窗里面(viewport)。
在Choose coordinate system for ‘DEM_burn.tif’对话框中选中同样的坐标系(EPGS:2272)。
在弹出的T errain对话框中,Texture file选项卡中选择贴在地形上的影像(data/basemap/Philly_basemap3.tif)。
如图6所示
图6选择影像
点击Finish按钮,按“f”键盘场景放大到数据的位置。
如图7所示
图7地形和影像
5、添加GIS数据
在Example_Philadelphia__2011_1/data目录下面找到Results.gdb,选中它然后将它拖动到视窗里面(viewport)。
在File Geodatabase Import对话框中(如图8所示),点击Finish,将GIS数据加载到了场景中如图9所示:
图8 File Geodatabase Import对话框
图9 GIS数据
6、使用规则
1、使用矢量建筑轮廓和属性创建三维建筑
A、选择“Building1_footprints3D”图层的所有对象:可以选中图层上的一个对象,右键菜单Select->Select Objects in the Same Layer选中该图层上的所有对象,如图10所示:
图10选择同一图层上的所有对象
B、在Example_Philadelphia__2011_1/rules目录下面找到GIS-Driven buildings.cga 规则文件,选中它然后将它拖动到“Building1_footprints3D”图层选中的所有对象上。
矢量对象按照GIS-Driven buildings文件中的规则产生三维模型,如图11所示:
图11 GIS-Driven building规则产生模型
C、这个规则使用了GIS数据中的屋檐高度(Eave_Ht),脊高(Ridge_Ht)和屋顶样式(Roof _Form)等属性数据来生成三维建筑。
使用规则创建模型的优势是,您可以通过改变规则来轻松地修改模型。
例如,选择一个感兴趣的建筑打开Inspector对话框,可以修改屋檐高度,脊高,屋顶样式、侧面纹理和屋顶纹理等属性,如图12所示:
图12修改模型属性
2、使用建筑轮廓导入已有三维模型
如果您已经有了一些三维模型,这些模型都是通过第三方建模软件生成的。
有两种方式可以将这些模型导入到CityEngine中:
A、如果模型带有地理坐标,例如dae/kml文件,可以直接将这些文件拖到CityEngine 中。
也是使用菜单File->Import使用导入对话框工具,将一个目录下面的所有*.kml文件导入到场景中。
B、如果模型没有位置信息,您可以使用矢量建筑物轮廓来为模型定位。
选择Building2_footprints3D图层上的所有矢量对象,在Example_Philadelphia__2011_1/ rules 目录下面找到Collada_Buildings.cga规则文件,选中它然后将它拖动到
Building2_footprints3D图层选中的所有对象上。
即可将已有的模型按照地理位置导入到
CityEngine场景中,如图13:
图13导入已有模型
注:1、可以看到CityEngine可以很好的支持已有三维模型,CityEngine可以很非常方便模型的进行模型修改或更新。
2、选择所有矢量对象的时候,可以选择某一个模型然后右键菜单Select->Select Objects in the Same Layer。
还可以在Scene对话框(如图14所示)上关闭其他矢量图层,软后Ctrl+A,选中打开图层中的所有对象。
图14关闭其他图层
3、创建植物和街道设施
GeoDatabase中的植物点数据,它提供了植物的位置并且带有植物的大小和类型等属性。
根据这些数据可以将已有的三维模型按照正确的大小导入到场景中。
选择Vegetation3D layer图层上的所有矢量对象。
在Example_Philadelphia__2011_1/ rules目录下面找到Vegetation.cga规则文件,选中它然后将它拖动到Vegetation3D laye图层选中的所有对象上。
同样的方式选中StreeFurniture3D layer图层上的所有矢量对象,将Street Furniture.cga 规则赋予它们,效果如图15所示:
图15植物和街道设施
4、创建街道
从图16上可以看到街道矢量部分插入到了地面里面。
图16街道陷入地形
这是由高程的精度低或者构建街道的三角网稀疏造成的,可以在CityEngine中进行调整:选择Streets3D layer上的所有矢量对象,菜单Layer->Align Shapes To T errain,在Align Terrain对话框(如图17所示)上Maximal raise distance选项卡中选择1米,点击Apply按钮。
图17调整地形
选择Streets3D layer上的所有矢量对象,赋予Street Construction.cga规则,可以在Inspector对话框调整中调整Vehicles per km和People percentage为道路添加一些车辆和行人,如图18所示:
图18创建街道
7、导出结果
3D城市创建完成后,可以使用CityEngine进行浏览也可以将创建好的模型导入到ArcGIS中以进行海量数据的浏览和更深入的分析。
将模型导入到ArcGIS中可以先将模型导出成COLLADA (dae),更详细的操作请关注系列文章《使用GIS模板创造三维数字城市(三)》。