The tool was originally written in response to a forum post by @BearBear. I've since found that it is very useful beyond just offsetting a polyline or polygon. I use it to copy a non-orthogonal line parallel to itself a specific distance, for example. I've since added a few more options, including units and scale.
Installation
Extract the zip file and save into %APPDATA%\Tracker Software\PDFXEditor\3.0\Javascripts It will add a button to the add-ons toolbar as well as to the home ribbon: Multi-language
The tool can be translated. I've attached the template translation file below and the tool at viewtopic.php?p=186101#p186101 will help editing the file to add translations.
Usage
Select the linework you want to offset, then the tool. It will open a dialog: Offset distance
- The distance can be positive or negative to put the line inside or outside the shape. It depends on the direction the shape was drawn. Select the units on the dropdown: mm, pt (points) or in (inches)
- The number of offset repeats desired. If offsetting inside a shape, these may start to fold on themselves.
- This is the number to divide the distance entered above by to get paper units. ie 100 would mean 10mm on the paper equals 1m. For US customary units, this number is 12 / inch scale similar to used commonly for Dimscale in AutoCAD:
1/4" = 1'-0" is 48
1" = 1'-0" is 12
1 1/2" = 1'-0" is 8
etc.
- When an offset distance exceeds the available space inside a shape, the polygon will start to fold on itself. This option detects where a line overlaps itself and splits that loop off as a separate item. There were a number of approaches discussed in the forum thread, but this one seems to work best for me. For example, if I offset the following shape, the result overlaps: The tool splits the interior shape at the overlap point so that I can delete the part that doesn't make sense:
- The tool will try to guess which is the correct shape to keep. For polygons it will select the one with the largest area. This may not be correct, so you can turn this option off, then manually select and delete the separate pieces that don't make sense.
I tried quite a few iterations on how to handle offsets when shrinking a shape. Proximity to the line was difficult to handle, because the original line may cross itself intentionally. I settled on the split at self-crossing approach because it was easiest to implement and seems to handle most cases fine.
The results can get really weird when offsetting a curved shape made up of polylines, even for relatively simple shapes. This is related to the way I'm offsetting the line: I split the angle between the two adjacent lines, and offset the point along that angle. The tool handles the little anomalies at the corners fine because their area is so small.
This method will not guess correctly which loop to keep if the correct loop has a smaller area, so in those cases it's better to leave "Delete loops" unchecked, and manually delete: