|
POST
|
When exporting models to separate files, the filename for each model will have the shape name appended to the base name. Therefore, you can write a python export script that changes the name of each shape to be whatever is in the object attribute. Then, you can specify the python export script in the last parameter in the export dialog window. To create a python export script, right click on the scripts folder -> New -> Python Module -> Module:Export. Then, add the following code (lines 4-7) to the initExport function which is executed before the export is performed. This code sets the name of the shape to whatever is in the object attribute called myName. def initExport(exportContextOID):
ctx = ScriptExportModelSettings(exportContextOID)
shapes = ce.getObjectsFrom(ce.scene, ce.isShape)
for s in shapes:
ce.setName(s, ce.getAttribute(s, 'myName'))
Note: Setting the shape's name in the initModel() function will not set the file name suffix. In order for the file name suffix to be set, you need to set the shape in the initExport() function.
... View more
11-07-2017
09:45 AM
|
1
|
0
|
1357
|
|
POST
|
Esri.lib, which comes with CityEngine, has some generic building rules that might be useful. The Building_From_Footprint.cga rule works on 2D footprints as initial shapes, and the Building_Mass_Texturizer.cga rule works on 3D models as initial shapes.
... View more
11-07-2017
08:42 AM
|
1
|
2
|
2603
|
|
POST
|
The taper() and roofShed() operations are good ideas. These functions or envelope() followed by a rotateScope() and a split or two might help you get what you want. Or, you can convert the dynamic shapes (the lot created by the street network) to static shapes (Select lot -> Graph -> Convert to Static Shapes). Then, you can delete the object attribute called streetWidth in the Inspector (Inspector -> Object Attributes -> right click on streetWidth -> Delete). Deleting this attribute will remove the ability to define polygon edges as street.front, street.side, street.back, etc. Then, envelope() will use the object.xxx selectors instead. You can specify the object.front edge by selecting it -> Shapes -> Set First Edge. The disadvantage of doing this is that your shapes will not be associated with the street network anymore. So, if you change the street network, the static shapes won't change.
... View more
10-27-2017
02:47 AM
|
1
|
0
|
1464
|
|
POST
|
Sorry, unfortunately, this isn't possible. In order to get a nice result, you'll need to specify a single setback operation that allows the specification of multiple setback distances for each edge, but this is currently not possible. If you do sequential setbacks, you probably won't get what you want. Here is an explanation in another post: https://community.esri.com/message/719008-re-select-a-range-of-edge-index?commentID=719008&et=watches.email.thread#comme… However, if you want to access the street width values for each edge you can do this. https://community.esri.com/message/722386-re-designate-multiple-street-edges?commentID=722386&et=watches.email.outcome#c…
... View more
10-27-2017
01:07 AM
|
0
|
1
|
1069
|
|
POST
|
If I understand correctly, you would like to subtract the red part in image 4 from the top part of the building which is constructed on top of the original building from image 1. Sorry, boolean operations, like subtracting one shape from another shape, are not supported in CityEngine. However, given that the roof of the original building is your new footprint, if you just want to specify the spatial extent in x and z for the footprint and then extrude to get the part of the building on top of the original building, you can do so with two successive splits. The split in x will take into consideration the x bounds on both sides, and the split in z will cut the footprint to the z bounds on both sides. Then, you can extrude to get your building. split(x) { xMarginLeft: NIL
| ~1: split(z) { zMarginFar: NIL
| ~1: Footprint
| zMarginNear: NIL }
| xMarginRight: NIL }
... View more
10-26-2017
09:23 AM
|
0
|
0
|
1730
|
|
POST
|
Unfortunately, I don't think this is currently possible because each of the elements of the comp are sibling shapes that don't know about each other. Sorry, maybe I was too hasty in my previous post to say that the attributes are not like global static variables when the help doc says they are. However, the help doc is not entirely correct about the static part. (Thanks for pointing it out and helping us find that.) The doc means to say that, at a first glance, attributes are similar to static variables because an attribute is set to an initial value, and this attribute persists throughout the lifetime of the program. Memory for this attribute is allocated at the beginning of execution, the attribute's value is set, and this value is accessible throughout the rest of the code. Attributes are not like static variables because of how the set() function works. A traditional use case for static variables is to use them as counters where each time a function is called, the variable is incremented. Attributes cannot be used like these static variable counters where sibling shapes try to increment the counter variable. When cga code is executed, shape trees are created. When the set() function is called in a rule, the attribute is set to the desired value in the shape corresponding to that rule. The attributes value is then set for that shape and the shape's children in the shape tree. A sibling shape is not affected by the set() performed in it's sibling. This is how attributes are NOT like static variables.
... View more
10-26-2017
08:41 AM
|
0
|
0
|
1375
|
|
POST
|
Does the example in this post work for you? https://community.esri.com/thread/194936-exporting-object-attributes-from-cityengine-to-scene-layer-package-problem?commentID=687983&et=watches.email.thread#comment-687138 Are the rule attributes connected to object attributes? (in Inspector, click on drop down arrow next to attribute -> Connect attribute -> Object attribute)
... View more
10-25-2017
02:22 AM
|
0
|
1
|
2917
|
|
POST
|
Thanks for the files, and thanks for the great labeled screenshots. They really helped us easily understand what you meant. The faces are missing because in CityEngine we do some cleanup that removes zero area faces. Some of the models you have are small, and this means that the details on the models, like the spikes and tips of decorative elements, are being removed because these faces are considered to be zero area faces. If you make your models larger in Maya before you export, then they should work. The bridge obj is 0.31m, which means the missing faces on the decorations are really tiny. (Keyboard shortcut M then D to get the measurement tool, or select it in the toolbar). In real life, I don't think you'd want a bridge that is only 30cm. If you scale the bridge up to a more city-scale bridge length, then the decorations should be visible. CityEngine is made for building-scale and city-scale scenes, so we try to cleanup excess geometry that essentially are "zero-area" faces at these scales. The collada file is a cube because it is an unknown asset. Given the error message, I assume that the model is also too small. The tower obj is ok because it is 4m wide, but the collada file is 0.04m wide. This is why the small decoration elements are missing in the collada file but ok in the obj file. Try scaling up your model to a larger size.
... View more
10-24-2017
02:21 AM
|
1
|
0
|
3535
|
|
POST
|
No, setting the seedian in this case wouldn't help because the attribute height is initially set to a random number before the rules are executed, and this value for height does not change as you execute the rules unless you use set() to change it. However, you can change height by making it a function rather than an attribute. This way, a different random number is retrieved every time the function is called. Then, you don't have to set the attribute value. You just have to remove the "attr" keyword in front of height, but in this example, I also renamed it to getHeight to make it clear (as an example) that it is going to be executed every time the function is called on line 7 (for each lot). getHeight = rand(1,10)
Block -->
split(x) { ~1: Lot }*
Lot -->
extrude(getHeight) You could extend this to work for materials as well. getHeight = rand(1,10)
getMaterial =
30%: "wood"
30%: "brick"
else: "concrete"
Block -->
split(x) { ~1: Lot }*
Lot -->
extrude(getHeight)
Building(getMaterial)
Building(material) -->
case material=="wood":
color(1,0,0)
case material=="brick":
color(0,1,0)
else:
color(0,0,1) Either by setting attributes or creating functions, you can achieve what you're looking for. There are probably other ways too. I don't think you need to set the seedian. For the initial block shape, one cga rule is executed, and every rand() call within that rule file will return a random number. Imagine that you have 5 blocks that are initial shapes onto which you apply the rule file. If the seedian of these 5 blocks were the same, then you would get the same result for each block because each block has the same seedian. In this case, it makes sense to set the seedian of the initial shapes to something different so that all 5 blocks have different seedian values. Then, the 5 blocks will have different results. This case where initial shapes start with the same seedian is not a common case. As a side note, this rare case can arise when you create static models/initial shapes out of shapes that are stacked vertically (with the same xz values but different y values).
... View more
10-24-2017
01:02 AM
|
2
|
0
|
2334
|
|
POST
|
Yes, then if you need different uv values for each uv set, then relying on the default to uv-set 0 doesn't help in this case, of course. Sorry, there is no way to copy uv sets from one uv set to another. In the 2017.1 release, which will come out soon, there were some fixes dealing with the rendering of multiple uv sets in collada files. This might help, but there also might be other problems, so it would be great if you could still post one of your broken collada files. Thanks.
... View more
10-23-2017
04:33 AM
|
1
|
3
|
3535
|
|
POST
|
Could you please give more details about your input data? Are you starting from footprints of the buildings? Are these buildings built using cga rules? Or, do you already have 3D models of the buildings? Is there a separate model for each building? Are the models inserted into the parcel in a cga rule on the parcel? Is the building model an obj file? In cga, there are options to get information like height and distance to a building. You can usually use scope.sy to get the height of a model. You can also get the distance between them by using the minimumDistance() function. If you label the buildings as "building", then you can find the minimum distance to a shape with the label "building". scope Shape Attribute minimumDistance Function
... View more
10-23-2017
03:21 AM
|
0
|
0
|
708
|
|
POST
|
I haven't tested this myself, but in the help doc, it says that if a texture layer (i.e. layers 1-5) has a texture assigned but the UVs are not defined for this layer, then it uses the UVs from UV set 0 by default. If you just need the same UV set in each layer, it seems like you can rely on these defaults and use objs. Texturing: Essential Knowledge With regards to collada, there could possibly be some bugs. Would you be able to post one of the collada files that appear broken?
... View more
10-23-2017
02:57 AM
|
0
|
5
|
3535
|
|
POST
|
When you put a rule on the block shape, this start shape will have all the attributes of the rule, and they will initially all be set to the same value. This block shape will also have one seedian for the whole block. You can see this in the Inspector in the Information section. When the block is divided into lots in the rule, then these lots all share the attributes and the seedian. You can, however, set the value of these attributes to be different for each lot. This can be done in the cga code using the set() function. set Operation When you set the value of an attribute in the cga code, you will not see this value in the Inspector. The Inspector will show the initial value set on the block shape, not the values set on each lot. This is because the value set on each lot is set on a shape in the shape tree and applies to that shape and it's children. In the Model Hierarchy (Window -> Show Model Hierarchy -> Inspect Model -> select object), you can see the shape tree. The root would be the block shape, if the block were divided into 10 lots, there would be 10 child shapes, one for each lot. Each of these lot shapes can be assigned a different value for the attribute. By using the set() function, you set the attribute on the shape in the shape tree where the set() function is called. For example, this sets the attribute height to a random value in [1,10] for each lot, but the value for height is 0 for the block, which is what is shown in the Inspector. attr height = 0
Block -->
split(x) { ~1: Lot }*
Lot -->
set(height, rand(1,10))
extrude(height)
... View more
10-23-2017
02:44 AM
|
1
|
2
|
2334
|
|
POST
|
Yes, I agree. That would be a useful feature, and we're talking about it now. Thanks for the input.
... View more
10-23-2017
01:55 AM
|
2
|
0
|
1816
|
|
POST
|
Yes and no. No, you cannot export rule attributes or object attributes directly through export dialog window. However, yes, you can export them by writing reports that report the values you desire to be exported. This is done this way so that the user has control over which object attributes and/or rule attributes are visible in the scene created by an slpk. Often users do not want the scenes cluttered with all the object attributes in the shape. This way the user can write reports to report the desired values with the desired names for those values. Yes, it requires more work to write the reports if you want all attributes reported, but it gives the user more flexibility in choosing what values should be exported and visible.
... View more
10-23-2017
01:22 AM
|
1
|
0
|
3733
|
| 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
|