mdbdesign Posted August 18, 2009 Posted August 18, 2009 It is possible to get arc dimension as shown below without breaking circle apart, just selecting two points on circle??? Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Yes, I believe this is possible through the use of the vlax-curve functions, specifically, vlax-curve-getDistatPoint. If you need further help, just shout. Lee Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 I use 2002 and was curious if Autodesk develop something in newer version to do it. Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Well there is Arc-Length dimensioning, but, of course, it only works on arcs... As for the LISP alternative: (defun ArcLen (Ent pt1 pt2) (abs (- (vlax-curve-getDistatPoint Ent Pt2) (vlax-curve-getDistatPoint Ent Pt1)))) Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 Command: _appload Arclen.lsp successfully loaded. Command: Command: Command: ARCLEN Unknown command "ARCLEN". Press F1 for help. Is my machine still on vacation??? Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Arclen is a sub-function and requires three arguments, namely the entity in question (circle), and two points. Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 As an example.... With absolutely no error trapping: (defun c:test (/ Cir p1 p2) (if (and (setq Cir (car (entsel "\nSelect Circle: "))) (setq p1 (getpoint "\nSelect First Point: ")) (setq p2 (getpoint "\nSelect Second Point: "))) [color=Red][b] (ArcLen Cir p1 p2)))[/b][/color] Quote
ronjonp Posted August 18, 2009 Posted August 18, 2009 Here's your solution Lee with a bit more error trapping (defun arclen (ent pt1 pt2) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getendparam (list ent)))) (abs (- (vlax-curve-getdistatpoint ent (vlax-curve-getclosestpointto ent pt2)) (vlax-curve-getdistatpoint ent (vlax-curve-getclosestpointto ent pt1)) ) ) ) ) (arclen (car (entsel)) (getpoint) (getpoint)) Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Thanks Ron Another, with slightly more info: (defun ArcLen (Ent pt1 pt2 / Cir Arc) (vl-load-com) (if (not (vl-catch-all-error-p (setq Cir (vl-catch-all-apply 'vla-get-Circumference (list (vlax-ename->vla-object Ent)))))) (list (setq arc (abs (- (vlax-curve-getDistatPoint Ent (vlax-curve-getClosestPointto Ent Pt2)) (vlax-curve-getDistatPoint Ent (vlax-curve-getClosestPointto Ent Pt1))))) (- Cir arc)))) (defun c:test (/ ent p1 p2) (if (and (setq ent (car (entsel "\nSelect Circle: "))) (setq p1 (getpoint "\nPt1: ")) (setq p2 (getpoint "\nPt2: "))) (print (ArcLen ent p1 p2))) (princ)) Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 I was off just half an hour (still working) let me try... Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 Thanks Lee now I will try to incorporate two lisp routine to get me result as on picture in first post. Attached is dimarc lisp. What you think ? Will work?? DIMARC.LSP Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 The DIMARC command will only allow an arc/polyline seg input - so no, I don't think that will work, unless you created a temporary arc, dimensioned it, then deleted it. Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 That is what I did so far. Got another lisps that divide circle on section and change layer of selected part to Hidden (yours) and another that create circle out of arc. So if I combine it in macro it should work. Quote
VovKa Posted August 18, 2009 Posted August 18, 2009 Lee Mac, you should add some extra checks to you code (mapcar 'entmakex '(((0 . "CIRCLE") (10 21.3977 221.18 0.0) (40 . 20.1493)) ((0 . "LINE") (10 21.3977 221.18 0.0) (11 41.2409 224.679 0.0)) ((0 . "LINE") (10 21.3977 221.18 0.0) (11 41.547 221.18 0.0)) ((0 . "LINE") (10 21.3977 221.18 0.0) (11 41.2409 217.682 0.0)) ) ) calculate arc length between upper and middle line, then between middle and lower line... they should be equal Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Indeed they are VovKa (within reason): Command: Command: test Select Circle: Pt1: Pt2: (3.51682 123.085) Command: Command: TEST Select Circle: Pt1: Pt2: (123.086 3.51584) Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Something like this perhaps M? (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))) (vlax-invoke spc 'adddimarc cen p1 p2 p1) (vla-delete ax) (vl-cmdf "_.dimtedit" (entlast) pause))) (princ)) Quote
VovKa Posted August 18, 2009 Posted August 18, 2009 Lee Mac, you know what I mean the answer should be a real number but not a list Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Lee Mac, you know what I mean the answer should be a real number but not a list I know :wink: But, how does one know what arc they want? Quote
mdbdesign Posted August 18, 2009 Author Posted August 18, 2009 Made button: ^C^C(load "brcirc") _brcirc \\\^C^C_(load "dimarc") -la;set;dimension;;_dimarc \\ _erase;\ ^C^C_(load "a2c.lsp") _a2c and all lisp file attached. Work like charm. Something like this perhaps M? I got 2002 onlybrcirc.lsp DIMARC.LSP A2C.LSP Quote
Lee Mac Posted August 18, 2009 Posted August 18, 2009 Made button: ^C^C(load "brcirc") _brcirc \\\^C^C_(load "dimarc") -la;set;dimension;;_dimarc \\ _erase;\ ^C^C_(load "a2c.lsp") _a2c and all lisp file attached. Work like charm. I got 2002 only Oh, what command is missing in '02? 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.