.NET

Reply
New Member
danielsu2013
Posts: 2
Registered: ‎04-05-2013
Message 1 of 3 (169 Views)
Accepted Solution

How to use SetSystemVariable setting coordinate values

169 Views, 2 Replies
04-05-2013 03:47 AM

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.

*Expert Elite*
norman.yuan
Posts: 946
Registered: ‎04-27-2009
Message 2 of 3 (150 Views)

Re: How to use SetSystemVariable setting coordinate values

04-05-2013 06:39 AM in reply to: danielsu2013

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);
        }

 

New Member
danielsu2013
Posts: 2
Registered: ‎04-05-2013
Message 3 of 3 (113 Views)

Re: How to use SetSystemVariable setting coordinate values

04-07-2013 09:10 PM in reply to: norman.yuan

thanks very much.

it worked well though there's a typo at the last line that should be newbase.:smileyvery-happy:

 

ed.WriteMessage("SNAPBASE: X={0} Y={1}", sBase.X, sBase.Y);

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community