TheSwamp

Code Red => .NET => Topic started by: Keith Brown on June 18, 2015, 09:42:30 AM

Title: API for obtaining Viewport Scale
Post by: Keith Brown on June 18, 2015, 09:42:30 AM
I am working with automatically generating viewports on a sheet based on drawing views and I am calculating the viewport scale.  Currently I have one scale hard coded (1/4" = 1') into the program along with its viewport scale factor of 48.  My question is that given the AutoCAD .NET API enumeration of StandardScaleType.Scale1To4inchAnd1ft is there anything in the API to return 48?  Do I need to calculate the viewport scale factor for each enumeration?  It is not hard to do and I have all the values already calculated and written down but before I write the class to generate this I thought that there might already be something in the API.


Thanks.
Title: Re: API for obtaining Viewport Scale
Post by: Jeff H on June 18, 2015, 11:38:51 AM
CustomScale property if I remember correctly.

Title: Re: API for obtaining Viewport Scale
Post by: Keith Brown on June 18, 2015, 12:33:13 PM
Yes,  that is it.  Thank you.
Title: Re: API for obtaining Viewport Scale
Post by: Keith Brown on June 18, 2015, 06:01:13 PM
I had issues implementing the API version of this.  I believe it had to do with setting the standard scale, the height, and the width of the viewport and the order in which you set them.  To make it easy on myself i just went ahead and created a quick method to return the scale factor that I was expecting.


I probably would not have had to do this if there was halfway decent documentation on the API.
Title: Re: API for obtaining Viewport Scale
Post by: Kerry on June 18, 2015, 06:05:49 PM

I probably would not have had to do this if there was halfway decent documentation on the API.

It's a pity someone from AutoDesk who could do something about this didn't visit these forums.
#IsThereAnybodyOutThereWhoCares
Title: Re: API for obtaining Viewport Scale
Post by: Kerry on June 18, 2015, 06:08:29 PM
afterthought added:
They're too busy playing with stuff that is going to make the world a better place ... oh, wait ....
Title: Re: API for obtaining Viewport Scale
Post by: Keith Brown on June 18, 2015, 06:10:00 PM
It's a pity someone from AutoDesk who could do something about this didn't visit these forums.
#IsThereAnybodyOutThereWhoCares


+1
Title: Re: API for obtaining Viewport Scale
Post by: Keith Brown on July 13, 2015, 09:03:46 AM
For anyone else finding this thread and wondering what to do the Autocad .net help file does touch upon the subject.


Quote
The StandardScale and CustomScale properties are used to specify the scale for a viewport. The StandardScale property accepts a value based on the StandardScaleType enum; whereas the CustomScale property accepts a real number which represents the ratio of units between Model and Paper space. For example, the real value equal to 1:4 is 0.25.


You can read the whole article here. (http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-4A177301-1624-45F5-97E9-8832E484B0FB)