rkent Posted May 6, 2009 Posted May 6, 2009 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) ) Quote
Lee Mac Posted May 6, 2009 Posted May 6, 2009 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)) Quote
Lee Mac Posted May 6, 2009 Posted May 6, 2009 No probs rkent - if you need anything about the code explained, just ask Quote
Recommended Posts
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.