Community
I am using the file intro-1.dwg. I am trying to change the following settings:
Analysis Type:
Ranges:
Run the analysis.
Document acDoc = AutoCadApp.DocumentManager.MdiActiveDocument;
using (acDoc.LockDocument())
using (Database acDb = acDoc.Database)
using (Transaction acT = acDb.TransactionManager.StartTransaction())
{
CivilDocument civilDocument = CivilDocument.GetCivilDocument(acDoc.Database);
BlockTable bT = acDb.GetBlockTable(acT);
BlockTableRecord modelSpace = acDb.GetModelSpace(acT);
Editor ed = acDoc.Editor;
// Select a Tin Surface
PromptEntityOptions peo = new PromptEntityOptions(
"\nSelect a tin surface: ");
peo.SetRejectMessage("\nOnly Tin surface is accepted");
peo.AddAllowedClass(typeof(TinSurface), true);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status != PromptStatus.OK) return;
CivilDocument civilDoc = CivilApplication.ActiveDocument;
TinSurface surface = acT.GetObject(per.ObjectId, OpenMode.ForRead) as TinSurface;
ObjectId styleId;
styleId = civilDoc.Styles.SurfaceStyles["Slope Banding (2D)"];
var value = surface.StyleId;
SurfaceAnalysis surfaceAnalysis = surface.Analysis;
surface.StyleId = styleId;
acT.Commit();
surface.Rebuild();
}
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Add this to your code:
SurfaceAnalysis surfaceAnalysis = surface.Analysis;
var data = new List<SurfaceAnalysisSlopeData>();
data.Add(new SurfaceAnalysisSlopeData(0, 0.05, Color.FromColorIndex(ColorMethod.ByAci,(short)1) ));
data.Add(new SurfaceAnalysisSlopeData(0.05, 0.20, Color.FromColorIndex(ColorMethod.ByAci, (short)2)));
surfaceAnalysis.SetSlopeData(data.ToArray());
surface.Rebuild();
dynamic surf = surface.AcadObject;
surf.Update();//without this a Regen is required
acT.Commit();
This adds 2 regions, 0 - 5% & 5% - 20%, with the colors Red and Yellow.
Can't find what you're looking for? Ask the community or share your knowledge.