I'm trying to develop a lisp routine that can do the following (Conceptually it's a conditional attribute edit program):
Search for a specific block(s) "MyBlock" and Attribute tag "Tag1" to find a given value "MyValue".
IF that value is found in the given block and attribute, then edit the attribute "Tag2" in "MyBlock" to a static value "MyNewValue".
I'm getting hung up on syntac and ACAD keeps returning with Error: too few arguments.
Any help is appreciated!
Solved! Go to Solution.
Solved by Sea-Haven. Go to Solution.
@Anonymous wrote:
I'm trying to develop a lisp routine that can do the following (Conceptually it's a conditional attribute edit program):
A hint / guide / advise is what you're looking for YES?
HTH
Following on from the Pbejse suggestions here is a VL example can use as a start for your solution.
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS x)) 'getattributes)
(if (and (= tag (strcase (vla-get-tagstring att)))
(= (vla-get-textstring att) teststring)
)
(vla-put-textstring att newstring)
)
)
@Anonymous,
in case you were asking what "Error: too few arguments" means?
here is an example: (foo a b c)
where a,b,c are arguments to function (foo)
if you call (foo) with less then 3 arguments or no arguments at all, you get that error.
here is a tip for debug: there is a nice helper function called (trace)
usage:
(trace foo)
(the argument may be a list of functions name to be traced)
when your program stuck with an error go back to VLIDE top menu window\trace the trace window is opened.
you will see there the call to your trace function plus the arguments that were sent and the result of the function.
if the error comes from this function, then you will get no result.
oh one last more 😀
to disable a traced function use (untrace foo)
enjoy
Moshe
That's my style, but your indentation is rather sloppy. 😏
BTW, how do you do parenthesis matching in NotePad++?
John F. Uhden
Can't find what you're looking for? Ask the community or share your knowledge.