How to find list point

Discussion in 'AutoCAD' started by Adesu, Oct 29, 2004.

  1. Adesu

    Adesu Guest

    I just create code,but I forgot to find list a point,anybody know or can you
    help me to inform,thanks.

    ; adx is stand for arc divide by x value
    ; Design by Ade Suharna <>
    ; 28 October 2004
    ; program no. 127/10/2004
    ; Edit by
    (defun c:adx (/)
    (vl-load-com)
    (setq oldosmode (getvar "osmode"))
    (setvar "osmode" 1)
    (setq en (entsel "\nSELECT AN ARC: "))
    (setq ent (entget (car en)))
    (setq info10 (assoc 10 ent))
    (setq opt (fix(getreal "\nENTER NEW VALUE FOR DIVIDE: ")))
    (command "_divide" en opt "")
    (while
    (setq ss (ssget))
    (setq lispoin (mapcar 'chr (vl-string->list ss)))) ; still trouble !!

    I want list the point like this ((0.0 0.0 0.0)(1.0 0.5 0.0)(2.0 0.75 0.)
    etc....)

    (setq len (strlen lispoin))
     
    Adesu, Oct 29, 2004
    #1
  2. Adesu

    MP Guest

    Hi again,

    ;------------------------------------
    ;this isn't what you were asking, but....
    ; if you just want integer values you can use Getint
    (setq opt (getint "\nENTER NEW VALUE FOR DIVIDE: "))

    ;------------------------------------

    ;------------------------------------
    ;now here you're really confusing me! :)
    ;ss is now a selection set (if something was selected - or nil if not)
    ;from the help files you can see that vl-string->list takes a string as
    an argument, not a selection set
    ;quote from help file
    Converts a string into a list of character codes
    (vl-string->list string)
    ;end quote
    ;------------------------------------

    ;------------------------------------
    HUH?
    I have no idea what you're trying to do here, can you explain?
    what point????
    if lispoin is supposed to be a list of points, it's not a string and
    so it won't work with strlen

    sounds like you need either more coffee or more sleep - ha ha -
    that's supposed to be a joke! ok?
    :)

    maybe you can try to explain what you're trying to do?

    Good luck
    Mark
     
    MP, Oct 29, 2004
    #2
  3. Adesu

    Mark Propst Guest

    ;;; Hi Adesu, heres one way that works in limited cases
    ;;; just to give you some ideas.
    ;;; I'm sure there's lots wrong with how it's written but it illustrates one
    approach anyway
    ;;; the part that calculates the included angle needs to be rewritten
    ;;; look for Jon Uhden's @delta function posted here in the past.
    ;;; always when working with angles the logic will break down in the "fourth
    quadrant"
    ;;; (from 270(south) to 0(east))
    ;;; the @delta function and others like it compensate for that special
    condition
    ;;; i probably have something around here somewhere but i'm out of time
    right now to look for it.
    ;;; maybe you already have your own toolbox function for that anyway
    ;;; Example for Adesu
    ;;; Divide and Conquer the Arc
    ;;;---------------------------------
    ;;;-----------adcxDivideArc-------

    ;;;---------------------------------
    (defun c:adcxDivideArc( / arcent numSpaces vo
    cenPt cenPointList radius stPt nextPt
    stAng edAng includeAng eachAng nextang)
    (setq arcent(car(entsel"\nPick arc")))
    (setq numSpaces(Getint"\nHow many divisions? "))
    (if arcent
    (progn
    (setq vo(vlax-ename->vla-object arcent))
    (setq cenPt(vlax-get-property vo 'Center))
    (setq cenPointList(vlax-safearray->list (vlax-variant-value cenPt)))
    (setq radius(vlax-get-property vo 'Radius))
    (setq stPt(vlax-get-property vo 'Startpoint))
    (setq stang(vlax-get-property vo 'Startangle))
    (setq edang(vlax-get-property vo 'Endangle))
    (setq includeang(- stang edang))
    (setq eachAng(/ includeang numspaces))

    (vla-addline
    (vlax-get-property
    (vlax-get-property
    (vlax-get-acad-object)
    'activedocument)
    'modelspace)
    cenPt
    stpt);add line

    (setq nextang stang)
    (repeat numspaces
    (setq nextang(if(< stAng edAng)
    (- nextang eachang)
    (+ nextang eachang)))
    (setq nextPt(polar cenPointList nextang radius))
    (vla-addline
    (vlax-get-property
    (vlax-get-property
    (vlax-get-acad-object)
    'activedocument)
    'modelspace)
    cenPt
    (vlax-3d-point nextpt)
    );add line
    );repeat
    );progn
    );if
    );
     
    Mark Propst, Oct 29, 2004
    #3
  4. Adesu

    CAB2k Guest

    Here is my attempt.

    (defun c:adx (/ ent lst seg cen rad ang1 ang2 p1 p2 len chord)
    (setq useros (getvar "osmode"))
    (setvar "osmode" 0)
    (if (and (setq ent (entsel "\Pick an arc to devide:"))
    (setq lst (entget (car ent)))
    (= (cdr (assoc 0 lst)) "ARC")
    (null (initget (+ 1 2 4))) ; return T
    (setq seg (getint "\nEnter number of segments:"))
    )
    (progn
    ;; get Arc info
    (setq cen (cdr (assoc 10 lst)) ; center point
    rad (cdr (assoc 40 lst)) ; radius
    ang1 (cdr (assoc 50 lst)) ; start angle
    ang2 (cdr (assoc 51 lst)) ; end angle
    inc (abs (- ang1 ang2)) ; included angle
    p1 (polar cen ang1 rad) ; start point
    p2 (polar cen ang2 rad) ; end point
    len (* (/ inc (* 2 pi)) ; arc length: (included angle / 360) * circumference
    (* 2 (* pi rad))
    )
    ;; another arc length (abs (* (- ang1 ang2) ra))
    chord (distance p1 p2) ; chord length
    ) ; setq
    (setq step (/ inc seg))
    (repeat (1+ seg)
    (command "._line" cen p1 "")
    (setq ang1 (+ ang1 step)
    p1 (polar cen ang1 rad)
    )
    )
    )
    )
    (setvar "osmode" useros)
    (princ)
    )
     
    CAB2k, Oct 30, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi CAB2k & Mark Propst,your code beautiful and nice,thanks a lot for you
    both
     
    Adesu, Nov 1, 2004
    #5
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.