Author Topic: Placing Text with bad results  (Read 1538 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2081
Placing Text with bad results
« on: September 06, 2016, 09:11:10 AM »
When zoomed in close to the line for placing the text, the text is placed correctly. If zoomed out the text is not placed as per the routine.
Why does zoomed in make a difference, and how can I fix it.

I always want (setq pnt2 (polar pnt1 (+ ang1 2) 3)) to work.

Thanks


Code: [Select]

(defun RTIT (/ rline firstendpnt secondendpnt pnt1 pnt2 ang1 txt agl ang angd xx) 
  (setvar "CMDECHO" 0)
  (setvar "OSMODE" 512) 
  (setq rline     (entsel "\n* Pick Roof Line: ")
        firstendpnt  (trans (cdr (assoc 10 (entget (car rline)))) 0 1)
        secondendpnt (trans (cdr (assoc 11 (entget (car rline)))) 0 1)
        ang1         (angle firstendpnt secondendpnt)
        pnt1         (arch:mid firstendpnt secondendpnt)
        )
  (if (and (<= ang1 4.71239)(> ang1 1.5708))(setq ang1 (angle secondendpnt firstendpnt)))
  (setq pnt2 (polar pnt1 (+ ang1 2) 3))

  (command "_.text" "j" "bc" pnt2 "" 0 (strcase ITEM))
  (setq AG (angle firstendpnt secondendpnt))
           (if (and (<= ang1 4.71239)(> ang1 1.5708))(setq ang1 (angle secondendpnt firstendpnt)))
           (setq AGL (car (list (cons 50 ang1))))
           (setq N 0)
           (setq TXT (ssget "L"))
           (repeat (sslength TXT)
             (setq
               Elist (subst AGL (assoc 50 (entget (ssname TXT N))) (entget (ssname TXT N))))
             (entmod Elist)
             (entupd (ssname TXT N))
             (setq N (+ N 1)))
  (princ))

(defun C:RT ()
 ; (ARCH:F_S-VAR)
 ; (cond ((= ARCH#CLAY "Off") (ARCH:LYR "A-ROOF-NOTE")))
 ; (ARCH:SET-ARIAL)
  (initget 7 "G H R K V E")
  (setq TYP (getkword "\n* Select: [Gable, Hip, Ridge, raKe, Valley, Enter text: ] *"))
  (cond ((= TYP "G") (setq ITEM "GABLE"))
        ((= TYP "H") (setq ITEM "HIP"))
        ((= TYP "R") (setq ITEM "RIDGE"))
        ((= TYP "K") (setq ITEM "RAKE"))
        ((= TYP "V") (setq ITEM "VALLEY"))
        ((= TYP "E") (setq ITEM (getstring 1 "\n* Type in text: ")))
  ) 
  (while (/= (getvar "cmdactive") 1)(RTIT)) 
 ; (ARCH:F_R-VAR)
  (princ)
)

Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Placing Text with bad results
« Reply #1 on: September 06, 2016, 09:27:50 AM »
(defun ARCH:MID  (w z)
  (list (/ (+ (car w) (car z)) 2) (/ (+ (cadr w) (cadr z)) 2)))
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Placing Text with bad results
« Reply #2 on: September 06, 2016, 09:40:13 AM »
Seems like a *classic* running osnap issue.
Change osmode or use "_non" to override.

EDIT: typo.
« Last Edit: September 06, 2016, 09:59:52 AM by roy_043 »

GDF

  • Water Moccasin
  • Posts: 2081
Re: Placing Text with bad results
« Reply #3 on: September 06, 2016, 09:43:50 AM »
Works perfectly now. Thank you very much!
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Placing Text with bad results
« Reply #4 on: September 06, 2016, 10:50:43 AM »
Here is the updated routine with sub functions included:
Command name RT.

If you cannot get the sub functions to work, just comment them out, or remove them in the main routine.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64