select a part of vectorial picture

Started by bendesarts, March 15, 2018, 04:54:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bendesarts

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

wapperdude

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
Visio 2019 Pro

bendesarts

thank you for your help but may you tell me a bit more on the pratical process to do this?

Croc

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

wapperdude

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

Wapperdude
Visio 2019 Pro

Nikolay

#5
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)

wapperdude

@Nikolay:  interesting...that didn't work very well at all on V2007.  It was the very 1st thing I tried.

W.
Visio 2019 Pro

Nikolay

#7
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?)

wapperdude

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???
Visio 2019 Pro