The rp commands
rp has six commands. The examples use rp-001-mounting-bracket.dxf, the sample drawing that ships with the viewer (an original drawing of a machined bracket, AutoCAD 2000 DXF), so you can run them yourself. Output is copied from build 0.1.0.
| Command | Free or licensed | What it does |
|---|---|---|
rp info <file> | Free | Version, counts, cached and computed extents |
rp plot <file> -o out.png | Free | A PNG of model space, a layout, or the saved view |
rp plot <file> -o out.pdf or out.svg | Licence | Vector plots |
rp dump <file> | Licence | The whole drawing as JSON Lines |
rp convert <file> -o out.dxf|out.dwg | Licence | Convert between DWG and DXF across versions (R12–R2018) |
rp compare <before> <after> | Licence | Structural & geometric revision diff with coloured redline PDF/SVG/PNG |
rp licence ... | Free | Install, check, refresh or remove a key |
Exit codes
These are a contract: scripts and CI can rely on them.
| Code | Meaning |
|---|---|
| 0 | Done |
| 1 | Usage error: an unknown command or a missing argument. The usage text goes to standard error |
| 2 | The file could not be read (missing, not a drawing, or damaged beyond reading), or the output could not be written |
| 3 | The command needs a licence this machine does not have, or the licence was refunded |
Messages go to standard error and start with rp::
$ rp plot nonexist.dxf -o x.png
rp: nonexist.dxf: No such file or directory (os error 2)
$ echo $?
2
$ echo hello > not.dxf; rp info not.dxf
rp: not.dxf: not a recognised drawing file
rp decides between DWG and DXF from the file's first bytes, not its name.
rp info
$ rp info rp-001-mounting-bracket.dxf
{
"blocks": 5,
"cached_extmax": {
"x": 305.0,
"y": 125.0,
"z": 0.0
},
"cached_extmin": {
"x": -45.0,
"y": -75.0,
"z": 0.0
},
"computed_extents": {
"max": {
"x": 305.0,
"y": 125.0,
"z": 0.0
},
"min": {
"x": -45.0,
"y": -75.0,
"z": 0.0
}
},
"entities": 78,
"layers": 10,
"model_space_entities": 59,
"objects": 5,
"version": "AC1015"
}
--json prints the same object on one line, for scripts:
$ rp info example_2018.dwg --json
{"blocks":16,"cached_extmax":{"x":860276.0217899824,"y":1053820.5150690218,"z":252.02428146042763},"cached_extmin":{"x":-2680430.068109198,"y":-1672547.1795475574,"z":-252.02428146042763},"computed_extents":{"max":{"x":857770.77706639,"y":1094412.8177514465,"z":5.0},"min":{"x":-2680430.0681091985,"y":-1672547.1795475576,"z":0.0}},"entities":211,"layers":5,"model_space_entities":68,"objects":167,"version":"AC1032"}
versionis the file's own version code:AC1015is AutoCAD 2000,AC1032is 2018. The table in supported versions lists them all.entitiescounts every block;model_space_entitiesonly model space.cached_extminandcached_extmaxare what the file says ($EXTMIN,$EXTMAX), which can be stale.computed_extentsis worked out from the geometry; it isnullwhen model space holds nothing with extents. In the second example the two differ: the file's cache is out of date.
rp plot
rp plot <file> -o <out.png|out.svg|out.pdf> [--layout NAME | --view saved] [--size WxH] [--paper WxH] [--white]
The output format follows the extension of -o.
| Option | Meaning | Default |
|---|---|---|
--layout NAME | Plot a paper layout. Names match without regard to case | Model space |
--view saved | Plot model space as it was last saved (the active view) | Model space zoomed to extents |
--size WxH | Pixels, for PNG (both) and SVG (width) | PNG 1600x1200, SVG 1200 wide |
--paper WxH | Millimetres, for PDF. The plot is fitted to the sheet | 420x297 (A3 landscape) |
--white | White background for PNG and SVG. Index colour 7 then draws black | Model space dark, as AutoCAD shows it |
PDFs are always on white paper.
$ rp plot rp-001-mounting-bracket.dxf -o bracket.png
$ file bracket.png
bracket.png: PNG image data, 1600 x 1200, 8-bit/color RGBA, non-interlaced
$ rp plot rp-001-mounting-bracket.dxf -o bracket-white.png --white --size 1200x800
$ rp plot rp-001-mounting-bracket.dxf -o sheet.pdf --layout "A3 Sheet"
$ qpdf --check sheet.pdf
...
No syntax or stream encoding errors found; the file may still contain
errors that qpdf cannot detect
Plotting the sample took 14 ms on an Apple silicon Mac.
To plot a folder, loop in the shell. Each call is independent, so a failure on one file does not stop the others:
for f in *.dwg *.dxf; do
rp plot "$f" -o "${f%.*}.pdf" || echo "failed: $f"
done
What a plot draws: model space or the layout you name, with layers that are off or frozen left out, lineweights applied, and dimensions drawn from the blocks AutoCAD stored for them. Text is drawn with open stand-in fonts (see limitations).
rp dump
rp dump writes the whole drawing to standard output as JSON Lines: one JSON object per line, each with a kind. It is the canonical form of the drawing model; the judges compare it with the reference tools, so its shape changes only with a version note.
$ rp dump rp-001-mounting-bracket.dxf | jq -r .kind | sort | uniq -c
5 block
1 dim_style
1 drawing
78 entity
10 layer
5 linetype
5 object
1 text_style
In order: one drawing line (version, code page and every header variable), then layer, linetype, text_style and dim_style lines, then each block followed by its entity lines, then object lines, then any diagnostic lines (what the reader noticed about the file). A layer and an entity from the sample:
{"data":{"color":{"Aci":7},"color_name":null,"description":"","frozen":false,"frozen_in_new_viewports":false,"handle":60,"linetype":"Continuous","lineweight":{"Hundredths":50},"locked":false,"material":null,"name":"OUTLINE","off":false,"plot":true,"plot_style":null,"transparency":null,"xdata":[],"xref_dependent":false},"handle":"3C","kind":"layer"}
{"block":"*Model_Space","data":{"common":{"color":"ByLayer","color_name":null,"extension_dict":null,"handle":101,"invisible":false,"layer":"OUTLINE","linetype":"ByLayer","linetype_scale":1.0,"lineweight":"ByLayer","material":null,"owner":41,"paper_space":false,"plot_style":null,"reactors":[],"transparency":null,"xdata":[]},"kind":{"Circle":{"center":{"x":55.0,"y":45.0,"z":0.0},"extrusion":{"x":0.0,"y":0.0,"z":1.0},"radius":14.0,"thickness":0.0}}},"handle":"65","kind":"entity","type":"CIRCLE"}
The top-level handle is the hexadecimal form AutoCAD shows (65); inside data it is the same number in decimal (101). Angles are in radians. The drawing model describes every field.
Some queries with jq:
$ rp dump rp-001-mounting-bracket.dxf | jq -r 'select(.kind=="layer") | .data.name'
0
OUTLINE
HIDDEN
CENTER
SECTION
HATCH
DIMS
TEXT
TITLE
VIEWPORTS
$ rp dump rp-001-mounting-bracket.dxf | jq -r 'select(.kind=="entity" and .block=="*Model_Space") | .type' | sort | uniq -c
1 ARC
2 CIRCLE
2 DIMENSION
1 HATCH
4 INSERT
23 LINE
5 LWPOLYLINE
1 MTEXT
2 SOLID
18 TEXT
rp convert
rp convert <file> -o <out.dxf|out.dwg> [--version R12|R2000|R2004|R2007|R2010|R2013|R2018] [--binary]
Writes any readable DWG or DXF drawing out as DXF (ASCII or binary, R12 through R2018) or DWG (R2000, R2004, R2010, R2013, or R2018; default R2018). DWG writing is marked experimental.
rp compare
rp compare <before> <after> [--json] [--tol N] [--no-geom-match] [--ignore-layer NAME]... [--redline out.pdf|out.svg|out.png] [--paper WxH] [--size WxH]
Compares two revisions of a drawing (DWG or DXF, same or different formats) and lists added, removed, and modified entities (with exact changed field names) plus modified table records (LAYER/, LTYPE/, STYLE/, DIMSTYLE/, BLOCK/, LAYOUT/). When handles differ across saves, --no-geom-match can disable geometric fallback pairing. --redline plots unchanged geometry in muted grey, removed in red, modified in amber, and added in green.
rp licence
rp licence status the installed key: tier, seats, dates
rp licence install <key> check a key and install it
rp licence refresh fetch the key for the current paid period
rp licence remove delete the installed key
rp licence with nothing after it means status. Without a key:
$ rp licence status
No licence installed. Free: info and PNG plots. See https://rulingpen.dev/pricing
$ rp dump rp-001-mounting-bracket.dxf
rp: rp dump needs a licence. Install one with `rp licence install <key>`; see https://rulingpen.dev/pricing
$ echo $?
3
Licence keys covers installing, CI, renewal and refunds.