How to calculation length of arc

Discussion in 'AutoCAD' started by Adesu, May 25, 2004.

  1. Adesu

    Jürg Menzi Guest

    TCEBob
    You can also ask why learning first bicycle if you can learn directly car?

    Cheers...8-D
     
    Jürg Menzi, May 26, 2004
    #21
  2. Adesu

    jbryant4 Guest

    Here's one that I have used.....

    (defun C:ARL
    (/ altest sp c cname ep cent crad ccen sa sb tang ipd alen)
    (initget 1)
    (setq sp (getpoint "\nPICK STARTING POINT: "))
    (setq altest 1)
    (while (= altest 1)
    (setq c (entsel "\nPICK ARC or CIRCLE: "))
    (if (= c nil)
    (princ "\nDID NOT PICK AN ARC OR A CIRCLE!!! TRY AGAIN. ")
    (progn
    (setq cent (entget (car c)))
    (setq cname (cdr (assoc 0 cent)))
    (if (or (= cname "ARC") (= cname "CIRCLE"))
    (setq altest 0)
    (princ
    "\nTHE ENTITY SELECTED IS NOT AN ARC OR A CIRCLE!!! TRY AGAIN. "
    )
    )
    )
    )
    )
    (initget 1)
    (setq ep (getpoint "\nPICK END POINT: "))
    (setq crad (cdr (assoc 40 cent)))
    (setq ccen (cdr (assoc 10 cent)))
    (setq sa (angle ccen sp))
    (setq sb (angle ccen ep))
    (setq ipd (/ (* (* crad 2.0) pi) 360))
    (setq tang (abs (rtd (- sb sa))))
    (if (> tang 180.0)
    (setq tang (abs (- 360 tang)))
    )
    (setq alen (* tang ipd))
    (alert
    (strcat
    "ARC LENGTH = "
    (rtos alen 2 4)
    (chr 34)
    " <"
    (rtos alen 4 4)
    ">"
    )
    )
    (princ)
    )
     
    jbryant4, May 26, 2004
    #22
  3. Adesu

    TCEBob Guest

    ...how can the student learn to run until he has mastered walking?
    Jürg,

    If you are so gifted a student that you can teach yourself activex programming
    and vanilla alisp programming at the same time, I stand and applaud. As for
    myself, I found the challenge of becoming useful in autolisp quite enough.
    Particularly after acquiring some really bad habits in msbasic.

    Just when I thought I was getting a grasp of alisp they came along with activex.
    My reaction was to ignore it as an exotic add-on that was confusing to implement
    and (I thought) not particularly an improvement. It took a few patient words and
    examples from some of the folks here to push me into the deeper waters. I am
    grateful they did and learning more every day.

    So you see, I cannot learn directly car because I had already learned bicycle
    before they invented car. Maybe younger, fresher minds, with a good texbook or
    instructor can assimilate the whole package. But I think that most of those who
    learn alisp do so informally, on their own and without any instruction except
    the help files and this forum if they know about it. Even my favorite textbook,
    "The Autocadet's Guide to Visual Lisp," hardly mentions activex until the last
    chapter.

    Sorry for the long answer to your short question. Sometimes, while I am
    thinking, my fingers get too close to the keyboard.

    rs
     
    TCEBob, May 26, 2004
    #23
  4. Adesu

    Tom Smith Guest

    Just when I thought I was getting a grasp of alisp they came along with
    activex

    It came along when I had a good few years comfort level with the old
    version, and had learned to do most everything I thought I needed to. As I
    said, I'm still looking for cases that actually demand vlax, where I can get
    motivated to go through this learning curve.
     
    Tom Smith, May 26, 2004
    #24
  5. Adesu

    Jürg Menzi Guest

    TCEBob

    Ok, ok, I'm working with AutoLISP since this interface exists (R2.5 1986).
    At this time there were no public Internet nor good books to this topics,
    therefore I had to teach myself everything. That did not hold me from
    learning the newest interfaces (VBA R14) and VisualLISP (R2k) immediately.
    And that with my ancient 45 years.
    It's a thing of attitude how to handle new technologies. It's understandable
    that not all people work immediately with the newest possibilities but there
    is no reason to refuse them. This leads to a backlog in knowledge.
    So I hope - despite my bad English - the substantial was said.

    Cheers
     
    Jürg Menzi, May 26, 2004
    #25
  6. Adesu

    OLD-CADaver Guest

    I well aware that it's my attitude that prevents me from just jumping into the VBA / VLISP mire, but I'm just having a hard time getting motivated. I'm conversationally fluent in half a dozen dead or dying computer programming languages, and just haven't the umpph to learn another. If someone has a secret potion that'll get me excited about it, mail me the formula.
     
    OLD-CADaver, May 26, 2004
    #26
  7. Adesu

    TCEBob Guest

    Ha! Ancient? I am 1.48 times that age, oh callow youth. I'm not at all averse to
    new technologies, but I didn't have a clue what it was about until I found out
    some of the neat things one can do with it.

    Your English is excellent. May I assume from the umlaut that your native tongue
    is German? A beautiful language, which I studied for two years without being
    able to carry on a conversation with a two-year old. That was when I had all my
    brain cells.

    rs
     
    TCEBob, May 26, 2004
    #27
  8. Adesu

    Jürg Menzi Guest

    TCEBob
    Sorry, I *was* 45 as I've learned VBA and VisualLISP, actual I'm 50. My
    calculation says ~1.33...8-D
    Correct...

    Cheers
     
    Jürg Menzi, May 27, 2004
    #28
  9. Adesu

    OLD-CADaver Guest

    <<despite my bad English >>

    Your English is considerably better than my German...

    ... now that I look, it's better than my English as well.
     
    OLD-CADaver, May 27, 2004
    #29
  10. Adesu

    TCEBob Guest

    Well, me to, sorta. But I found some stuff I could do with vlisp that would have
    been impossible with alisp. As for vba, not for now. See if you can lather up
    some interest in activex, you might get to like it. At least it will allow you
    to read those hilarious help messages.

    rs

    VBA / VLISP mire, but I'm just having a hard time getting motivated. I'm
    conversationally fluent in half a dozen dead or dying computer programming
    languages, and just haven't the umpph to learn another. If someone has a secret
    potion that'll get me excited about it, mail me the formula.
     
    TCEBob, May 27, 2004
    #30
  11. Adesu

    Adesu Guest

    Hi Menzi,this my Lisp after I corrected and adopted from others forum,made
    it become simple and clear,in my home this program can it run,but in my
    office I got " error: malformed list on input ",can you give me suggest.
    Best regards
    Ade Suharna
    ; Ale is stand for to calculation length of arc
    ; Design by Ade Suharna
    ; May 29, 2004
    ; Suggest and corrected by
    ; 1).Jürg Menzi <>
    ; 2).Tom Smith <nospam>
    (defun c:ale ()
    (setvar "cmdecho" 0)
    (vl-load-com)
    ;--------------------------------------------
    (setq p1 (getpoint "\nCLICK FIRST POINT: "))
    (setq p2 (getpoint "\nCLICK SECOND POINT: "))
    (setq p3 (getpoint "\nCLICK THIRD POINT: "))
    ;--------------------------------------------
    (command ".arc" p1 p2 p3)
    (setq ent_data (entget (entlast)))
    (setq radius (cdr (assoc 40 edata)))
    (setq start_angle (cdr (assoc 50 edata)))
    (setq end_angle (cdr (assoc 51 edata)))
    (setq arc_length (* (- (+ (* 2 pi) end_angle)
    start_angle)radius))
    (prompt "\nLength of arc: ")
    (princ arc_length)
    ;--------------------------------------------
    (setvar "cmdecho" 1)
    (princ)
    )
    ;----------------------------------------------
    [CHECKING TEXT Length of Arc.LSP loading...]
    ..
    ; error: malformed list on input >>>>>>>>>>>>>I not yet find location
    of false !!!!
    ; Check done.
    ;---------------------------------------------------------------------------
     
    Adesu, May 31, 2004
    #31
  12. Change the line -
    (setq ent_data (entget (entlast)))
    to
    (setq edata (entget (entlast)))
    solves part of the program problem

    but the formula -
    (setq arc_length (* (- (+ (* 2 pi) end_angle) start_angle) radius))
    does NOT return the correct length if the start_angle is greater than
    end_angle
    so change to
    (if (> start_angle end_angle) (setq end_angle (+ (* 2 pi) end_angle)))
    (setq arc_length (* (- end_angle start_angle) radius))



     
    Alan Henderson @ A'cad Solutions, May 31, 2004
    #32
  13. Adesu

    Jürg Menzi Guest

    Ade

    See comments...
    ; Ale is stand for to calculation length of arc
    ; Design by Ade Suharna
    ; May 29, 2004
    ; Suggest and corrected by
    ; 1).Jürg Menzi <>
    ; 2).Tom Smith <nospam>
    (defun c:ale ( / p1 p2 p3 edata radius start_angle end_angle arc_length)
    ;localize variables, see line above
    (setvar "cmdecho" 0)
    ;;;(vl-load-com) ;not necessary without vl-functions
    ;--------------------------------------------
    (setq p1 (getpoint "\nCLICK FIRST POINT: ")
    p2 (getpoint "\nCLICK SECOND POINT: ")
    p3 (getpoint "\nCLICK THIRD POINT: ")
    ) ;one 'setq' is enough
    ;--------------------------------------------
    (command "_.arc" p1 p2 p3) ;'_' for internationalize
    (setq edata (entget (entlast)) ;from Alan's post
    radius (cdr (assoc 40 edata))
    start_angle (cdr (assoc 50 edata))
    end_angle (cdr (assoc 51 edata))
    end_angle (if (> start_angle end_angle) ;from Alan's post
    (+ end_angle (* 2 pi))
    end_angle
    )
    arc_length (* (- end_angle start_angle) radius)
    ) ;one 'setq' is enough
    (prompt "\nLength of arc: ")
    (princ arc_length)
    ;--------------------------------------------
    (setvar "cmdecho" 1)
    (princ)
    )

    Cheers
     
    Jürg Menzi, Jun 1, 2004
    #33
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.