Jump to content

convert ft&inch from dcl to inches


BIGAL

Recommended Posts

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. 

Link to comment
Share on other sites

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 by hanhphuc
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

 

 

 

Link to comment
Share on other sites

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.

 

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