Creating a 3D boundary...What's the best way to create a 3D boundary from a shapefile?

4147
10
Jump to solution
02-24-2015 08:32 AM
MichaelWalton
New Contributor III

NOTE: I don't have the feature to line or polygon to line tool licensed for ArcGIS analysis.

So, I have a polygon shapefile in CityEngine and I want it to be a thin 3D outline with no color infill. I tried doing it in ArcGIS Pro by setting the symbology properties and extruding. I do not like the way it looks see image...Boundary.JPG

Also I don't want it in Pro anyway...I'd like to write a CE rule that turns this boundary shapefile into a 3D tube. Any ideas for how I can write this rule?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Here's what happens at the corners (automatic miter cut):

CapturePipeTrim.JPG

View solution in original post

0 Kudos
10 Replies
by Anonymous User
Not applicable

This works in most cases (strange shapes work better with smaller pipe diameter):

attr pipeThickness = 5

@StartRule

Boundary -->

  offset(-pipeThickness) comp(f) {inside: Inside}

Inside -->

  extrude(pipeThickness) comp(f) {side: Pipeline}

Pipeline -->

  extrude(pipeThickness)

  s('20,'1,'1)

  center(x)

  i("assets/pipe.obj")

# Asset is attached.

# Let me know if this works, Chris

by Anonymous User
Not applicable

Here's what happens at the corners (automatic miter cut):

CapturePipeTrim.JPG

0 Kudos
MichaelWalton
New Contributor III

Thank you,

It works nicely for me.

BoundaryExample.JPG

0 Kudos
MichaelWalton
New Contributor III

Hi Chris,

I was told that the 3D boundary looks too much like an oil pipeline, so I am trying to make it into a dashed 3D line...But CityEngine keeps crashing as I update the code....Can you please test this code out to see if it works?

attr pipeThickness = 1.5

attr colorer = "#ffffff"

@StartRule

Boundary -->

  offset(-pipeThickness) comp(f) {inside: Inside}

Inside -->

  extrude(pipeThickness) comp(f) {side: Pipeline}

Pipeline -->

  extrude(pipeThickness)

  s('5,'1,'1)

  center(x)

  i("models/pipe/pipe.obj")

  t(0,'0.5,0)

  split(x) { { ~5 : Pipeline | ~1 : NIL }*  | ~5 : Pipeline }

  color(colorer)

0 Kudos
by Anonymous User
Not applicable

Michael,

This is crashing due to an endless loop. The Pipeline rule is calling itself. It is fine for a rule to call itself, but there must be an exit condition (that is called recursion and is quite useful in CGA).

I just changed this line:

split(x) { { ~0.75 : Pipeline | ~1 : NIL }*  | ~0.75 : Pipeline }

To this (has period after the word Pipeline):

split(x) { { ~0.75 : Pipeline. | ~1 : NIL }*  | ~0.75 : Pipeline. }

Or this:

split(x) { { ~0.75 : ThisIsAFinalShapeSoItHasAPeriodAfterIt. | ~1 : NIL }*  | ~0.75 : ThisIsAFinalShapeSoItHasAPeriodAfterIt. }

And I can see this (looks good except the last pipe parts have a face dropped):

CapturePipes.JPG

0 Kudos
by Anonymous User
Not applicable

Michael,

I looked at the corner thing and wasn't sure if you wanted the empty corners. If you do, then here is a modification to do that. Also moved the color command to the very first line, just to execute it only once.

CapturePipes2.JPG

attr pipeThickness = 1.5

attr colorer = "#ffffff"

attr cornerScale = 1  # Make this higher number to handle sharp corners.

@StartRule

Boundary -->

  color(colorer)

  offset(-pipeThickness) comp(f) {inside: Inside}

Inside -->

  extrude(pipeThickness) comp(f) {side: Pipeline}

Pipeline -->

  extrude(pipeThickness)

  s('20,'1,'1)  # Added this for automatic trim.

  center(x)

  t(0,'0.5,0)

  i("pipe.obj")

  split(x) {

    ~(pipeThickness * cornerScale) : PipeCorner. | # Longer to handle corners.

    {~(pipeThickness * 2/3) : NIL | ~(pipeThickness * 0.5) : PipeDash. }* |

    ~(pipeThickness * 2/3) : NIL |

    ~(pipeThickness * cornerScale) : PipeCorner.   # Longer to handle corners.

  }

MichaelWalton
New Contributor III

Hi,

The rule works when displayed in the cga rule preview window...

dashed.JPG

However, when assigning the dashed boundary rule to an irregular shapefile, it causes a big long crash to any computer. If I draw a perfect rectangle, the rule works perfectly. But, on the complex and irregular shapes there is a big problem. I tried to increase the  corner scale to 5 meters, but  it still crashed when applied to my district's political boundary.

0 Kudos
MichaelWalton
New Contributor III

     For instance, the same rule applied to the shapefile looks different in some areas and corners.   

        Good                                                  Bad                                                   Ugly

boundary.JPG boundary2.JPG  boundary3.JPG

0 Kudos
by Anonymous User
Not applicable

I did know that sharp corners would possibly break it. I'd have to see the project and shapes in question to help trouble shoot. I'm a bit knee deep this morning, but if you can't fix it, try posting a stripped out version of the project, so that we can see and test on the same shapes you are using (scene, rules, assets).

Chris

0 Kudos