Author Topic: which code can change Tolerance Display to Basic  (Read 3132 times)

0 Members and 1 Guest are viewing this topic.

masao

  • Newt
  • Posts: 97
which code can change Tolerance Display to Basic
« on: October 21, 2023, 05:22:58 AM »
which code can change Tolerance Display to Basic,how to change to picture showing by lisp?

HOSNEYALAA

  • Newt
  • Posts: 106
Re: which code can change Tolerance Display to Basic
« Reply #1 on: October 21, 2023, 07:52:04 AM »
try

Code: [Select]
c#

(defun c:ccdtoleranceDisplay (/ DT ENT ID SDT)
  (setq dt  (ssget '((0 . "DIMENSION")))
        sdt (sslength dt)
        id  0

  ) ;_ end of setq
  (repeat sdt

    (progn
      (setq
        ent (ssname dt id)
        id  (1+ id)

      ) ;_ end of setq

      (vlax-put-property
        (vlax-ename->vla-object ent)
        'toleranceDisplay
        4
      ) ;_ end of vlax-put-property
    ) ;_ end of progn
  ) ;_ end of repeat
 
 
  (princ)
) ;_ end of defun
;;;;;;;;;;;;;;;;;;;;;;;;;;

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #2 on: October 22, 2023, 02:43:14 AM »
thank you very much.

i know how to change in cad,but i don't know how to change by lisp.

i can not find which code can change it.

thanks your teach,thank you very much.

BIGAL

  • Swamp Rat
  • Posts: 1434
  • 40 + years of using Autocad
Re: which code can change Tolerance Display to Basic
« Reply #3 on: October 22, 2023, 06:32:04 PM »
You can add the rest of code required.

Code: [Select]
(setq obj (vlax-ename->vla-object (car  (entsel "Pick dim to remove tolerance "))))
(vla-put-tolerancedisplay obj 0)
A man who never made a mistake never made anything

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #4 on: March 19, 2024, 08:25:06 AM »
How to get Basic+Deviation?

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #5 on: March 30, 2024, 03:21:32 AM »
if dimension Deviation how to get basic and keep Deviation?

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: which code can change Tolerance Display to Basic
« Reply #6 on: March 31, 2024, 08:42:19 AM »
Unless I've misunderstood, something like this?

Code - Auto/Visual Lisp: [Select]
  1. (defun getdimtext ( ent / blk btr enx rtn )
  2.     (if (and (setq enx (entget ent))
  3.              (setq blk (cdr (assoc 2 enx)))
  4.              (setq btr (tblobjname "block" blk))
  5.         )
  6.         (while (and (setq btr (entnext btr)) (not rtn))
  7.             (if (= "MTEXT" (cdr (assoc 0 (setq enx (entget btr)))))
  8.                 (setq rtn (cdr (assoc 1 enx)))
  9.             )
  10.         )
  11.     )
  12.     rtn
  13. )

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #7 on: April 06, 2024, 06:58:08 AM »
Unless I've misunderstood, something like this?

Code - Auto/Visual Lisp: [Select]
  1. (defun getdimtext ( ent / blk btr enx rtn )
  2.     (if (and (setq enx (entget ent))
  3.              (setq blk (cdr (assoc 2 enx)))
  4.              (setq btr (tblobjname "block" blk))
  5.         )
  6.         (while (and (setq btr (entnext btr)) (not rtn))
  7.             (if (= "MTEXT" (cdr (assoc 0 (setq enx (entget btr)))))
  8.                 (setq rtn (cdr (assoc 1 enx)))
  9.             )
  10.         )
  11.     )
  12.     rtn
  13. )

i use code but not change just get princ "305,71±0,08"

i want to add dimension text box,dimension or text replacement dimension use HOSNEYALAA's code is ok.

but Deviation dimension can not keep Symmetrical tolerance.

i post picture is else lisp make it,but i don't know how to get it,or lisp can not do it?

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #8 on: April 06, 2024, 07:32:43 AM »
You mean something like this - look at picture and DWG... I just changed height of tolerances from 1.0 to 0.5...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #9 on: April 08, 2024, 08:38:25 AM »
You mean something like this - look at picture and DWG... I just changed height of tolerances from 1.0 to 0.5...

sorry,i use picture to express whit i mean.

thanks for your reply.

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #10 on: April 08, 2024, 09:15:10 AM »
You can add the rest of code required.

Code: [Select]
(setq obj (vlax-ename->vla-object (car  (entsel "Pick dim to remove tolerance "))))
(vla-put-tolerancedisplay obj 0)

Isn't this what you want... BIGAL already answered...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #11 on: April 08, 2024, 10:15:30 AM »
You can add the rest of code required.

Code: [Select]
(setq obj (vlax-ename->vla-object (car  (entsel "Pick dim to remove tolerance "))))
(vla-put-tolerancedisplay obj 0)

Isn't this what you want... BIGAL already answered...

i want chang to (vla-put-tolerancedisplay obj 4) and keep text box. like this picture.it is use autolist to make?or use VBA?

this picture is else lisp make it but i want to know how to make text box like basic(vla-put-tolerancedisplay obj 0).

i want to get add text box result.
« Last Edit: April 08, 2024, 10:23:26 AM by masao »

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #12 on: April 08, 2024, 02:33:53 PM »
To change dimstyle to one with text frame you have to change DXF 147 code from this example to negative value and to remove deviations you'll have to remove rest of MTEXT in DXF 1 code... Something like this example, but if you want to do this fast I don't see why not just using (MA) - matchprop like you described... Anyway, there is no system variable for frame like DIM* only DIMGAP - also negative for text frame...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimtolerances ( / *error* s i e o ox )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (prompt "\nSelect DIMENSION entities...")
  10.   (setq s (ssget "_:L" (list (cons 0 "DIMENSION"))))
  11.   (repeat (setq i (sslength s))
  12.     (setq e (ssname s (setq i (1- i))))
  13.     (cond
  14.       ( (= (vla-get-tolerancedisplay (setq o (vlax-ename->vla-object e))) 0)
  15.         (vla-put-tolerancedisplay o 4)
  16.         (setq ox (entget (tblobjname "dimstyle" (cdr (assoc 3 (entget e)))) (list "*")))
  17.         (if (> (cdr (assoc 147 ox)) 0)
  18.           (entupd (cdr (assoc -1 (entmod (subst (cons 147 (- 0 (cdr (assoc 147 ox)))) (assoc 147 ox) ox)))))
  19.         )
  20.         (setvar (quote dimgap) (if (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) (getvar (quote dimgap))))
  21.       )
  22.       ( (> (vla-get-tolerancedisplay o) 0)
  23.         (vla-put-tolerancedisplay o 0)
  24.         (setq ox (entget (tblobjname "dimstyle" (cdr (assoc 3 (entget e)))) (list "*")))
  25.         (if (< (cdr (assoc 147 ox)) 0)
  26.           (entupd (cdr (assoc -1 (entmod (subst (cons 147 (abs (cdr (assoc 147 ox)))) (assoc 147 ox) ox)))))
  27.         )
  28.         (setvar (quote dimgap) (if (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) (getvar (quote dimgap))))
  29.       )
  30.     )
  31.     (entupd e)
  32.   )
  33.   (*error* nil)
  34. )
  35.  
« Last Edit: April 08, 2024, 07:25:13 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #13 on: April 08, 2024, 07:17:55 PM »
To change dimstyle to one with text frame you have to change DXF 147 code from this example to negative value and to remove deviations you'll have to remove rest of MTEXT in DXF 1 code... Something like this example, but if you want to do this fast I don't see why not just using (MA) - matchprop like you described... Anyway, there is no system variable for frame like DIM*...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ( / *error* s i e o ox )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (prompt "\nSelect DIMENSION entities...")
  10.   (setq s (ssget "_:L" (list (cons 0 "DIMENSION"))))
  11.   (repeat (setq i (sslength s))
  12.     (setq e (ssname s (setq i (1- i))))
  13.     (cond
  14.       ( (= (vla-get-tolerancedisplay (setq o (vlax-ename->vla-object e))) 0)
  15.         (vla-put-tolerancedisplay o 4)
  16.         (setq ox (entget (tblobjname "dimstyle" (cdr (assoc 3 (entget e)))) (list "*")))
  17.         (if (> (cdr (assoc 147 ox)) 0)
  18.           (entupd (cdr (assoc -1 (entmod (subst (cons 147 (- 0 (cdr (assoc 147 ox)))) (assoc 147 ox) ox)))))
  19.         )
  20.       )
  21.       ( (= (vla-get-tolerancedisplay o) 4)
  22.         (vla-put-tolerancedisplay o 0)
  23.         (setq ox (entget (tblobjname "dimstyle" (cdr (assoc 3 (entget e)))) (list "*")))
  24.         (if (< (cdr (assoc 147 ox)) 0)
  25.           (entupd (cdr (assoc -1 (entmod (subst (cons 147 (abs (cdr (assoc 147 ox)))) (assoc 147 ox) ox)))))
  26.         )
  27.       )
  28.     )
  29.     (entupd e)
  30.   )
  31.   (*error* nil)
  32. )
  33.  

thanks so much. i just want to know from (vla-put-tolerancedisplay obj 4) change to (vla-put-tolerancedisplay obj 4)+text box like (vla-put-tolerancedisplay obj 0) by autolisp ←it is possible?

other lisp can do if but can not see code ,so i don't know other lisp how to do it. or it is use other programming language.

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #14 on: April 08, 2024, 07:31:32 PM »
I've changed the code - see my latest revision in post above... ^^^^ It removes tolerances and toggles text frames... That's what you described in your firstly posted pictures... I hope that's what you initialy searched for...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #15 on: April 09, 2024, 06:22:17 AM »
Here, I've finished this LISP... I think you are searching something like this :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimtolerances ( / *error* e ch chh )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (while (setq e (car (entsel "\nPick DIMENSION... - ENTER for FINISH...")))
  10.     (initget "Yes No")
  11.     (setq ch (cond ( (getkword "\nDo you want to keep symetrical deviation or not [Yes/No] <Yes> : ") ) ("Yes")))
  12.     (if (= ch "Yes")
  13.       (progn
  14.         (setvar (quote dimtol) 1)
  15.         (setvar (quote dimtm) 0)
  16.         (setvar (quote dimtp) 0)
  17.         (setvar (quote dimtdec) 2)
  18.         (setvar (quote dimtzin) 0)
  19.         (initget "Yes No")
  20.         (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  21.         (if (= chh "Yes")
  22.           (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  23.           (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  24.         )
  25.         (vl-cmdf "_.-dimstyle" "_a" e "")
  26.       )
  27.       (progn
  28.         (setvar (quote dimtol) 0)
  29.         (initget "Yes No")
  30.         (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  31.         (if (= chh "Yes")
  32.           (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  33.           (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  34.         )
  35.         (vl-cmdf "_.-dimstyle" "_a" e "")
  36.       )
  37.     )
  38.     (entupd e)
  39.   )
  40.   (*error* nil)
  41. )
  42.  

HTH.
M.R.
« Last Edit: April 09, 2024, 07:34:35 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #16 on: April 09, 2024, 07:58:27 AM »
Better yet - selecting multiple dimensions...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimtolerances-ss ( / *error* ch chh s i e )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (initget "Yes No")
  10.   (setq ch (cond ( (getkword "\nDo you want to keep symetrical deviation or not [Yes/No] <Yes> : ") ) ("Yes")))
  11.   (if (= ch "Yes")
  12.     (progn
  13.       (setvar (quote dimtol) 1)
  14.       (setvar (quote dimtm) 0)
  15.       (setvar (quote dimtp) 0)
  16.       (setvar (quote dimtdec) 2)
  17.       (setvar (quote dimtzin) 0)
  18.       (initget "Yes No")
  19.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  20.       (if (= chh "Yes")
  21.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  22.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  23.       )
  24.     )
  25.     (progn
  26.       (setvar (quote dimtol) 0)
  27.       (initget "Yes No")
  28.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  29.       (if (= chh "Yes")
  30.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  31.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  32.       )
  33.     )
  34.   )
  35.   (prompt "\nSelect DIMENSION entities...")
  36.   (setq s (ssget "_:L" (list (cons 0 "DIMENSION"))))
  37.   (repeat (setq i (sslength s))
  38.     (setq e (ssname s (setq i (1- i))))
  39.     (vl-cmdf "_.-dimstyle" "_a" e "")
  40.     (entupd e)
  41.   )
  42.   (*error* nil)
  43. )
  44.  

HTH.
M.R.
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #17 on: April 09, 2024, 08:49:10 AM »
I've added lower and upper deviations choices...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimtolerances-ss ( / *error* ch chh tm tp s i e )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (initget "Yes No")
  10.   (setq ch (cond ( (getkword "\nDo you want to add or keep deviation or not [Yes/No] <Yes> : ") ) ("Yes")))
  11.   (if (= ch "Yes")
  12.     (progn
  13.       (setvar (quote dimtol) 1)
  14.       (setq tm (getreal "\nSpecify lower deviation - for symetrical it must be negative number <0.0> : "))
  15.       (if (not tm)
  16.         (setq tm 0.0)
  17.       )
  18.       (setvar (quote dimtm) (- tm))
  19.       (setq tp (getreal (strcat "\nSpecify upper deviation - it must be higher number than : " (rtos tm 2) " - and for symetrical must be the same but positive value (" (rtos (- tm) 2) ") <0.0> : ")))
  20.       (if (not tp)
  21.         (setq tp 0.0)
  22.       )
  23.       (setvar (quote dimtp) tp)
  24.       (setvar (quote dimtdec) 2)
  25.       (setvar (quote dimtzin) 0)
  26.       (initget "Yes No")
  27.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  28.       (if (= chh "Yes")
  29.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  30.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  31.       )
  32.     )
  33.     (progn
  34.       (setvar (quote dimtol) 0)
  35.       (initget "Yes No")
  36.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  37.       (if (= chh "Yes")
  38.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  39.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  40.       )
  41.     )
  42.   )
  43.   (prompt "\nSelect DIMENSION entities...")
  44.   (setq s (ssget "_:L" (list (cons 0 "DIMENSION"))))
  45.   (repeat (setq i (sslength s))
  46.     (setq e (ssname s (setq i (1- i))))
  47.     (vl-cmdf "_.-dimstyle" "_a" e "")
  48.     (entupd e)
  49.   )
  50.   (*error* nil)
  51. )
  52.  

M.R.
« Last Edit: April 09, 2024, 12:16:12 PM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #18 on: April 09, 2024, 09:16:56 AM »
I've added lower and upper deviations choices...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:dimtolerances-ss ( / *error* ch chh tm tp s i e )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if m (prompt m))
  6.     (princ)
  7.   )
  8.  
  9.   (initget "Yes No")
  10.   (setq ch (cond ( (getkword "\nDo you want to keep deviation or not [Yes/No] <Yes> : ") ) ("Yes")))
  11.   (if (= ch "Yes")
  12.     (progn
  13.       (setvar (quote dimtol) 1)
  14.       (initget 1)
  15.       (setq tm (getreal "\nSpecify lower deviation : "))
  16.       (setvar (quote dimtm) (- tm))
  17.       (initget 1)
  18.       (setq tp (getreal (strcat "\nSpecify upper deviation - for symertical, type : " (rtos (- tm) 2) " : ")))
  19.       (setvar (quote dimtp) tp)
  20.       (setvar (quote dimtdec) 2)
  21.       (setvar (quote dimtzin) 0)
  22.       (initget "Yes No")
  23.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  24.       (if (= chh "Yes")
  25.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  26.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  27.       )
  28.     )
  29.     (progn
  30.       (setvar (quote dimtol) 0)
  31.       (initget "Yes No")
  32.       (setq chh (cond ( (getkword "nDo you want text frame or not [Yes/No] <Yes> : ") ) ("Yes")))
  33.       (if (= chh "Yes")
  34.         (setvar (quote dimgap) (cond ( (> (getvar (quote dimgap)) 0) (- 0 (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  35.         (setvar (quote dimgap) (cond ( (< (getvar (quote dimgap)) 0) (abs (getvar (quote dimgap))) ) ( t (getvar (quote dimgap)))))
  36.       )
  37.     )
  38.   )
  39.   (prompt "\nSelect DIMENSION entities...")
  40.   (setq s (ssget "_:L" (list (cons 0 "DIMENSION"))))
  41.   (repeat (setq i (sslength s))
  42.     (setq e (ssname s (setq i (1- i))))
  43.     (vl-cmdf "_.-dimstyle" "_a" e "")
  44.     (entupd e)
  45.   )
  46.   (*error* nil)
  47. )
  48.  

M.R.

thanks ,if add textbox to (vla-put-tolerancedisplay obj 4) ,i must get which metadata? (get size and dimtp and dimtm)

dimgp can add textbox?

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #19 on: April 09, 2024, 09:30:57 AM »
You quoted my code that is not last one... Copy with ctrl+c and ctrl+v the code into notepad and save it as *.lsp - be sure that all file types are selected from notepad before you save it as *.lsp... I am tired now and don't understand what else do you want... It works for me perfectly...

Bye and best wishes...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

masao

  • Newt
  • Posts: 97
Re: which code can change Tolerance Display to Basic
« Reply #20 on: April 09, 2024, 09:58:22 AM »
You quoted my code that is not last one... Copy with ctrl+c and ctrl+v the code into notepad and save it as *.lsp - be sure that all file types are selected from notepad before you save it as *.lsp... I am tired now and don't understand what else do you want... It works for me perfectly...

Bye and best wishes...

thanks so much,i fix ok.

i just add textbox. so just fix dimgap <0 can get box. i didn't know at first. thank you so much.

Code: [Select]
(defun c:tolerance_Display (/ DT ENT ID SDT)

(setq acdoc (vla-get-activedocument (vlax-get-acad-object)))

(while


  (setq dt  (ssget ":S" '((0 . "DIMENSION")))
        sdt (sslength dt)
        id  0

  ) ;_ end of setq

(vl-cmdf "_.undo" "_begin")

  (repeat sdt

    (progn
      (setq
        ent (ssname dt id)
        tol    (vla-get-tolerancedisplay (vlax-ename->vla-object ent))
        id  (1+ id)

      ) ;_ end of setq

(if (or (= tol 1) (= tol 2) (= tol 3))

(vla-put-textgap (vlax-ename->vla-object ent) -0.625)

      (vlax-put-property
        (vlax-ename->vla-object ent)
        'toleranceDisplay
        4
      ) ;_ end of vlax-put-property



)

    ) ;_ end of progn
  ) ;_ end of repeat

(vl-cmdf "_.undo" "_end")

)
 
  (princ)
) ;_ end of defun
(princ)
;;;;;;;;;;;;;;;;;;;;;;;;;;

ribarm

  • Gator
  • Posts: 3309
  • Marko Ribar, architect
Re: which code can change Tolerance Display to Basic
« Reply #21 on: April 09, 2024, 12:19:47 PM »
I've just looked at your code, you missed (= tol 0) in the line (if (or (= tol 1) (= tol 2) (= tol 3)) ...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube