PDA

View Full Version : find and replace in lisp


ReachAndre
2009-03-09, 03:44 PM
Hello all,
I am looking to find a way to use the find and replace in a lisp format. I need this to not include the replacing of fielded attributes.

Thanks all,
Andre

irneb
2009-03-09, 05:08 PM
That's a bummer :cry: ... basically you'll have to redo the entire FIND command (including dialog boxes). Then get each text like entity's vla-object and check if it's FieldCode method returns something different than its TextString property.

If not do a normal vl-string-subst. And assign to the TextString property.

Otherwise store the FieldCode in a variable. First get a substring from position 1 to just before the first %<\\, do the vl-string-subst on that, then do a vl-string-subst on the substring from just after the last >%. Then strcat the 3 portions back together and assign to the TextString property of the object.

Unfortunately this would not work for wildcards. That needs some extra programming.

Opie
2009-03-09, 05:20 PM
That's a bummer :cry: ... basically you'll have to redo the entire FIND command (including dialog boxes). Then get each text like entity's vla-object and check if it's FieldCode method returns something different than its TextString property.

If not do a normal vl-string-subst. And assign to the TextString property.

Otherwise store the FieldCode in a variable. First get a substring from position 1 to just before the first %<\\, do the vl-string-subst on that, then do a vl-string-subst on the substring from just after the last >%. Then strcat the 3 portions back together and assign to the TextString property of the object.

Unfortunately this would not work for wildcards. That needs some extra programming.
And if there is more than one field within the string, you might even lose some fields.

irneb
2009-03-09, 05:54 PM
And if there is more than one field within the string, you might even lose some fields.Oh yes! Forgot about nested fields ... this would simply loose any nested field. So it's even more involved than I thought ... :shock: ... sorry to say, but you're in for some steep learning & long programming.