@@ -40,12 +40,14 @@ protected void InternalSetReferencePrimitiveIdPairs(Dictionary<Reference, int> k
4040 ///
4141 /// </summary>
4242 /// <param name="view"></param>
43- /// <param name="data"></param>
43+ /// <param name="surface"></param>
44+ /// <param name="sampleLocations"></param>
45+ /// <param name="samples"></param>
4446 /// <param name="resultsName"></param>
4547 /// <param name="description"></param>
4648 /// <param name="unitType"></param>
4749 protected FaceAnalysisDisplay (
48- Autodesk . Revit . DB . View view , ISurfaceData < Autodesk . DesignScript . Geometry . UV , double > data , string resultsName , string description , Type unitType )
50+ Autodesk . Revit . DB . View view , Surface surface , Autodesk . DesignScript . Geometry . UV [ ] sampleLocations , IEnumerable < double > samples , string resultsName , string description , Type unitType )
4951 {
5052
5153 SpatialFieldManager sfm ;
@@ -56,7 +58,7 @@ protected FaceAnalysisDisplay(
5658 var refPriIds = new Dictionary < Reference , int > ( ) ;
5759 var primitiveIds = new List < int > ( ) ;
5860
59- var reference = data . Surface . Tags . LookupTag ( DefaultTag ) as Reference ;
61+ var reference = surface . Tags . LookupTag ( DefaultTag ) as Reference ;
6062 if ( reference == null )
6163 {
6264 // Dont' throw an exception here. Handle the case of a bad tag
@@ -74,7 +76,7 @@ protected FaceAnalysisDisplay(
7476 int primitiveId ;
7577 if ( refPriIds . TryGetValue ( reference , out primitiveId ) )
7678 {
77- InternalSetSpatialFieldValues ( primitiveId , data , resultsName , description , unitType ) ;
79+ InternalSetSpatialFieldValues ( primitiveId , surface , sampleLocations , samples , resultsName , description , unitType ) ;
7880
7981 TransactionManager . Instance . TransactionTaskDone ( ) ;
8082
@@ -94,7 +96,7 @@ protected FaceAnalysisDisplay(
9496 InternalSetSpatialPrimitiveIds ( primitiveIds ) ;
9597 InternalSetReferencePrimitiveIdPairs ( refPriIds ) ;
9698
97- InternalSetSpatialFieldValues ( primitiveId , data , resultsName , description , unitType ) ;
99+ InternalSetSpatialFieldValues ( primitiveId , surface , sampleLocations , samples , resultsName , description , unitType ) ;
98100 }
99101 }
100102 else
@@ -111,7 +113,7 @@ protected FaceAnalysisDisplay(
111113 InternalSetSpatialPrimitiveIds ( primitiveIds ) ;
112114 InternalSetReferencePrimitiveIdPairs ( refPriIds ) ;
113115
114- InternalSetSpatialFieldValues ( primitiveId , data , resultsName , description , unitType ) ;
116+ InternalSetSpatialFieldValues ( primitiveId , surface , sampleLocations , samples , resultsName , description , unitType ) ;
115117 }
116118
117119 TransactionManager . Instance . TransactionTaskDone ( ) ;
@@ -126,16 +128,17 @@ protected FaceAnalysisDisplay(
126128 /// input sequences should be of the same length.
127129 /// </summary>
128130 /// <param name="primitiveId"></param>
129- /// <param name="data"></param>
131+ /// <param name="surface"></param>
132+ /// <param name="sampleLocations"></param>
133+ /// <param name="samples"></param>
130134 /// <param name="schemaName"></param>
131135 /// <param name="description"></param>
132136 /// <param name="unitType"></param>
133137 private void
134- InternalSetSpatialFieldValues ( int primitiveId , ISurfaceData < Autodesk . DesignScript . Geometry . UV ,
135- double > data , string schemaName , string description , Type unitType )
138+ InternalSetSpatialFieldValues ( int primitiveId , Surface surface , Autodesk . DesignScript . Geometry . UV [ ] sampleLocations , IEnumerable < double > samples , string schemaName , string description , Type unitType )
136139 {
137140 // Get the surface reference
138- var reference = data . Surface . Tags . LookupTag ( DefaultTag ) as Reference ;
141+ var reference = surface . Tags . LookupTag ( DefaultTag ) as Reference ;
139142
140143 var el = DocumentManager . Instance . CurrentDBDocument . GetElement ( reference . ElementId ) ;
141144 var pointLocations = new List < UV > ( ) ;
@@ -144,16 +147,16 @@ private void
144147 var face = el . GetGeometryObjectFromReference ( reference ) as Autodesk . Revit . DB . Face ;
145148 if ( face != null )
146149 {
147- foreach ( var loc in data . ValueLocations )
150+ foreach ( var loc in sampleLocations )
148151 {
149- var pt = data . Surface . PointAtParameter ( loc . U , loc . V ) ;
152+ var pt = surface . PointAtParameter ( loc . U , loc . V ) ;
150153 var faceLoc = face . Project ( pt . ToXyz ( ) ) . UVPoint ;
151154 pointLocations . Add ( faceLoc ) ;
152155 }
153156 }
154157 }
155158
156- var valList = data . Values . Select ( v => new ValueAtPoint ( new List < double > ( ) { v } ) ) ;
159+ var valList = samples . Select ( v => new ValueAtPoint ( new List < double > ( ) { v } ) ) ;
157160
158161 TransactionManager . Instance . EnsureInTransaction ( Document ) ;
159162
@@ -227,9 +230,7 @@ public static FaceAnalysisDisplay ByViewFacePointsAndValues(
227230 description = Properties . Resources . AnalysisResultsDefaultDescription ;
228231 }
229232
230- var data = SurfaceData . BySurfacePointsAndValues ( surface , sampleLocations , samples ) ;
231-
232- return new FaceAnalysisDisplay ( view . InternalView , data , name , description , unitType ) ;
233+ return new FaceAnalysisDisplay ( view . InternalView , surface , sampleLocations , samples , name , description , unitType ) ;
233234 }
234235
235236 #endregion
0 commit comments