AeJay Posted March 24, 2023 Posted March 24, 2023 These two pictures below is a before and after for an object that has only 1 dimension. It successfully change the distance from 100 to 200. But on this different plate with 1st and 2nd dimension. Somehow the outcome is what is not desired/expected, which is to keep the distance of the 1st dimension from the 2nd and only affect the 2nd dimension as the max value from the dim distance input. Code by exceed from this thread: (defun c:DLA ( / sel ent txp al ar mp uALR s txpp uvt tp exss exssent exssl exssindex) (defun deg2rad (ang / ) (/ (* PI ang) 180.0) ) (defun rad2deg ( ang / ) (/ (* 180.0 ang) PI) ) ;; midpoint of 2 given points (defun mid ( pt1 pt2 / ) (mapcar '(lambda (x y) (+ (* 0.5 x) (* 0.5 y))) pt1 pt2 ) ) ;;; Calculate unit vector of vector a (defun uvec (a / d) (setq d (distance '(0 0 0) a) a (mapcar '/ a (list d d d)) ) ) ; Compute the dot product of 2 vectors a and b (defun dot ( a b / dd) (setq dd (mapcar '* a b)) (setq dd (+ (nth 0 dd) (nth 1 dd) (nth 2 dd))) ) ;end of dot (princ "\nDistance DIM: ") (setq dist (getreal)) (princ "\nSelect DIM: ") (setq exss (ssget '((0 . "*dim*")))) (setq exssl (sslength exss)) (setq exssindex 0) (repeat exssl (setq exssent (entget (ssname exss exssindex))) (setq ent (cdr (car exssent))) (setq txp (cdr (assoc 10 (entget ent)))) (setq al (cdr (assoc 13 (entget ent)))) (setq ar (cdr (assoc 14 (entget ent)))) (setq mp (mapcar '/ (mapcar '+ al ar) '(2. 2. 2.) ) ) ; uALR = unit vector from al to ar (setq uALR (uvec (mapcar '- ar al))) (setq s (dot uALR (mapcar '- txp al))) ; txpp = projection of txp onto the line (setq txpp (mapcar '+ al (mapcar '* uALR (list s s s))) ) (setq uvt (uvec (mapcar '- txp txpp))) (setq tp (mapcar '+ mp (mapcar '* uvt (list dist dist dist)))) (entmod (subst (cons 10 tp) (assoc 10 (entget ent)) (entget ent)) ) (entmod (subst (cons 11 tp) (assoc 11 (entget ent)) (entget ent)) ) ;) while delted (setq exssindex (+ exssindex 1)) for repeat added ) for repeat added (princ) ) Quote
devitg Posted March 24, 2023 Posted March 24, 2023 7 hours ago, AeJay said: These two pictures below is a before and after It is a picture , not a dwg . AFIK , ACAD can not edit pictures. Please upload your sample.DWG Quote
BIGAL Posted March 24, 2023 Posted March 24, 2023 This is being asked for over at forums/autodesk, its about resetting the dim offset from the object, say current dim offst is 10 but want 12.5. There was an answer plays with the dxf 13 & 14 codes. 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.