Visio Guy

Visio Discussions => General Visio => Topic started by: bendesarts on March 15, 2018, 04:54:40 PM

Title: select a part of vectorial picture
Post by: bendesarts on March 15, 2018, 04:54:40 PM
Hello,

I have a curve (which is a vectorial picture).
I would like to obtain only a part of this image delimited in a rectangular box.
How can i do this ?
I attach .vsd file which enable you to understand my issue.
I would only to retrieve the part of the curve which is located in the rectangular box.
Thanks a lot for your help
Title: Re: select a part of vectorial picture
Post by: wapperdude on March 15, 2018, 11:38:16 PM
Not really a Visio thing.  You have couple options:  1) use a freebie program like Inkscape, or 2) trace over it with Visio's drawing tools.  Probably 5 min of effort.  Result is a fully Visio shape object.

Wapperdude
Title: Re: select a part of vectorial picture
Post by: bendesarts on March 16, 2018, 07:19:03 AM
thank you for your help but may you tell me a bit more on the pratical process to do this?
Title: Re: select a part of vectorial picture
Post by: Croc on March 16, 2018, 01:36:48 PM
I tried writing a converter that turns this shape into a polyline.
Then I cut out a section of the new shape with the Trim operation.
Unfortunately, this method can not always be used. But sometimes in special cases it can be useful.
Macro:
Sub ChangeToPolyline()
    Dim shp As Visio.Shape
    Dim xy() As Double
    If ActiveWindow.Selection.Count <> 1 Then Exit Sub
    Set shp = ActiveWindow.Selection(1)
    intSect = shp.GeometryCount
    ReDim Preserve xy(intSect * 2 - 1)
    For i = 0 To intSect - 1
        j = visSectionFirstComponent + i
        xy(i * 2 + 0) = shp.CellsSRC(j, 1, 0)
        xy(i * 2 + 1) = shp.CellsSRC(j, 1, 1)
    Next
    Set sh = ActivePage.DrawPolyline(xy, visPolyline1D)
End Sub
Title: Re: select a part of vectorial picture
Post by: wapperdude on March 16, 2018, 02:47:02 PM
If you use an external program, ought to be able to convert to SVG file.  Also, should be able to crop either in the program or in Visio.

To trace, put image on background page.  Open a drawing page with background enabled.  Use drawing tools...line, arc, pencil to get approximate desired shape.  Note it can be reasonably crude.  Use pencil tool to adjust inflection points, change curvature.  Pencil tool can add additional points.

Another approach might be one developed by Yacine:  http://visguy.com/vgforum/index.php?topic=6986.msg29256#msg29256 (http://visguy.com/vgforum/index.php?topic=6986.msg29256#msg29256)

Wapperdude
Title: Re: select a part of vectorial picture
Post by: Nikolay on March 18, 2018, 11:19:53 AM
You can also use shape operations, like "Substract" operation (or "Fragment"/"Trim", and then delete the parts you don't want). For Visio 2010+
1. Select the shapes
2. Developer => Operations => Substract (or Fragment)
Title: Re: select a part of vectorial picture
Post by: wapperdude on March 18, 2018, 01:41:59 PM
@Nikolay:  interesting...that didn't work very well at all on V2007.  It was the very 1st thing I tried.

W.
Title: Re: select a part of vectorial picture
Post by: Nikolay on March 18, 2018, 04:29:40 PM
For me, it was slooooow, but did the job. Since what you see is NOT a dashed line! It is a sequence of small ovals - this shape has hundreds of geometry sections! Amazing! Poor Visio :))
Check out the macro from Croc.. It converts all those sections into simple line.

I just though that maybe @bendesarts is not aware that Visio has these simple shape operations (Join/Fragment/Trim, etc..)
Llooks like Microsoft did a good job of hiding these during the period of the last 10 years, presumably promoting Visio as easy to use, drag-n-drop diagramming software.

BTW, Is it Excel, converting charts like this (drawing dashed line with hundreds of small ovals?)
Title: Re: select a part of vectorial picture
Post by: wapperdude on March 18, 2018, 08:44:17 PM
Yes, it took a very long time.  Then it dropped a couple ovals, and grouped a couple others.  Process was unsatisfactory.  But it could be my PC / video card.

Doesn't strike me as excel output.  Probably some other app or even output from a piece of test gear... oscilloscope???