TheSwamp
Code Red => .NET => Topic started by: jmaeding on November 05, 2009, 12:42:34 PM
-
I drew a highlighted line and arc with the transientmanager object, and the arc tends to show as solid, not highlighted.
Its fine when you zoom in, but ugly when zoomed out.
I am contemplating breaking my arcs into lines to get around this, but is there some other object that affects the display of these?
see image attached
-
Here is my home-tesselated solution.
Note that I added a extension method of "polar" to 3dpoints, SM is alias for system.math, TrDrawLines does transient graphics for list of points, it draws lines.
public static bool TrDrawArc(AcGe.Point3d cenPt, double radius, double startAng, double endAng,
int color, bool highlight, out List<Drawable> lstDraws)
{
lstDraws = null;
//make list of pts to feed to TrDrawLines
List<AcGe.Point3d> pts = new List<Point3d>();
//make segments no longer than VIEWSIZE / 50, and no less degrees than 1/10th delta
//end result is number of arc divisions
double fullDelta;
if (endAng > startAng)
fullDelta = endAng - startAng;
else
fullDelta = endAng + ((SM.PI * 2.0) - startAng);
double vsize = System.Convert.ToDouble(AcAp.GetSystemVariable("VIEWSIZE"));
double distByLen = vsize / 50.0;
int divs = 1 + (int)SM.Truncate(fullDelta * radius / distByLen);
//check if less than than 1/10th delta
if (divs < 10) divs = 10;
for (int i = 0; i < divs; i++) {
pts.Add(cenPt.Polar(startAng + ((fullDelta / divs) * i), radius));
}
return TrDrawLines(pts, color, highlight, out lstDraws);
}
public static AcGe.Point3d Polar(this AcGe.Point3d stPt, double angle, double dist)
{
return new AcGe.Point3d(
stPt.X + (dist * SM.Cos(angle)),
stPt.Y + (dist * SM.Sin(angle)), stPt.Z);
}