AutoCAD
Advertisement

Lineweight stripper is a simple AutoLISP tool to turn lineweights to zero in a drawing.

Source Code[]

;;; AutoCAD Wiki AutoLISP code header.  
;;;
;;; Copy this code to a file on your computer. 
;;; Start highlighting OUTSIDE the code boxes and use the mouse or keyboard to
;;; highlight all the code.
;;; If you select too much, simply delete any extra from your destination file.
;;; In Windows you may want to start below the code and use [Shift]+[Ctrl]+[Home] 
;;; key combination to highlight all the way to the top of the article,
;;; then still holding the [Shift] key, use the arrow keys to shrink the top of
;;; the selection down to the beginning of the code.  Then copy and paste.
;;; This program is free software: you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation, either version 3 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; The working version of this software is located at the AutoCAD Wiki.
;;; Please AutoCAD:Be_bold in adding clarifying comments and improvements at
;;; https://autocad.fandom.com/wiki/Lineweight_stripper_(AutoLISP_tool)
;;; C:LWSTRIP
;;; Makes all lineweights 0 in the current drawing
;;;
;;; Copyright holders:
;;; 2008 Hubbard Enterprises, Inc. dba Hubbard Engineering Gilbert, Arizona
(DEFUN
   C:LWSTRIP (/ EG EN ICURRENTOBJECT SSALL)
  (SETQ
    SSALL
     (SSGET "X")
    ICURRENTOBJECT -1
  )
  ;;For every object in the selection set,
  (WHILE (SETQ EN (SSNAME SSALL (SETQ ICURRENTOBJECT (1+ ICURRENTOBJECT))))
    ;;Set the lineweight to 0
    (SETQ EG (ENTGET EN))
    ;;Entmod modifies the entity based on the new list after the substitution.
    (ENTMOD (SUBST (CONS 370 0) (ASSOC 370 EG) EG))
  )
  ;;Set various drawing settings to make sure lineweights don't appear unexpectedly.
  (SETVAR "celweight" -1)
  (SETVAR "dimlwd" -2)
  (SETVAR "dimlwe" -2)
  (SETVAR "lwdefault" 0)
  ;;Exit function silently
  (PRINC)
)
;|«Visual LISP© Format Options»
(72 2 40 2 nil "end of " 60 2 2 2 1 nil nil nil T)
;*** DO NOT add text below the comment! ***|;
Advertisement