There's a built-in tool to remove individual control points from polylines and polygons: Right click on each point, and select Control Points > Delete Point. Deleting multiple points this way is laborious.
Usage
Select the markup(s) you want to edit, then this tool from the Add-on Toolbar. The tool will then activate the rectangle tool so you can draw a rectangle around the points you want to delete. As soon as you finish drawing the rectangle, it will remove the points: CTRL: Line Segments
If you want to delete line segments instead of just the points, hold down CTRL (this may split the polyline/polygon into multiple polylines if selecting interior segments). I prefer to use the tool to delete segments, so I change the default to deleting segments (and CTRL deleting points) on line 22 of the code:
Code: Select all
let segmentsDefault = true; // true = delete segments by default, CTRL deletes pointsIf you hold down SHIFT, the tool works inversely: Only the points inside the rectangle are saved:
Installation Download the zip file, and copy the javascript files into the JavaScripts directory. More detailed directions here: viewtopic.php?p=196006#p196006
After PDF XChange is restarted, it will add a button to the Add-on Tools
This is the first version; doesn't add temporary markers at control points and is not localizable
Translations
This script is translatable with 1ang.js. Here are the translation strings:
Code: Select all
# Translation file (requires 1ang v1.0 or later)
# Domain for this translation file is "deleteControlPoints"
# Filename must be "translationData.deleteControlPoints.json" and saved in the JavaScripts folder
# It is not necessary for all strings to be included in every language,
# but don't put an empty string "" for the translation, because that's what will be shown!
# This must be formatted as a JSON file except that:
# lines starting with # and empty lines are stripped out before processing
# "Language" is three letter code as output from app.language
# "Original Text" is case sensitive!
# Notice that the last item in a list does not allow a comma after it.
# Format:
# "Language 1": {
# "Original Text": "Translated Text in Language 1",
# "Original Text 2": ["Translated Text 2 singular", "Translated Text 2 plural"]
# },
# "Language 2": {
# "Original Text": "Translated Text in Language 2"
# }
{
"": {
"Remove Points": "",
"Delete control points\n────────────────────────\nSelect polyline or polygons and then the tool. Draw a rectangle around the control points to delete (or if SHIFT is held down, keep only the control points inside the rectangle).": "",
"Temporary Marker": "",
"Select at least one polyline, polygon, rectangle or oval annotation to work on before running this tool.": "",
"segments": "",
"control points": "",
"keep": "",
"delete": "",
"Draw around %1 to %2": "",
"Cancelled Remove Points tool": "",
"%1 has fewer than 2 remaining vertices - ignored: %2": "",
"Not all selected annotations were changed.\nSee console output for details.": "",
"%1 was unchanged: %2": ""
}
}