Hi,
I have an outline shape selected. To reduce the number of nodes, I do it manually as:
1. Click Shape Tool
2. Click "Select all nodes" button on the toolbar
3, Click Reduce nodes button on the toolbar
That works fine but how do I achieve this in VBA?
I tried this:
shp.Curve.Nodes.All.AutoReduce (0.5)
But the results don't match with the result of manual work. Further, the manual work did not require any "Precision Margin" value like 0.5 here.
Thanks.
Mehdi
As you have found there is AutoReduce, there is also Smoothen and AutoReduceNodes.
AutoReduce uses a Double
Smoothen uses a Long
AutoReduceNodes uses a value between 0 and 100
Sub ReduceNodes() Dim s As Shape For Each s In ActiveSelectionRange.Shapes.FindShapes() If s.Type = cdrCurveShape Then 's.Curve.Nodes.All.AutoReduce 0.5 's.Curve.Nodes.All.Smoothen 1 s.Curve.AutoReduceNodes 50 End If Next s End Sub
Best of luck, -Shelby
The main problem is all the above commands and their values seem to be factor in node proximity. Artworks detail levels and scale vary's wildly in my line of work and it should never change its appearance for it to be worthwhile.
The problem when using them in code is there's no clean way of finding the best value. You probably could work out the mean scale of the subpaths or loop over a duplicate and find the best point for node numbers vs differences in the shape... but neither are good in my book.
For me its the 'Reduce Nodes' button all day long!