insert operation

Syntax

i(filePath)

i(filePath, upAxisOfGeometry)

i(filePath, upAxisOfGeometry, insertMode)

Parameters

Description

Reads a geometry asset (3D model, polygon mesh) from a file and inserts it into the scope of the current shape. The asset is transformed such that its bounding box coincides with the scope.

If one or more of the scope's sizes sx, sy and sz (i.e. width, height or depth) are zero the scope is modified as follows:

If the current shape has trim planes (generated in a component split), the model is cut with the trim planes. Trim planes can be enabled and disabled by the trim attribute. Use the geometry.isInstanced function to check if an inserted asset was trimmed. See example below.

A collection of basic geometries are available as built-in assets.

Supported Asset Formats

The following formats are supported for asset insertion:

The OBJ reader imports the material description file (.mtl) and also understands negative indices (referencing from current position backwards). It will silently drop unsupported geometry/material tags and also deletes normals or texture coordinates of inconsistent meshes.

The COLLADA reader imports the full scene graph including transformation nodes. Extra tags are ignored and it will also delete normals and texture coordinates of inconsistent meshes.

The FBX reader imports whole scene graphs including transformation nodes. Additionally, coordinate unit and up-vector information are handled. Custom attributes are ignored and normals and texture coordinates of inconsistent meshes are deleted.

The glTF reader supports glTF 2.0 and is able to read glTF JSON (.gltf), and GLB binary (.glb) formats. For geometry data, external .bin files, GLB-stored buffer, and base64-encoded buffers are all supported. For texture data, external JPEG and PNG images stored externally or inside the GLB buffer are the two supported options (base64-encoded images are not supported). The full scene graph will be imported including transformation nodes and multiple texture coordinate sets. Skinned mesh attributes and animations are ignored. The CGA material.shader attribute will be set to CityEnginePBRShader. Please see PBR Material Attributes for details.

The USD reader imports all objects of type UsdGeomMesh. Material nodes of type UsdPreviewSurface are automatically converted to CityEnginePBRShader materials.

The Autodesk DWG Importer only imports 3D aspects of the file. It silently drops all 2D only elements.

The buildingSMART IFC Importer supports version 2x3. It converts the element structure to named groups.

Remarks:

Related

Examples

Window insertion


Insert a
Lot-->
   extrude(47)
   comp(f){side : Facade  |
           top :  X }	
	
Facade-->
   split(y) { { ~1 : X | 
                ~8 : Floor }* |
              ~1 : X }
			   
Floor-->
   split(x) { { ~1 : X |
                ~5 : Window }* |
              ~1 : X }
			
The rules above yield the subdivided mass model on the left.
			   
Window-->
	i("window.obj")                          
			
The effect of inserting a window model in the Window rule is shown on the right.

Insertion and Zero Scope Dimensions


Insert Zero a


The asset which is going to be inserted, displayed in the inspector. The asset's coordinates contain a translation of (12.3, 4.3, 7.2).

Insert Zero a
Head-->
	s(0,0,0)	
	i("beethoven.obj") 	
	
Inserting an asset into a shape with a zero-sized scope sets the scope's size to the asset's dimensions and translates the scope such that the asset's position is preserved. Note that the translation relative to the shape's pivot (small axes on the left) is identical to the translation of the asset in the inspector, relative to the origin (picture above).

Insert Zero c
Head-->
	s(9,0,0)	
	i("beethoven.obj") 	
	
If the scope size is non-zero in one dimension, the two other dimensions are set relative to the non-zero dimension. The same is valid for the scope translation along the zero-dimensions. In the picture on the left, the original scope is shown (it is one-dimensional along the x-axis).

Insert Zero b
Head-->
	s(9,9,0)	
	i("beethoven.obj") 	
	
If one of the scope sizes is zero, the scope's size is modified relative to the average of the two non-zero sizes. Note that the position of the scope is not modified.

Trim Planes and Insertion


Insert a
Lot-->
	primitiveCube()
	s(10,40,10)
	t(-5, 0, -5)
	comp(f) { side: Side }
	
Side-->
	t(0,0,-5)
	s('1,'1,10)			 
	i("cylinder.vert.obj") 
	
The cylinder model, shown on the left, is inserted at the four side-faces of a cube.

Insert a
The inserted cylinders are cut with the trim planes generated by the component split.
In the picture on the left, the geometry of one Side shape (i.e. the cut cylinder) and its trim planes are highlighted.
On the right is the same scene from top view (top), and a close-up of the upper area (bottom).

Insert a
Lot-->
	primitiveCube()
	s(10,40,10)
	t(-5, 0, -5)
	comp(f) { side: Side }
	
Side-->
	t(0,0,-5)
	s('1,'1,10)			 
	set(trim.vertical, false)
	i("cylinder.vert.obj") 
	
Note how disabling the trim planes just before the insert operation changes the resulting geometry.

Copyright ©2008-2024 Esri R&D Center Zurich. All rights reserved.