POST
|
How to I explicitly set an absolute co-ord world location of a static mesh within a scene. ie I want my static model of a cube at exactly (10, 20, 30)
... View more
11-09-2012
12:10 PM
|
0
|
1
|
613
|
POST
|
Ah okay I see, Thanks this could be a useful approach elsewhere! Strikes me that you could certainly create a set of specific example design patterns for use with the cga language. It could be most helpful for those wanting to discover possible rule approaches to solve their required outcomes. "to always place the same specific assets regularly among a certain street shape" Actually the solution above was too randomly select and place an asset from a given selection set along a street shape with irregular random offset spacings. 😉 Thus the code setups an initial selection(to prime the pump, so to speak) then the next leaf is recursively selecting and placing. But I'm pretty sure there are many ways to approach a similar solution, some probably more elegant that this. 🙂
... View more
10-23-2012
07:57 AM
|
0
|
0
|
376
|
POST
|
Hey was just looking over this again not so sure I understood this specifcally. - use modulo function ( 5 % 2 = 1 ) with a recursion index
... View more
10-16-2012
08:35 AM
|
0
|
0
|
376
|
POST
|
How do i raise my own errors to the error Log window? Is there a CEError exception class I can use?
... View more
09-27-2012
01:04 PM
|
0
|
1
|
231
|
POST
|
Why would ce.getVertices return an unstructured list of floating point numbers? Is it assumed that when returning from a shape the coord listings are in vertex order so we can structure as needed? Personally I see this to be more useful if it returned a dict with vertex number(key) and tuple in the format (x,y,z) mydict[vertexNum/vertUUID]=(x,y,z) I guess this is another case of lists are more approachable for people new to python.
... View more
08-30-2012
12:27 PM
|
0
|
1
|
763
|
POST
|
From graphNode how do i get to connected graphSegments?
... View more
08-30-2012
11:04 AM
|
0
|
0
|
462
|
POST
|
Thanks for the response, but I guess I am not using it as you would regularly. 😉 Okay so I understood the insert rules for streets having studied the modern streets examples they were helpful, and tally with your post. I needed to create broken streets, I am not using the city engine street geometry as output. This is almost the solution, I need to work on the spacing of the instances I am placing as they are currently butted to each other.I would like to space them out a little more, so adding some random variance to one of the splits should do it. The importance here is the random selection of a new instance at each recursion whilst filling the street. This is also interesting as it shows how cityEngines Rules generate nodes and get added to the execution stack and how different it is to normal code execution.
/**
* File: streetTest.cga
* Created: 20 Aug 2012 18:28:49 GMT
* Author: rhexter
*/
version "2011.2"
//attribute and function to randomly select a street section for insertion
//- lengths are unitized to 25m sections
//- x4 represents the number of lanes, could be a varible
attr streetAsset = "asset"
setStreetAsset = "assets/road_details/Street_"+listRandom("Short;Medium;Long")+"_x4" + ".obj"
// attribute to kick off our knowledge of streetsectionlength
@Hidden
attr streetModelUDim=0
PlaceInstance(asset) -->
/*
Inserts the selected model asset
*/
//Provide some Feedback
print ("PlaceInstance: In")
print ("Placing \"asset\": \n\t" + asset)
print ("InstanceLength: \n\t" + assetInfo(asset, sz))
alignScopeToGeometry(yUp, 0, 0)
s(0,0,0)
center(xz)
r(scopeCenter, 0, 89, 0) // skew'd for easy visual reading of section placements
i(asset)
print ("PlaceInstance: Out")
PlaceStreetPiece(streetModel, streetModelLen, remainingStreetUDim) -->
/*
This leaf is recursive:
In one side of the split it:
- inserts a preselected model,
(because we know the udimension of it and it fits the street)
- in the other:
- it chooses a new random model
- checks if it fits the remaining street udimension
- passes it to its-self to place
rinse/repeat
*/
print ("*-----------------------------------------*")// iterator section feedback break
print ("PlaceStreetPiece: In")
split(u,unitSpace,0)
{
streetModelLen:
//Place the streetModel previously choosen here, cos we know it fits
PlaceInstance(streetModel)
print ("RemainingStreetLength: \n\t" + remainingStreetUDim)
|// split
remainingStreetUDim :
//Work out our next model to place that will fit within our remaining streetUDimension
print ("-----------------------------------------")// iterator section feedback break
print ("-----Try to pick a new Random \"Model\"----")
set(streetAsset, setStreetAsset) // randomly pick a new model for next iteration placement
print ("Chosen streetModel: " + streetModel)
[
case assetInfo(streetAsset, sz) < remainingStreetUDim:
// if our chosen model fits, place it
PlaceStreetPiece(
streetAsset, //the next chosen streetModel
assetInfo(streetAsset, sz), // streetModelLength
(remainingStreetUDim-assetInfo(streetAsset, sz)) // the remaining StreetUDimension
)
else:
print ("-----------------------------------------")// iterator section feedback break
print ("StreetModel Did not fit " + streetAsset)
print ("-----------------------------------------")// iterator section feedback break
NIL
]
}
print ("PlaceStreetPiece: Out")
print ("*-----------------------------------------*")// iterator section feedback break
attr dim = 1.0
attr markerDim=2.0
Street -->
/*
Begin to fill the streets with streetAssets
Set an initialModel here:
- we need know its length
-- we need this information to setup and pass in
the recursive leaf's values
*/
set(streetAsset, setStreetAsset)
set(streetModelUDim, assetInfo(streetAsset, sz))
//Feedback
print ("Start streetAsset: " + streetAsset)
print ("Start streetModelUDim: " + streetModelUDim)
split(v,unitSpace,0)
{
~dim: NIL
|
markerDim:
// PlaceStreetPiece(streetAsset, streetModelUDim, remainingStreetUDim)
PlaceStreetPiece(streetAsset, streetModelUDim, geometry.du(0,unitSpace)- assetInfo(streetAsset, sz))
|
~dim: NIL
}
... View more
08-20-2012
12:11 PM
|
0
|
0
|
376
|
POST
|
Here's the puzzel.. I have a street of length x. I have three models I can randomly select from to insert on that street, the models are of known length (units of 25m). 100, 50 and 25. I would like to effectively iterate along the road and fill it with assets(inserted at realworld size s(0,0,0)) until the road is full. Additionally the intention is to have randomly sized gaps between each model. Here's the bit I'm struggling with.. I would like after each asset placement to the randomly choose from the three models again before the next insert. How would I do this?
... View more
08-16-2012
07:27 PM
|
0
|
7
|
2384
|
POST
|
From a graphSegment how do you determine a sidewalkLeftShape from sidewalkRightShape? Since the return from, the assumption is that I am trying to iterate through the shapes returned from: shapes=ce.getObjectsFrom(graphSegment, ce.isShape) shapeType=ce.getAttribute(shapes[0], '/ce/shapeType') shapeType is 'sidewalk'? left or right..
... View more
08-14-2012
11:16 AM
|
0
|
2
|
2110
|
POST
|
How do you get from a shape to a graph segment when working with roads in python? It would appear that you can only get to graphSegments from layers? is this correct... the reason I ask is because the seemingly obvious does not appear to work for me I select a streetShape and : segment = ce.getObjectsFrom(ce.selection(), ce.isGraphSegment) and I get an empty list back?
... View more
08-13-2012
02:26 PM
|
0
|
1
|
764
|
POST
|
So re-reading your reply here again Matthias: http://forums.arcgis.com/threads/55547-Accessing-Street-Attributes?highlight=street important : Attributes on Start Shapes, such your specific Lot's StreetWidth attributes are constant for the Model since those Attributes are specific INPUTS for CGA to create the Model on this shape. Once the Model Generation is started, CGA works just with the input it gets. CGA just executes a series of geometric operations. Once the Model Generation is started, CGA can not go back and check the environment around the shape and read more info to further process that data in the current Model. That is currently not possible, but may change with an upcoming release. [same is true with sampled map layer information: it is constant during the Model Generation process.] Does this also mean that once a generation process starts it can't be interrupted, it has to complete generation and end in a resulting leaf(or error)? i.e. by the changing of an attribute during the generation process such as streetWidth Attr does it not halt execution and restart the generation? Not that i require this I'm just interested. What I am not understanding is if I place a list to appear in a UI (@Range) for a shapeNode, for a user to select a streetWidth, for the initialStreetShapeSegment, why the result of this change can not set the attribute on that initialStreetShapeSegment and have it start the regeneration of the initialStreetShape leaf. Yet a map layer can alter this value? Is there a way to customise per project the attributes and settings on those initialShapes(non user StartShapes)?
... View more
08-10-2012
03:08 PM
|
0
|
0
|
488
|
POST
|
Guys I see that by looking at these: http://forums.arcgis.com/threads/55547-Accessing-Street-Attributes?highlight=street http://forums.arcgis.com/threads/52304-Deriving-block-parameters-from-landuse-maps That the streetWidth can be driven by a map. I wasn't wanting to have to numerically set the dimension for the streetWidth or paint an image map to control it. I was wanting to put in a ui : @Range("Narrow", "Side", "Main", "Highway") attr myStreetWidth="Main" and then driven the streetWidth by simply changing this value, and workout and set the road dimensions how can I make this possible?
... View more
08-09-2012
02:48 PM
|
0
|
4
|
1082
|
POST
|
Are you using instances or one large static mesh for your world? If one large static mesh then export as fbx and you should get the lot, do not export each building to a separate file, consider breaking the city or map into regions of fbx data. Multiple meshes mean multiple draws in runtime if you have many materials and textures, reduce the number of these. If you intend to use instances in Unity, then you will require a method of writing the instance locations in a format that can then be read by Unity and placed by Unity. Consider the Unreal instance placements demo data. I assume that something could be written into Unity to allow the read and placements of these subsequent locations. Instances would be most effective management for building mesh data but comes with some caveats you'll discover those along the way. One large lump of mesh via the fbx export will cost more in the runtime and may or may not require editing afterwards for efficiencies sakes. Note: this is not a magic bullet for mesh generation and will still require some careful rule crafting and 3d modelling work to get the best from the data, if you are looking at a game style application. You will need to consider a 3d package, Max Maya or and appropriate modelling app. Nevercenters Silo is a good cheap alternative for home use(it does have its quirks mind).
... View more
08-08-2012
10:24 AM
|
0
|
0
|
151
|
Title | Kudos | Posted |
---|---|---|
1 | 07-25-2012 03:42 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|