Author Topic: Setting DIMSCALE  (Read 5047 times)

0 Members and 1 Guest are viewing this topic.

JimAndi

  • Guest
Setting DIMSCALE
« on: August 23, 2011, 10:15:32 AM »
Hi All,

I am getting a Error with this code:

Double LTSCALEV, DIMSCALEV;
DIMSCALEV = Convert.ToDouble(dsTITLEBLOCK4.Rows[0]["DIMSCALE"].ToString());

Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMSCALE", DIMSCALEV);

I am getting a "eInvalidInput" error with the value of DIMSCALEV

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Setting DIMSCALE
« Reply #1 on: August 23, 2011, 10:32:47 AM »
Since this works fine
 
Code: [Select]

 
                Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMSCALE", 2.5);

I would think your problem is with
 
DIMSCALEV = Convert.ToDouble(dsTITLEBLOCK4.Rows[0]["DIMSCALE"].ToString());

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
Re: Setting DIMSCALE
« Reply #2 on: August 23, 2011, 10:39:51 AM »
public static void SetSystemVariable(string name, object value)

kaefer

  • Guest
Re: Setting DIMSCALE
« Reply #3 on: August 23, 2011, 11:12:31 AM »
Another possible pitfall, albeit one AutoCAD takes care of, AFAIK:

 System.Convert.ToDouble("2.5") might return 25.0. If in doubt, throw in System.Globalization.CultureInfo.InvariantCulture.

JimAndi

  • Guest
Re: Setting DIMSCALE
« Reply #4 on: August 23, 2011, 12:11:38 PM »
I tried this: Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMSCALE", 12.0); and get the same error

Jeff H

  • Needs a day job
  • Posts: 6144
Re: Setting DIMSCALE
« Reply #5 on: August 23, 2011, 12:31:08 PM »
What year and or vertical are you using?
Ad if you try this all by itself does it fail?
 
Code: [Select]

         [CommandMethod("DimScaler")]
        public void DimScaler()
        {
            Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMSCALE", 12.0);
        }

JimAndi

  • Guest
Re: Setting DIMSCALE
« Reply #6 on: August 23, 2011, 12:54:45 PM »
VS-2010 .NET 4.0 in C#.  AutoCAD 2012

This works fine
  Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("LTSCALE", 6.0);


This errors
 Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable("DIMSCALE", 12.0);

JimAndi

  • Guest
Re: Setting DIMSCALE
« Reply #7 on: August 23, 2011, 01:19:14 PM »
Fixed it....  must be inside the document.LockDocument(); function

Glenn R

  • Guest
Re: Setting DIMSCALE
« Reply #8 on: August 25, 2011, 08:52:02 AM »
Fixed it....  must be inside the document.LockDocument(); function

No, it doesn't. It will depend entirely on the context of where it's being called from.