Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Global Attribute Edit w/ Widcard
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Global Attribute Edit w/ Widcard (Read 335 times)
0 Members and 1 Guest are viewing this topic.
GDF
Water Moccasin
Posts: 2084
Global Attribute Edit w/ Widcard
«
on:
February 29, 2024, 04:07:55 PM »
I trying to use Peter's function with a wildcard to reset a tags value.
(AttributeStringSubst "SYMRM" "NOTE2"
wildcard
"")
Need help, please.
Code - Auto/Visual Lisp:
[Select]
;;;(AttributeStringSubst BlockName TagString OldText NewText)
;;;Peter Jamtgaard
(
defun
AttributeStringSubst
(
strBlockName strTagString
strPattern strNewString
/
strString
)
(
vlax-for
objLayout
(
vla-get-layouts
(
vla-get-activedocument
(
vlax-get-acad-object
)
)
)
(
vlax-for
objBlock
(
vla-get-block
objLayout
)
(
if
(
and
(
wcmatch
(
vla-get-objectname
objBlock
)
"AcDbBlockReference,AcDbMInsertBlock"
)
(
wcmatch
(
strcase
strBlockName
)
(
strcase
(
vla-get-name
objBlock
)
)
)
(
=
(
vla-get-hasattributes
objBlock
)
:vlax-true
)
)
(
foreach
objAttribute
(
vlax-invoke
objBlock
"getattributes"
)
(
setq
strString
(
vla-get-textstring
objAttribute
)
)
(
if
(
wcmatch
(
strcase
(
vla-get-tagstring
objAttribute
)
)
(
strcase
strTagString
)
)
(
if
(
not
(
vl-string-search
strPattern strNewString
)
)
(
progn
(
while
(
vl-string-search
strPattern strString
0
)
(
setq
strString
(
vl
-
string
-
subst
strNewString strPattern strString
)
)
)
(
vla-put-textstring
objAttribute strString
)
)
)
)
)
)
)
)
(
princ
)
)
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
Lee Mac
Seagull
Posts: 12929
London, England
WWW
Re: Global Attribute Edit w/ Widcard
«
Reply #1 on:
February 29, 2024, 06:46:19 PM »
Perhaps this can help Gary -
https://www.theswamp.org/index.php?topic=58363.msg615317#msg615317
Though, I'm unsure what you mean by 'reset' - do you mean revert to the default value held by the attribute definition?
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
GDF
Water Moccasin
Posts: 2084
Re: Global Attribute Edit w/ Widcard
«
Reply #2 on:
March 01, 2024, 08:40:37 AM »
Thanks Lee...works perfectly!!!
Logged
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Global Attribute Edit w/ Widcard