Jump to content

Recommended Posts

Posted

It is possible to get arc dimension as shown below without breaking circle apart, just selecting two points on circle???:?

ScreenShot009.jpg

Posted

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

Posted

I use 2002 and was curious if Autodesk develop something in newer version to do it.

Posted

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))))

Posted

Command: _appload Arclen.lsp successfully loaded.

 

 

Command:

Command:

Command: ARCLEN

Unknown command "ARCLEN". Press F1 for help.

 

Is my machine still on vacation???

Posted

Arclen is a sub-function and requires three arguments, namely the entity in question (circle), and two points.

Posted

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]

Posted

Here's your solution Lee with a bit more error trapping :P

 

(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))

Posted

Thanks Ron :D

 

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))

Posted

I was off just half an hour (still working) let me try...

Posted

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

Posted

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.

Posted

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.

Posted

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

Posted

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)

Posted

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))

Posted

Lee Mac, you know what I mean :)

the answer should be a real number but not a list

Posted
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?

Posted

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 only

brcirc.lsp

DIMARC.LSP

A2C.LSP

Posted
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?

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...