LISP help

Discussion in 'AutoCAD' started by Dr. After, May 22, 2004.

  1. Dr. After

    Dr. After Guest

    I need this routine to work. I got it from Cadalyst Oct 2002 Zip file. It
    is the 3D Arc
    routine by Barry Brown. In the zip file it is named "arc3d.lps.txt" When
    opened it looks just like any other LISP routine, so I changed the name to
    "arc3d.lsp" but running it creates this error:

    The object is not in current space.
    *Invalid*
    ; error: Function cancelled

    So what gives? If this won't work, then does anyone know how I can draw a
    simple little arc in 3d?

    Here is the code:

    ;;;by Barry Bowen, Cadalyst, October 2002

    (defun C:ARC3D (/ SS2 PT_LIST EL EL1 ELIST EN IN PT X Y 3DPT DST PTLIST)
    (setvar "osmode" 0)
    (command "._ucs" "_w")
    (setq SS2 nil SS2 (ssadd))
    (setq PT_LIST nil PT_LIST '())
    (setq EL (entlast))
    (command "._divide" EL 24)
    (setq EL1 (entnext EL))
    (while EL1 (ssadd EL1 SS2) (setq EL1 (entnext EL1)))
    (setq IN 0 EN (ssname SS2 IN) DST 0.25)
    (setq PT_LIST (append (list SPT) PT_LIST))
    (while EN
    (setq ELIST (entget EN))
    (setq PT (cdr (assoc 10 ELIST)))
    (setq X (car PT) Y (cadr PT))
    (setq 3DPT (list X Y DST))
    (setq PT_LIST (append (list 3DPT) PT_LIST))
    (setq DST (+ DST 0.25))
    (setq IN (1+ IN) EN (ssname SS2 IN))
    )
    (setq X (car EPT) Y (cadr EPT))
    (setq 3DPT (list X Y DST))
    (setq PT_LIST (append (list 3DPT) PT_LIST))
    (setq PTLIST (reverse PT_LIST))
    (setq IN 0) (command "._3dPOLY")
    (repeat (length PTLIST)
    (setq PT (nth IN PTLIST))
    (command PT)
    (setq IN (1+ IN))
    )
    (command "")
    (command "._erase" SS2 EL "")
    )

    (prompt "\nType ARC3D To Execute!")
     
    Dr. After, May 22, 2004
    #1
  2. Dr. After

    Dr. After Guest

    BTW - I am using VanillaCAD2002
     
    Dr. After, May 22, 2004
    #2
  3. Dr. After

    ECCAD Guest

    What happens when you comment out the line:
    (command "._ucs" "_w")
    like this:
    ;(command "._ucs" "_w")

    Bob
     
    ECCAD, May 22, 2004
    #3
  4. Dr. After

    Dr. After Guest

    *ECCAD* typed this help:

    | What happens when you comment out the line:
    | (command "._ucs" "_w")
    | like this:
    | ;(command "._ucs" "_w")

    Unforunately nothing... No change at all and yes I did make sure to reload
    the *.lsp before trying.

    stupid vanillaCAD..... :-(
     
    Dr. After, May 22, 2004
    #4
  5. Dr. After

    Dr. After Guest

    *Dr. After* typed this crap:

    | Unforunately nothing... No change at all and yes I did make sure to
    | reload the *.lsp before trying.

    and I did save it before reloading it
     
    Dr. After, May 22, 2004
    #5
  6. Dr. After

    ECCAD Guest

    Looks like the routine is to be called after you add an ARC - in Model Space. IF that is the case, pick the ARC..then type in the arc3d command.

    Bob
     
    ECCAD, May 22, 2004
    #6
  7. Dr. After

    Dr. After Guest

    *ECCAD* typed this crap:

    | Looks like the routine is to be called after you add an ARC - in
    | Model Space. IF that is the case, pick the ARC..then type in the
    | arc3d command.

    now I am getting an unknown command "arc3d", yet it erases the arc I had
    selected.
     
    Dr. After, May 22, 2004
    #7
  8. Dr. After

    ECCAD Guest

    I loaded it to play with it too. Try this:
    Comment out the line:
    (command "._erase" SS2 EL "")
    Add in a line:
    (setvar "pdmode" 2); show points
    Save / reload the routine.
    ... starting with a blank drawing, draw a single arc.
    Then, type in arc3d.
    This should draw 24 points along the arc .. why I have no idea.

    Bob
     
    ECCAD, May 22, 2004
    #8
  9. Dr. After

    ECCAD Guest

    Cute little routine, but it certainly does NOT make an arc into a 'arc3d'...

    Bob
     
    ECCAD, May 22, 2004
    #9
  10. Dr. After

    CAB2k Guest

    This routine looks like a "Work in Progress" and is incomplete.

    There is no error checking and no instructions.

    The arc must be selected before you run the routine.

    BUT in the following line it refers to spt variable not yet defined.
    It should be the start point of the arc, but is nil.

    Code:
    (setq PT_LIST (append (list SPT) PT_LIST))
    It starts with a 0 z-value then uses DST as a starting Z value in increments it by 0.25, why?


    Then the end point ept variable is not defined and therefore the last point
    can not be drawn.

    The routine can not work as-is.

    I suspect they added the wrong lisp file to there zip.

    CAB
     
    CAB2k, May 22, 2004
    #10
  11. Dr. After

    Dr. After Guest

    *ECCAD* typed this crap:

    | I loaded it to play with it too. Try this:
    | Comment out the line:
    | (command "._erase" SS2 EL "")
    | Add in a line:
    | (setvar "pdmode" 2); show points
    | Save / reload the routine.
    | .. starting with a blank drawing, draw a single arc.
    | Then, type in arc3d.
    | This should draw 24 points along the arc .. why I have no idea.

    It seems to run some sort of divide... What that has to do with a 3darc is
    beyond me. I am losing hope in this lisp routine.... Thanks for the help,
    though!!!!
     
    Dr. After, May 22, 2004
    #11
  12. Dr. After

    Anne Brown Guest

    Without a valid email, I cannot send you an off discussion group
    note. Please refrain from using "crap" on the groups. It's not a
    professional level language and demeans your posts. Please use
    the groups as you would an office meeting with clients,
    co-workers and owners.
     
    Anne Brown, May 24, 2004
    #12
  13. Dr. After

    Dr. After Guest

    *Anne Brown* typed this stuff:

    | "crap" on the groups.

    noted....
     
    Dr. After, May 24, 2004
    #13
  14. Dr. After

    ECCAD Guest

    LOL

    :)
    Bob
     
    ECCAD, May 24, 2004
    #14
  15. Dr. After

    DEVItG Guest

    Hi Dr After , would you please teel me whta is the task to do?
    Meanwhile , ist the arc on MODEL space.




    SERVICIOS TECNICOS Gabriel CALÓS DE VIT Ducasse 948 CORDOBA ARGENTINA TE
    0351-472-2677 CELULAR 156-575-497
     
    DEVItG, May 26, 2004
    #15
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.