CADLISPMASTER
Stop wasting time on repetitive AutoCAD tasks. CAD LISP Master provides free, efficient AutoLISP codes and clear tutorials designed to automate your workflow and speed up your drafting.

Draw Cross Lines / X-Marks Instantly

Download the free AutoCAD SXX LISP to draw diagonal cross lines and speed up your CAD workflow.

 [AutoCAD LISP] Draw Cross Lines / X-Marks Instantly (SXX.lsp)

Draw Cross Lines / X-Marks Instantly
Drawing X-marks or cross lines to indicate openings, voids, or structural sections is a repetitive but necessary task in AutoCAD. Doing this manually by drawing individual lines from corner to corner drains your time and breaks your design flow, especially in large-scale projects.

If you are still clicking every single corner to draw an X-box, you are losing valuable minutes that could be spent on actual design work. Manually drawing these lines also increases the risk of snapping to the wrong points, leading to inaccurate drawings.

Fortunately, the SXX LISP automates this entire process. With just two clicks (or four specific points), you can instantly generate perfectly aligned cross lines, changing your line color automatically to keep your workspace organized.

Why You Should Use the 'SXX' LISP

  • Instant X-Marking: Create cross lines instantly using either a diagonal bounding box or 4 customized points.
  • Smart Layer/Color Management: The LISP automatically switches the line color to Red (Color 1) for distinct visibility and restores your original color afterward.
  • Eliminates Repetitive Clicks: Reduces the number of clicks required to draw cross lines by more than 50%.
  • Flawless Accuracy: Avoids manual snapping errors by calculating exact diagonal paths automatically.

How It Works (Step-by-Step Guide)

  1. Load the LISP: Load the SXX.lsp file into your AutoCAD session using the APPLOAD command.
  2. Run the Command: Type SXX in the command line and press Enter.
  3. Choose Your Mode:
  • Standard Mode (2-Point Diagonal): Simply click the first corner, then click the opposite diagonal corner. The LISP will instantly draw the X-mark.
  • 4-Point Mode: Type 4P and press Enter. Click four points in order (Top-Left > Bottom-Right > Top-Right > Bottom-Left) to draw custom cross lines.
  1. Automatic Reset: Once the lines are drawn, the LISP automatically restores your previous active color and command echo settings.

Wrapping Up

The SXX LISP is a simple yet incredibly powerful tool that saves you from the tedious, click-heavy process of marking voids and openings. By integrating this into your daily CAD workflow, you can keep your drawings precise while saving hours of repetitive drafting time.

Try implementing the SXX LISP today and let AutoCAD do the tedious line work for you!

The LISP Code

(defun c:SXX ( / p1 p2 p3 p4 pt1 pt2 pt3 pt4 oldecho oldcolor *error*)
  (defun *error* (msg)
    (if oldcolor (setvar "cecolor" oldcolor))
    (if oldecho (setvar "cmdecho" oldecho))
    (princ)
  )
  (setq oldecho (getvar "cmdecho"))
  (setq oldcolor (getvar "cecolor"))
  (setvar "cmdecho" 0)
  (setvar "cecolor" "1")
  (initget "4P")
  (setq p1 (getpoint "\nSpecify first diagonal point or [4P]: "))
  (cond
    ((= p1 "4P")
      (setq pt1 (getpoint "\nSpecify Top-Left point: "))
      (if pt1 (setq pt2 (getpoint pt1 "\nSpecify Bottom-Right point: ")))
      (if pt2 (setq pt3 (getpoint pt2 "\nSpecify Top-Right point: ")))
      (if pt3 (setq pt4 (getpoint pt3 "\nSpecify Bottom-Left point: ")))
      (if (and pt1 pt2 pt3 pt4)
        (progn
          (command "_.line" "_none" pt1 "_none" pt2 "")
          (command "_.line" "_none" pt3 "_none" pt4 "")
        )
      )
    )
    ((listp p1)
      (setq p2 (getcorner p1 "\nSpecify second diagonal point: "))
      (if p2
        (progn
          (setq p3 (list (car p2) (cadr p1) (caddr p1)))
          (setq p4 (list (car p1) (cadr p2) (caddr p2)))
          (command "_.line" "_none" p1 "_none" p2 "")
          (command "_.line" "_none" p3 "_none" p4 "")
        )
      )
    )
  )
  (setvar "cecolor" oldcolor)
  (setvar "cmdecho" oldecho)
  (princ)
)

Post a Comment