• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

bVisual

  • Home
  • Services
    • How Visio smartness can help your business
    • Visio visual in Power BI
    • Visio Consulting Services
    • Visio Bureau Services
    • Visio Training and Support Services
  • Products
    • Visio Shape Report Converter
    • SS Plus
    • LayerManager
    • visViewer
    • Metro Icons
    • Rules Tools for Visio
    • The Visio 2010 Sessions App
    • Multi-Language Text for Visio
    • Document Imager for Visio
    • multiSelect for Visio
    • pdSelect for Visio
  • Case Studies
    • Case studies overview
    • Visualizing Construction Project Schedules
    • Visio Online Business Process Mapping
    • Nexans Visio Template
    • CNEE Projects, WorldCom
    • Chase Manhattan Bank
  • News
    • Recent news
    • News archive
  • Resources
    • Articles➡
      • ShapeSheet Functions A-Z
      • Comparing Visio for the Web and Desktop
      • Customising Visio Shapes for the Web App
      • Key differences between the Visio desktop and web apps
      • Using the Visio Data Visualizer in Excel
      • Using Visio in Teams
      • Creating Visio Tabs and Apps for Teams with SharePoint Framework (SPFx)
      • Designing Power Automate Flows with Microsoft Visio
      • Innovative uses of Visio Lists
    • Webcasts ➡
      • Visio in Organizations
      • My session and other Visio sessions at MSIgnite 2019
      • Power up your Visio diagrams
      • Vision up your Visio diagrams
      • The Visio 2010 MVP Sessions
    • Visio Web Learning Resources
    • Books➡
      • Mastering Data Visualization with Microsoft Visio
      • Microsoft Visio Business Process Diagramming and Validation
      • Visualizing Information with Microsoft Visio
  • Blog
    • Browse blog articles
    • Visio Power BI articles
    • Visio for Web articles
    • A history of messaging and encryption
  • About us
    • About bVisual
    • Testimonials
    • Bio of David Parker
    • Contact Us
    • Website Privacy Policy
    • Website terms and conditions
    • Ariba Network
You are here: Home / Visio / Changing Visio Shape Size and Angle with Linked Data

Published on March 7, 2019 by David Parker

Changing Visio Shape Size and Angle with Linked Data

I was recently laying out a computer room floor plan to scale in Visio, from survey data of the cabinets\racks within it, and it occurred to me that I could work a bit smarter than I first thought. Originally, I was going to just add lots of rectangles, size them, rotate them, and label each them with their name. Then I thought, why not use the Width, Depth and Name columns from the survey data to do most of the work for me? It was so simple to do, and only took a few minutes, so I thought I would share my methodology because it demonstrates how easy it is to work smarter with Visio….

These are the simple steps shown above, written out for your education….

Model the data with Excel PowerQuery if necessary

I often use Excel as the data source for the Data \ Custom Import feature in Visio, even if the orginal data is not in Excel, because Excel has so many more data connection abilities with Data \ Get & Transform Data feature. It is so easy in Excel to then use the (Power)Queries to re-form the data with M Functions ( see Power Query M Reference ). For example, I added an Angle column with the following formula, since I had a Cabinet_Name column that can be used to ascertain the position of the front side of each cabinet:

= Table.AddColumn(#"Replaced Value", "Angle", each if (Text.StartsWith([Cabinet_Name],"01")) then "0" else if (Text.StartsWith([Cabinet_Name],"02") or Text.StartsWith([Cabinet_Name],"SAN") or Text.StartsWith([Cabinet_Name],"I-")) then "180" else "270")

These Excel queries can then be used in Visio (all desktop editions except Standard).
Note that I could have gone further with PowerQuery to formulate the width, height and angle with units, but I decided to do that in Visio ShapeSheet formulas instead.

Import the data into Visio and create a simple shape in Visio

I setup my particular page as 1:50 scale with meters units  using the Page Setup dialog from the right mouse menu of the page tab. Then I drew a simple shape using Home / Tools / Rectangle. The default angle for shapes drawn like this is zero degrees or radians.
Note that the Size & Position window displays the Width and Height of the rectangle in meters at this point.
Next, I imported the Excel query using the Data \ Custom  Import feature, and set the Column_Name as the unique identifier.

Link a data row to the shape

Then I dragged and dropped one of the rows of data from the External Data window onto the rectangle shape. I did make sure that I chose one with a zero value for the  Angle for this.
Note that the shape suddenly gets all of the columns of data from that row as Shape Data.
You can now see that the Cabinet_Height value is 48, but that is not the height required for the shape because it is actually referring to the vertical height being 48 Us, with each U being 1 3/4″ or 44.45 mm, and then their could be a base, plinth and header plate added to this. So, its actual height is greater than 2.136 m ( 48 x 44.45 mm ).
The Cabinet_Width value is shown as 800, but we know that those are actually mm (millimeters), and that needs to be the width of this rectangle.
The Cabinet_Depth value is 1000, again millimeters, and this needs to be the height of the rectangle since we are drawing a floor plan to scale.
Of course, the shape has not changed size or rotated yet … that magic comes next.
You may have accidently added more Data Graphics to your shape than you intended, but no bother since I used Data / Advanced Data Graphics to edit this to display only the Cabinet_Name value as text in the center / middle of the shape. This text will be automatically at the same angle as the shape, so I will be able to tell if the rectangle shape is rotated or not.

Add ShapeSheet formulas referencing the Shape Data

Many Visio users do not realise that there is a Developer tab in Visio (and other Office applications), that can be easily made visible by ticking it with File / Options / Customize the Ribbon / Main Tab. This is so useful for power users because it reveals a lot more functionality, then main one being the ability to open the ShapeSheet of a selected shape from Developer / Shape Design / Show ShapeSheet or from the right mouse action menu on the shape itself.
Do not be afraid of the ShapeSheet … it is just like entering formulas into cells of an Excel worksheet, but the sheet is split into sections to make it easier to navigate. If you cannot see the sections that I now refer to, then tick them in the dialog that pops up from Design / View / Sections.
Note that the Shape Data section contains many rows, all created by the Link Data action performed earlier, and Visio has automatically named these rows with an _VisDM_ prefix.
Al we need to do now is reference the values in the relevant Shape Data row in the formula of the Width, Height and Angle cells in the Shape Transform section at the top of the ShapeSheet.
Now, Visio stores all measurements as inches to four decimal places behind the scenes, so it is important to include the measurement units if you want something different than inches. Similarly, angles are stored as radians so units should be used to denote degrees. Therefore, enter the formulas as follows:
Width cell:

=GUARD(Prop._VisDM_Cabinet_Width&" mm")

Height cell:

=GUARD(Prop._VisDM_Cabinet_Depth&" mm")

Angle cell:

=GUARD(Prop._VisDM_Angle&" deg")

The GUARD(…) function merely prevents the user from accidently re-sizing the shape or rotating it.
You should find that there is IntelliSense as you type to make it even easier.
Now close the ShapeSheet window and notice that the size, and possibly the angle, of the shape has changed. Also note that the units for the Width and Height are now mm, rather than m.

Create a local master and then create many linked shape instances

Now open the local stencil using More Shapes / Show Document Stencil, and drag the rectangle on to the stencil, and rename it to say, Cabinet.
At this point you do not appear to have any shapes on your page, but all you need to do is ensure that this Cabinet master is selected in the stencil before dragging and dropping one or more rows from the External Data window onto the page.
Hey presto! You now have many different sized and angled Cabinet shapes with a unique data cached into them.  All that remains is to position them on the floor plan manually, which is simple if ensure that snap to shape geometry is on, and snap to ruler subdivisions and grid are off.
View the sample Visio drawing : Shape Size and Angle from Data.vsdx
Here is a video of the above

Related

Filed Under: Excel, External Data, mFormula, ShapeSheet Formulas, Visio Tagged With: Shape Data, Shape Design, ShapeSheet, ShapeSheet Functions

About David Parker

David Parker has 25 years' experience of providing data visualization solutions to companies around the globe. He is a Microsoft MVP and Visio expert.

Reader Interactions

Comments

  1. Mathieu Dupuis says

    July 20, 2021 at 7:29 pm

    Hi,

    I have just watched David’s video. I would like to have more. I am working with Visio here on floor plans and P&ID’s.
    Looking to improve my skills.
    Can you help

    Reply
    • David Parker says

      July 22, 2021 at 8:04 am

      Mathieu
      Glad you liked that video … here are some more
      https://bvisual.net/category/webcasts/
      And these are articles that I have written about floor plans:
      https://bvisual.net/category/diagram-types/floor-plans/

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Twitter

Recent Posts

  • Update to LayerManager add-in for non-English users
  • Pushing Data Visualizer in Visio beyond its limits
  • Pushing Data Visualizer in Visio to the limits!
  • Teams Tuesday Podcast Recording about Visio
  • Linking Data to Visio Shapes in Code

Categories

Tags

Accessibility Add-Ins Connectors Containers Data Export Data Graphics Data Import Data Visualizer Educational Excel GraphDatabase Hyperlinks Icon Sets JavaScript Layers Legend Link Data to Shapes Lists MSIgnite MVP Office365 Org Chart PowerApps PowerBI PowerQuery Processes Shape Data Shape Design ShapeSheet ShapeSheet Functions SharePoint 2013 SQL Teams Themes Validation VBA Video Visio Visio 2007 Visio 2013 Visio for the Web Visio Online Visio Services Visio Viewer Webinar

Footer

bVisual Profile

The UK-based independent Visio consultancy with a worldwide reach. We have over 25 years experience of providing data visualization solutions to companies around the globe.

Learn more about bVisual

  • LinkedIn
  • Twitter

Search this website

Recent posts

  • Update to LayerManager add-in for non-English users
  • Pushing Data Visualizer in Visio beyond its limits
  • Pushing Data Visualizer in Visio to the limits!
  • Teams Tuesday Podcast Recording about Visio
  • Linking Data to Visio Shapes in Code

Copyright © 2023 · Executive Pro on Genesis Framework · WordPress · Log in