Visio Guy

Visio Discussions => Visio 2016 Issues => Topic started by: Memnok on December 06, 2018, 05:16:04 PM

Title: Shape Data not shown in XML
Post by: Memnok on December 06, 2018, 05:16:04 PM
Hello,

I have a electrical schematic in visio that i'm trying to parse for data to display in another program. I unzip the visio file and parse the XML pages for data fields. My problem is that in a certain case the data field will not be stored in the shape XML data, but it's still visible in Visio so the information must be somewhere but i can't find it. The other problem is that this only happends when the data field value is "1", any other value seems to work fine.

(https://i.imgur.com/y93jbvD.jpg)
This is a typical connector in the schematic, it consists of 3 Pins that are grouped together, it has a Data field called REF that is called out to the label above it.

(https://i.imgur.com/z7XYYFI.jpg)
Each Pin has a data field with its number

(https://i.imgur.com/VLGBMgV.jpg)
Here is the XML data of this connector, you can see the group shape with ID 2010 and each grouped shape
ID 1994 Pin 1
ID 2002 Pin 2
ID 2006 Pin 3
Pin 2 and 3 both have a <Property> field with the "Pin" data field and the Value for that field. But Pin 1 does not have this data.

Now, if i decide to name Pin 1 something else, like say "1 " (it works with everything except "1")
(https://i.imgur.com/wZxwEto.jpg)
So now the value has a blankspace after the number

(https://i.imgur.com/NWLP3b7.jpg)
When i look up the data field now Pin 1 has a <Property> field and you can see the "Pin" Value which is "1 "

Does anyone here know why the value disappears or where the information is saved?
Thankful for any help with this.
Title: Re: Shape Data not shown in XML
Post by: Paul Herber on December 06, 2018, 05:23:32 PM
Shape.1994 is a grouped shape. Could the data be in one of the sub-shapes?
Title: Re: Shape Data not shown in XML
Post by: Memnok on December 06, 2018, 05:41:05 PM
No, that's just the blue background, the text callout from the "Pin" data field and one more shape that i don't really know what it is, seems related to the text callout, but none of them has a <Property> field.
As you can see i changed the data field back to "1" and the <Property> field dissapeared.
(https://i.imgur.com/1Wo8Rjp.jpg)
Title: Re: Shape Data not shown in XML
Post by: Croc on December 06, 2018, 05:47:49 PM
Maybe master 126 has a value of 1 and is it inherited?
Title: Re: Shape Data not shown in XML
Post by: Memnok on December 06, 2018, 06:00:29 PM
Quote from: Croc on December 06, 2018, 05:47:49 PM
Maybe master 126 has a value of 1 and is it inherited?

Does not seem like it, i can't find a <Property> field in the master document either.
I also noticed that when the value is filled in correctly there's a lot more information in the shape. I changed it back to "1 "
(https://i.imgur.com/x9R4oFK.png)
Title: Re: Shape Data not shown in XML
Post by: Croc on December 06, 2018, 06:07:48 PM
I insist.
Here is an example for .vdx

<Master ID='0'
...
<Shapes><Shape ID='5'
...
<Prop NameU='p' ID='1'><Value Unit='STR'>2</Value>
...
<Shape ID='1'
...
</XForm></Shape>
...
<Shape ID='2'
...
</XForm><Prop NameU='p' ID='1'><Value Unit='STR'>1</Value>


I assigned the value 2 to the master. Now on the page is missing 2, but there is 1.
(I used the old XML format, but it doesn't matter)
Title: Re: Shape Data not shown in XML
Post by: Croc on December 06, 2018, 06:21:34 PM
In addition, if you look at ShapeSheet, then in one of the shapes, the Value cell will be marked with color as inherited, and with the rest, the color of the new value will be used.
Title: Re: Shape Data not shown in XML
Post by: Memnok on December 06, 2018, 06:25:46 PM
Quote from: Croc on December 06, 2018, 06:21:34 PM
In addition, if you look at ShapeSheet, then in one of the shapes, the Value cell will be marked with color as inherited, and with the rest, the color of the new value will be used.

I can't really find it in the master at all. The information about the text callout is there but nothing about the data field "Pin" which is what my program is looking for.
You can look through the master yourself if you want, https://puu.sh/CduQO/489e7c024b.xml (https://puu.sh/CduQO/489e7c024b.xml)
Title: Re: Shape Data not shown in XML
Post by: Croc on December 06, 2018, 06:46:11 PM
In my file, I see it like this:
visio / masters / master1.xml

<?xml version='1.0' encoding='utf-8' ?>
<MasterContents xmlns='http://schemas.microsoft.com/office/visio/2012/main' xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' xml:space='preserve'>
<Shapes>
<Shape ID='5' Type='Shape' LineStyle='3' FillStyle='3' TextStyle='3'>
<Cell N='PinX' V='0.1968503937007877'/>
<Cell N='PinY' V='0.1968503937007853'/>
<Cell N='Width' V='0.3937007874015754'/>
<Cell N='Height' V='0.3937007874015706'/>
<Cell N='LocPinX' V='0.1968503937007877' F='Width*0.5'/>
<Cell N='LocPinY' V='0.1968503937007853' F='Height*0.5'/>
<Cell N='Angle' V='0'/>
<Cell N='FlipX' V='0'/>
<Cell N='FlipY' V='0'/>
<Cell N='ResizeMode' V='0'/>
<Section N='Property'>
<Row N='p'>
<Cell N='Value' V='1' U='STR'/>

Put your file (vsdx) here. Remove from there all but one shape (group).
Title: Re: Shape Data not shown in XML
Post by: Memnok on December 06, 2018, 07:18:49 PM
Here's the first shape in the master.

<?xml version='1.0' encoding='utf-8' ?>
<MasterContents xmlns='http://schemas.microsoft.com/office/visio/2012/main' xmlns:r='http://schemas.openxmlformats.org/officeDocument/2006/relationships' xml:space='preserve'>
<Shapes>
<Shape ID='5' Type='Group' LineStyle='0' FillStyle='0' TextStyle='0' UniqueID='{F811FFC2-FDBC-4EFF-97CF-13F5FFBC677C}'>
<Cell N='PinX' V='0'/><Cell N='PinY' V='0'/><Cell N='Width' V='1.333333333333333'/>
<Cell N='Height' V='1'/>
<Cell N='LocPinX' V='0' F='Width*0'/>
<Cell N='LocPinY' V='0' F='Height*0'/>
<Cell N='Angle' V='0'/>
<Cell N='FlipX' V='0'/>
<Cell N='FlipY' V='0'/>
<Cell N='ResizeMode' V='0'/>
<Cell N='DisplayMode' V='1'/>
<Cell N='FillForegnd' V='#f0f0f0'/>
<Cell N='LineColor' V='14'/>
<Section N='User'>
<Row N='visDGDefaultPos'>
<Cell N='Value' V='PNT(2,3)' U='PNT' F='PNT(2,3)'/>
<Cell N='Prompt' V='' F='No Formula'/>
</Row>
</Section>
<Section N='Geometry' IX='0'>
<Cell N='NoFill' V='0'/>
<Cell N='NoLine' V='0'/>
<Cell N='NoShow' V='0'/>
<Cell N='NoSnap' V='0'/>
<Cell N='NoQuickDrag' V='0'/>
<Row T='RelMoveTo' IX='1'>
<Cell N='X' V='0'/><Cell N='Y' V='0'/>
</Row>
<Row T='RelLineTo' IX='2'>
<Cell N='X' V='1'/>
<Cell N='Y' V='0'/>
</Row>
<Row T='RelLineTo' IX='3'>
<Cell N='X' V='1'/>
<Cell N='Y' V='1'/>
</Row>
<Row T='RelLineTo' IX='4'>
<Cell N='X' V='0'/>
<Cell N='Y' V='1'/>
</Row>
<Row T='RelLineTo' IX='5'>
<Cell N='X' V='0'/>
<Cell N='Y' V='0'/>
</Row>
</Section>


After this part there's the next shape ID 6 and then 7, 6 is the text callout.