POST
|
Seems like you have your question answered, but for completeness, here's the help page and some further explanation. color Operation The help shows you three ways to set a color: 1) You can set the color by calling the color function with 3 parameters. For example, color(1, 1, 1) sets the color to white. The first parameter specifies the red component, the second specifies the green component, and the third specifies the blue component. Each of these parameters should be in the range [0,1]. A color is described by its red, green, and blue components. When all the components have a value of 1, we get white. When all are 0, we get black. When all are the same, for example (0.7, 0.7, 0.7), we get some shade of gray. Different combinations of r, g, and b values yield different colors. If red is 1, then there is the maximum amount of red in the color, and if red is 0, then there is no red in the color. If red=0.8, green=0, and blue=0.4, this means that there is half as much blue as there is red, and there is no green. This is some shade of magenta/purple (mixture of blue and red with more red), but to know the exact color just from the numbers is very difficult. To have a specific color in mind and to guess its rgb values is also very difficult. Note that rgb values can also be described in the range [0,255] (not in CityEngine). It is the same thing, but now 255 corresponds to 1. The range is just scaled. You can use webpages with color charts to find colors you want, or you can use a color picker in any tool on your computer since most software will display rgb and/or hex values. 2) You can set the color and opacity by calling the color function with 4 numbers. This is the same as (1), but the fourth parameter is the opacity value, which describes how transparent the object should be. 3) You can set the color by calling the color function with a string. This is a hex string that describes the color. It starts with a # sign and is followed by 6 characters. The first two characters represent red, the second two represent green, and the last two represent blue. In “#ff0000”, the “ff” corresponds to the red component, green is “00”, and blue is “00”. This means that the red component is at the max, and green and blue are both 0, making the color pure red. Instead of having values from 0 to 1, hex uses values from 00 to ff. In our number system, which is base 10, we have single digits that go from 0 to 9. In a hex number system, the base is 16, and the digits are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f. After the 9 th digit, letters are used up to f. So, for the each color component, successive values are 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 0a, 0b, 0c, 0d, 0e, 0f, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1a, 1b, 1c, 1d, 1e, 1f, 20, … and so on until ff. Basically, it probably suffices to know the cc is a brighter color than aa which is brighter than 88 which is brighter than 33, for example. Also, hex colors are hard to guess sometimes, so I would just look them up. For colors it helps to know the following: Black = (0, 0, 0) or “#000000” White = (1, 1, 1) of “#ffffff” Red = (1, 0, 0) or “#ff0000” Green = (0, 1, 0) or “#00ff00” Blue = (0, 0, 1) or “#0000ff”
... View more
05-20-2016
10:46 AM
|
1
|
0
|
1413
|
POST
|
If I understand correctly, you would like to split the shape as if you were making street lanes. For this, you could split in the v direction. Streets have u coordinates that follow the street and v coordinates that cross the street perpendicularly. (This is uv set 0.) split(v, uvSpace, 0) { '0.5 : C | '0.5 : C } Here's the documentation on the uv coordinates on street shapes: Street and Intersection Shape UVs Here's the documentation on uv splits (uv split example on bottom of page): split Operation
... View more
05-10-2016
01:19 AM
|
0
|
0
|
622
|
POST
|
There isn't official code for an example with playground equipment, but you could make these things with rules or insert pre-modeled assets. If you would like to have plants in your park, in ESRI.lib, there are rules to generate a variety of plants and distribute them. Just drag and drop the rule onto a shape in your scene. Then, you can customize it using the parameters in the Inspector. Or, you could import the rule into your own code for more control. There is an example of a garden like park downloadable from within CityEngine. Help -> Download Tutorials and Examples -> Example Landscape Design. In this example, there are rules to make things like benches, fountains, and trellises. Playground equipment could be made in a similar manner.
... View more
05-02-2016
07:05 AM
|
0
|
0
|
949
|
POST
|
If the trees are inserted into a block shape by the rule file that is applied to that block shape, then no, I don't think there is a way you can get the positions of the trees in python. If each tree is created from its own initial shape, then yes, you can use ce.getObjectsFrom() in python to get the shapes. Then, you could use ce.getVertices on each shape. There are examples on the reference page for ce.getObjectsFrom() that show how to get different kinds of shapes. Maybe using ce.isShape and ce.withName would help. Python Scripting Interface Reference
... View more
05-02-2016
05:53 AM
|
1
|
0
|
411
|
POST
|
I downloaded the code from the link you sent (and also from within CE by going to Help -> Download Tutorials and Examples), but I have something different on line 55. The code you mention appears on line 98 instead, and it has a ~1 as Z R mentioned. split(x){ StoneLength*rand(0.8,1.2): Stone | ~1: RollingStones }
... View more
04-11-2016
02:28 AM
|
0
|
0
|
431
|
POST
|
Yes, aligning the light should be possible. This can be done by setting the scope before making the object. This could be done using the uv split on sidewalk shapes. The v direction will always be perpendicular to the street direction (and the u direction always follows the street). split Operation Street and Intersection Shape UVs
... View more
04-11-2016
01:49 AM
|
0
|
0
|
2026
|
POST
|
You could turn the wireframe rendering off by either pressing 7 in the viewport or selecting it through the gear icon on the top right corner of the viewport -> "Wireframe on Shaded/Textured". (You could turn it back on the same way; it is a toggle switch.) You could use color() to set the color and opacity in one command: color Operation
... View more
04-06-2016
01:21 AM
|
1
|
0
|
691
|
POST
|
You could try: Select graph network -> Graph -> Set Curves Straight.
... View more
04-06-2016
01:06 AM
|
0
|
2
|
637
|
POST
|
If you have your street light as a pre-modeled asset, then you can easily just insert the asset using i() as Z R suggested above. i Operation Otherwise, you could create the street light from stratch in CGA using extrude, resize s(), rotate r(), and translate t() operations. Tutorial 6 introduces the basics of CGA: Tutorial 6: Basic shape grammar—CityEngine Tutorials | ArcGIS for Desktop Maybe the reference pages for CGA are also helpful (especially the operations in the "Transformations" section): Help -
... View more
04-01-2016
02:52 AM
|
2
|
0
|
2026
|
POST
|
First, you'll need to import your shapes into CityEngine. Check out this tutorial on importing shapes from different sources: Tutorial 5: Import initial shapes—CityEngine Tutorials | ArcGIS for Desktop Then, to apply rules to the shapes, you'll have to create a cga file with the rules and assign it to the shapes. Using extrude() you can create your building according to the specified height. Then, there are four different roof types you could make: gable, hip, pyramid, or shed. Here is a simple rule: attr height = 20 attr facade_tex = "myFacadeTexture.png" Lot --> extrude(height) Building Building --> comp(f) { side : Facade | top : Roof } Facade --> setupProjection(0, scope.xy, '1, '1) texture(facade_tex) projectUV(0) Roof --> roofGable(30) Here is a tutorial on CGA (check out the sections "Lot rule", "Building rule", and "Texture the simple building"): Tutorial 6: Basic shape grammar—CityEngine Tutorials | ArcGIS for Desktop Here is the help page for gable roofs (there are pages for other roof types as well): roofGable Operation Then, you'll probably want to texture your buildings in the CGA code (rather than using the Texturing Tool in the video), so check out the "Texture the simple building" section in Tutorial 6 or the "Texture the facade" section in Tutorial 7: Tutorial 7: Facade modeling—CityEngine Tutorials | ArcGIS for Desktop To link object attributes (on the shape - visible in the Inspector) to rule attributes (in the rule file - also visible in the Inspector), make sure they have the same name. So, if your object attribute is called "height", then use attr height in your rule file. Then, link them through the connection editor in the Inspector (click on arrow icon next to attribute name in Inspector, choose Object Attribute).
... View more
04-01-2016
02:45 AM
|
1
|
0
|
604
|
POST
|
You could apply a rule to each shape that sets the size of the object/sensor using s(obj_width, obj_height, obj_depth) and then translates it to the appropriate height using t(0, Height_2m, 0). s Operation t Operation
... View more
04-01-2016
01:35 AM
|
1
|
1
|
378
|
POST
|
Oh, that's right. Good point. The pipes will break open with the current extrude method (and extruding along world.y will keep some pipes together but will not work at all for vertical pipes). We are working on new functionality for the extrude method which would solve this problem. Sorry, I'm not sure if there is a good workaround for 2015.2.
... View more
03-30-2016
02:18 AM
|
1
|
0
|
376
|
POST
|
Yes, you can have repeating splits with floating and absolute sizes. In a split, elements specified by absolute sizes will have exactly those sizes. For example, if the facade has a width of 10, and the repeat split tries to divide it into elements of absolute size 3, then you will get 4 pieces. The first three will have size 3, and the fourth will have size 1. split(x) { 3 : A. }* If a repeating split contains floating sizes, then the split will divide the shape into as many pieces as it can that have a size close to the specified floating size. In this example, the result would be 3 shapes each of width 3.33. split(x) { ~3 : A. }* See the examples for floating and absolute splits on the help page for more info: split Operation Working with the Repeat Split
... View more
03-29-2016
07:18 AM
|
1
|
0
|
554
|
POST
|
Yes, I would recommend writing rules on street shapes. You could create a graph network where the streetWidth is equal to the pipe width, and the sidewalk widths are set to 0. Then, you could apply a rule on the Street, Joint, Crossing, and Junction shapes to insert cylinders on each face. But, the cylinders might not look nice at the joins, so if you can accept square pipes, a rule that just extrudes the shape by the pipe width would be a simple way to model the pipe network.
... View more
03-29-2016
06:54 AM
|
1
|
0
|
376
|
POST
|
Your guess is correct. Unfortunately, it is not possible to get rule-set attribute values this way. However, there is a workaround (which is not so easy) if you need to access the rule-set attribute values. This involves reporting the attribute's value in the cga code and reading that reported value in python. Use option 2, and in step 2, add the following code to the finishModel() method: h = model.getReports()["height"][0] # get value of height from reports ce.setAttribute(shape, "/ce/rule/height", h+5) # add 5 to height ce.setAttributeSource(shape, "/ce/rule/height", "USER") # set source to USER (since value doesn't come from rules anymore) And, report the value of the rule-set attribute height in your cga code: Lot --> extrude(height) Mass. Reports Reports --> report("height", height) NIL Why do we need to export objects? No reason really, but this is just the workaround that I found works. Perhaps there is another way.
... View more
03-29-2016
06:31 AM
|
1
|
2
|
2764
|
Title | Kudos | Posted |
---|---|---|
1 | 12-14-2022 07:18 AM | |
1 | 06-22-2020 04:54 AM | |
1 | 02-17-2020 03:10 AM | |
1 | 07-03-2023 03:37 AM | |
1 | 06-07-2023 05:26 AM |
Online Status |
Offline
|
Date Last Visited |
10-19-2023
12:40 PM
|