斯潘8
span4
A geometry definition is a shared geometry that can have several geometry instances in the same or different features.A geometry instance consists of a geometry definition reference,a placement location,and a 3D affine matrix.几何定义可以包含任何类型的几何体,including instances of other geometry definitions.
Geometry instances are useful for complex geometries where many copies of the same object are required.例如,在城市的想象中,many copies of the same park bench may be used in different locations.
If a single geometry definition is used,with many geometry instances,文件总大小,需要处理,and effort to display the geometry is greatly reduced than if many copies of the same geometry are used.This is especially true if the geometry instance is very large or detailed.
有了单一的几何定义,也可以简单地修改几何定义,and subsequently,update all instances of that definition without needing to modify every instance.For example,如果用户希望将公园长椅从红色改为蓝色,只能对几何定义进行修改,它随后将反映在所有几何体实例中。
生成实例.fmw(Example 1)
updateinstance2.fmw(Example 2)
在下面的示例中,using生成实例.fmw,我们将用灯柱实际模型的实例替换一组灯柱位置点。The model was obtained from theSketchUp三维仓库.
读取灯柱的极点FME特征存储数据和草图模型
From the location points,we need to extract the coordinate system (with the CoordinateSystemExtractor) and the location (with the CoordinateExtractor).极点位置具有包含极点旋转的属性。
The 3D warehouse model is not centered at 0,0,0,nor is it facing the right way,so we center and align it with the Offsetter and Rotator,然后用定标器把单位换算成米。
Merging the two datasets together using shared_id and setting the geometry to shared Pole
In FME,the geometry instances are stored within the shared item library.We add geometries to the shared item library with the SharedItemAdder transformer.
SharedItemAdder parameters
shareditemadder可用于向共享项库添加外观或几何图形,因此,我们设置要添加到几何定义的项。我们正在添加一个新的定义,so we set the Insert Mode to Add New Item.分配给新实例的共享项ID将添加到属性“共享项ID”。
为了用实例替换点,我们需要向他们提供新共享的项目ID。我们可以使用一个特性合并,并将join-on值设置为1,而不是特征属性。这将合并所有点上的共享项ID,即使它们与实例没有共同的属性。
FeatureMerger Parameters,set the Requestor to 1 and the Supplier to 1
Now that the points all have shared item IDs,我们可以使用shareditemidsetter将它们的几何体实际设置为该共享项的实例。
shareditemidsetter参数,set the Shared Item ID Attribute to _shared_item_id
项类型应设置为几何定义。We are setting the instance on simple points,so the Geometry Part Selection can be left as is,但是如果你有一个更复杂的源几何体,you can use Geometry XQueries to determine which part of the geometry should be replaced with the instance.
Set Retrieve Shared Item ID to From Attribute,然后将share item id属性设置为\u shared \u item \u id。
Rotate the lamp post,确保坐标系正确,然后写出草图。
shareditemidsetter将模型放置在与点相同的位置,but we still need to apply the streetlight rotation with a Rotator.In the Rotator settings,使用由coordinatextractor创建的x和y属性设置旋转的x原点和y原点。
Finally,我们将把之前提取的点坐标系应用到新的实例几何体中,在写生之前。
在草图中查看的结果,其中灯柱表示单个灯柱点
SketchUp支持将实例几何图形作为共享组件,so you can create a relatively small file that contains hundreds of streetlights.
在这个例子中,usingupdateinstance2.fmw,we want to replace the wooden street lights with some snazzier ones (also from theSketchUp三维仓库)我们将通过更新共享项库中的模型来完成此操作,而不是更改每个极点实例。
亚搏在线Workflow for updateinstance2.fmw,使用新的路灯样式更新现有模型
From the input Sketchup file,我们将提取原始极的共享项ID,并将其合并到按比例排列的新灯杆模型上。
shareditemiddextractor参数,extract the Shared Item ID as Attribute
我们将项目类型设置为几何定义,并将共享项ID提取到属性。Since there may be more than one instance in the feature geometry,the shared item IDs will be stored in a list attribute: _shared_item_id{}.此列表将通过FeatureMerge合并到新模型中。
This time we will use the SharedItemAdder in the update mode.
shareditemadder参数,set the Insert Mode to Replace Existing Item and the Shared Item ID to Replace to _shared_item_id{0}
设置要添加到几何图形定义的项,并将插入模式设置为替换现有项。The ID to replace will be set to the first element of the _shared_item_id{} list.This works OK in our example since the model only contains a single instance definition.If you have several shared items in your data,you can use a Geometry XQuery in the ShareItemIdExtractor to extract only the id of the shared item you want to update.
FME works on the input data sequentially,因此,为了确保在更新共享项之前不会将源功能写入输出,我们将使用FeatureMerge输出而不是源特性的副本来写入输出。The Supplier features will be output through the ports Referenced,Unreferenced,or DuplicateSupplier,depending on the number of source features.We will route all these output ports to the Sketchup writer.
结果生成更新的灯光样式的草图。
我们现在更新了路灯,与原始位置和路线相同。
© 2019 亚搏在线Safe Software Inc |Legal