Author Topic: offset label probelm  (Read 138 times)

0 Members and 2 Guests are viewing this topic.

dussla

  • Bull Frog
  • Posts: 259
offset label probelm
« on: July 30, 2020, 12:20:04 AM »
hi firends
sorry many ask ~~
i made with other code 
but there is some problem
i need good label
i attached dwg file
pls pls can you help again ?

(defun c:muoff (/ s i d p v)
(setvar "DIMTMOVE"    1) 
 (setvar "DIMATFIT"     0)
 (setvar "DIMTOFL"     0)
 (setvar "DIMTAD" 1)

 (if (and (setq s (car (entsel "\n Select entity :")))
          (member (cdr (assoc 0 (entget s))) '( "CIRCLE" ))
          (setq i (getint "\n number of offset times :"))
     
        (setq d 500)
          (setq p (getpoint "\n Specify point on side to offset :"))
          (setq v d)
     )
   (repeat i
         (command "_.offset" d s p "")
         (setq enl (entlast) )
           (setq elist (entget enl)
           cp (cdr (assoc 10 elist))
           rad (cdr (assoc 40 elist))
           pt (trans (polar cp (/ pi -2) rad) 1 0))
           (vl-cmdf "_.dimradius"
              (ssname (ssget pt '((0 . "circle"))) 0)
              pt
              )
         (setq d (+ d v))
   
   
   )
   
   
 )
 

 
 (princ)
)




DEVITG

  • Bull Frog
  • Posts: 442
Re: offset label probelm
« Reply #1 on: July 30, 2020, 05:02:59 PM »
Hi Dussla , do you mean label to be TEXT , and not DIMENSION_
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Dlanor

  • Bull Frog
  • Posts: 236
Re: offset label probelm
« Reply #2 on: July 30, 2020, 06:58:42 PM »
Thought I had replied earlier.  :thinking:

Try this
Code - Auto/Visual Lisp: [Select]
  1. (defun rh:cdns ( n dp / i fp lst nlst str)
  2.   (if (equal 0.0 (rem n 1.0) 1.0e-4) (setq i (fix n) fp nil) (setq i (fix n) fp (substr (rtos (- n i) 2 dp) 2)))
  3.   (setq lst (reverse (vl-string->list (itoa i))))
  4.   (while lst
  5.     (cond ( (<= (length lst) 3) (setq nlst (strcat (apply 'strcat (mapcar 'chr (reverse lst))) (apply 'strcat (mapcar 'chr nlst))) lst nil))
  6.           (t (repeat 3 (setq nlst (cons (car lst) nlst) lst (cdr lst))) (setq nlst (cons 44 nlst)))
  7.     )
  8.   )
  9.   (if fp (setq str (strcat nlst fp)) nlst)
  10. )
  11.  
  12. (defun c:muoff (/ s i d p v enl elist cp rad pt)
  13.   (setvar "DIMTMOVE"    1)
  14.   (setvar "DIMATFIT"     0)
  15.   (setvar "DIMTOFL"     0)
  16.   (setvar "DIMTAD" 1)
  17.  
  18.   (if (and (setq s (car (entsel "\n Select entity :")))
  19.            (member (cdr (assoc 0 (entget s))) '( "CIRCLE" ))
  20.            (setq i (getint "\n number of offset times :"))
  21.            (setq d 500)
  22.            (setq p (getpoint "\n Specify point on side to offset :"))
  23.            (setq v d)
  24.            (setq tht 150)
  25.       )
  26.     (repeat i
  27.       (command "_.offset" d s p "")
  28.       (setq enl (entlast) )
  29.       (setq elist (entget enl)
  30.             cp (cdr (assoc 10 elist))
  31.             rad (cdr (assoc 40 elist))
  32.             str (rh:cdns rad)
  33.             pt (trans (polar cp (* pi 1.5) (+ rad (* tht 1.5))) 1 0)
  34.       )
  35.        (entmakex (list (cons 0 "TEXT")
  36.                        (cons 8 "test")
  37.                        (cons 10  pt)
  38.                        (cons 40 tht)
  39.                        (cons 1 str)
  40.                        (cons 7 "chos3")
  41.                        (cons 72 1)
  42.                        (cons 11  pt)
  43.                        (cons 73 1)
  44.                  )
  45.        )
  46.       (setq d (+ d v))
  47.     )
  48.   )
  49.  (princ)
  50. )
  51.  

dussla

  • Bull Frog
  • Posts: 259
Re: offset label probelm
« Reply #3 on: July 30, 2020, 08:41:55 PM »
Hi Dussla , do you mean label to be TEXT , and not DIMENSION_

yes text ~~~
thank you for reply

dussla

  • Bull Frog
  • Posts: 259
Re: offset label probelm
« Reply #4 on: July 30, 2020, 08:48:50 PM »
thank you for  good  code ~
wow
wow
wow
perpect~~

REALLY REALLY THANK YOU  always~
« Last Edit: July 30, 2020, 09:07:56 PM by dussla »