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:
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.
That's a good question and something I would also like to know!
As you rightly pointed out autoreduce nodes isn't the same as the 'Reduce Nodes' button. The autoreduce nodes method is destructive and generally not much use, whereas the button rarely alters artwork and also fixes several other issues with curves.
I've briefly looked into without being able to figure out... I suspect you can use the custom command on it but I could never get my head around making that work for reduce nodes.
It's not elegant, but sometimes one can get something done by "pushing the button" in code. Suss out what the GUID is, then use InvokeItem:
ActiveTool = cdrToolNodeEdit
It might help if you could explain exactly what you are trying to accomplish, and show specific examples where you CAN do what you want using the button on the Property Bar, but CANNOT do it using AutoReduce in a macro.
That's a nice little trick there! I'll be using that. How do you retrieve the GUID for object?
The reason I don't like Autoreduce in code is how is how it can change artwork. For laser cut parts that's really not good!
Howardhopkins said:That's a nice little trick there! I'll be using that. How do you retrieve the GUID for object?
I used regular workspace customization to put the "Reduce Nodes" command on a custom toolbar.
The workspace (.CDWS) file is a zip archive. Looking in the workspace.xml file that is in there, I searched for that toolbar and could then see the GUID for that command.
Howardhopkins said:The reason I don't like Autoreduce in code is how is how it can change artwork. For laser cut parts that's really not good!
I understand that you don't want to wreck artwork. What I don't know is if AutoReduce is always prone to wrecking artwork, or if that can be controlled by the PrecisionMargin that is used.
I don't know how AutoReduce and "Reduce Nodes" do their respective things. That's why I was interested in seeing specific examples.