anyone care to write a lisp?

Discussion in 'AutoCAD' started by longshot, Feb 27, 2004.

  1. longshot

    longshot Guest

    I do a lot of sheetmetal layout & have to rotate my UCS to align with each
    piece of a multi sided transition..

    what I am thinking is a one step block command that prompts for 3 point ucs
    , then prompts for object to make block then switches to world or view UCS
    & prompts for insertion point. I know lots of you guys could write this in
    less than hour & it would take me a week since I know very little about LISP
    programming... any takers? TIA

    Rob
     
    longshot, Feb 27, 2004
    #1
  2. I'm not being snotty here, but that also makes it a great beginners'
    project.
    Why not give it a (long)shot? ; D
    I'm sure you'll get help when stuck, and you'll have a new skill....
     
    Michael Bulatovich, Feb 27, 2004
    #2
  3. longshot

    longshot Guest

    the most common example is a twisted fitting.. .take 2 square flanges for
    example around 2 foot square
    looking at them flat in world ucs , move one up (on z axis) a couple feet,
    rotate 45 degrees in xy plane, then rotate it 20 degrees on each x & y axis,
    now draw triangles with 3d face (these triangles should always go in the
    directions that doesn't choke the volume of the fitting <try it both ways &
    hide to see which is which>)to represent the sheet metal sides of this
    transition. (I draw only the inside face of the metal since it will be fit
    for corner welding, the outside or metal thickness is irrelevant.)

    now to lay out all the pieces to be cut on a cnc laser... I use 3 point UCS
    align, then trace over the 3d face with a polyline & writeblock it to a junk
    file, I rotate around the fitting with my UCS aligning with each one from
    outside looking in & create 8 Blocks, then set my UCS to View or World &
    insert all these blocks flat into one view & DXF out to the laser to cut. I
    was actually thinking it would be nice if the WBlock box had UCS alignment
    options it would cut that work in half,,, but if anyone has any other ideas,
    I'd like to hear em... If my description is hard to follow I'd gladly post
    a dwf or dwg or email it if desired...

    still sound easy? how about a lisp that would take the whole fitting &
    produce all the cut files with one click???

    ideas?

    TIA
    Rob
     
    longshot, Feb 27, 2004
    #3
  4. longshot

    jochen Guest

    for general unfoldings you should try out my
    www.black-cad. It will sove your "twisted problem" too ...
    regards
    Jochen
     
    jochen, Feb 27, 2004
    #4
  5. longshot

    longshot Guest

    I have surfed your site & found nothing useful, however I appreciate your
    good intentions.

    Rob
     
    longshot, Feb 27, 2004
    #5
  6. longshot

    longshot Guest

    anyone else wants to see the type of transition I am talking about, post
    your email & I'll send the r2000i file
     
    longshot, Feb 27, 2004
    #6
  7. longshot

    B. W. Salt. Guest

    That link gives the following message:

    Cannot find server or DNS Error
     
    B. W. Salt., Feb 27, 2004
    #7
  8. longshot

    CW Guest

    I would like to see it.
     
    CW, Feb 27, 2004
    #8
  9. longshot

    Chip Harper Guest

    If this gets scrambled you can email me for a copy.

    ;; ***********************************************************************
    ;; * RUCS.lsp written by Chip Harper 06-17-03 *
    ;; * *
    ;; * Email: *
    ;; * Homepage: *
    ;; * *
    ;; * Program to rotate ucs, set to plan and maintain zoomed area *
    ;; * *
    ;; * *
    ;; * *
    ;; * This lisp is FREEWARE, you may distribute, copy, edit and/or modify *
    ;; * this program as you see fit. *
    ;; * *
    ;; ***********************************************************************
    ;;
    ;;
    ;; ****************************************
    ;; * == Error Handler == *
    ;; * *
    ;; ****************************************
    ;;
    ;;
    (defun ETRAP (msg)
    (if (or
    (= msg "Function cancelled") ; if user cancelled
    (= msg "quit / exit abort") ; if user aborted
    ) ; end or sequence
    (princ) ; exit quietly
    (princ (strcat "\nError: " msg)) ; otherwise report error message
    ) ; end if sequence
    ;;
    ;; **** Variable Resets ****
    ;;
    (setvar "cmddia" CCDI) ;
    Reset cmddia variable
    (setvar "cmdecho" CCME) ; Reset cmdecho variable
    (setvar "cecolor" CCOL) ;
    Reset color variable
    (setvar "dimscale" CDMS) ;
    Reset dimscale variable
    (setvar "filedia" CFDI) ;
    Reset fiedia variable
    (setvar "celtype" CLTY) ;
    Reset linetype variable
    (setvar "clayer" CLAY) ;
    Reset layer variable
    (setvar "orthomode" CORM) ;
    Reset ortho variable
    (setvar "osmode" COSM) ;
    Reset osnaps variable
    (setvar "snapang" CSAN) ;
    Reset snapang variable
    ;;
    ;; **** Screen Prompts ****
    ;;
    (prompt "\n") ; clear text line
    (princ (strcat CLFN " Terminated")) ; notify Operator
    (setq *error* PERROR) ; reset Previous Error Function
    (princ) ; nil supression
    )
    ;;
    ;;
    ;; ****************************************
    ;; * == End Error Handler == *
    ;; * *
    ;; ****************************************
    ;;
    ;;
    ;;
    ;; ****************************************
    ;; * == Main Function == *
    ;; * *
    ;; ****************************************
    ;;

    (defun c:RUCS ( / RCTR NRCTR RSIZE CLFN)
    ;;
    ;; **** Sets general conditions****
    ;;
    (setq PERROR *error*) ; Get previous error
    (setq *error* ETRAP) ; Set error trap
    (setq CLFN "RUCS") ; Set Current Lisp Function name
    ;;
    (setq CCDI (getvar "cmddia")) ;
    Get cmddia setting
    (setq CCME (getvar "cmdecho")) ;
    Get cmdecho setting
    (setq CCOL (getvar "cecolor")) ;
    Get current color
    (setq CDMS (getvar "dimscale")) ;
    Get dimscale setting
    (setq CFDI (getvar "filedia")) ;
    Get filedia setting
    (setq CLTY (getvar "celtype")) ;
    Get current linetype
    (setq CLAY (getvar "clayer")) ;
    Get current layer
    (setq CORM (getvar "orthomode")) ;
    Get ortho setting
    (setq COSM (getvar "osmode")) ;
    Get osnap settings
    (setq CSAN (getvar "snapang")) ;
    Get snapang setting
    ;;
    (setvar "cmdecho" 0) ;
    Turn cmdecho off
    ;;
    ;; **** Change UCS, set to plan and zoom ****
    ;;
    (if (= RSTAT "1")
    (progn
    (setq RCTR (trans(getvar "viewctr") 1 0)) ;
    Get and transfer screen center
    (setq RSIZE (getvar "viewsize")) ;
    Get viewsize
    (Command "ucs" "world") ;
    Change UCS to object
    (Command "Plan" "current") ;
    Set to plan
    (setq NRCTR (trans RCTR 0 1)) ;
    Transfer screen center
    (command "zoom" "c" NRCTR RSIZE) ;
    Reset center zoom
    (setq RSTAT "0") ;
    Reset stat to world setting
    ) ;
    End progn "if"
    (progn
    (setq RCTR (trans(getvar "viewctr") 1 0)) ;
    Get and transfer screen center
    (setq RSIZE (getvar "viewsize")) ;
    Get viewsize
    (prompt "\nSelect Object to Align UCS") ;
    Prompt for object
    (Command "ucs" "new" "OB" PAUSE) ;
    Change UCS to object
    (Command "Plan" "current") ;
    Set to plan
    (setq NRCTR (trans RCTR 0 1)) ;
    Transfer screen center
    (command "zoom" "c" NRCTR RSIZE) ;
    Reset center zoom
    (setq RSTAT "1") ;
    Reset stat to object setting
    ) ;
    End progn "else"
    ) ;
    End if
    ;;
    ;; **** Reset conditons ****
    ;;
    (prompt "\n. ") ;
    Clear the command Line
    (prompt "\n. ")
    (princ)
    ;;
    (setvar "cmdecho" CCME) ;
    Reset cmdecho
    (setq *error* PERROR) ;
    Reset previous error
    (princ)
    )
    ;;
    ;; ****************************************
    ;; * == Load Message == *
    ;; * *
    ;; ****************************************
    ;;
    (prompt "\n Template.lsp Loaded")
    (prompt "\n Written by Chip Harper")
    (prompt "\n ")
    ;;
    ;; ****************************************
    ;; * == End of File == *
    ;; * *
    ;; ****************************************
    ;;
     
    Chip Harper, Feb 28, 2004
    #9
  10. longshot

    P.C. Guest

    Hi

    Architects still today think that the most advanced feature about programs
    like AutoCAD, is the option of having a surface unfolded , to produce the
    building as a primitive mesh entity , as done 20 years ago.
    Bad acturly, as the idea of unfolding is up against some very conservative
    engineers idears .that is about that the only geometrie you must use being a
    designer using CAD, is "known geometrics" ; ----- this acturly is a 2D way
    of thinking.

    So when you get this link as reply, it is becaurse a lot of profesional
    think, that surface is what the thing is about.

    Now I builded lots of boats with my own software, doing unfolded panels from
    single curved surfaces represented as mesh entity, and that acturly work
    even projecting nice tradisional wooden boats , on the screen with a lot of
    Lisp applications ----------- but with my experience I know, that surface is
    the least thing about it ; acturly the structure is much more important, the
    structure or framework to place the panels with. Beside ,try being a bit
    critic about buildings produced from mesh entity ; where are the core
    structure, the floors and walls ?
    Is the best and most progressive realy an emty metal tophat, where you need
    to build another house within, just to get the floors and walls ?

    Surfaces is acturly easy unfolded with a bit Lisp, and AutoCAD offer direct
    access to the drawing database , ------ that's from my point of view much
    better, than a script like way of placing UCS's , as doing it by calculating
    can "unfold" a surface with thoousands of faces in one go. Like what you se
    done with the paneling for these boats ;
    http://groups.yahoo.com/group/Cyber-Boat/

    But if structure is the issue, if you want . If you don't want just an emty
    mesh entity but the floors and walls in an assembly structure, please check
    this ;

    http://home20.inet.tele.dk/h-3d/

    Or this ;
    http://home20.inet.tele.dk/h-3d/villa-3dh.htm

    P.C.
     
    P.C., Feb 28, 2004
    #10
  11. longshot

    jochen Guest

    Hi longshot,
    please send me the file too.
    Regards
    Jochen

    scj.schulz(at)t-online.de
     
    jochen, Feb 28, 2004
    #11
  12. longshot

    longshot Guest

    getting syntax error message when I try to run this
     
    longshot, Mar 1, 2004
    #12
  13. longshot

    longshot Guest

    I managed to get it to work , but it doesn't do anything close to what I was
    looking for. Thanks for the attempt.
     
    longshot, Mar 1, 2004
    #13
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.