Jump to content

Recommended Posts

Posted

I want to take some existing code I found over on another site and change it to add user input. I have added a getstring line but I don't know how to get the program to evaluate that later when needed. So I have a setq ndimtext line, and later I need it to use that setq string in the setq NewDimValue line. Hopefully that makes sense.

 

 
; original code from Mike Perry, AUGI NG
(defun c:DimAddText (/ DimObject ndimtext NewDimValue)
 [color=red](setq ndimtext (getstring "Enter text to add to dim: "))
[/color]  (princ "\nSelect Dimension to add \(REF.\) to: ")
 (setq DimObject (ssget '((0 . "DIMENSION"))))
 (if (not (eq DimObject nil))
(progn
  (setq NewDimValue "<>\\X\( [color=red]ndimtext[/color] \)")
  (command "._DimEdit" "_N" NewDimValue DimObject "")
)
 )
 (princ)
)

Posted

Perhaps:

 


 ; original code from Mike Perry, AUGI NG

(defun c:DimAddText  (/ DimObject ndimtext NewDimValue)
 (vl-load-com)
 (setq ndimtext (getstring t "\nEnter text to add to dim: "))
 (princ "\nSelect Dimension to add \(REF.\) to: ")
 (if (setq DimObject (ssget '((0 . "DIMENSION"))))
   (foreach Obj  (mapcar 'vlax-ename->vla-object
                   (vl-remove-if 'listp
                     (mapcar 'cadr
                       (ssnamex DimObject))))
     (vla-put-TextOverride Obj (strcat "<>\\X" ndimtext)))
   (princ "\n<!> No Dimensions Selected <!>"))
 (princ))

Posted

LeeMac,

Thanks, that works great.

rkent

Posted

No probs rkent - if you need anything about the code explained, just ask :)

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...