BIGAL Posted April 25, 2020 Posted April 25, 2020 I am looking at trying to get something working in my metric program that currently asks for input via dcl's. The issue is that the dcl returns a ($value) as a string which is fine I would normally do a (setq w2 (atof $value)) as its metric no probs. So the question is how do I enter 4'6" and return 54 without a lot of conversion work or is that the only way ? Even 4.5 is no good. I am asking how do you handle the feet inch input in dcl's for distances ? Getdist 4'6" returns 54 which is what I want. Quote
hanhphuc Posted April 25, 2020 Posted April 25, 2020 (edited) 1 hour ago, BIGAL said: Getdist 4'6" returns 54 which is what I want. (cvunit number "ft" "in") ;not string... ACAD only (CAL "4'6\"") BCAD not support CAL? (defun foo ( str ) (apply '+ (mapcar '* (read (strcat "(" (vl-string-translate "'\"" " " str) ")") ) '(12. 1.)))) Edited April 25, 2020 by hanhphuc Quote
Jonathan Handojo Posted April 25, 2020 Posted April 25, 2020 7 hours ago, Roy_043 said: (distof "4'6\"") That returned nil for me Quote
Jonathan Handojo Posted April 25, 2020 Posted April 25, 2020 1 hour ago, Lee Mac said: (distof "4'6\"" 4) That's better Quote
BIGAL Posted April 26, 2020 Author Posted April 26, 2020 Thank you all that may be what I am looking for with around 50+ programs to imperialise looking for something simple. I would like it to work in Briscad as well. Will respond later on how successful. Quote
hanhphuc Posted April 26, 2020 Posted April 26, 2020 35 minutes ago, BIGAL said: Thank you all that may be what I am looking for with around 50+ programs to imperialise looking for something simple. I would like it to work in Briscad as well. Will respond later on how successful. BCAD (distof "4'6\"") returns 54 okay ACAD unless (setvar 'LUNITS 4) (distof "4'6\"") returns 54 not nil This proves (distof "4'6\"" 4) as Lee's previous post Quote
BIGAL Posted April 26, 2020 Author Posted April 26, 2020 Thanks Hanhphuc I have lunits in a global startup load as part of the package. I am working on two versions now advantage is code is already debugged just the input to be confirmed. 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.