Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Visio Shape to FlowChart.Net Shape Reference (Read 6278 times)
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Visio Shape to FlowChart.Net Shape Reference
May 5th, 2008 at 3:36pm
Print Post  
Hi

Is there a document or table that shows the FlowChart.Net shape name that corresponds to a Visio shape.

For instance, I need to use the FlowChart.Net "Offpage Connection" or "Arrow7" shape, but I cannot find those in my Visio 2003 when I do a "Search for Shapes".

Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #1 - May 6th, 2008 at 7:52am
Print Post  
Hi,

I could not find a similar shape in Visio, but managed to create a custom one:

https://mindfusion.eu/_samples/fcnet.vss.zip

Use the Open Stencil command in Visio, and you will see my "OffpageConnection" rendering in the palette. You can drop it into your Visio drawings, and map it to respective Flowchart.NET shape by handling the VisioImporter.ShapeImported event:

private void ShapeImported(object sender, ShapeImportedEventArgs e)
{
     if (e.ShapeName == "OffpageConnection")
           e.Shape.Shape = Shapes.OffpageConnection;
}

If you need to create additional shapes, use the Visio's File/Shapes/New Stencil command, right-click and select "New Master", and enter the shape id you'd like to get as a ShapeName in the ShapeImported event. Now you can use the tools from the Drawing toolbar to draw the shape, and choose various shape properties from the context menus.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #2 - May 6th, 2008 at 3:37pm
Print Post  
Thanks, that worked. One more question.

I have created a custom shape in Visio, I then created a custom shape in ShapeDesigner.  Now what do I do so that I can use that shape in VB.Net 2008?  Is there a short write-up somewhere?

Thanks
Jim

  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #3 - May 6th, 2008 at 5:35pm
Print Post  
Insert the shape definition code into your application initialization method, specifying appropriate id as the last argument of the Shape constructor. Then you will be able to use Shape.FromId() to access that shape. For an example demonstrating this, see the DirTree sample project.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #4 - May 6th, 2008 at 8:44pm
Print Post  
Hi:

Thanks, but I still did not get it to work.  I did look at DirTree, but did not see the Shape.FromID info.

Here is what I get from the Shape Designer:
' VB.NET ShapeTemplate definition
   new Shape( _
      new ElementTemplate() _
      { _
           new LineTemplate(0, 0, 72, 0), _
           new LineTemplate(72, 0, 100, 50), _
           new LineTemplate(100, 50, 70, 100), _
           new LineTemplate(70, 100, 0, 100), _
           new LineTemplate(0, 100, 0, 0) _
      }, _
      new ElementTemplate() _
      { _
      }, _
      new ElementTemplate() _
      { _
           new LineTemplate(5, 5, 67, 5), _
           new LineTemplate(67, 5, 95, 50), _
           new LineTemplate(95, 50, 65, 95), _
           new LineTemplate(65, 95, 5, 95), _
           new LineTemplate(5, 95, 5, 5) _
      }, _
nothing, FillMode.Winding,   "test" )

This does not work in VB.Net 2008 (it is the same code as the C# generated code).  Am I missing something?

I want the shape to be called "GoTo".


Here is the VB.Net 2008 code I plan to use:

       If e.ShapeName = "GoTo" Then
           e.Shape.Shape = Shapes.GoTo
       End If



Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #5 - May 7th, 2008 at 11:09am
Print Post  
Hi Jim,

That code passes one more parameter to the Shape constructor than the expected number of arguments. Was it generated like this by the designer tool, or you have modified the code afterwards? Anyway, it worked after removing the empty-array argument -

Code
Select All
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	  ' VB.NET ShapeTemplate definition
	  Dim s As New Shape( _
		New ElementTemplate() _
		{ _
		    New LineTemplate(0, 0, 72, 0), _
		    New LineTemplate(72, 0, 100, 50), _
		    New LineTemplate(100, 50, 70, 100), _
		    New LineTemplate(70, 100, 0, 100), _
		    New LineTemplate(0, 100, 0, 0) _
		}, _
		New ElementTemplate() _
		{ _
		    New LineTemplate(5, 5, 67, 5), _
		    New LineTemplate(67, 5, 95, 50), _
		    New LineTemplate(95, 50, 65, 95), _
		    New LineTemplate(65, 95, 5, 95), _
		    New LineTemplate(5, 95, 5, 5) _
		}, _
		Nothing, _
	  FillMode.Winding, "GoTo")

	  Dim sn As New ShapeNode(diag)
	  diag.Nodes.Add(sn)
	  sn.Shape = Shape.FromId("GoTo")
    End Sub
 



You must also import the System.Drawing.Drawing2D namespace for the FillMode definition.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #6 - May 7th, 2008 at 1:42pm
Print Post  
Thanks

The code I sent you was taken directly from the ShapeDesigner.

The code you sent me does draw my shape on Form1. BUT what I want to do is use that shape for when I import a VISIO .vdx file and during the import I see a shape called "GoTo". Here is the subroutine that I plan to use. You can see my commented out portion.

Private Sub ShapeImported(ByVal sender As Object, ByVal e As ShapeImportedEventArgs)

Dim vdxCode As XmlNode = e.ShapeXml
If e.ShapeName = "GoTo" Then
' e.Shape.Shape = Shapes.GoTo
e.Shape.Shape = Shapes.OffpageConnection
End If

If e.ShapeName = "OffpageConnection" Then
e.Shape.Shape = Shapes.OffpageConnection
End If




Try
Dim ns As XmlNamespaceManager = New XmlNamespaceManager(e.ShapeXml.OwnerDocument.NameTable)
ns.AddNamespace("vdx", "http://schemas.microsoft.com/visio/2003/core")
' Dim myPropVal As XmlNode = vdxCode.SelectSingleNode("vdx:Prop[vdx:Label='MyProperty']/vdx:Value", ns)
Dim myPropVal As XmlNode = vdxCode.SelectSingleNode("vdx:Prop[vdx:Label='Block#']/vdx:Value", ns)
If Not (myPropVal Is Nothing) Then
e.Shape.Tag = myPropVal.InnerText
BoxMes(MyCount) = myPropVal.InnerText
MyCount = MyCount + 1

End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #7 - May 7th, 2008 at 6:38pm
Print Post  
Just keep the "dim s as new Shape" declaration in the form's Load handler - the constructor will automatically add the definition to an internal list and you will be able to access it later from any part of your code. Then set

e.Shape.Shape = Shape.FromId("GoTo");

when importing the Visio shape.

If you plan to use more custom shapes, it might be more convenient to save them in a shape-library file, and then call ShapeLibrary.LoadFrom() to load all custom shapes at once.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #8 - May 7th, 2008 at 8:15pm
Print Post  
Thanks. BUT, I did as you had said, but I do not see my shape. I see a rectangle. The code is executed, just I do not get the shape I had made.


I like the idea of importing a library. I may go that direction, once I get this to work. Is there a sample application I can look over to get the syntex correct?

Any ideas?

Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #9 - May 8th, 2008 at 10:39am
Print Post  
Can you see your shape if you assign FromId("GoTo") to a node from a NodeDoubleClicked event handler? Assuming you have this in the ShapeImported event

If e.ShapeName = "GoTo" Then
     e.Shape.Shape = Shape.FromId("GoTo")
End If

and add a breakpoint to the assignment line, does the debugger ever stop there?

Use the Save/File command in ShapeDesigner to save your shape definitions to a shape library file, add that file to your project, and in the property window set its Build Action to "Content" and enable the Copy property. Now add ShapeLibrary.LoadFrom(lib_file_name) to your initialization code and the custom shapes should be accessible through Shape.FromId().

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #10 - May 8th, 2008 at 1:40pm
Print Post  
Hi:

If I add this:

Private Sub view_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles view.Click

Dim sn As New ShapeNode(diag)

diag.Nodes.Add(sn)

sn.Shape = Shape.FromId("GoTo")
End Sub

Then double click on the view window, I see my new shape in the upper left corner of the window.

If I put a break on the import event, I do execute those lines of code - but my shape is the generic rectangle.

Any ideas? I can send you the project - if that will help.

Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #11 - May 8th, 2008 at 1:57pm
Print Post  
Hi,

Please email the project to support@mindfusion.eu.

Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #12 - May 8th, 2008 at 3:21pm
Print Post  
Files are on their way.

Thanks
Jim
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #13 - May 8th, 2008 at 5:37pm
Print Post  
The importer initially loads the GoTo node as expected, but then processes it as some kind of a union shape and loads a rectangular sub-shape that hides the GoTo symbol (you will see ShapeImported raised for a second time). Could you email us the stencil file as well? Have you created any group from the GoTo symbol and another shape in Visio ?

Stoyan
  
Back to top
 
IP Logged
 
JCRonSaratoga
YaBB Newbies
*
Offline


Go Cubs Go!

Posts: 30
Joined: Apr 15th, 2008
Re: Visio Shape to FlowChart.Net Shape Reference
Reply #14 - May 9th, 2008 at 1:48pm
Print Post  
Hi
Thanks - that was the problem.  I had 2 shapes in my  "GoTo" VISIO Stencil.  When I changed it to 1, it worked.

I was also able to get the library import to work - thanks.

Have A Good Weekend,
Jim
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint