vanhuyou Posted September 16, 2023 Share Posted September 16, 2023 Please help me divide dimension, i post drawing before and result. Thank so much. dimension divide.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 16, 2023 Share Posted September 16, 2023 If you look at the properties of a dimension via entget. ((-1 . <Entity name: 68b1a340>) (0 . "DIMENSION") (5 . "1A1C") (330 . <Entity name: 68b0fe80>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (370 . -1) (100 . "AcDbDimension") (280 . 0) (2 . "*D13") (10 905.565830296284 -1983.72335023666 0.0) (11 -1094.43416970372 -1946.22335023666 0.0) (12 0.0 0.0 0.0) (70 . 32) (1 . "") (71 . 5) (72 . 1) (41 . 1.0) (42 . 4000.0) (73 . 0) (74 . 0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0 1.0) (3 . "B 1_20 [cm]") (100 . "AcDbAlignedDimension") (13 -3094.43416970372 -2176.25632836718 0.0) (14 905.565830296284 -2176.25632836718 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 . 0.0) (100 . "AcDbRotatedDimension")) So look at dxf codes 13 & 14 that should be the 2 dim points so get the length divide by say 3. Dxf 10 can be used for offset point. Work out new points erase old dim and make new ones. Do you know how to program in lisp ? If not good time to learn. Quote Link to comment Share on other sites More sharing options...
vanhuyou Posted September 17, 2023 Author Share Posted September 17, 2023 On 9/16/2023 at 10:45 AM, BIGAL said: If you look at the properties of a dimension via entget. ((-1 . <Entity name: 68b1a340>) (0 . "DIMENSION") (5 . "1A1C") (330 . <Entity name: 68b0fe80>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (370 . -1) (100 . "AcDbDimension") (280 . 0) (2 . "*D13") (10 905.565830296284 -1983.72335023666 0.0) (11 -1094.43416970372 -1946.22335023666 0.0) (12 0.0 0.0 0.0) (70 . 32) (1 . "") (71 . 5) (72 . 1) (41 . 1.0) (42 . 4000.0) (73 . 0) (74 . 0) (75 . 0) (52 . 0.0) (53 . 0.0) (54 . 0.0) (51 . 0.0) (210 0.0 0.0 1.0) (3 . "B 1_20 [cm]") (100 . "AcDbAlignedDimension") (13 -3094.43416970372 -2176.25632836718 0.0) (14 905.565830296284 -2176.25632836718 0.0) (15 0.0 0.0 0.0) (16 0.0 0.0 0.0) (40 . 0.0) (50 . 0.0) (100 . "AcDbRotatedDimension")) So look at dxf codes 13 & 14 that should be the 2 dim points so get the length divide by say 3. Dxf 10 can be used for offset point. Work out new points erase old dim and make new ones. Do you know how to program in lisp ? If not good time to learn. sorry man. I don't know anything about Lisp programming :(( Quote Link to comment Share on other sites More sharing options...
dan20047 Posted September 18, 2023 Share Posted September 18, 2023 Getting someone to code for you for free is like an American trying to get service in France. Go in speaking English and they will ignore you, honestly try and speak French and they'd rather reply to you in English than listen to you torture the language. Try and write your own code and post when you're having problems. Then you're almost guaranteed to get help. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 18, 2023 Share Posted September 18, 2023 A freebie for you try this (defun c:dimdiv ( / ent num pt1 pt2 pt3 pt4) (setq ent (entget (car (entsel "\nPick dimension ")))) (setq num (getint "\nEnter how many divisons ")) (setq pt1 (cdr (assoc 13 ent))) (setq pt2 (cdr (assoc 14 ent))) (setq pt3 (cdr (assoc 10 ent))) (setq dist (/ (distance pt1 pt2) num)) (setq ang (angle pt1 pt2)) (command "erase" (cdr (assoc -1 ent)) "") (repeat num (setq pt4 (polar pt1 ang dist)) (command "DIM" "align" pt1 pt4 pt3 "" "exit") (setq pt1 pt4) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
vanhuyou Posted September 18, 2023 Author Share Posted September 18, 2023 10 hours ago, BIGAL said: A freebie for you try this (defun c:dimdiv ( / ent num pt1 pt2 pt3 pt4) (setq ent (entget (car (entsel "\nPick dimension ")))) (setq num (getint "\nEnter how many divisons ")) (setq pt1 (cdr (assoc 13 ent))) (setq pt2 (cdr (assoc 14 ent))) (setq pt3 (cdr (assoc 10 ent))) (setq dist (/ (distance pt1 pt2) num)) (setq ang (angle pt1 pt2)) (command "erase" (cdr (assoc -1 ent)) "") (repeat num (setq pt4 (polar pt1 ang dist)) (command "DIM" "align" pt1 pt4 pt3 "" "exit") (setq pt1 pt4) ) (princ) ) its not dividing dimension into equal parts, please check the drawing. Thank so much man. dimension divide rev1.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted September 18, 2023 Share Posted September 18, 2023 (edited) No idea its working for me 3 4 5. Can some one else please check. Edited September 18, 2023 by BIGAL Quote Link to comment Share on other sites More sharing options...
exceed Posted September 19, 2023 Share Posted September 19, 2023 (edited) 2 hours ago, BIGAL said: Can some one else please check. (defun c:dimdiv ( / *error* acdoc oldosmode oldcmdecho ent entlist num pt1 pt2 pt3 pt4 entl objl measurevalue digits rounddownvalue lsf ssl index ) (vl-load-com) (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object))) (defun *error* ( msg ) (if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")) (princ (strcat "\nError: " msg)) ) (setvar 'osmode oldosmode) (setvar 'cmdecho oldcmdecho) (vla-EndUndoMark acdoc) (princ) ) ;; Round Down - Lee Mac ;; Rounds 'n' down to the nearest 'm' (defun LM:rounddown (n m) ((lambda (r) (cond ((equal 0.0 r 1e-8) n) ((< n 0) (- n r m)) ((- n r)))) (rem n m) ) ) (vla-StartUndoMark acdoc) (setq oldosmode (getvar 'osmode)) (setq oldcmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) (setvar 'osmode 0) (princ "\n Pick Dimension : ") (if (setq ss (ssget '((0 . "DIMENSION")))) (progn (setq num (getint "\nEnter how many divisons ")) (setq ssl (sslength ss)) (setq index 0) (repeat ssl (setq ent (ssname ss index)) (setq entlist (entget ent)) (setq pt1 (cdr (assoc 13 entlist))) (setq pt2 (cdr (assoc 14 entlist))) (setq pt3 (cdr (assoc 10 entlist))) (setq dist (/ (distance pt1 pt2) num)) (setq ang (angle pt1 pt2)) (setq lsf (vlax-get-property (vlax-ename->vla-object ent) 'linearscalefactor)) (entdel ent) (repeat num (setq pt4 (polar pt1 ang dist)) (command "DIM" "align" pt1 pt4 pt3 "" "exit") (setq entl (entlast)) (setq objl (vlax-ename->vla-object entl)) (vlax-put-property objl 'linearscalefactor lsf) (setq measurevalue (vlax-get-property objl 'measurement)) (setq digits (strlen (rtos measurevalue 2 0))) (setq rounddownvalue (LM:rounddown measurevalue (expt 10 (- digits 2)))) (vlax-put-property objl 'textoverride rounddownvalue) (setq pt1 pt4) ) (setq index (+ index 1)) ) ) (progn) ) (setvar 'osmode oldosmode) (setvar 'cmdecho oldcmdecho) (vla-EndUndoMark acdoc) (princ) ) maybe osmode do that? Edited September 19, 2023 by exceed 1 Quote Link to comment Share on other sites More sharing options...
XDSoft Posted April 8 Share Posted April 8 On 9/16/2023 at 8:05 AM, vanhuyou said: Please help me divide dimension, i post drawing before and result. Thank so much. dimension divide.dwg 70.22 kB · 9 downloads https://www.theswamp.org/index.php?topic=59428.0 Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 8 Share Posted April 8 1 hour ago, XDSoft said: https://www.theswamp.org/index.php?topic=59428.0 It would be easier to post the code here in case anyone doesn't have an account over in theswamp 1 Quote Link to comment Share on other sites More sharing options...
XDSoft Posted April 9 Share Posted April 9 18 hours ago, Steven P said: It would be easier to post the code here in case anyone doesn't have an account over in theswamp I don’t know why, but I can’t upload animated GIFs here. Quote Link to comment Share on other sites More sharing options...
Steven P Posted April 9 Share Posted April 9 We don't always need an animation 1 Quote Link to comment Share on other sites More sharing options...
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.