Can Posted June 15, 2017 Share Posted June 15, 2017 Hello everyone; I need a lisp code which puts dimension automatically between the center of each circle chosen and endpoints of chosen lines as shown in the attached drawing. Thanks. dim_test.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 16, 2017 Share Posted June 16, 2017 I need a lisp code We all need something ! Something like pick 1st circle, pick last and it counts the circles in between if greater than 3 then label as num x dist. May need an extra step as pick orientation at very start but only needed once. Use ssget "CP" & circle on a layer. Dont have anything but I think its achievable. Just need to check about CP when using a different UCS. Quote Link to comment Share on other sites More sharing options...
Can Posted June 20, 2017 Author Share Posted June 20, 2017 Thank you for your answer Bigal, Frankly, I am not good at LISP, I am just a beginner. I would like to ask for the code it self if it is possible and convinient. Bucause I need to do it urgently. thanks in advance. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 25, 2017 Share Posted June 25, 2017 (edited) Try this. Ps dimmed the whole lot in one go ! ; dim bolts ; by Alan H june 2017 (defun dim1 (offx / ) (repeat x (setq pt2 (nth (setq x (- x 1)) lst)) (command "Dimlinear" pt1 pt2 offx ) (setq pt1 pt2) ) ) (defun dim2 (offx / ptlast objpt) (setq ptlast (nth 0 lst)) (setq howmany (rtos x 2 0)) (setq len ( / (- (car pt1) (car ptlast)) x)) (setq ans (strcat (rtos x 2 0) "x" (rtos len 2 2))) (command "Dimlinear" pt1 ptlast "T" ans offx ) ) (defun C:dimbolt ( / ss lst circen pt2 pt1 xoff) (setq oldsnap (getvar "osmode")) (setq oldang (getvar "units")) (setvar "Aunits" 3) (if (/= alertused nil) (princ) (progn (alert "You need to pick a line near bolt holes for orientation\n\nthis message will not appear again") (setq alertused "Y")) ) (princ "\nPick a line etc for dim alignment ") (setq obj (entsel "\nPick a line etc for dim alignment ")) (command "UCS" "OB" obj) (setq ent (entget (car obj))) (setq stp (cdr (assoc 10 ent))) (setq stp (trans stp (car obj) 1)) (setq endp (cdr (assoc 11 ent))) (setq endp (trans endp (car obj) 1)) (setq ang (+ (/ pi 2.0) (angle stp endp))) (setq xoff (polar stp ang 400)) ;(setq xoff (getpoint stp "Pick point for dim")) (setq ss (ssget (list (cons 0 "Circle")))) (setq lst '()) (repeat (setq x (sslength ss)) (setq cen (vla-get-center (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))) (setq circen (vlax-safearray->list (vlax-variant-value cen)) ) (setq circen (trans circen 0 1)) (setq lst (cons circen lst)) ) ; Now sort on x (setq lst (vl-sort lst (function (lambda (e1 e2) (< (car e1) (car e2))))) ) ;(setq xoff (getpoint "Pick dim offset point")) (setq x (length lst)) (setq pt1 (nth (setq x (- x 1)) lst)) (setvar "osmode" 0) (setq ans (getstring "Do All Y or min 3 <Cr>")) (if (= ans "") (dim2 xoff) (dim1 xoff) ) (command "ucs" "world") (setvar "osmode" oldsnap) (setvar "Aunits" oldang) (princ) ) (C:dimbolt) Edited August 4, 2017 by BIGAL Quote Link to comment Share on other sites More sharing options...
Can Posted July 3, 2017 Author Share Posted July 3, 2017 Thank you very much for your effort. We had one week holiday, so last week i could not check your code. I will try soon and let you know. Thanks again. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 4, 2017 Share Posted July 4, 2017 Good to know if it all works, bolt patterns like this are pretty common. Quote Link to comment Share on other sites More sharing options...
Can Posted July 4, 2017 Author Share Posted July 4, 2017 I have checked my observations are defined in the attached files. Thanks in advance. dim_test_checked.dwg Quote Link to comment Share on other sites More sharing options...
Can Posted August 2, 2017 Author Share Posted August 2, 2017 Hi there, Did you have a chance to check your code? Becouse there is no reply from you for a long time. Thanks Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 3, 2017 Share Posted August 3, 2017 Sorry must have missed your post will have a look at it. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 4, 2017 Share Posted August 4, 2017 Please down load code above the dim spacing I fixed it now shows 5x40. The offset is 400 hard coded the problem is it uses a method of start and end of a line so it may draw the dim on wrong side with a bit of use you should get used to picking the parallel line top or bottom and know which side the dim will appear. To pick side thats version 3 more code needed. There is a check vector direction method but you still have to pick a side. Quote Link to comment Share on other sites More sharing options...
Can Posted August 4, 2017 Author Share Posted August 4, 2017 (edited) Thank you very much for your efforts. However, there is problem related to dimensioning as i tried to explain in the attached drawing. Actually i have a basic lisp code which is also not able to put "6x40" detail. Attached you can find the code, also below video shows how it works. I thing you can use "UCS_OB" in this way. thanks again Edited June 13, 2019 by Can Quote Link to comment Share on other sites More sharing options...
Can Posted September 25, 2017 Author Share Posted September 25, 2017 Hi BIGAL; Could you deal with my latest questions? Thanks in advance 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.