Jump to content

convert the number to text number in Arabic language


mahmoudqaswal

Recommended Posts

Hi, first thanks for lee mac and rkmcswain to help me

 

i was write a lisp that can convert the number to text number in Arabic language

but, i have some problem in this lisp i use mathematics equations to separate every number like this

 

665.33

x=600

y=60

z=5

x1=30

x2=3

and then i use nth, fix condition by using sequence

no problem about this but when reach to number after comma the variable x2 increase +1 to the value expect no 3 i don't know why do that

please help me to solve this problem

 

;    NCONVERT.lsp - convert number to text

(defun c:NC (x6 )   
(setq n ( getdist "\nEnter the no. :"))
(setq x1 ( fix (/ n 100)))
(setq x2 (fix(/ (- n (* (fix (/ n 100)) 100 )) 10)))
(setq x3 (fix(- n (* x1 100) (* x2 10))))
(setq x4 (- n (* 100 x1) (* 10 x2) x3))
(setq x5 (* 100 x4))
(setq x6 (fix x5))
(setq y1 (nth x1 '("" "lhzm" "lzjhk" "eghelhzm" "hvfulhzm" "olslhzm" "sjlhzm"  "sfulhzm" "elhklhzm" "jsulhzm")))
(setq y2 (nth x2 '("" ",uav" ",uav,k" ",eghe,k" ",hvfu,k" ",ols,k" ",sj,k" ",sfu,k" ",elhk,k" ",jsu,k")))
	(setq y3 (nth x3 '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum")))
(setq x5 (* 100 x4))
(setq x6 (fix x5))
(setq y6 (nth x6 '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum" ",uavm" ",hp] uav" ",hekh uav" ",eghem uav" ",hvfum uav" ",olsm uav" ",sjm uav" ",sfum uav" ",elhkdm uav" ",jsum uav" ",uav,k" ",,hp] ,uav,k" ",hekhk ,uav,k" ",eghem ,uav,k" ",hvfum ,uav,k" ",olsm ,uav,k" ",sjm ,uav,k" ",sfum ,uav,k" ",elhkdm ,uav,k" ",jsum ,uav,k" ",eghe,k" ",,hp] ,eghe,k" ",hekhk ,eghe,k" ",eghem ,eghe,k" ",hvfum ,eghe,k" ",olsm ,eghe,k" ",sjm ,eghe,k" ",sfum ,eghe,k" ",elhkdm ,eghe,k" ",jsum ,eghe,k" ",hvfu,k" ",,hp] ,hvfu,k" ",hekhk ,hvfu,k" ",eghem ,hvfu,k" ",hvfum ,hvfu,k" ",olsm ,hvfu,k" ",sjm ,hvfu,k" ",sfum ,hvfu,k" ",elhkdm ,hvfu,k" ",jsum ,hvfu,k" ",ols,k" ",,hp] ,ols,k" ",hekhk ,ols,k" ",eghem ,ols,k" ",hvfum ,ols,k" ",olsm ,ols,k" ",sjm ,ols,k" ",sfum ,ols,k" ",elhkdm ,ols,k" ",jsum ,ols,k" ",sj,k" ",,hp] ,sj,k" ",hekhk ,sj,k" ",eghem ,sj,k" ",hvfum ,sj,k" ",olsm ,sj,k" ",sjm ,sj,k" ",sfum ,sj,k" ",elhkdm ,sj,k" ",jsum ,sj,k" ",sfu,k" ",,hp] ,sfu,k" ",hekhk ,sfu,k" ",eghem ,sfu,k" ",hvfum ,sfu,k" ",olsm ,sfu,k" ",sjm ,sfu,k" ",sfum ,sfu,k" ",elhkdm ,sfu,k" ",jsum ,sfu,k" ",elhk,k" ",,hp] ,elhk,k" ",hekhk ,elhk,k" ",eghem ,elhk,k" ",hvfum ,elhk,k" ",olsm ,elhk,k" ",sjm ,elhk,k" ",sfum ,elhk,k" ",elhkdm ,elhk,k" ",jsum ,elhk,k" ",jsu,k" ",,hp] ,jsu,k" ",hekhk ,jsu,k" ",eghem ,jsu,k" ",hvfum ,jsu,k" ",olsm ,jsu,k" ",sjm ,jsu,k" ",sfum ,jsu,k" ",elhkdm ,jsu,k" ",jsum ,jsu,k")))



(setq v (strcat y1 " " y3 " " y2 " " "ljvh lvfu" " " y6 " " "skjljvh lvfu"   ))

(SETQ pt (GETPOINT"\nWHERE TO PLACE LABLE ?"))
	(command "text" "m" PT 1 0 v) 

	)

Edited by mahmoudqaswal
Link to comment
Share on other sites

Perhaps try something like this:

(defun c:nc ( / f n p )
   (setq f '(( x ) (fix (+ x 1e-)))
   (initget 6)
   (if (and (setq n (getreal  "\nEnter number: "))
            (setq p (getpoint "\nSpecify point for text: "))
       )
       (entmake
           (list
              '(0 . "TEXT")
               (cons 40 (getvar 'textsize))
               (cons 10 p)
               (cons 01
                   (strcat
                       (nth (f (/ n 100)) '("" "lhzm" "lzjhk" "eghelhzm" "hvfulhzm" "olslhzm" "sjlhzm"  "sfulhzm" "elhklhzm" "jsulhzm")) " "
                       (nth (f (rem n 10)) '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum")) " "
                       (nth (f (/ (rem n 100) 10)) '("" ",uav" ",uav,k" ",eghe,k" ",hvfu,k" ",ols,k" ",sj,k" ",sfu,k" ",elhk,k" ",jsu,k")) " ljvh lvfu "
                       (nth (f (* 100 (rem n 1))) '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum" ",uavm" ",hp] uav" ",hekh uav" ",eghem uav" ",hvfum uav" ",olsm uav" ",sjm uav" ",sfum uav" ",elhkdm uav" ",jsum uav" ",uav,k" ",,hp] ,uav,k" ",hekhk ,uav,k" ",eghem ,uav,k" ",hvfum ,uav,k" ",olsm ,uav,k" ",sjm ,uav,k" ",sfum ,uav,k" ",elhkdm ,uav,k" ",jsum ,uav,k" ",eghe,k" ",,hp] ,eghe,k" ",hekhk ,eghe,k" ",eghem ,eghe,k" ",hvfum ,eghe,k" ",olsm ,eghe,k" ",sjm ,eghe,k" ",sfum ,eghe,k" ",elhkdm ,eghe,k" ",jsum ,eghe,k" ",hvfu,k" ",,hp] ,hvfu,k" ",hekhk ,hvfu,k" ",eghem ,hvfu,k" ",hvfum ,hvfu,k" ",olsm ,hvfu,k" ",sjm ,hvfu,k" ",sfum ,hvfu,k" ",elhkdm ,hvfu,k" ",jsum ,hvfu,k" ",ols,k" ",,hp] ,ols,k" ",hekhk ,ols,k" ",eghem ,ols,k" ",hvfum ,ols,k" ",olsm ,ols,k" ",sjm ,ols,k" ",sfum ,ols,k" ",elhkdm ,ols,k" ",jsum ,ols,k" ",sj,k" ",,hp] ,sj,k" ",hekhk ,sj,k" ",eghem ,sj,k" ",hvfum ,sj,k" ",olsm ,sj,k" ",sjm ,sj,k" ",sfum ,sj,k" ",elhkdm ,sj,k" ",jsum ,sj,k" ",sfu,k" ",,hp] ,sfu,k" ",hekhk ,sfu,k" ",eghem ,sfu,k" ",hvfum ,sfu,k" ",olsm ,sfu,k" ",sjm ,sfu,k" ",sfum ,sfu,k" ",elhkdm ,sfu,k" ",jsum ,sfu,k" ",elhk,k" ",,hp] ,elhk,k" ",hekhk ,elhk,k" ",eghem ,elhk,k" ",hvfum ,elhk,k" ",olsm ,elhk,k" ",sjm ,elhk,k" ",sfum ,elhk,k" ",elhkdm ,elhk,k" ",jsum ,elhk,k" ",jsu,k" ",,hp] ,jsu,k" ",hekhk ,jsu,k" ",eghem ,jsu,k" ",hvfum ,jsu,k" ",olsm ,jsu,k" ",sjm ,jsu,k" ",sfum ,jsu,k" ",elhkdm ,jsu,k" ",jsum ,jsu,k"))
                       " skjljvh lvfu"
                   )
               )
           )
       )
   )
   (princ)
)

Edited by Lee Mac
Link to comment
Share on other sites

Thank you Lee Mac for help me, and i have another request please, can you do this lisp by selection the number instead of writing the number :)

Link to comment
Share on other sites

Thank you Lee Mac for help me, and i have another request please, can you do this lisp by selection the number instead of writing the number :)

 

Should the selected text be replaced, or should a new text object be created?

Link to comment
Share on other sites

should a new text object be created please or replaced but with another text not with the orginal number text

Link to comment
Share on other sites

Try the following:

(defun c:nc ( / f n p )
   (setq f '(( x ) (fix (+ x 1e-)))
   (initget 6)
   (if (and (setq n (getnumber "\nSelect number: "))
            (setq p (getpoint "\nSpecify point for text: "))
       )
       (entmake
           (list
              '(0 . "TEXT")
               (cons 40 (getvar 'textsize))
               (cons 10 p)
               (cons 01
                   (strcat
                       (nth (f (/ n 100)) '("" "lhzm" "lzjhk" "eghelhzm" "hvfulhzm" "olslhzm" "sjlhzm"  "sfulhzm" "elhklhzm" "jsulhzm")) " "
                       (nth (f (rem n 10)) '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum")) " "
                       (nth (f (/ (rem n 100) 10)) '("" ",uav" ",uav,k" ",eghe,k" ",hvfu,k" ",ols,k" ",sj,k" ",sfu,k" ",elhk,k" ",jsu,k")) " ljvh lvfu "
                       (nth (f (* 100 (rem n 1))) '("" ",,hp]" ",hekhk" ",eghem" ",hvfum" ",olsm" ",sjm" ",sfum" ",elhkdm" ",jsum" ",uavm" ",hp] uav" ",hekh uav" ",eghem uav" ",hvfum uav" ",olsm uav" ",sjm uav" ",sfum uav" ",elhkdm uav" ",jsum uav" ",uav,k" ",,hp] ,uav,k" ",hekhk ,uav,k" ",eghem ,uav,k" ",hvfum ,uav,k" ",olsm ,uav,k" ",sjm ,uav,k" ",sfum ,uav,k" ",elhkdm ,uav,k" ",jsum ,uav,k" ",eghe,k" ",,hp] ,eghe,k" ",hekhk ,eghe,k" ",eghem ,eghe,k" ",hvfum ,eghe,k" ",olsm ,eghe,k" ",sjm ,eghe,k" ",sfum ,eghe,k" ",elhkdm ,eghe,k" ",jsum ,eghe,k" ",hvfu,k" ",,hp] ,hvfu,k" ",hekhk ,hvfu,k" ",eghem ,hvfu,k" ",hvfum ,hvfu,k" ",olsm ,hvfu,k" ",sjm ,hvfu,k" ",sfum ,hvfu,k" ",elhkdm ,hvfu,k" ",jsum ,hvfu,k" ",ols,k" ",,hp] ,ols,k" ",hekhk ,ols,k" ",eghem ,ols,k" ",hvfum ,ols,k" ",olsm ,ols,k" ",sjm ,ols,k" ",sfum ,ols,k" ",elhkdm ,ols,k" ",jsum ,ols,k" ",sj,k" ",,hp] ,sj,k" ",hekhk ,sj,k" ",eghem ,sj,k" ",hvfum ,sj,k" ",olsm ,sj,k" ",sjm ,sj,k" ",sfum ,sj,k" ",elhkdm ,sj,k" ",jsum ,sj,k" ",sfu,k" ",,hp] ,sfu,k" ",hekhk ,sfu,k" ",eghem ,sfu,k" ",hvfum ,sfu,k" ",olsm ,sfu,k" ",sjm ,sfu,k" ",sfum ,sfu,k" ",elhkdm ,sfu,k" ",jsum ,sfu,k" ",elhk,k" ",,hp] ,elhk,k" ",hekhk ,elhk,k" ",eghem ,elhk,k" ",hvfum ,elhk,k" ",olsm ,elhk,k" ",sjm ,elhk,k" ",sfum ,elhk,k" ",elhkdm ,elhk,k" ",jsum ,elhk,k" ",jsu,k" ",,hp] ,jsu,k" ",hekhk ,jsu,k" ",eghem ,jsu,k" ",hvfum ,jsu,k" ",olsm ,jsu,k" ",sjm ,jsu,k" ",sfum ,jsu,k" ",elhkdm ,jsu,k" ",jsum ,jsu,k"))
                       " skjljvh lvfu"
                   )
               )
           )
       )
   )
   (princ)
)
(defun getnumber ( msg / ent enx num )
   (while
       (progn (setvar 'errno 0) (setq ent (car (entsel msg)))
           (cond
               (   (= 7 (getvar 'errno))
                   (princ "\nMissed, try again.")
               )
               (   (null ent) nil)
               (   (not (wcmatch (cdr (assoc 0 (setq enx (entget ent))))"*TEXT"))
                   (princ "\nPlease select a text object.")
               )
               (   (not (setq num (distof (cdr (assoc 1 enx)))))
                   (princ "\nText content is not numerical.")
               )
           )
       )
   )
   num
)
(princ)

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