-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathodbx_substbloc.lsp
More file actions
53 lines (42 loc) · 1.54 KB
/
odbx_substbloc.lsp
File metadata and controls
53 lines (42 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
; ANSI-Windows 1252
; Autolisp, Visual Lisp
;|
odbx_substbloc.lsp 1.0
Replace a block with another with the same name.
Place the files, odbx_substbloc.lsp and odbx_fct.lsp, in an Autocad approved folder.
Use APPLOAD to load them.
Enter odbx_substbloc in Autocad, the old text, the new and choose folder.
Drawings are not open.
PLEASE NOTE, there is no going back.
Tested on Windows 10 and Autocad 2015.
No copyright: (!) 2021 by Frédéric Coulon.
No license: Do with it what you want.
|;
;Dependencies
(vl-load-com)
;(load "fct.lsp")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun c:odbx_substbloc (/ acdc axdoc lfil bl)
(setq acdc (vla-get-activedocument(vlax-get-acad-object))
bl (findfile (strcat (getstring "Block name?") ".dwg"))
)
; Choose folder.
(if (and (setq dir (getdir))
; dwg liste.
(setq lfil (vl-directory-files dir "*.dwg" 1)))
; Loop over files.
(foreach f lfil
(if (setq axdoc (getaxdbdoc (strcat dir f)))
(progn
(vla-delete (vlax-invoke (vla-get-modelspace axdoc) 'insertblock '(0.0 0.0 0.0) bl 1 1 1 0))
(vla-saveas axdoc (strcat dir f))
(vlax-release-object axdoc)
)
(princ (strcat "\n" f ": Illegible or corrupt."))
)
)
(princ "\nHave you lost your way?")
)
(princ)
)
;É;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;