Points to Line / Extrude to last point

1382
4
10-19-2020 04:33 AM
lina738
New Contributor

Hello. I have a shape file with points and want to link one point to the next one. I wrote some python script that adds an attribute of the position of the last point to the current point object. I thought there is an CGA operation where I can extrude a primitiveDisk in the direction of the last point with the lenght of the distance, but I did not find something like that. Does someone have some hint for me how that can be done?

Thank you!

0 Kudos
4 Replies
by Anonymous User
Not applicable

I think you will have to convert your points to lines in GIS format.    From there, a primitive disk extruded along a line is relatively simple CGA.  But if you don't have too many points, you could use the street graph (a line tool) and turn the street graph shapes off, turn node shapes off, turn the node type to junction, maybe remove the sidewalk widths, and then work with that line.

Here's a simple pipe code for a line.

/**
 * File:    Disk_Along_Line.cga
 * Created: 19 Oct 2020 13:50:39 GMT
 * Author:  cheeb
 */

version "2020.0"

attr diameter = .4

@Start
Line-->
	primitiveQuad
	Plane
	
Plane-->	
	extrude(diameter)
	Pipes
	
Pipes-->	
	center(xyz)
	rotateScope(0,0,90)
	primitiveCylinder(32,diameter,scope.sy)	
	t(-(diameter/2),0,0)
lina738
New Contributor

Hi Brian,

thank you for your answer. I have many points, so I prefer your first solution. Anyhow, I cannot add a rule file to the files in the scene. I found some comment that this might not be possible: https://community.esri.com/thread/111778 

As you suggested the solution and provided a code, I guess there is a workaround? Do I have to change some settings to add a rule file to the lines?

0 Kudos
by Anonymous User
Not applicable

Good catch.    The "segment" (line) must have shape creation on.  Just make your street width smaller than the diameter of the pipe so that the starting shape is hidden within.   Turn sidewalks to 0 each.

I suppose the nodes could have shape creation enabled too, but you would have to explore code that makes use of those shapes.  For example, the Candler building tutorial for its roof pipes uses extruded boxes on the nodes to make it all look connected.   I would be interested if those could be connected by curves but I have not explored that yet.

Also, I noticed that the Desert Tutorial has a powerlines CGA.   You might want to check that out also.  It uses a powerline .fbx model to fit the scopes.   

0 Kudos
CherylLau
Esri Regular Contributor

As I understand it, I think you want to make a cylindrical pipe that connects all the points you have.

A single pipe could be done nicely on a street network using insertAlongUV().  Save a cylindrical asset in a file, and then insert that cylinder so that it follows the UVs of the street shapes.  Note:  If you have intersecting pipes, then the intersection point won't be nice.  But, in your case, you only have a single pipe, so it should be ok.

insertAlongUV operation—ArcGIS CityEngine Resources | Documentation 

You can also try applying the Fence_On_Graph.cga rule in ESRI.lib to street shapes from a street network.  If you disable everything except the base (hasPosts, hasHorizBars, hasVertBars, hasUpper) and set the baseMiddle_asset to your cylinder, then you'll get a cylindrical pipe that follows the streets.

As another example, you can look at how this guard rail was inserted using insertAlongUV() so that it follows the street.

https://www.arcgis.com/home/item.html?id=3bb75a133c3e4ceb98607d0423b1f3ec 

0 Kudos