Jump to content

subfix in dimension...


Recommended Posts

Posted

hello all:

I need a routine that first asks me to enter "a word"

and this word is added to the value of the dimension below the line

example

image.thumb.png.4131b4db3da4a4c9a699827f2c03b260.png

 

The modified dimension shows this

image.png.2c0bd50b3317175973052196e144208e.png

 

 

Does anyone know of any code that can help me?

 

 

thanks

Posted

Here's a quick one -

(defun c:dimsub ( / enx grp idx new pos sel str )
    (cond
        (   (= "" (setq str (getstring t "\nSpecify string: "))))
        (   (setq sel (ssget "_:L" '((0 . "*DIMENSION"))))
            (repeat (setq idx (sslength sel))
                (setq idx (1- idx)
                      enx (entget (ssname sel idx))
                      grp (assoc 1 enx)
                )
                (if (setq pos (vl-string-search "\\X" (cdr grp)))
                    (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str)))
                    (setq new (cons 1 (strcat "<>\\X" str)))
                )
                (entmod (subst new grp enx))
            )
        )
    )
    (princ)
)

 

  • Thanks 1
Posted
7 minutes ago, Lee Mac said:

Here's a quick one -

(defun c:dimsub ( / enx grp idx new pos sel str )
    (cond
        (   (= "" (setq str (getstring t "\nSpecify string: "))))
        (   (setq sel (ssget "_:L" '((0 . "*DIMENSION"))))
            (repeat (setq idx (sslength sel))
                (setq idx (1- idx)
                      enx (entget (ssname sel idx))
                      grp (assoc 1 enx)
                )
                (if (setq pos (vl-string-search "\\X" (cdr grp)))
                    (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str)))
                    (setq new (cons 1 (strcat "<>\\X" str)))
                )
                (entmod (subst new grp enx))
            )
        )
    )
    (princ)
)

 

i will try master thanks

Posted

EXCELLENT...

You can make it so that by default it suggests the word "typ" so that with just one enter I can continue the routine and if in the future I need to add another word I can change it.

Posted
36 minutes ago, leonucadomi said:

You can make it so that by default it suggests the word "typ" so that with just one enter I can continue the routine and if in the future I need to add another word I can change it.


For a "fixed" default, you can use something like the following:

(defun c:dimsub ( / enx grp idx new pos sel str )
    (if (= "" (setq str (getstring t "\nSpecify string <TYP>: ")))
        (setq str "TYP")
    )
    (if (setq sel (ssget "_:L" '((0 . "*DIMENSION"))))
        (repeat (setq idx (sslength sel))
            (setq idx (1- idx)
                  enx (entget (ssname sel idx))
                  grp (assoc 1 enx)
            )
            (if (setq pos (vl-string-search "\\X" (cdr grp)))
                (setq new (cons 1 (strcat (substr (cdr grp) 1 pos) "\\X" str)))
                (setq new (cons 1 (strcat "<>\\X" str)))
            )
            (entmod (subst new grp enx))
        )
    )
    (princ)
)


For a "dynamic" default, you can use one of the methods I describe here.

Posted

Interesting ""Windows Speech Recognition," and then use the shortcut Windows logo key + Ctrl + S to activate it.

 

Typed dimsub then spoke T Y P a box appeared then did accept. !typ = "TYP " very close.

 

It did 1st go put EYP  in command line. So I think I need to train it more. Can turn on and off microphone by voice. 

 

If I have time may play more.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...