Shear Wall Lisp Help

Discussion in 'AutoCAD' started by akdrafter, Jan 16, 2004.

  1. akdrafter

    akdrafter Guest

    Hello All,

    I have a routine that I have had some help with from people in this Discussion Groups. Their names are listed in the routine. I am in need of an addition to this routine. Let me explain.

    As it stands now this routine will ask the user to select a line and the side to offset. Then offset the selected line as a pline to the selected side with a layer, linetype, width, etc. set by the routine.

    Now, I need an addition to this routine that will ask the user to select two lines (hopefully parallel), find the midpoint between those two lines and then create a pline down the middle of the two selected lines with the pline layer, linetype, width, etc. set by the routine.

    I am pasting the original code in here. Any help would be great. Thanks in advance.

    "Catch" Ya Later,
    AKDRAFTER

    ;;;
    ;;; Timothy J. Jaronik Sr.
    ;;; December, 2003
    ;;;
    ;;; Credit goes to the following people
    ;;; from the Auotdesk Discussion Groups(ADG)
    ;;; for their help with this routine
    ;;;
    ;;; Joe Burke
    ;;; Bob Shaw
    ;;; TCEBob <<<<ADG Handle Not sure what his real name is
    ;;
    ;;
    ;;;;;;;;;;;;;;;BEGIN ERROR HANDLING FUNCTION;;;;;;;;;;;;;;;
    ;;
    (defun *ERROR* (msg)
    (princ "\nerror: ")
    (if msg (princ msg))
    (setvar "CMDECHO" CME)
    (setvar "OSMODE" OSM)
    (setvar "SNAPMODE" SNM)
    (setvar "CLAYER" CLA)
    (prompt "\nResetting System Variables... ")
    (princ)
    )
    ;;
    ;;;;;;;;;;;;;;;END ERROR HANDLING FUNCTION;;;;;;;;;;;;;;;
    ;;
    (defun c:SW ( / CME OSM SNM CLA L1 L2 SID)
    (setq CME(getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (setq OSM(getvar "OSMODE"))
    (setvar "OSMODE" 0)
    (setq SNM(getvar "SNAPMODE"))
    (setvar "SNAPMODE" 0)
    (setq CLA(getvar "CLAYER"))
    (command "-layer" "thaw" "S-SHEAR" "on" "S-SHEAR" "make" "S-SHEAR" "color" "1" "S-SHEAR" "lt" "hidden" "S-SHEAR" "")
    (while
    (or
    (not (setq L1 (entsel "\nSelect Line: ")))
    (/= "LINE" (cdr (assoc 0 (entget (car L1)))))
    )
    (princ "\nMissed Pick or Wrong Object Type" )
    )
    (setq SID(getpoint "\nSide To Offset To: "))
    (command "offset" "3" L1 SID "")
    (setq L2(entlast))
    (command "change" L2 "" "p" "layer" "S-SHEAR" "color" "bylayer" "lt" "bylayer" "")
    (command "pedit" L2 "Y" "w" "2.50000000" "")
    (setvar "CMDECHO" CME)
    (setvar "OSMODE" OSM)
    (setvar "SNAPMODE" SNM)
    (setvar "CLAYER" CLA)
    (princ)
    )
     
    akdrafter, Jan 16, 2004
    #1
  2. akdrafter

    ECCAD Guest

    Want more free code ?
    Are the lines just lines or Plines, and what type ?
    Are the lines to be selected (always) > 0 length and both the (same) length ?
    IF so, can do.
    Bob
     
    ECCAD, Jan 16, 2004
    #2
  3. akdrafter

    akdrafter Guest

    Bob,

    More free code? I am not exactly sure how to take that.

    Basically all it is supposed to do is find the midpoint between two selected points and draw a pline with a set layer, linetype, width. Wether the two points are the edge of a block, line, pline or whatever, the routine should just find the midpoint between those two points and draw the pline. I know this creates some in depth coding so I think that just making sure the selected "Line" is a "Line" would be appropriate. Now the lines selected do not have to be the same length as I will be joining together other plines created with this routine. It just has to create a pline I can select, wether it be the same length of the first selected line or the same length as the second line selected.

    Hope that explains it better. :)

    "Catch" Ya Later,
    AKDRAFTER
     
    akdrafter, Jan 16, 2004
    #3
  4. akdrafter

    ECCAD Guest

    I'm working on it.
    Be done soon.
    Bob
     
    ECCAD, Jan 16, 2004
    #4
  5. akdrafter

    akdrafter Guest

    Bob,

    Thanks.

    "Catch" Ya Later,
    AKDRAFTER
     
    akdrafter, Jan 16, 2004
    #5
  6. akdrafter

    CAB2k Guest

    Here is another method.
    No error code or housekeeping.


    (defun c:sw3 ()
    (prompt "\nInsert a shear wall line by picking 3 points in L pattern."
    )
    (if (setq p1 (getpoint "\nPick end of wall on one side"))
    (if (setq p2 (getpoint "\nPick other end of wall on same side"))
    (if (setq p3 (getpoint "\nPick across end of wall to the other side"))
    (progn
    (command "_pline"
    (polar p1 (angle p2 p3) (/ (distance p2 p3) 2))
    "w"
    "2.50000000"
    ""
    (polar p2 (angle p2 p3) (/ (distance p2 p3) 2))
    ""
    )
    (command "change"
    (entlast)
    ""
    "p"
    "layer"
    "S-SHEAR"
    "color"
    "bylayer"
    "ltype"
    "bylayer"
    ""
    )
    )
    )
    )
    )
    )
     
    CAB2k, Jan 19, 2004
    #6
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.