Strikethrough Text

Function Syntax strike / strike2 / strike3 / ... (customisable)
Current Version 1.1
Download StrikethroughV1-1.lsp
View HTML Version StrikethroughV1-1.html
Donate

Program Description

This application provides a function to allow the user to create custom programs for generating any number of lines above, below or through selected text objects, in order to create strikethrough, underline or overline text effects.

The core function LM:strikethrough accepts two arguments (parameters): the entity name of a Text or MText object, and a list of lists in which each item defines a polyline to be created through the supplied text object.

The function has the following syntax:

(LM:strikethrough <Text-Entity> '((<Spacing-Factor> <Width-Factor>) ... ))

Here, the Spacing Factor is a numerical value which determines the vertical position of the polyline through the text object as a factor of the text height. A Spacing Factor of zero will result in a polyline through the centre of the text object, giving a strikethrough effect; a positive value will position the line above centre, and a negative value below centre.

The Width Factor is a positive numerical value which determines the width or thickness of the polyline through the text object, again as a factor of the text height.

I have included six example programs which are demonstrated below as examples of how to evaluate the core function with the required parameters.

The program will perform successfully with supplied Single-line Text (DText) objects or Multiline Text (MText) objects with a single line of text, at any rotation, drawn in any plane, under all UCS & View settings.

The ability to strikethrough MText is of course now available in more recent versions of AutoCAD, however, this application will hopefully prove useful to those without access to newer versions of the software, or who wish to create multiple strikethrough, underline or overline effects.

Example Programs

I have included the following six example programs with the application to demonstrate how the main function may be evaluated with the required parameters to achieve various results:

Strikethrough

(defun c:strike ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    (0.0 0.1)
                )
            )
        )
    )
    (princ)
)

Strikethrough

Double Strikethrough

(defun c:strike2 ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    ( 0.15 0.1)
                    (-0.15 0.1)
                )
            )
        )
    )
    (princ)
)

Double Strikethrough

Triple Strikethrough

(defun c:strike3 ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    ( 0.2 0.1)
                    ( 0.0 0.1)
                    (-0.2 0.1)
                )
            )
        )
    )
    (princ)
)

Triple Strikethrough

Underline

(defun c:under ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    (-0.8 0.1)
                )
            )
        )
    )
    (princ)
)

Underline

Double Underline

(defun c:under2 ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    (-0.8  0.05)
                    (-1.0  0.05)
                )
            )
        )
    )
    (princ)
)

Double Underline

Double Overline & Underline

(defun c:overunder2 ( / i s )
    (if (setq s (ssget '((0 . "TEXT,MTEXT"))))
        (repeat (setq i (sslength s))
            (LM:strikethrough (ssname s (setq i (1- i)))
               '(
                    ( 1.0 0.05)
                    ( 0.8 0.05)
                    (-0.8 0.05)
                    (-1.0 0.05)
                )
            )
        )
    )
    (princ)
)

Double Overline & Underline

Instructions for Running

Please refer to How to Run an AutoLISP Program.

textsize

increase · reset · decrease

Designed & Created by Lee Mac © 2010