Showing posts with label Revit. Show all posts
Showing posts with label Revit. Show all posts

Friday, November 21, 2014

Revit Dockable Pane Failures with Windows 8 Video Scaling

I'm not sure if this is a bug, or just something that I'm missing, but there is definitively something weird with how Revit dockable pages display on systems that implement video scaling, namely windows 8.1 on retina displays.

Let me first start by explaining what I mean by video scaling. Windows has a feature under display settings that allows you to "scale" objects on your display. This is different from the use of resolution. Here's an illustration of what I'm talking about:


The dockable page in question is basically divided up into two even columns down the center. When the Windows video scaling is set to anything other than 100%, it throws off the coordination between the grid and the host page width. Sorry for having to blur out the controls, but here is a sample of what my dockable page looks like (cutting off about 50% on right hand side):



I went through the normal process of handling this through traditional WPF windows means thinking that I'd be out of the woods, but nope. My dockable page object is surrounded by one master grid, but for some reason on systems with video scaling active, this grid does not know how large it is supposed to be. The whacky result is what you see above with the cut-off issues.

The "traditional" code that should have worked, but did not is shown below. It gets the video scaling from the Matrix object and then applies that value to the ScaleTransform of my MasterGrid which is of course the base grid at the top level of the page layout.


        private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            Matrix m = PresentationSource.FromVisual(Application.Current.MainWindow).CompositionTarget.TransformToDevice;
            double dx = m.M11;
            double dy = m.M22;

            ScaleTransform s = (ScaleTransform)MasterGrid.LayoutTransform;
            s.ScaleX = 1 / dx;
            s.ScaleY = 1 / dy;
        }


What I ended up having to do was first get the scaling values from the matrix object (similar to above) and then use the SizeChanged event on my Revit dockable page to adjust the width and height to match the size of the page object.

The code that ended up working for adjusting the host grid object size with scaling is shown here.

    private void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
      Matrix m = PresentationSource.FromVisual(this).CompositionTarget.TransformToDevice;
      double dx = m.M11;
      double dy = m.M22;
      GridMain.Width = this.Width / dx;
      GridMain.Height = this.Height / dy;
    }

The code above gets the current Windows video scaling in the same way, but the difference is that instead of applying scaling, we're just calculating the corrected widths and heights for the form. Here's how the page looks after the updates (slightly less blur):


I'm curious if anyone else has run into this and if so, how did you deal with it?

Monday, July 8, 2013

Announcing the 2013 Hands-on Revit API Training Workshop

It is time to announce the second annual CASE Revit API Hands-on Workshop!! We have dates and pricing ready and you can book a spot today! Spots are very limited, so reserve your spot early!

This workshop is designed for beginners!

All computers and software will be provided! All you need to bring is excitement and a willingness to learn... If you have concerns about hotel pricing, we have a few insider tips that we can let you in on to avoid those costly hotels. Contact us for details!



Free Stuff:
All attendees will receive a free 3 month trial membership to our CASE Pro Apps
http://apps.case-inc.com/proapps

When:
The workshop will run four days from Tuesday September 10th to the 13th. Workshop days will begin at 9am and finish at 5pm with a two hour break at noon. You will be building all kinds of useful tools that you can take with you!

  • Day 1 - (Tuesday Sep. 10) Introduction to .NET and Concepts
  • Day 2 - Introduction to Revit API
  • Day 3 - Data Samples
  • Day 4 - Elements and Geometry
  • Social - After conclusion of day 4

Where (The CASE Office):
401 Broadway, Suite 1600 (16th floor)
New York, New York
Map: http://bit.ly/N1PteT



Pricing!
We are offering an early bird discount that will gradually increase as we get closer. Act fast because spots are limited!

$1,500 (Aug 1 - Aug 17)
$1,850 (Aug 18 - Aug 31)
$2,000 After Aug 31


Booking a Spot
Send an email to [info at case-inc dot com] and copy myself [d dot rudder at case-inc dot com] with a title of "CASE Revit 2013 API Workshop" letting us know you are interested in reserving a seat for the API workshop. Please include a phone number and we will contact you to secure payment. Your price will lock in on the date your email is sent to us if we do not get back to you the same day (highly unlikely).

Thanks for your interest and we're looking forward to helping you get your Revit API learn on!


Friday, July 27, 2012

CASE Revit 2013 API Workshop

It's time to make this official! We have dates and pricing ready for you guys and you can book a spot today! All computers and software will be provided so all you need to bring is excitement and a willingness to learn.



This workshop is also where I will be unveiling our subscription tools and giving away a few free 90 day trial memberships! You wont want to miss this because the general public will not be able to access these tools until November!

When:
The workshop will run four days from Monday September 11th to the 14th. Workshop days will begin at 9am and finish at 4pm with a one hour break at noon. You will be building all kinds of useful tools that you can take with you!

  • Day 1 - (Tuesday Sep. 11) Introduction to .NET and Concepts
  • Day 2 - Introduction to Revit API
  • Day 3 - Data
  • Day 4 - Elements and Geometry

Where (The New CASE Office):
401 Broadway, Suite 1600 (16th floor)
New York, New York
Map: http://bit.ly/N1PteT



Pricing!
We are offering an early bird discount that will gradually increase as we get closer. Act fast because spots are limited!
$1,500 until Friday August 3rd, 2012
$1,700 (Aug 4 - Aug 17)
$1,850 (Aug 18 - Aug 31)
$2,000 After Aug 31

Booking a Spot
Send an email to [info at case-inc dot com] and copy myself [d dot rudder at case-inc dot com] with a title of "CASE Revit 2013 API Workshop" letting us know you are interested in reserving a seat for the API workshop. Please include a phone number and we will contact you to secure payment. Your price will lock in on the date your email is sent to us if we do not get back to you the same day (highly unlikely).

Thanks for your interest and we're looking forward to helping you get your Revit API learn on!


Friday, July 6, 2012

Free CASE Add-In Updates 2013 Change and Replace Linestyles

I just posted a 2013 installer for the free CASE Change and Replace Linestyles tool. You can download both the 2012 and 2013 version from the link below!

http://apps.case-inc.com/content/change-and-replace-line-styles