Jump to content

Field with custom properties


Kowal

Recommended Posts

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 ####

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

Thanks Tharwat!

Now the code works.

I'm just wondering why there is no additional \ in the expression in the field edit then.

Link to comment
Share on other sites

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).

  • Like 1
Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...