Author Topic: Stencil - metric or US units?  (Read 489 times)

0 Members and 1 Guest are viewing this topic.

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • Paul Herber's website
Stencil - metric or US units?
« on: March 18, 2019, 08:52:59 AM »
I'm trying to work out (in code) whether a stencil is US units or metric. It's a flag within the stencil: in .VSX files it's
<metric="0">
or
<metric="1">
I can't see anything appropriate in the API. Does anyone know?
Thanks.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

vojo

  • Hero Member
  • *****
  • Posts: 1252
Re: Stencil - metric or US units?
« Reply #1 on: March 18, 2019, 10:07:04 AM »
forgive me, but why would it matter??
A length of distance X is the same whether in mm or in.
I assume you are writing some VBA that would alter some set of shapes in a stencil or in a drawing...so not sure why you care.

I would think you would be more concerned about the page settings

That said

http://www.visguy.com/2017/11/19/detect-drawing-units-in-the-shapesheet/

I guess you could examine the first shape in the stencil and see if its in inches or mm

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • Paul Herber's website
Re: Stencil - metric or US units?
« Reply #2 on: March 18, 2019, 11:20:41 AM »
I'm trying to maintain (and check consistency) in all the stencils I've created. The suffixes _M and _U are used to denote whether the stencil is metric or inches but there is also this metric flag in the xml in .VSX etc files. This flag is also used in .VSS and .VSSX files as converting from one to the other maintains the metric flag setting. I a;so need to check this in the stencil report in my utilities.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/

Yacine

  • Hero Member
  • *****
  • Posts: 2599
Re: Stencil - metric or US units?
« Reply #3 on: March 18, 2019, 03:28:25 PM »
I googled a while with no success.
Requiring the user to choose from the very beginning between metric and us may imply that this flag is so fundamentally important that the developers didn't even consider including it in the API.

Instead of checking the documents, you may consider recreating them with the desired units system (documents.addex) ... ugly, I know.

PS: You certainly have already tried to modify the flag in the xml?
Yacine

vojo

  • Hero Member
  • *****
  • Posts: 1252
Re: Stencil - metric or US units?
« Reply #4 on: March 19, 2019, 07:21:58 AM »
hmm...here is an interesting question

if you drag a shape in imperial units on to a metric page, what happens?  (yes, I could do a test, thought just occurred to me).

Shapesheet values converted?  shapesheet left as is but converted under the covers?

If the former, you could use VBA to copy from imperial stencil to metric stencil....if the later, then do you even care.

Yacine

  • Hero Member
  • *****
  • Posts: 2599
Re: Stencil - metric or US units?
« Reply #5 on: March 19, 2019, 07:36:10 AM »
hmm...here is an interesting question

if you drag a shape in imperial units on to a metric page, what happens?  (yes, I could do a test, thought just occurred to me).

Shapesheet values converted?  shapesheet left as is but converted under the covers?

If the former, you could use VBA to copy from imperial stencil to metric stencil....if the later, then do you even care.

The flag metric/us is in the document. The page itself has units which are inherited - but can be modiefied. The shapes themselves handle internal units and ask the page in which format to convert.
So my guess would be that a us shape will be displayed as metric on a metric page. No conversion needed.
Yacine

Paul Herber

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • Paul Herber's website
Re: Stencil - metric or US units?
« Reply #6 on: March 19, 2019, 09:49:42 AM »
These are the stencils I provide on my website, customers want metric and/or US units stencils. Most users will want metric, most US users will want US units, some US users may want metric, some non-US users will have no knowledge at all of US units (these are actually Imperial units). But Visio will expect the stencils to be either US units or metric units, designated by _U or _M at the end of the filename. It is even possible to not show stencils that are not in the units for your area i.e. don't show metric stencils within the US area. So, MSI installer files have to contain both types and I want to ensure the files are correct. It's not just a case of "it seems to work" or being tidy, if customers don't see the file correctly then it's a no-go as far as I'm concerned.
Electronic and Electrical engineering, business and software stencils and applications for Visio -

http://www.paulherber.co.uk/