CAP Posted Tuesday at 03:37 PM Posted Tuesday at 03:37 PM Afternoon All, I'm looking for a lisp that would adapt an existing dimension and change this to show the original output + a further output that gave the original number divided by a given length of 3000. So, if we have a dimension of 1500 we have an output of "1500mm - 1 No 3000mm length", dimension of 6450 an output of "6450 - 3 No 3000mm length" etc. The existing dimensions could be selected individually or a crossing selection. Alternatively, rather than selecting dimensions, would it be possible to simply select a bunch of lines and automatically produce the same output dimensions I did find a lisp posted by @irneb from back in 2011, but, it doesn't quite work for me. For instance when the selected dimension is broken up into multiples of 3000 leaving a remaining section that is less than half the 3000mm then it doesn't count the part left over. i.e 2800 gives 1 @ 3000, 3000 gives 1 @ 3000, 4450 gives 1 @ 3000 but 4600 gives 2 @ 3000 (See attached). The original lisp was (thanks @irneb) : On 9/27/2011 at 4:46 PM, irneb said: Anyhow, if you want it as a lisp: (defun c:@Dims (/ dist ss n eo) (if (and (setq dist (getdist "\nSpecify increment distance: ")) (setq ss (ssget '((0 . "DIMENSION")))) ) (progn (setq n (sslength ss)) (while (> (setq n (1- n)) -1) (setq eo (vlax-ename->vla-object (ssname ss n))) (vla-put-AltUnitsScale eo dist) (vla-put-LinearScaleFactor eo (/ 1.0 dist)) (vla-put-TextOverride eo (strcat "[%<\\AcExpr (1+%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectID eo)) ">%).Measurement \\f \"%lu2%pr0\">%) \\f \"%lu2%pr0\">%]\\X@ %<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-ObjectID eo)) ">%).AltUnitsScale \\f \"%lu2%pr0\">% C/C" ) ) (vla-Update eo) ) ) ) (command "._UpdateField" ss "") (princ) ) Quote
hosneyalaa Posted Wednesday at 04:48 AM Posted Wednesday at 04:48 AM Can you attached example drawing Quote
CAP Posted Wednesday at 09:03 AM Author Posted Wednesday at 09:03 AM Hi @hosneyalaa, thanks for the reply. Its basically as per the screenshot above, however, please see attached .dwg. When recreating the example this morning, the results appear different from those produced previously - now I'm confused even more example.dwg Quote
BIGAL Posted Friday at 04:06 AM Posted Friday at 04:06 AM (edited) The 4600 is wrong should be 2 not 3 is it not a length / 3000 then take the fix so / 4450 3000 = 1.483 so you have a fraction greater than 0.0 and the number is just add 1 to the fix of the length. This would be using a simple lisp adding field formulas may be difficult. I would also do a check equal with a factor of like 1e-8 as sometimes a 3000 can be 3000.00000001. May have time later, really no need for a dim just pick line. Edited Friday at 04:08 AM by BIGAL Quote
BIGAL Posted 3 hours ago Posted 3 hours ago Ok got the math working, do you just need them labelled say Text or need a dim with 2x@3000 and so on. (defun c:wow ( / ) (while (setq ent (entsel "\nPick a line Enter to exit ")) (setq obj (vlax-ename->vla-object (car ent))) (setq len (vlax-get obj 'length)) (setq howmany (/ len 3000.)) (setq frac (- howmany (fix howmany))) (if (< howmany 1.0) (setq howmany 1.0) (if (> frac 0.0) (setq howmany (+ (fix howmany) 1)) ) ) (princ (strcat "\n" (rtos len 2 2) " - " (rtos howmany 2 0))) ) (princ) ) 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.