irneb Posted August 15, 2012 Posted August 15, 2012 On Lee's site there are some tutorials on this: http://www.lee-mac.com/tutorials.html#lisptutorials Quote
Ryder Posted August 16, 2012 Posted August 16, 2012 thanx guys, last question? Once i have successfully loaded the .lisp file how do i get my dims to actualy do what Bruce has mentioned? Quote
irneb Posted August 16, 2012 Posted August 16, 2012 Assuming you used Lee's code, then once it's loaded you should have a new command called MacDim. Just type it into the command-line. It'll ask you to select the dimension(s) and specify the alteration value. Edit: As a future tip: If there's a piece of code in the LSP file which starts with (defun C: Then the word following it will be the command. Note it's possible that the word could have other characters in it (like - ), but no spaces. Basically acad looks at the name of the function when it's defined (defun = define function), if the name starts with C: then acad adds it as a custom lisp command, otherwise it's just a normal lisp function which you can also call but need to use lisp-like syntax. Also a LSP file may have many of these custom commands, not just one, so look through the whole code for new commands. Quote
Ryder Posted August 20, 2012 Posted August 20, 2012 than x irneb, much appreciated everything works well. Only problem i sthat after i use the macdim command my dimensions are no longer rounded off to 5 as they were before applying the command? Any thoughts on this? Quote
irneb Posted August 20, 2012 Posted August 20, 2012 (edited) That's because Lee's code overwrites the dim with a new computed string. His code would need some alteration to test these rounding of the dimension so it matches the original dim. Perhaps this: (defun c:MacDim (/ ss num) (vl-load-com) (if (and (setq ss (ssget '((0 . "DIMENSION")))) (setq num (getreal "\nSpecify Alteration: "))) (mapcar (function (lambda (x) (vla-put-TextColor x 1) ; <<-- 1 = Red (vla-put-TextOverride x (strcat (vla-get-TextPrefix x) (rtos [color=red](round [/color](+ (vla-get-Measurement x) num) [color=red](vla-get-RoundDistance x)[/color]) (vla-get-UnitsFormat x) (vla-get-PrimaryUnitsPrecision x)) (vla-get-TextSuffix x))))) (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))) (princ)) [color=red](defun round (num fact / mod) (if (< (setq mod (rem num fact)) (/ fact 2)) (- num mod) (+ num [u](- fact mod)[/u])))[/color] Edit: Sorry, stupid mistake on my part ... in a rush! Edited August 20, 2012 by irneb Quote
Ryder Posted August 20, 2012 Posted August 20, 2012 :Dawesome! thanx alot saving me lots of grey hairs. 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.