+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24

Thread: Arguments

  1. #1
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default Arguments

    Registered forum members do not see this ad.

    Hello to all,

    Attached below are three formulas to solve for distance for ellipsodial heads of different types.
    My question is can each formula be written in one argument or does it need to be written in several?
    I am not completely sure how to break this down. Any help on this would be greatly appreciated.

    Again Thank You in advance,
    The Buzzard
    Attached Images

  2. #2
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Sorry,

    I think I explained myself incorrectly.
    What I meant was can each formula be written in one statement with the given arguments.

  3. #3
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Thanks God, I'm far enough from Hitleropa
    Posts
    1,697

    Default

    Quote Originally Posted by The Buzzard View Post
    Sorry,

    I think I explained myself incorrectly.
    What I meant was can each formula be written in one statement with the given arguments.
    Not sure about but have you tried use the COND statement?

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    I probably overlooked something, but this should be a good example (your first function)...

    Code:
    (defun foo (L r O D tt / _sq)
      (setq _sq (lambda (#) (* # #)))
    
      (- L (sqrt (- (_sq (- L r)) (_sq (/ (* O D) (apply '- (list 2 tt r)))))))
    ) ;_ defun
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  5. #5
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Sorry again,

    Fixo,

    I do not mean to combine all three or a way to pick a formula.
    For each formula above can the supplied arguments be put into one continuous statement for each formula.

  6. #6
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Thanks Alan,

    I think I can figure the rest from here.
    But what is apply in the statement for.

  7. #7
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    Quote Originally Posted by The Buzzard View Post
    Thanks Alan,

    I think I can figure the rest from here.
    But what is apply in the statement for.
    It was to subtract the 3 numbers, but I completely forgot you can add more than 2 numbers to the (- function.

    Code:
    (defun foo (L r O D tt / _sq)
      (setq _sq (lambda (#) (* # #)))
    
      (- L (sqrt (- (_sq (- L r)) (_sq (/ (* O D) (- 2 tt r))))))
    ) ;_ defun
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  8. #8
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    You don't have to use the _sq sub function. However, it saves you a lot of typing and condenses your routine quite a bit.

    Code:
    (setq _sq (lambda (#) (* # #)))
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  9. #9
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Alan,

    I looked up apply Function,

    Passes a list of arguments to, and executes, a specified function.

    Thanks

  10. #10
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by The Buzzard View Post
    Alan,

    I looked up apply Function,

    Passes a list of arguments to, and executes, a specified function.

    Thanks
    Hope it helps.
    And good luck keeping your head on straight while typing everything out.
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

Similar Threads

  1. too many arguments error on lsp anyone know why
    By chelsea1307 in forum AutoLISP, Visual LISP & DCL
    Replies: 7
    Last Post: 17th Jun 2009, 09:34 pm
  2. Too many Arguments
    By Enigma in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 21st Apr 2009, 07:27 pm

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