TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Shade on March 30, 2009, 03:42:16 PM

Title: SHX or Shape file remove
Post by: Shade on March 30, 2009, 03:42:16 PM
Does any one have a lisp that will remove all occurrences of a shape file (shx) from a drawing?
It would be great if it removed the shape file from the xrefs and blocks also.

I have a drawings that asks for a certain file that we do not use and canceling it when we open each drawing is a major pain for it occurs multiple times in some drawings.

Any help would be greatly appreciated.....

Thanks
Shade  :mrgreen:
Title: Re: SHX or Shape file remove
Post by: CAB on March 30, 2009, 04:44:19 PM
You can allways replace the shape.
In the dwg create a shape using express tools Make Shape routine.
Use the same name as the missing shape.
You could use a point or a dot as your new shape.
Title: Re: SHX or Shape file remove
Post by: gile on March 30, 2009, 05:45:29 PM
Hi,

Here's the routine I use. It replace not founded shape with AutoCAD "ltypeshp.shx".

Code: [Select]
(defun c:rform (/ ext)
  (vl-load-com)
  (vlax-for ts (vla-get-TextStyles
(vla-get-ActiveDocument (vlax-get-acad-object))
       )
    (if (and
  (setq ext (vl-filename-extension (vla-get-FontFile ts)))
  (= (strcase ext) ".SHX")
  (= 1 (cdr (assoc 70 (tblsearch "STYLE" (vla-get-Name ts)))))
  (not (findfile (vla-get-FontFile ts)))
)
      (vla-put-FontFile ts "ltypeshp.shx")
    )
  )
  (princ)
)