[tool] roughen a polyline

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

User avatar
Mathew
User
Posts: 885
Joined: Thu Jun 19, 2014 7:30 pm

[tool] roughen a polyline

Post by Mathew »

This tool will take a polyline, polygon or line and either:
[*]"roughen" it (ie it adds intermediate points and moves them slightly out of line by a random distance); or
[*]"zigzag" it (the intermediate points are uniformly spaced).

It's based on the ROUGHEN.LSP tool for AutoCAD by Mark Middlebrook. There's a much more complex line tool posted by @TBS that does all this tool can do, and more, here: viewtopic.php?t=48946

Usage
First select the line you want to roughen, then select the tool. For the Ribbon UI it's on the Home ribbon at the right side. For the Classic Toolbars it's in Tools > Add-in Tools > Roughen
image(2).png
It will show a dialog
image.png
  • Type is either Roughen (offset and spacing is random) or Zigzag (offset and spacing is uniform).
    Period is the approximate length of the segments (in points) to break the line into.
    Amplitude is the maximum distance (in points) away from the line to move intermediate points.
    Keep Roughening, if checked, will split up line segments on a selected polyline even if they are shorter than Roughness Period.
    Smooth will smoothen the line to make curved patterns
    Squareness is what percent of the Period to make the length of each tip on a zigzag (ie zero makes a point, and 100 makes a square wave. It can be positive or negative, and greater than 100%:
    image(3).png
    Preview shows the result of the current values on the output line.
Presets… allows you to load or save or edit the current values as a named preset. I included a few example presets:
image(4).png

After you press 'OK' it will roughen the line(s). If you've selected a line, it will convert it into a polyline.
image(1).png
Installation
Extract (unzip) the zip file and save the files into the JavaScript folder (either in %APPDATA%\Tracker Software\PDFXEditor\3.0\JavaScripts or in the application folder). After restarting PDF XChange it will add a menu item "Roughen" to the Comment Tools ribbon and to the Comment menu (in the classic UI)
roughen v1.0.zip
You do not have the required permissions to view the files attached to this post.
Last edited by Mathew on Fri Aug 14, 2026 7:29 pm, edited 6 times in total.
User avatar
Dimitar - PDF-XChange
Site Admin
Posts: 2732
Joined: Mon Jan 15, 2018 9:01 am

Re: [tool] roughen a polyline

Post by Dimitar - PDF-XChange »

That you for your effort Mathew.

We appreciate it.
User avatar
Mathew
User
Posts: 885
Joined: Thu Jun 19, 2014 7:30 pm

Re: [tool] roughen a polyline

Post by Mathew »

I've expanded this tool to make a variety of line shapes in additional to roughen and it shows a live preview of any settings. It also now can save presets - a much more capable and extensive line type tool by @TBS is here: viewtopic.php?t=48946

I've included a few preset lines:
image.png
roughen v1.0.zip
Changes in v1.0
  • add option for random (roughen) and uniform (zigzag);
  • add preview;
  • fix initial step in each interval, and roughening angle;
  • add 'squareness' parameter to square off ends;
  • add smoothing option;
  • add about box;
  • add presets (requires xutil.PresetDialog)
You do not have the required permissions to view the files attached to this post.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 13148
Joined: Wed Jan 03, 2018 6:52 pm

[tool] roughen a polyline

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
[email protected]
PDFan
User
Posts: 20
Joined: Tue Jan 07, 2025 1:54 pm

Re: [tool] roughen a polyline

Post by PDFan »

Hi Mathew!

Thank you for developing this nice tool!

Can you make this dropdown list to display the name of the selected shape instead of "Presets:" ?

017.png
You do not have the required permissions to view the files attached to this post.
User avatar
Mathew
User
Posts: 885
Joined: Thu Jun 19, 2014 7:30 pm

Re: [tool] roughen a polyline

Post by Mathew »

PDFan wrote: Thu Aug 20, 2026 5:47 pm Hi Mathew!

Thank you for developing this nice tool!

Can you make this dropdown list to display the name of the selected shape instead of "Presets:" ?


017.png
Yes it's on my 'todo' but I was having a bit of difficulty dealing with recursion in the dialog, so it takes a bit more thinking about... :wink:
User avatar
Sean - PDF-XChange
Site Admin
Posts: 1152
Joined: Wed Sep 14, 2016 5:42 pm

Re: [tool] roughen a polyline

Post by Sean - PDF-XChange »

:)
Sean Godley
Technical Writer
PDF-XChange Co LTD
Sales: +1 (250) 324-1621
Fax: +1 (250) 324-1623