Points Problemo... F1

Discussion in 'AutoCAD' started by akdrafter, Feb 3, 2004.

  1. akdrafter

    akdrafter Guest

    Hello All,

    I have taken some code from other routines that the users in ADG have helped me with and combined the code into other routines. I have this one that I am using to create a beam line that is to be shown as if it were hanging from a column or a wall and not on top of the column or wall. We do this by moving the line 6 inches off of the column or wall. Here is the problem I am having. For P2, if I select the osnap of "perpendicular" it does not create a true perpendicular line. Instead it creates what seems to be a random P2, which is stored for use by the "polar" function later in this routine. I believe it has something to do with the "polar" function later in the routine not working correctly with the "perpendicular" osnap.

    I know the BOFFOFF seems a bit cumbersome to initiate the routine, but I am using generic terms so that I can recognize important items until I have it lean mean and clean. Then I will make the initiation of the routine a little less cumbersome. :)

    Any ideas?

    Thanks in advance. Code is pasted below.

    "Catch" Ya Later,
    AKDRAFTER

    ;;;
    ;;; Beam Hanging Creation Routine
    ;;;
    ;;; Timothy J. Jaronik Sr.
    ;;; February, 2004
    ;;;
    ;;; Credit to Mike Weaver for his input with this code.
    ;;
    ;;;;;;;;;;;;;;;BEGIN ERROR HANDLING FUNCTION;;;;;;;;;;;;;;;
    ;;
    (defun ERRTRAP (msg)
    (princ "\n Error: ")
    (if msg (princ msg))
    (setvar "CLAYER" CLA)
    (setvar "CMDECHO" CME)
    (setvar "OSMODE" OSM)
    (setvar "ORTHOMODE" OTHM)
    (setvar "SNAPMODE" SNM)
    (setq *ERROR* OLDERR)
    (prompt "\n Resetting System Variables... ")
    (princ)
    )
    ;;
    ;;;;;;;;;;;;;;;END ERROR HANDLING FUNCTION;;;;;;;;;;;;;;;
    ;;
    (defun c:BOFFOFF (/ OLDERR *ERROR* CME OSM SNM OTHM CLA P1 P2 A1 P3 P4)
    (setq OLDERR *ERROR*)
    (setq *ERROR* ERRTRAP)
    (setq CLA(getvar "CLAYER"))
    (setq CME(getvar "CMDECHO"))
    (setvar "CMDECHO" 0)
    (setq OSM(getvar "OSMODE"))
    (setvar "OSMODE" 0)
    (setq OTHM(getvar "ORTHOMODE"))
    (setvar "ORTHOMODE" 0)
    (setq SNM(getvar "SNAPMODE"))
    (setvar "SNAPMODE" 0)
    (command "-layer" "make" "S-BEAM" "thaw" "S-BEAM" "on" "S-BEAM" "color" "4" "S-BEAM" "lt" "CONTINUOUS" "S-BEAM" "")
    ;;;
    (setq P1(getpoint "\n Select First Point: "))
    (setq P2(getpoint "\n Select Second Point: "))
    (setq
    A1 (angle P1 P2)
    P3 (polar P1 A1 6)
    p4 (polar P2 A1 -6)
    )
    ;;;
    (setvar "CLAYER" "S-BEAM")
    (command "._line" "_non" P3 P4 "")
    (setq *ERROR* OLDERR)
    (setvar "CLAYER" CLA)
    (setvar "CMDECHO" CME)
    (setvar "OSMODE" OSM)
    (setvar "ORTHOMODE" OTHM)
    (setvar "SNAPMODE" SNM)
    (princ)
    )
    (prompt "\n Type BOFFOFF To Run The Beam Hanging Creation Routine")
     
    akdrafter, Feb 3, 2004
    #1
  2. akdrafter,

    The Perpendicular point must have an original point to be calculated from.
    The solution is to change the following line:
    Change to:

    (setq P2 (getpoint P1 "\n Select Second Point: "))

    The P1 argument gives the second point a place to reference.
     
    Phil Kenewell, Feb 3, 2004
    #2
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.