Jump to content

calculate during a command input value request


khoshravan

Recommended Posts

Is it possible to input an arithmetic expression (like 0.7*24) when a command asks for input value? For example during offset command.

I thought it is possible to use calculator command inside a command but there was no success.

Link to comment
Share on other sites

You can use a LISP expression as input for a command. The syntax can be confusing.

 

LISP means LISt Processor. Every "statement" is a list to be evaluated, enclosed in parenthesis. The operator appears first and is applied to the rest of the list. When AutoCAD sees a left parenthesis, it invokes AutoLISP and takes the result of the evaluation as if you had typed it in.

 

Examples:

 

(+ 1 1) means "add 1 and 1"

 

(/ 10 5) means "divide 10 by 5"

 

In both cases AutoCAD will respond as if you had typed 2.

Link to comment
Share on other sites

When dividing be sure you have a decimal point on one of the numbers or it will round off.

 

IE: divide 11 by 2 (/ 11 2.0)

Link to comment
Share on other sites

To add another option to the table; the quick calc will Paste value to command line during the command (if you have it open before you invoke your command). The calc can be used at before or during the command. See image below.

 

Capture.PNG

Link to comment
Share on other sites

You can use QuickCalc while in your command, just right-click and choose QuickCalc and select Apply to send to command line.

 

Quick calc is not an option when I right click while in a command. At least not in Civil 3D.

 

 

Edit:

Ahhh it is in Map 3D and vanilla AutoCad. Interesting. I wonder why C3D is excluded?

Link to comment
Share on other sites

You can use a LISP expression as input for a command. The syntax can be confusing.

 

LISP means LISt Processor. Every "statement" is a list to be evaluated, enclosed in parenthesis. The operator appears first and is applied to the rest of the list. When AutoCAD sees a left parenthesis, it invokes AutoLISP and takes the result of the evaluation as if you had typed it in.

 

Examples:

 

(+ 1 1) means "add 1 and 1"

 

(/ 10 5) means "divide 10 by 5"

 

In both cases AutoCAD will respond as if you had typed 2.

 

Thanks. It is very nice.

Even it is possible to nest parenthesis to make complex calculations.

Link to comment
Share on other sites

'cal might be what you are looking for.

 

[ATTACH=CONFIG]33678[/ATTACH]

 

No lisp required.

 

I read about this in forum but it didn't work for me.

When I type "cal" in input stage, it gives following message:

 

requires numeric input, two points or option key word

specify offset distance or

Link to comment
Share on other sites

I read about this in forum but it didn't work for me.

When I type "cal" in input stage, it gives following message:

 

requires numeric input, two points or option key word

specify offset distance or

 

You omitted the apostrophe to make it a transparent command.

 

Type it as you see it below while in your command.

'cal

Link to comment
Share on other sites

To add another option to the table; the quick calc will Paste value to command line during the command (if you have it open before you invoke your command). The calc can be used at before or during the command. See image below.

 

[ATTACH=CONFIG]33679[/ATTACH]

 

Thanks this works. The only disadvantage is that, calculator should be present before invoking the command. which is not a big problem.

Link to comment
Share on other sites

Thanks this works. The only disadvantage is that, calculator should be present before invoking the command. which is not a big problem.

 

Please read my post #6

Link to comment
Share on other sites

Dear All

Thanks for your help.

It seams that Cal is a powerful tool.

I have to study it thoroughly.

I think there will be topics in this regard in this forum.

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