Kowal Posted June 21, 2023 Posted June 21, 2023 I created a custom peopertis. Name custim propertis: Test I'm trying to put it in an existing text. Why is this code not working? (vla-put-TextString (vlax-ename->vla-object (car (entsel))) "%<\AcVar CustomDP.Test>%") The code inserts text but the result is #### Quote
Tharwat Posted June 21, 2023 Posted June 21, 2023 You need to add another backslash like this "%<\\AcVar ......" Can you upload your sample drawing to check it out if the above mod did not fully work? Quote
Kowal Posted June 21, 2023 Author Posted June 21, 2023 Thanks Tharwat! Now the code works. I'm just wondering why there is no additional \ in the expression in the field edit then. Quote
Tharwat Posted June 22, 2023 Posted June 22, 2023 You're welcome. That's how autodesk built fields codes so we need to live with it. Quote
Lee Mac Posted June 22, 2023 Posted June 22, 2023 10 hours ago, Kowal said: I'm just wondering why there is no additional \ in the expression in the field edit then. The backslash character in AutoLISP is an escape character, used to give the characters which follow it an alternatively meaning - for example, \n represents a newline, \t represents a tab character, \" represents a literal double quote (as opposed to a string delimiter). As such, if you want to represent a literal backslash in a string, this must be preceded by another backslash to mark it as a literal as opposed to the start of another escape character sequence (i.e. the first backslash is an escape character which gives the second backslash an alternative meaning, marking it as a literal character). The reason that you only see one backslash everywhere else in the GUI is because the backslash is only an escape character in AutoLISP (and other programming languages). 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.