|
POST
|
If your scene is pretty simple you can save a high res screenshot (quadruple you view resolution in the snapshot window or go even higher if you can) and live trace it in illustrator to get vectors.
... View more
11-10-2016
07:54 AM
|
0
|
0
|
1249
|
|
POST
|
This creates a simple 500mx500m rectangle. from scripting import *
# get a CityEngine instance
ce = CE()
#vertex array xyz
myVertices = [0,0,0, 0,0,500, 500,0,500, 500,0,0]
if __name__ == '__main__':
myShape = ce.createShape(None, myVertices)
... View more
11-09-2016
03:44 AM
|
0
|
0
|
575
|
|
POST
|
You have to add reporting code to the rule that creates the area, e.g. like this: attr AreaWhole = 0
attr AreaPart1 = 0
attr AreaPart2 = 0
@StartRule
Lot -->
set(AreaWhole, geometry.area)
report ("AreaWhole", AreaWhole)
split(z){scope.sz/2: Part1 | scope.sz/2: Part2}
Part1 -->
color(1,0,0)
set(AreaPart1, geometry.area)
report ("AreaPart1", AreaPart1)
Part2 -->
color(0,1,0)
set(AreaPart2, geometry.area)
report ("AreaPart2", AreaPart2)
... View more
11-08-2016
05:06 AM
|
1
|
1
|
2522
|
|
POST
|
You could maybe rig up a script that adds a "selected" attribute to the table, writes a "1" into the selected feature's rows, then does a MFL with "selected" = "1", then deletes the attribute from the original table or sets it to 0.
... View more
10-31-2016
05:04 AM
|
1
|
0
|
4564
|
|
POST
|
That's a pretty large scene so I guess CE can't handle it. Try selecting parts of your layers and export them separately. You might also want to check how stressed your GPU is, I usually use a program called GPU-Z for that.
... View more
10-24-2016
05:55 AM
|
1
|
0
|
718
|
|
POST
|
This should help you getting started. It creates a 500x500 rectangle, gives it an attribute plus value, assigns a CGA rule and triggers model creation. Create the CGA rule ("extruder.cga") first. Python rect1x1 = [0,0,0, 0,0,500, 500,0,500, 500,0,0]
shape = ce.createShape(None, rect1x1)
ce.setAttribute(shape, 'Height', 50)
shapeRule = "rules/extruder.cga"
ce.setRuleFile(shape, shapeRule)
ce.setStartRule(shape, 'Lot')
ce.generateModels(shape, False)
ce.waitForUIIdle() CGA attr Height = 0
@StartRule
Lot -->
extrude(Height)
... View more
10-24-2016
03:00 AM
|
2
|
0
|
1024
|
|
POST
|
Here's a small example. It spawns a window with a text field and a button, when you press the button, the text field content is printed in the CE Python console. from scripting import *
from javax.swing import *
from java.awt import *
def spawnUI():
frame = JFrame("Hell World!")
frame.setSize(300, 300)
frame.locationRelativeTo=None
frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE)
pnl = JPanel(GridLayout(0,2,5,5))
frame.add(pnl)
global txt_input
txt_input = JTextField('',15)
pnl.add(txt_input)
btn_run = JButton('Print!',actionPerformed=runAction)
pnl.add(btn_run)
frame.pack()
frame.setVisible(True)
def runAction(event):
print(txt_input.text)
# get a CityEngine instance
ce = CE()
if __name__ == '__main__':
spawnUI()
... View more
10-17-2016
06:14 AM
|
0
|
1
|
2307
|
|
POST
|
I haven't been able to go further than swing, but I never really needed to - you can write and read values to/from the UI which is all I really need for my scripts. I doubt it's possible anyway. I tried hijacking some CE windows a while ago but the random SWT window naming that didn't even stay consistent within a program session wasn't exactly helping.
... View more
10-11-2016
07:12 AM
|
0
|
3
|
2307
|
|
POST
|
The split.index is overwritten on a new split. You're splitting once, creating two polygons (index 0 and 1), and then you're splitting those too, creating index 0 and 1 or each. AFAIK you'd have to store the index info somewhere, like this: attr CumulativeSplitIndex = ""
@StartRule
Lot -->
splitArea(z){ '0.5: TowerLots1}*
TowerLots1 -->
set(CumulativeSplitIndex, "z"+split.index)
splitArea(x){ '0.5: TowerLots2}*
TowerLots2 -->
set(CumulativeSplitIndex, CumulativeSplitIndex+"x"+split.index)
print (CumulativeSplitIndex) This should give you addressable lots for a conditional rule. Alternatively, you could of course do it all manually, like this: attr SetBack_1 = 0
attr SetBack_2 = 0
attr SetBack_3 = 0
attr SetBack_4 = 0
@StartRule
Lot -->
splitArea(z) {
'0.5: Split_Z_1 | '0.5: Split_Z_2
}
Split_Z_1 -->
splitArea(x) {
'0.5: Split_X_1_1 | '0.5: Split_X_1_2
}
Split_Z_2 -->
splitArea(x) {
'0.5: Split_X_2_1 | '0.5: Split_X_2_2
}
Split_X_1_1 -->
setback(SetBack_1){all: X | remainder: Tower}
# repeat for rest
Tower --> extrude (10)
... View more
10-10-2016
03:11 AM
|
1
|
0
|
884
|
|
POST
|
Unless I'm mistaken you can't do this in a webscene except by cloning your layers and applying different colors to the objects. If you group them when you export to web scene you can then turn them on and off.
... View more
10-05-2016
02:27 AM
|
0
|
0
|
523
|
|
POST
|
You can, but projects saved with 2016 aren't backwards compatible. I also remember getting a message about downgrading esri.lib on another machine, but it's not popping up on the one I'm on right now.. might be due to both pointing at the same workspace.
... View more
09-27-2016
09:34 AM
|
0
|
0
|
833
|
|
POST
|
Here's a basic approach for a hollow cylinder - I insert a disc, move/extrude it and then delete the center. Again, straight lines only. version "2016.0"
attr shapeType =""
attr TunnelLength = 0
@StartRule
Lot -->
case shapeType == "Street": MakeTunnel
else:NIL
MakeTunnel -->
set(TunnelLength, scope.sx)
alignScopeToGeometry(zUp, any, world.lowest)
primitiveDisk(20, 5)
center(xyz)
r(0,90,0)
t(-scope.sx/2,0,-TunnelLength/2)
extrude(TunnelLength)
setback(1){all: TunnelColor | remainder: NIL}
TunnelColor -->
color(1,1,0)
... View more
09-15-2016
02:50 AM
|
0
|
0
|
1001
|
|
POST
|
I don't think there is one. If you want to replace text, pick your attribute, click Calculate, type in the first box: replace(!YOURFIELDNAME!) and in the "Code Block" box: import re
def replace(val):
return re.sub ('OLDVALUE', 'NEWVALUE', val) ..or just stick with ArcMap.
... View more
09-14-2016
05:58 AM
|
4
|
4
|
5031
|
|
POST
|
If your building parts are seperate objects, they will each be translated seperately. If you select the building pieces you can group the shapes with the -> <- button in the drawing toolbar. Now you should be able to translate it while keeping its form. Mind that projecting always projects the vertices of the shapes. This will flatten any shape.
... View more
09-14-2016
03:24 AM
|
0
|
0
|
621
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-13-2018 02:05 AM | |
| 1 | 08-08-2016 06:59 AM | |
| 1 | 07-12-2018 09:08 AM | |
| 4 | 04-12-2019 08:20 AM | |
| 1 | 05-17-2016 03:25 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|