HELP ON MAKING A SPLINE OUT OF A POINT LIST

Discussion in 'AutoCAD' started by A.r.a.k.h.N.i.d.e.F, Feb 4, 2004.

  1. I am trying to make a program that will automatically draw gears based on
    basic parameters fed to it and I've come across a problem. Now that I
    have a point list, how can I make a spline out of it. What I'm doing now
    is very convoluted, I am setting up a selection set and a loop that will
    draw a segment of the line for each loop and add it to that selection set
    After that I use the pedit command to join the line segments and convert
    them into a spline.

    Also has anybody had problems with trying to use trim through Autolisp,
    sometimes the trim works and sometimes it doesn't (check that out for
    yourself) Even though the point I feed it resides on a line that I want
    to trim nothing happens.

    Thank You

    This is a bit of code from the lisp file




    ;========================================
    DRAWING THE CURVE

    (setq curv (ssadd)) ; CREATE A CURVE HOLDING SELECTION SET
    (setq index 0)
    (repeat (length endpoints) ; WILL MAKE A WHOLE BUNCH OF LINE
    SEGMENTS, AND ADD EACH OF THEM TO THE CURV SELECTION SET
    (command ".line"
    (nth index endpoints) ; GET THE CURRENT ENDPOINT AS THE
    START OF THE LINE
    (nth (1+ index) endpoints); GET THE NEXT ENDPOINT AS THE EP OF
    THE LINE
    ""
    )
    (ssadd (entlast) curv) ; ADD THE LAST CREATED LINE TO THE
    SELECTION SET
    (setq index (1+ index))
    )



    (cond
    (
    (> bc rd) ; IF THE BASE CIRCLE IS LESS THAN THE
    ROOT DIAMETER
    (command ".line"
    (last endpoints) ; START FROM THE END OF THE INVOLUTE
    (polar center :) 0) (/ rd 2.0))
    ; AND TO THE ROOT DIAMETER
    ""
    )
    (ssadd (entlast) curv) ; ADD THE LAST ENTITY CREATED TO THE
    CURV SS
    )
    )
    (command ".pedit" "m" curv "" "y" "j" "" "s" "")
    ; CONVERT THE LINES GRABBED IN THE SELECTION
    SET INTO A SPLINE USING THE POLYLINE EDIT COMMAND

    (COMMAND ".CIRCLE" center "d" rd) ; CREATE THE ROOT DIAMETER TO TRIM
    THE CURVE TO



    (command ".trim" ; TRIM THE INVOLUTE CURVE UP THE ROOT
    DIAMETER
    (polar center :) 13.45) (/ rd 2.0))
    ""
    (last endpoints)
    ""
    )
     
    A.r.a.k.h.N.i.d.e.F, Feb 4, 2004
    #1
  2. by the way sorry for the caps heading didn't notice it until now.
     
    A.r.a.k.h.N.i.d.e.F, Feb 4, 2004
    #2
  3. do a google search for autogear.lsp & save your time for better things
     
    Alan Williamson, Feb 5, 2004
    #3
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.