Author Topic: Ohm symbol  (Read 2203 times)

0 Members and 1 Guest are viewing this topic.

Adesu

  • Guest
Ohm symbol
« on: May 25, 2007, 02:58:50 AM »
Hi Alls,
I just create a simple code to write an ohm symbol, but in area drawing it can't write it.
Code: [Select]
(defun c:test (/ loc th str)
  (if
    (setq loc '(0 0 0))
    (progn
      (setq th 2)
      (setq str "\"U+2126")
      (command "_text" loc th "" str 0)
      )  ; progn
    )    ; if
  (princ)
  )      ; defun

Adesu

  • Guest
Re: Ohm symbol
« Reply #1 on: May 25, 2007, 03:14:40 AM »
Oops, sorry it just solve the problem
Code: [Select]
(defun c:test (/ loc th str)
  (if
    (setq loc '(0 0 0))
    (progn
      (setq th 2)
      (setq str (strcat (chr 92) "U+2126"))
      (command "_text" loc th "" str 0)
      )  ; progn
    )    ; if
  (princ)
  )      ; defun

Hi Alls,
I just create a simple code to write an ohm symbol, but in area drawing it can't write it.
Code: [Select]
(defun c:test (/ loc th str)
  (if
    (setq loc '(0 0 0))
    (progn
      (setq th 2)
      (setq str "\"U+2126")
      (command "_text" loc th "" str 0)
      )  ; progn
    )    ; if
  (princ)
  )      ; defun

Adesu

  • Guest
Re: Ohm symbol
« Reply #2 on: May 25, 2007, 03:35:57 AM »
I'm still got problem if that code would combine with other function, like this
Code: [Select]
(if                                                            ; 1).
    (not (tblsearch "style" "Isoct"))                            ; 1).
    (command "_style" "Isoct" "Isoct" 1 1 0 "n" "n" "n")
    (alert (strcat "\nStyle name of " "Isoct" " still exist"))   ; 1). 2).
    )
  (setq loc '(0 0 0))
  (setq th 1)
  (setq str (strcat (chr 92) "U+2126"))
  (command "_text" loc th "" str 0)
  (setq el (entlast))
  (setq sse (entget el))
  (setq ohm (cdr (assoc 1 sse))) 
  (setq val (getstring (strcat "\nENTER VALUE OF RESISTOR<3.5M " ohm ">: ")))

I mean the symbol of ohm should display at "val", any idea ?

lispman21

  • Guest
Re: Ohm symbol
« Reply #3 on: May 25, 2007, 10:43:37 AM »
Here is another way to code it although this does not fix the fact that the ohm symbol does not show when prompted to enter resistor value.

Code: [Select]
(defun c:test (/ loc th str)
(if                                                            ; 1).
    (not (tblsearch "style" "Isoct"))                            ; 1).
    (command "_style" "Isoct" "Isoct" 1 1 0 "n" "n" "n")
    (alert (strcat "\nStyle name of " "Isoct" " still exist"))   ; 1). 2).
    )
  (setq loc '(0 0 0))
  (setq th 1)
  (setq str (strcat (chr 92) "U+2126"))
  (setq val (getstring (strcat "\nENTER VALUE OF RESISTOR<3.5M ohm >: ")))
  (setq ohm (strcat val str))
  (entmake
   (list
      '(0 . "TEXT")
      '(67 . 0)
      '(100 . "AcDbText")
       (cons 10 loc)
       (cons 40 th)
       (cons 1 ohm)
      '(7 . "Isoct")
      '(50 . 0.0)
      '(41 . 1.0)
      '(51 . 0.0)
      '(71 . 0)
      '(72 . 1)
       (cons 11 loc)
      '(73 . 2)
    )
  )
)