Hi guys,
This task might be like a string manipulation challenge:
I've been reading recently here about
vla-SendCommand function and decided to give it a try:
The above sample (to change all objects to color 1) works perfectly, however not in these ways:
"CHANGE
\n(ssget \"_X\")
\n
\nP
\nC
\n1
\n
\n"
) ; not working
Soo after that conclusion I decided to try to input the arguments for the
vla-SendCommand, by using
vl-prin1-to-string with
quote/
apostrophe combo:
BUT the problem is that the above argument string is:
"CHANGE\\\\N (SSGET \"_X\") \\\\N\\\\NP\\\\NC\\\\N1\\\\N\\\\N"
While I need it to become like:
"change\n(ssget \"_x\")\n\np\nc\n1\n\n"
Which means:
1. Somehow substituting the "\\\\" with "\"
2. Remove spaces " "around the syntaxes "()"
3. (strcase ... t) the whole string
Similiarly to a technique for
action_tile I learned from Lee Mac, while dealing with DCL - where his genious mind created this fragment from his code:
(set_tile "error" "Please enter a positive numerical length.") )
(set_tile "error" "Please enter a positive numerical width.") )
)
)
)
So my end question would be: Is it possible to reproduce the same string result with vl-prin1-to-string + quote/apostrophe combo like Lee did, without getting lost in string characters?
Say if further I'd want incorporate fragments from a code as a string to become argument for the vla-SendCommand.
Also would be nice to hear your oppinions (2+ heads are better than 1).
BTW The best way I figured out ot deal with this particular problem is to create a string list, and apply strcat to it:
'(
"CHANGE"
"\n"
"(ssget \"_X\")"
"\n"
"\nP"
"\nC"
"\n1"
"\n"
"\n"
)
)
)