Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

apply analysis results over multiple faces at once...

0 REPLIES 0
Reply
Message 1 of 1
sobon.konrad
321 Views, 0 Replies

apply analysis results over multiple faces at once...

I am using the example below to generate a analysis result. I am trying to apply data to more than one face at the time. Is there a way to add multiple faces to the result and then generate one field of data over it? Like in this example there is one face that user is being asked to select. can you select multiple faces from the project and then generate fielddomainpointsbyUV() over all faces? i would hate to split my results and apply them seperately to each face. However, if that is necessary then can somone tell me how to add more faces and domain faces but still make them part of the same analysis result so that i can display them all at once. 

 

thank you,

 

 

 

Document doc = commandData.Application.ActiveUIDocument.Document;
2. UIDocument uiDoc = commandData.Application.ActiveUIDocument;
3.
4. SpatialFieldManager sfm = SpatialFieldManager.GetSpatialFieldManager(doc.ActiveView);
5. if (null == sfm)
6. {
7. sfm = SpatialFieldManager.CreateSpatialFieldManager(doc.ActiveView, 1);
8. }
9.
10. Reference reference = uiDoc.Selection.PickObject(ObjectType.Face, "Select a face");
11. int idx = sfm.AddSpatialFieldPrimitive(reference);
12.
13. Face face = doc.GetElement(reference).GetGeometryObjectFromReference(reference) as Face;
14.
15. IList<UV> uvPts = new List<UV>();
16. BoundingBoxUV bb = face.GetBoundingBox();
17. UV min = bb.Min;
18. UV max = bb.Max;
19. uvPts.Add(new UV(min.U,min.V));
20. uvPts.Add(new UV(max.U,max.V));
21.
22. FieldDomainPointsByUV pnts = new FieldDomainPointsByUV(uvPts);
23.
24. List<double> doubleList = new List<double>();
25. IList<ValueAtPoint> valList = new List<ValueAtPoint>();
26. doubleList.Add(0);
27. valList.Add(new ValueAtPoint(doubleList));
28. doubleList.Clear();
29. doubleList.Add(10);
30. valList.Add(new ValueAtPoint(doubleList));
31.
32. FieldValues vals = new FieldValues(valList);
33.
34. AnalysisResultSchema resultSchema = new AnalysisResultSchema("Schema Name", "Description");
35. int schemaIndex = sfm.RegisterResult(resultSchema);
36. sfm.UpdateSpatialFieldPrimitive(idx, pnts, vals, schemaIndex);

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community