Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert Formula to String (in solvable)

Status
Not open for further replies.

jtm2020hyo

Technical User
Dec 30, 2021
24
PE
I found an in solvable issue, I use AutoCAD MEP and this support VBS v3.0 if I remember correctly, everything work good but ...

... When I try convert create a tag for my object like "ABC-123", VBS read this like a formula, and I already tried everything in the internet to convert this Tag/Formula to String but is unsolvable...

I just found a trick, to convert "ABC-123" in a String I need add a invisible character in the end, like this:

"ABC-123(Chr28)" = "ABC-123 "

... and this was a temporal solution until I tried print and use Adobe Acrobat and other PDF readers, this las character is interpreted as "/" or "|".

So, my last hope is request for help to the Tek-TIPS gurus.

Any suggestion or help?
 
Why do you use Chr(28)? It is FS = File Separator.
Why don't you prefer to use Chr(32), which is a normal space?
 
ABC-123" is string in vbscript.

Unfortunately I've never seen the software you mentioned and I don't understand well how Autocad MEP, VBscript and PDF are related: As I understood VBscript is a scripting language of Autocad MEP. But how do you get from Vbscript to PDF?
 
AutoCAD have a PLOT command, this command put the TAG-OBJECT than contain the VBS with "RETURN = ABC-123" to pdf, and I am not sure why happen this issue only here.

Also Cstr(ABC-123) should work or maybe I did anything wrong.

Any suggestion? Or is there another command to convert a Formula to String?
 
Really need to see some of the actual code you are using, but from what you have shown here if actually representative then

RETURN = ABC - 123

should read

RETURN = "ABC - 123"

Or, if that line is really in quotes as per your post, then:

"RETURN = ABC - 123"

should read

"RETURN = ""ABC - 123"""

 
>Also Cstr(ABC-123) should work

In the sense that it will attempt to evaluate [tt]ABC - 123[/tt] first, then convert the result into a string
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top