+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Sep 2008
    Posts
    13

    Default Clothoid drawing revised lisp

    Registered forum members do not see this ad.

    Dear all,

    This is the last revision of a lisp I posted last week to draw clothoid curves.

    The improvements are:

    * Possibility to draw a clothoid tangent to an alignment (alignment must be a line or a 2 vertexes polyline but the lisp will tell you so). Be carefull that the pick point is important as it will define the alignment's side on which the clothoid will be drawn.
    * Extended clothoid parameter imput. Now a clothoid can be define by a set of 2 parameters chosen between (length / Radius / Parameter A=sqrt(LR) / Angle of deviation)
    * Possibility to extract the clothoid parameters once drawn

    -> To draw a clothoid, use the "clotho" function
    -> To extract clothoid parameters use the "clotho?" function

    I hope this lisp will help some of you and entertain the others.
    I also hope you could give me some feed back on the coding. As a baby programmer in lisp (and in any language for that matter) this would be very useful to me.

    Finally, I have two small questions (among many more...) :
    1. How do you get the negative of a number in lisp? I do it the hard way with
    a-> (- 0 a) but this doesn't feel right.
    2. I use a mapcar in the program with a 2 variable function, let's say f(l , a)
    I have a n-list of values for l but my a stays the same. I created a n-list with only the value a to get it to work. Is there something simplier ?

    Hope I wasn't too long.

    Regards,

    J.BREARD
    Attached Files

  2. #2
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    3,004

    Default

    Quote Originally Posted by jbreard View Post
    How do you get the negative of a number in lisp? I do it the hard way with
    a-> (- 0 a) but this doesn't feel right.
    That is correct, although I feel to be more natural like this:
    Code:
    (* -1 a)
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,738

    Default

    Quote Originally Posted by jbreard View Post
    1. How do you get the negative of a number in lisp? I do it the hard way with
    a-> (- 0 a) but this doesn't feel right.
    No need for the '0':
    Code:
    (- a)
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  4. #4
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Sep 2008
    Posts
    13

    Default

    Ok,

    Thanks to you both. I have try both and will update my code. Guess I will go with the more concise.

    As for my second question, I might reformulate after re-reading my post.

    So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

    I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?

    Hope this is possible.

    On another note, did someone try the lisps and if yes is it working fine with you ?

    Regards,

    J.BREARD

  5. #5
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,738

    Default

    Quote Originally Posted by jbreard View Post
    So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

    I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?
    Code:
    (mapcar '(lambda ( l ) (f l a)) lst)
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  6. #6
    Full Member
    Using
    AutoCAD 2004
    Join Date
    Nov 2009
    Posts
    46

    Default

    Quote Originally Posted by jbreard View Post
    Ok,

    Thanks to you both. I have try both and will update my code. Guess I will go with the more concise.

    As for my second question, I might reformulate after re-reading my post.

    So I have a function f(l, a). I want to evaluate it on n couples of value where only the l value is changing namely (l1,a) (l2,a) (l3,a)...(ln,a)

    I have the n-list (l1, l2, l3, ...., ln). In order to use mapcar I had to create as well a n-list (a, a, a....,a). Is there a way to still use mapcar and avoid the creation of the second list ?

    Hope this is possible.

    On another note, did someone try the lisps and if yes is it working fine with you ?

    Regards,

    J.BREARD
    Hi, I tried your lisp but I don't think I understand how it works but it seems it draws the clothoid in relation to a line right? is it possible to draw it in relation to two lines?

    I'm sorry if this is stupid, my math skills are pretty rudimentary

  7. #7
    Junior Member
    Using
    not specified
    Join Date
    Jan 2006
    Posts
    14

    Default

    Registered forum members do not see this ad.

    I'm having no luck at all getting this to work. Or even load.

    Can somebody post an example of what to type please just to make sure I'm doing it right.
    Best

Similar Threads

  1. My first Lisp : Draw Clothoid Curves (what do you think ?)
    By jbreard in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 21st Dec 2012, 03:47 am
  2. Clothoid/Transitional Curves
    By jakemstone in forum AutoCAD General
    Replies: 2
    Last Post: 25th Aug 2006, 07:46 pm
  3. report on Autocad (REVISED)
    By tomcollins in forum AutoCAD Drawing Management & Output
    Replies: 6
    Last Post: 7th Feb 2005, 11:43 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts