|
POST
|
hmm. what datatype is your buildingID ? did you create it as float or string ? ( CityEngine does not have ints, just floats for use with CGA ) are you in general familiar with Python scripting or is this the first time ? let me know .. 😉
... View more
06-06-2012
02:21 AM
|
0
|
0
|
2729
|
|
POST
|
hi ! as follows : - create a file with you data, e.g. info.txt - put that file into your project's data folder - copy the attached python script into your project's scripts folder - open the script (double click) - edit the absolute path to your into.txt file so it works on your machine. - create a shape with StartRule 'Lot' (not Lot50 !) - open it's Object Attributes tab, right-click into it. create an object attr called 'buildingID', with a float value of 49. - select your shapes of interest on which you have set all buildingIDs. - run the python script via F9 (python editor must be active view, click on the code) what happens is : - python checks the building ID, which is an object attr you have set for each building. - the list is parsed until the first entry of the line is the building ID. - that line is given back - a new object attr for 'rooms', 'arch' and 'yard' is created with the values given in that line. once you have those attributes now set, you can access them via CGA. initialize each object attr of interest in the CGA code by using : attr rooms = 0 attr arch = 0 attr yard = 0 make sure you then POINT TO the object attr value and not to the rule value ( which is initialized with 0 ) using the connection editor in the inspector (the little rectangle icon with the triangle). let me know if it works or if you have questions !
... View more
06-05-2012
09:32 AM
|
0
|
0
|
2729
|
|
POST
|
Hi ! The detailed manual is in the Help Menu ( on Windows, press F1 ) Cheers !
... View more
05-31-2012
04:00 AM
|
0
|
0
|
2797
|
|
POST
|
Please PM me your mail address, I'll guide you from there.
... View more
05-30-2012
05:07 AM
|
0
|
0
|
1719
|
|
POST
|
And here's an other example of recursion : [ATTACH=CONFIG]14747[/ATTACH] see attached files. That's basically the same approach as used for the Abandone Space Station I made quite some time ago : http://www.youtube.com/watch?v=juQHrjK5jXM
... View more
05-30-2012
04:56 AM
|
0
|
0
|
3369
|
|
POST
|
Hi .. to 'properly' access geometric values such as 'geometry.area()', we have some operations, but that list could be extended forever. CGA is at the moment, as you state correctly, limited to the top-down order. Thus, if you e.g. split a shape into 2 separate child shapes, they have no more knowledge of the existence of the each other. An other thing, if you split a shape, it may happen that depending on the topology of a shapes, 2, 3 or more children are created (concave shape). How many will be resulting is not possible to query prior to actually splitting. the scope always encompasses the whole shape geometry, thus the edge length is only then correct if it's a planar rectangle you're dealing with. otherwise, you need a different approach, if this is the goal. Here's the code to find the longest edge : Again, this is total overkill and shall not be a sample of proper code ! What I do here is do some vector math, calculating the distanced from 1 reported vertex position to the next, comparing the index of the longest edge until the recursion is done.
version "2011.2"
@Hidden
attr currentLongestEdgeID = 0
@Hidden
attr currentLongestEdgeLength = 0
@Hidden
attr startPivotPosX = 0
@Hidden
attr startPivotPosY = 0
@Hidden
attr startPivotPosZ = 0
@Hidden
attr endPivotPosX = 0
@Hidden
attr endPivotPosY = 0
@Hidden
attr endPivotPosZ = 0
dist (sX, sY, sZ, eX, eY, eZ) =
# space diagonal
sqrt ( (eX-sX) * (eX-sX) + (eY-sY) * (eY-sY) + (eZ-sZ) * (eZ-sZ) )
FindEdgeIndexOfLongestEdge -->
# align to edge BEFORE first edge
alignScopeToGeometry(yUp, 0, geometry.nVertices)
# set first END point
set (endPivotPosX, convert(x,pivot,world,pos,0,0,0))
set (endPivotPosY, convert(y,pivot,world,pos,0,0,0))
set (endPivotPosZ, convert(z,pivot,world,pos,0,0,0))
EdgeRecursion(0, geometry.nVertices) # check all edges !
EdgeRecursion (current, max) -->
case current <= max :
# main loop over all edge indices
alignScopeToGeometry(yUp, 0, current)
# print (current)
# print (scope.sx)
# new start = old end
set (startPivotPosX, endPivotPosX)
set (startPivotPosY, endPivotPosY)
set (startPivotPosZ, endPivotPosZ)
# new end
set (endPivotPosX, convert(x,pivot,world,pos,0,0,0))
set (endPivotPosY, convert(y,pivot,world,pos,0,0,0))
set (endPivotPosZ, convert(z,pivot,world,pos,0,0,0))
SetAttributes(current, max)
NIL
else :
#bail out
print ("________________________")
print (currentLongestEdgeID)
print (currentLongestEdgeLength)
NIL
SetAttributes (current, max) -->
case dist (startPivotPosX,startPivotPosY,startPivotPosZ,endPivotPosX,endPivotPosY,endPivotPosZ) > currentLongestEdgeLength :
set (currentLongestEdgeLength, dist (startPivotPosX,startPivotPosY,startPivotPosZ,endPivotPosX,endPivotPosY,endPivotPosZ))
set (currentLongestEdgeID, current - 1) # -1 because we calculate a first edge for the correct vector of the first edge !
EdgeRecursion(current + 1, max)
else :
EdgeRecursion(current + 1, max)
... View more
05-30-2012
04:48 AM
|
0
|
0
|
3369
|
|
POST
|
hi ! multiple things to say : the export setting I meant is under Granularity > File ( 2 options : Use File Size Limit and Create 1 File per shape. ) the second option generates 1 vob file for each single shape the first option generates as many files as needed, using the File Size Limit in MegaBytes, by default set to 500 MB. the File Size Limit uses a max of 500 MB RAM for the export, but then at the end optimizes the files again, so in the end, they're not 500 MB, but can be a lot less. (this may be a little confusing). thus, your files are all around 100MB. If you increase this value, you'll get less files. entering 0 is 'no file size limit'.
... View more
05-30-2012
02:13 AM
|
0
|
0
|
2797
|
|
POST
|
Passing values on :
RuleA -->
RuleB(5)
RuleB(myVal) -->
print (myVal)
or :
attr myValue = 0 # initialize attr
RuleA -->
set (myValue , 15)
RuleB
RuleB -->
print (myValue)
* * * About CGA development : Cannot really share 🙂 * * * a simple recursive rule :
attr startValue = 20
Lot -->
Recursion(startValue)
Recursion(n) -->
case n > 0 : # break !
Printer(n)
Recursion(n - 1)
else :
NIL
Printer(n) -->
print (n)
... View more
05-30-2012
01:42 AM
|
0
|
0
|
3369
|
|
POST
|
Hi ! If you have bought a 'CityEngine Vue' version, then you can only export to .vob, the Vue file format. Check here for the other CityEngine versions : http://www.esri.com/software/cityengine/buy/comparison-table.html
... View more
05-29-2012
06:01 AM
|
0
|
0
|
2797
|
|
POST
|
Hi . Rules pass the shapes down to the next rules. Due to that 'passing on', previous data cannot be accessed unless it is passed explicitly. The access to geometric values is currently still limited in CityEngine, thus the only way to compute the sum of the edge lengths would need to be done with a complex recursive rule. I've written such a thing once to find the index of the shortest edge (or so). There are still some limitations, but we're working hard to improve such details.
... View more
05-29-2012
05:57 AM
|
0
|
0
|
3369
|
|
POST
|
hi Caroline, Can you meanwhile download tutorial 13 and check the html tutorial docs which are stored in the project ? I'm very busy again and have to check when I finally get some time to help you with this. I'm sure it will help you meanwhile.
... View more
05-24-2012
05:01 AM
|
0
|
0
|
1655
|
|
POST
|
hi .. sadly I don't have Vue10, so I cannot test myself. can be they have changed something in Vue10 which worked in 9 .. well, just PM me, ok ? sry I can not help further atm. matt
... View more
05-24-2012
04:55 AM
|
0
|
0
|
1600
|
|
POST
|
hi .. - on which Vue version are you ? - as I remember, there's also a center option on the vue vob import dialog, does this one help ? - do you have to move individual buildings or are all buildings in 1 vob (there's export options for this in Cityengine) ? If you'd like for a test, if my inputs do not help you, I could issue you a Time Limited Full License with Exporter, so you can test other formats such as obj which may behave better. This may then become a reason why to switch to CityEngine BASIC. Let me know. PM if you like. cheers ! matt
... View more
05-23-2012
03:29 AM
|
0
|
0
|
1600
|
|
POST
|
CGA operations such as the split take into account the so-called 'scope' and it's orientation. the initial state is based on the 'First Edge' (check the Manual on the First Edge). If you want to split north-south, you thus need to orient the scope first accordingly. Btw. you can visualize the scope's orientation by entering the Edit Model Mode, then select one of the shapes in the viewport. Also, open the Model Hierarchy Window to check the way your model was created. (all nodes are selectable to visualize the scopes). aligning : use alignScopeToAxes() ((like this, without argument in the brackets)) this aligns the scope to the xyz (world) axes. from there you should be good to go. oh, and check out this thread : http://forums.arcgis.com/threads/44417-CGA-Understanding-the-concept-of-the-scope let me know if you have more questions.
... View more
05-23-2012
01:24 AM
|
0
|
0
|
1184
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 12-06-2012 08:40 AM | |
| 1 | 09-30-2013 08:33 AM | |
| 1 | 08-07-2013 04:45 AM | |
| 1 | 10-15-2012 02:19 AM | |
| 1 | 01-30-2014 12:09 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:24 AM
|