POST
|
Solution: Simply set the pLineGeoColl as zAware - that's the whole trick! IGeometryCollection pLineGeoColl = new PolylineClass(); IZAware zAware1 = (IZAware)pLineGeoColl; zAware1.ZAware = true; IGeometry pGeometry = pGeometryCollection.get_Geometry(intPartCount); pLineGeoColl.AddGeometry(pGeometry, ref Missing, ref Missing); Many Thanks to those looking at it!
... View more
03-13-2013
01:30 AM
|
0
|
0
|
214
|
POST
|
Hi All, I'm trying to split a polyline by the boundaries of a polygon using IPolyCurve2.SplitAtPoints using C#. The polyline I'm trying to split is zAware and holds elevation values at a regular interval. After splitting the polyline I would obviously like to get the different parts and save them as new features in my feature class, then deleting the original one. The problem is that when I try to set feature.shape to the geometry in my geometry collection made up of all the polyline parts, I get the error message that the geometry has no Z values. Does anybody know how to solve this issue? I've looked around in the forum but all I found was code that doesn't deal with polylines that hold Z values. Thank you very much! Here is the code I'm using, passing in the original polyline, the point collection that holds all the intersection points with the polygon and the original feature class I create new features in. public void SplitPolylineFeature(IFeature pPolylineFeature, IPointCollection pSplitPointCollection, IFeatureClass pFeatureClass) { //split the feature, each split makes a new part IEnumVertex pEnumVertex = pSplitPointCollection.EnumVertices; IPolycurve2 pPolyCurve = pPolylineFeature.Shape as IPolycurve2; IEnumSplitPoint pEnumSplitPoint = pPolyCurve.SplitAtPoints(pEnumVertex, true, true, -1); object Missing = Type.Missing; if(pEnumSplitPoint.SplitHappened) { //new geocoll for polycurve IGeometryCollection pGeometryCollection = pPolyCurve as IGeometryCollection; //loop through the parts of the split polyline for(int intPartCount = 0; intPartCount < pGeometryCollection.GeometryCount; intPartCount++) { IGeometryCollection pLineGeoColl = new PolylineClass(); IGeometry pGeometry = pGeometryCollection.get_Geometry(intPartCount); //IZAware zAware1 = (IZAware)pGeometry; //zAware1.ZAware = true; pLineGeoColl.AddGeometry(pGeometry, ref Missing, ref Missing); IFeature pFeature = pFeatureClass.CreateFeature(); try { pFeature.Shape = pLineGeoColl as IGeometry; //code crashes here: Geometry has no Z values pFeature.Store(); } catch (Exception ex) { MessageBox.Show("Error in WillisPolylines.SplitPolylineFeature: " + ex.Message); } } } pPolylineFeature.Delete(); }
... View more
03-12-2013
02:18 AM
|
0
|
1
|
546
|
POST
|
Thanks, kreuzrsk, that's exactly what I'm after. I've written a Python add-in application extension which in a nutshell uses: arcpy.CheckInExtension("3D") - and the same for Spatial Analyst ("SA") And for the "Method s to Implement" in the Python Wizard I've selected "closeDocument", "openDocument" and "newDocument" which should act as the trigger points to run the add in. All that sounds really simple, but that doesn't seem to work at all. Licenses are kept in the Normal.mxt when closing down and opening up an mxd. We have now installed the VBA SDK for 10.1 and if there is no solution with python add-ins I'll have to dig out my old VBA script form the 9.x days and hope it will work.
... View more
12-06-2012
01:29 AM
|
0
|
0
|
401
|
POST
|
@jamesfreddyc Thanks for your answer. First of all, I'm working with 10.1 SP1. I'm aware of the functionality and how to check in and check out extensions with python. What I don't get to work is storing this code as an Add-In or in the Normal.mxt so it automatically releases any extensions when closing down/starting a mxd. 😞
... View more
12-04-2012
11:12 PM
|
0
|
0
|
401
|
POST
|
Good morning, I'm trying to find a way to automatically release extensions like SA or 3D. The reason being that when I'm working with an extension (concurrent license) and don't explicitly un-tick it before closing the mxd, it will automatically grab it next time I open a mxd, i.e. it seems to be stored in the Normal.mxt. As you can imagine, this many times happens to users in our organisation without them being aware of it and as a result all licenses are in use. I've tried to write a python Add-In to release the extensions whenever I open or close a mxd. But it doesn't work. I remember having written a VBA macro saved in the Normal.mxt which was very straight forward and worked fine every time. However, this easy method is not possible in python anymore as far as I'm aware of. If anybody has faced the same problem, but was more successful than me, I'd very much appreciate to hear about his/her solution. Many Thanks, Hubert
... View more
12-04-2012
12:41 AM
|
0
|
6
|
2687
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|