Hi,
I have a problem setting sysvar like SNAPBASE, which requires 2d point or 3d point.
I always get wrong input for the following lines. can anybody help to take a look?
double[] point = new double[2] {5,5};
object value1 = point;
Application.SetSystemVariable("SNAPBASE", value1);
what value should I give a 2d point or 3d point?
Please help.
Solved! Go to Solution.
Solved by norman.yuan. Go to Solution.
The value of system varibale SNAPBASE in .NET API is a Point2d, not a Point3d, nor a double array.
This code works:
[CommandMethod("SetSB")] public static void SetSnapBase() { Document dwg = Application.DocumentManager.MdiActiveDocument; Editor ed = dwg.Editor; Point2d sBase = (Point2d)Application.GetSystemVariable("SNAPBASE"); ed.WriteMessage("SNAPBASE: X={0} Y={1}", sBase.X, sBase.Y); Point2d newBase = new Point2d(2.0, 2.0); Application.SetSystemVariable("SNAPBASE", newBase); ed.WriteMessage("SNAPBASE: X={0} Y={1}", sBase.X, sBase.Y); }
Norman Yuan
thanks very much.
it worked well though there's a typo at the last line that should be newbase.
ed.WriteMessage("SNAPBASE: X={0} Y={1}", sBase.X, sBase.Y);