Results 1 to 2 of 2

Thread: Help-calculation fanction

  1. #1
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Help-calculation fanction

    Hi i write a code to calculate fanctions in text . I want the results to have 2 decimals. I try to add

    Code:
    (rtos (cal (vla-get-textstring e)) 2 2 )
    but is not working. Can you show me the correct way to do this ?

    Code:
    (defun c:cal2 (/ e)
      (setq e (car (entsel "\Pick text: ")))
      (setq e (vlax-ename->vla-object e))
      (vlax-property-available-p e 'textstring)
      (vla-put-textstring e (cal (vla-get-textstring e)))
      (princ)
    )
    Thanks

  2. #2
    Member
    Join Date
    2015-08
    Posts
    32
    Login to Give a bone
    0

    Default Re: Help-calculation fanction

    I think i find it

    Code:
    (defun c:test (/ e)
      (setq e (car (entsel "\Pick text: ")))
      (setq e (vlax-ename->vla-object e))
      (vlax-property-available-p e 'textstring)
      (vla-put-textstring e (atof (rtos(cal (vla-get-textstring e)) 2 2)))
      (princ)
    )

Similar Threads

  1. Replies: 9
    Last Post: 2022-01-22, 06:54 AM
  2. Line Angle Pole Calculation and Dimensoning - Need Help!
    By chris_girkin_1969 in forum AutoLISP
    Replies: 1
    Last Post: 2013-06-16, 03:39 PM
  3. need help on calculation--math problem
    By CAD CHICK MTY in forum AutoCAD General
    Replies: 6
    Last Post: 2008-07-25, 07:21 PM
  4. UK SAP Ratings - free calculation service
    By Martin P in forum Revit - In Practice
    Replies: 0
    Last Post: 2004-07-20, 12:12 PM
  5. Area Calculation Extents Using Room Tag
    By photography67836 in forum Revit Architecture - General
    Replies: 3
    Last Post: 2004-06-03, 06:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •