Author Topic: Arc Text Editor  (Read 7532 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Arc Text Editor
« Reply #15 on: October 07, 2004, 02:34:08 PM »
Now I understand what you were talking about! Try this.
Code: [Select]


(defun make-txt (str pt / txt_ent)
  (if
(entmake
 (list
'(0 . "MTEXT")
'(100 . "AcDbEntity")
(cons 8 (getvar "clayer"))
'(100 . "AcDbMText")
(cons 10 pt)
(cons 40 (getvar "textsize"))
'(71 . 1)
'(72 . 5)
(cons 1 str)
(cons 7 (getvar "textstyle"))
'(73 . 1)
)
 )
txt_ent
)
  )

(defun c:c2m (/ ent c_text ins_pt mt_ent)

  (if (setq ent (car (entsel "\nSelect Curved Text: ")))
(if (= (cdr (assoc 0 (entget ent))) "AEC_CURVETEXT")
 (progn
(setq c_text (cdr (assoc 1 (entget ent))))
(if (vl-string-search "\r\n" c_text)
 (setq c_text (vl-string-subst "\\P" "\r\n" c_text))
 )
)
 )
; else
(progn
 (alert "Selected text was not Curved Text")
 (exit)
 )
)

  (if (setq ins_pt (getpoint "\Text insertion point: "))
(setq mt_ent (make-txt c_text ins_pt))
)
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Arc Text Editor
« Reply #16 on: October 07, 2004, 02:38:02 PM »
Quote from: Keith
Mark you have a misplaced closing parenthesis... the fact that you have been working in C++ is showing through...

Keith I went back and checked my original code but couldn't find the misplaced paren.  :?
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Arc Text Editor
« Reply #17 on: October 07, 2004, 03:14:13 PM »
Maybe this will help you see it ...


Code: [Select]

(defun c:c2m (/ ent c_text ins_pt mt_ent)
  (if (setq ent (car(entsel "\nSelect Curved Text: "))) ;IF#1
    (if(=(cdr(assoc 0 (entget ent)))"AEC_CURVETEXT");IF#2
      (progn    ;first argument of IF#2
        (setq c_text (cdr (assoc 1 (entget ent))))
        (if(vl-string-search "\r\n" c_text) ;IF#3
          (setq c_text (vl-string-subst "\\P" "\r\n" c_text))
        );_ IF#3
      );_progn
     ;note no second argument for IF#2
     );IF#2    <----------------- this closing parenthesis   ------------
   ; else
;;Second arg of IF#1 (should be second arg of IF#2)
;;what is happening is you are saying that if ENT is nil
;;tell the user that curved text was not found when you should
;;be telling the user that the ENT selected is not curved text        
   (progn                                                                                  
      (alert "Selected text was not Curved Text")
     (exit)
    );_progn
  ;) <-----------------------should go here -------------------
  );_IF#1
  (if (setq ins_pt (getpoint "\Text insertion point: "))
    (setq mt_ent (make-txt c_text ins_pt))
  )
  (princ)
);_defun
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
Arc Text Editor
« Reply #18 on: October 07, 2004, 03:23:50 PM »
One of those "can't see the trees for the forest" kinda things.

thanks.
TheSwamp.org  (serving the CAD community since 2003)