VovKa Posted August 18, 2009 Posted August 18, 2009 I know :wink: But, how does one know what arc they want? user supplies to points, if pt1 and pt2 are picked clockwise then one answer, otherwise another (defun vk_GetLeftAngle (p1 p2 p3 / Ang) (if (minusp (setq Ang (rem (+ pi (angle p2 p1) (- (angle p3 p2))) (* pi 2.0)))) (+ pi pi Ang) Ang ) ) (defun vk_GetArcLength (Ent pt1 pt2) (* (cdr (assoc 40 Ent)) (vk_GetLeftAngle pt1 (cdr (assoc 10 Ent)) pt2)) ) Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Been dissecting your code VovKa, and I must say, that is pure genius... where do you get your ideas from? Quote
VovKa Posted August 18, 2009 Posted August 18, 2009 Been dissecting your code VovKa, and I must say, that is pure genius... where do you get your ideas from? I steal them from math books Quote
Lee Mac Posted August 19, 2009 Posted August 19, 2009 I steal them from math books Now there was me thinking that you had thought them up yourself... Quote
mdbdesign Posted August 19, 2009 Author Posted August 19, 2009 Oh, what command is missing in '02? DIMARC - That why I did replace it with lisp Quote
Lee Mac Posted August 19, 2009 Posted August 19, 2009 Ah ok, maybe this instead then: (defun c:DimCir (/ doc spc ent p1 p2 ax cen) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (and (setq ent (car (entsel "\nSelect Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget ent)))) (setq p1 (getpoint "\nPt1: ")) (setq p2 (getpoint "\nPt2: "))) (progn (setq ax (vla-addArc spc (vlax-3D-point (setq cen (cdr (assoc 10 (entget ent))))) (cdr (assoc 40 (entget ent))) (angle cen p1) (angle cen p2))) (vla-put-TextOverride (vlax-invoke spc 'adddimangular cen p1 p2 p1) (rtos (vla-get-ArcLength ax))) (vla-delete ax) (vl-cmdf "_.dimtedit" (entlast) pause))) (princ)) 1 Quote
mdbdesign Posted August 19, 2009 Author Posted August 19, 2009 I don't know how this happen but I am able to put dimension of longer arc on side of small arc as on picture ( red color) Or this again issue of Acad version Quote
Lee Mac Posted August 19, 2009 Posted August 19, 2009 It will depend upon which order the points are picked (i.e. counter/clockwise), but it is temperamental to say the least. Quote
mdbdesign Posted August 19, 2009 Author Posted August 19, 2009 OK Lee, got it. Thank you very much. My next question... oops, need to start new topic (just kidding) Thanks again. Quote
motee-z Posted August 20, 2009 Posted August 20, 2009 here is my lisp i use it and tested and can write the length of three consequent points (defun c:leng () (command"regen""") (setq clyr(getvar"clayer")) (while (setq m1 (getpoint "\n please click on first point of curve")) (setq osmd(getvar"osmode")) (setq m2 (getpoint "\n click second point on circle")) (setq m3 (getpoint "\n click third point of curve")) (setq g (/(+(car m1)(car m2))2) h (/(+(cadr m1)(cadr m2))2) i (/(+(car m1)(car m3))2) j (/(+(cadr m1)(cadr m3))2) m (-(car m2)(car m1)) n (-(cadr m2)(cadr m1)) o (-(car m3)(car m1)) p (-(cadr m3)(cadr m1)) y0 (/(-(-(+(*(* o m)i)(*(* p m)j))(*(* o g)m))(*(* o n)h))(-(* m p)(* o n))) x0 (/(+(-(* g m)(* n y0))(* n h))m) r0 (sqrt(+(expt(- x0 (car m1))2)(expt(- y0 (cadr m1))2))) ccm (list x0 y0) a1 (angle ccm m1) a2 (angle ccm m2) a3 (angle ccm m3) a2x (sin a2) a2c (cos a2) a2m (/ a2x a2c) ) (cond ((and(< a1 a2)(< a1 a3)(< a2 a3)) (setq ang0 (- a3 a1))) ((and(> a1 a2)(> a1 a3)(> a2 a3)) (setq ang0 (- a1 a3))) ((and(> a1 a2)(> a1 a3)(< a2 a3)) (setq ang0 (-(* 2 pi)(- a1 a3)))) ((and(< a1 a2)(> a1 a3)(> a2 a3)) (setq ang0 (-(* 2 pi)(- a1 a3)))) ((and(< a1 a2)(< a1 a3)(> a2 a3)) (setq ang0 (-(* 2 pi)(- a3 a1)))) ((and(> a1 a2)(< a1 a3)(< a2 a3)) (setq ang0 (-(* 2 pi)(- a3 a1)))) ) (setq l0 (* r0 ang0)) (setq a2g (/(* a2 200)pi)) (setq az2 (atan 1 a2m)) (setq az2g (/(* az2 200)pi)) (setq m21(polar m2(+ a2(* 2 pi)) 0.4)) (command "color"1) (command "color"6) (setvar"osmode"0) (command "text" m21"1"az2g(rtos l0 2 3)) (setvar "osmode"osmd) ) ) ;be sure texthight is zero 1 Quote
mdbdesign Posted August 21, 2009 Author Posted August 21, 2009 I am off my computer, will back on Monday. Have a good weekend everybody!!! Quote
Nikon Posted January 16 Posted January 16 (edited) hello everyone Very convenient lisp (DimCir.lsp), help to improve it a little... How to add ORTHO mode shutdown to lisp correctly when calling the command, if ORTHO mode is enabled, the dimensions are obtained incorrectly... thanks... (defun c:DimCir (/ doc spc ent p1 p2 ax cen) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)) spc (if (zerop (vla-get-activespace doc)) (if (= (vla-get-mspace doc) :vlax-true) (vla-get-modelspace doc) (vla-get-paperspace doc)) (vla-get-modelspace doc))) (if (and (setq ent (car (entsel "\nSelect Circle: "))) (eq "CIRCLE" (cdr (assoc 0 (entget ent)))) (setq p1 (getpoint "\nPt1: ")) (setq p2 (getpoint "\nPt2: "))) (progn (setq ax (vla-addArc spc (vlax-3D-point (setq cen (cdr (assoc 10 (entget ent))))) (cdr (assoc 40 (entget ent))) (angle cen p1) (angle cen p2))) (vla-put-TextOverride (vlax-invoke spc 'adddimangular cen p1 p2 p1) (rtos (vla-get-ArcLength ax))) (vla-delete ax) (vl-cmdf "_.dimtedit" (entlast) pause))) (princ)) Edited January 16 by Nikon Quote
Nikon Posted January 16 Posted January 16 (edited) I add (setvar "orthomode" 0) ; off, I select the points clockwise, but the dimensions are still set either correctly or incorrectly... Edited January 17 by Nikon 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.