Master element

Started by partialdata, August 27, 2014, 02:09:27 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

partialdata

When creating a VDX dynamically how do you reference the standard visio shapes? I can see when analyzing the vdx xml that you have a Master element but im not sure how one would know whats a circle or a square?

Yacine

Hi,
not sure about how you are dropping the shapes, but shouldn't you make sure that the right stencil is loaded, then select the shape to drop?
I think there is no "standard" shape. However there is one selected master in the stencil which is used when adding automatically shapes. But still with this method, you need to control what shape is to be dropped.
Yacine

partialdata

Quote from: Yacine on August 27, 2014, 06:31:12 AM
Hi,
not sure about how you are dropping the shapes, but shouldn't you make sure that the right stencil is loaded, then select the shape to drop?
I think there is no "standard" shape. However there is one selected master in the stencil which is used when adding automatically shapes. But still with this method, you need to control what shape is to be dropped.


Thank you for your response. I am creating a VDX using php. I am trying to create a lets say a circle shape by generating the vdx xml dynamically. I am using php to build the xml and then saving it as myfile.vdx I am just not clear on how i would now what is a circle like i see it has a id what id is a circle or what name is the circle shape?

Yacine

Do you control the geometry section? Guess, yes.
Then instead of using a master, you could "draw" the shape.
I mean, write the right formulas in the geometry section.
Yacine

Jumpy

Quote from: partialdata on August 28, 2014, 04:46:09 PM
Quote from: Yacine on August 27, 2014, 06:31:12 AM
Hi,
not sure about how you are dropping the shapes, but shouldn't you make sure that the right stencil is loaded, then select the shape to drop?
I think there is no "standard" shape. However there is one selected master in the stencil which is used when adding automatically shapes. But still with this method, you need to control what shape is to be dropped.


Thank you for your response. I am creating a VDX using php. I am trying to create a lets say a circle shape by generating the vdx xml dynamically. I am using php to build the xml and then saving it as myfile.vdx I am just not clear on how i would now what is a circle like i see it has a id what id is a circle or what name is the circle shape?

Reading this I can only recommend to create some simple shapes with Visio and than look at the vdx-xml-file. It's not so easy as you seem to think it is. And download the Visio SDK. May find some usefull information there.

Nikolay

AFAIK, there is no way to reference "standard Visio shapes".
Means, the masters (primitives) which are used in document must be defined in the document (vdx) itself.
So you need to add them to the document you generate first, and then you can reference them using masterID.

P.S. I would forget about VDX - it looks kind of dead since Visio 2013 - and go for the VSDX instead.

partialdata

Quote from: Nikolay on August 29, 2014, 08:00:00 AM
AFAIK, there is no way to reference "standard Visio shapes".
Means, the masters (primitives) which are used in document must be defined in the document (vdx) itself.
So you need to add them to the document you generate first, and then you can reference them using masterID.

P.S. I would forget about VDX - it looks kind of dead since Visio 2013 - and go for the VSDX instead.

I need to use vdx for the current project I am working on. I am sure if i can get this project handled I will be assigned to develop a VSDX as well.

partialdata

Quote from: Yacine on August 28, 2014, 05:08:54 PM
Do you control the geometry section? Guess, yes.
Then instead of using a master, you could "draw" the shape.
I mean, write the right formulas in the geometry section.

Thank you I will check that out.

partialdata

Quote from: Jumpy on August 29, 2014, 07:21:56 AM
Quote from: partialdata on August 28, 2014, 04:46:09 PM
Quote from: Yacine on August 27, 2014, 06:31:12 AM
Hi,
not sure about how you are dropping the shapes, but shouldn't you make sure that the right stencil is loaded, then select the shape to drop?
I think there is no "standard" shape. However there is one selected master in the stencil which is used when adding automatically shapes. But still with this method, you need to control what shape is to be dropped.


Thank you for your response. I am creating a VDX using php. I am trying to create a lets say a circle shape by generating the vdx xml dynamically. I am using php to build the xml and then saving it as myfile.vdx I am just not clear on how i would now what is a circle like i see it has a id what id is a circle or what name is the circle shape?

Reading this I can only recommend to create some simple shapes with Visio and than look at the vdx-xml-file. It's not so easy as you seem to think it is. And download the Visio SDK. May find some usefull information there.

I know all too well about how hard this is... I have been working on this for weeks. I have made many different vdx documents and have reversed engineered them. So is there away i can store master and then reference from code? I am using php to create my xml.

Nikolay

Here is a simple example of using masters in VDX.
You can just define a master and then reference it by ID using the Master attribute.
Attributes which were not redefined in the shape instance are taken from the master.

Note that it seems that ID of shape inside of master should be more than 4  (?) - lower values seem to be reserved somehow.


<?xml version='1.0' encoding='utf-8' ?>
<VisioDocument xmlns='http://schemas.microsoft.com/visio/2003/core' >
  <Masters>
    <Master ID='0' NameU='RectMaster'>
      <Shapes>
        <Shape ID='4' Type='Shape'>
          <XForm>
            <PinX>0</PinX>
            <PinY>0</PinY>
            <Width>1</Width>
            <Height>1</Height>
          </XForm>
          <Geom IX='0'>
            <MoveTo IX='1'><X F='Width*0' /><Y F='Height*0' /></MoveTo>
            <LineTo IX='2'><X F='Width*1' /><Y F='Height*0' /></LineTo>
            <LineTo IX='3'><X F='Width*1' /><Y F='Height*1'/></LineTo>
            <LineTo IX='4'><X F='Width*0' /><Y F='Height*1' /></LineTo>
            <LineTo IX='5'><X F='Geometry1.X1' /><Y F='Geometry1.Y1'/></LineTo>
          </Geom>
          <Fill>
            <FillForegnd F='RGB(255,0,0)' />
          </Fill>
        </Shape>
      </Shapes>
    </Master>
  </Masters>
  <Pages>
    <Page ID='0' NameU='Page-1'>
      <Shapes>
        <Shape ID='1' Type='Shape' Master='0'>
          <XForm>
            <PinX>1</PinX>
            <PinY>1</PinY>
          </XForm>
        </Shape>
        <Shape ID='2' Type='Shape' Master='0'>
          <XForm>
            <PinX>3</PinX>
            <PinY>3</PinY>
          </XForm>
        </Shape>
      </Shapes>
    </Page>
  </Pages>
</VisioDocument>

partialdata

Quote from: Nikolay on August 30, 2014, 12:08:33 AM
Here is a simple example of using masters in VDX.
You can just define a master and then reference it by ID using the Master attribute.
Attributes which were not redefined in the shape instance are taken from the master.

Note that it seems that ID of shape inside of master should be more than 4  (?) - lower values seem to be reserved somehow.


<?xml version='1.0' encoding='utf-8' ?>
<VisioDocument xmlns='http://schemas.microsoft.com/visio/2003/core' >
  <Masters>
    <Master ID='0' NameU='RectMaster'>
      <Shapes>
        <Shape ID='4' Type='Shape'>
          <XForm>
            <PinX>0</PinX>
            <PinY>0</PinY>
            <Width>1</Width>
            <Height>1</Height>
          </XForm>
          <Geom IX='0'>
            <MoveTo IX='1'><X F='Width*0' /><Y F='Height*0' /></MoveTo>
            <LineTo IX='2'><X F='Width*1' /><Y F='Height*0' /></LineTo>
            <LineTo IX='3'><X F='Width*1' /><Y F='Height*1'/></LineTo>
            <LineTo IX='4'><X F='Width*0' /><Y F='Height*1' /></LineTo>
            <LineTo IX='5'><X F='Geometry1.X1' /><Y F='Geometry1.Y1'/></LineTo>
          </Geom>
          <Fill>
            <FillForegnd F='RGB(255,0,0)' />
          </Fill>
        </Shape>
      </Shapes>
    </Master>
  </Masters>
  <Pages>
    <Page ID='0' NameU='Page-1'>
      <Shapes>
        <Shape ID='1' Type='Shape' Master='0'>
          <XForm>
            <PinX>1</PinX>
            <PinY>1</PinY>
          </XForm>
        </Shape>
        <Shape ID='2' Type='Shape' Master='0'>
          <XForm>
            <PinX>3</PinX>
            <PinY>3</PinY>
          </XForm>
        </Shape>
      </Shapes>
    </Page>
  </Pages>
</VisioDocument>



Perfect!!! thank you so much!