Jump to content

real numbers in autolisp


gpd

Recommended Posts

I have a lisp routine which reads point coordinates from excel sheet and inserts blocks at those points. All the points have 3 decimal places. For example

 

614332.785, 2619494.544

 

The routine works fine.

 

Now in another routine I get the base points of the blocks and compare them to their coordinates in the excel file they are not same but have slight difference for example the base point of the block inserted at above point would be reported by lisp as (614333.0, 261949e+006). What is the reason for this difference. How can I get the same exact value.

 

Similarly suppose their is a value 6123.494 stored in an excel cell when I extract that value (using vlisp) the system shows value of variant to be 6123.494 but when I call (valx-variant-value) the returned value becomes 6123 Why this .494 part is omitted. Please guide.

 

Thanks

Link to comment
Share on other sites

Simply change the last number in the function as the following.

(rtos [color="blue"]YourNumber[/color] 2 [color="red"]3[/color] )

It is better also to paste your codes to let us check them for you if any other mistakes found...

Regards

 

Tharwat

Link to comment
Share on other sites

Thanks Tharwat,

 

But I want the end resut as a real number and not string. rtos perhaps converts result to String.

 

Any Suggestions?

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