Difference Between ACAD2004 & ACAD 2005

Discussion in 'AutoCAD' started by Tim, May 17, 2004.

  1. Tim

    Tim Guest

    Okay heres my question..Does anybody know what they changed as far as lisp
    handling from R2004 to R2005.

    Reason I ask is because a routine that I have (Thanks in large part to Luis
    Esquivel & TCEBob) works great in 2002 & 2004 but bombs in 2005..its not a
    complicated routine either...

    Whats happening is the points are getting set as they are supposed to but
    when 2005 draws the line it acts as though some of the points dont exist. So
    instead of getting a nice square point, it will combine 2 points as one.
    And the centerline gets drawn from the corners instead of the center of the
    pipe. Since the variables are not being set locally, I can query them &
    confirm that they are there...

    Any suggestions..

    Thanks


    Tim W.

    (See Below)


    ;Run This For Architectural Unit Drawings

    (defun aop (a)
    (* pi (/ a 180.0))
    )


    (defun drawit( a b / )
    (setq sp1 (polar sp pangle 1.44))
    (setq ep1 (polar ep pangle -1.44))
    (setq p1 (polar sp angb90 a))
    (setq p2 (polar p1 pangle 1.44))
    (setq p3 (polar p2 anga90 b))
    (setq p4 (polar ep1 angb90 shdiam))
    (setq p5 (polar p4 angb90 b))
    (setq p6 (polar p5 pangle 1.44))
    (setq p7 (polar ep anga90 (+ shdiam b)))
    (setq p8 (polar p7 pangle -1.44))
    (setq p9 (polar ep1 anga90 shdiam))
    (setq p10 (polar sp1 anga90 shdiam))
    (setq p11 (polar p10 anga90 b))
    (setq p12 (polar sp anga90 (+ shdiam b)))

    (command "pline" p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 "c")
    (command "_line" sp ep "")
    (setq ET (entlast))
    (command ".Change" ET "" "P" "LT" "CENTER2" "c" "3" "")
    (command ".Change" ET "" "P" "LA" "defpoints" "")

    ) ;drawit

    (defun pipecl ( / stp enp pangle plength diam diam1 shdiam anga90 angb90)
    (setq stp (getpoint "\nPick Start of Pipe: "))
    (setq enp (getpoint stp "\nEnd point of pipe: " ))
    (setq pangle (angle stp enp))
    (setq plength (distance stp enp))
    (setq diam (getreal "\nDiameter of pipe in inches: <3 4 6 8 10 12 14> "))
    (setq diam1 diam)
    (setq shdiam (/ diam1 2))
    (setq anga90 (+ pangle (aop 90))) ; Angle of pipe + 90 deg
    (setq angb90 (- pangle (aop 90))) ; Angle of pipe - 90 deg
    (setq rlength plength)
    (if (> plength 240)
    (progn
    (setq sp stp)
    (setq ep (polar sp pangle 240))
    );progn
    (progn
    (setq sp stp)
    (setq ep enp)
    );progn
    );if

    (while (> rlength 0.0)
    (princ rlength)

    (if (< rlength 240) (setq rlength -1))

    (cond ;draw it
    ((= diam 3)
    (drawit 3.75 2.25)
    )
    ((= diam 4)
    (drawit 4.5 2.5)
    )
    ((= diam 6)
    (drawit 5.5 2.5)
    )
    ((= diam 8)
    (drawit 6.75 2.75)
    )
    ((= diam 10)
    (drawit 8.0 3.0)
    )
    ((= diam 12)
    (drawit 9.5 3.5)
    )
    ((= diam 14)
    (drawit 10.5 3.5)
    )
    )

    (if (> rlength 240)
    (progn
    (setq rlength (- rlength 240))
    (setq sp ep)
    (setq ep (polar sp pangle 240))
    );progn
    );if
    (if (< rlength 240)
    (progn
    (setq ep enp)
    );progn
    )

    );while

    );end defun pipecl

    (defun centerl ()
    (setq #CLE (getvar "clayer"))
    (if (null (tblsearch "layer" "Defpoints"))
    (command "layer" "m" "Defpoints" "c" "7" "" "")
    (command "layer" "s" "Defpoints" "")
    );end if
    (setvar "clayer" #CLE)
    )

    (defun C:NPIPEA ()
    (centerl)
    (pipecl)
    )
     
    Tim, May 17, 2004
    #1
  2. Turn off your osnaps.
     
    Jason Piercey, May 17, 2004
    #2
  3. Tim

    Tim Guest

    You know I hope its not simple duh......

    I cant check it out now..but I will feel so stupid.......


    Thanks


    Jason
     
    Tim, May 17, 2004
    #3
  4. Tim

    ECCAD Guest

    Tim,
    You might want to add a couple of functions:
    (defun get_vars ()
    (setq old_osmode (getvar "OSMODE"))
    (setq old_snap (getvar "SNAPUNIT"))
    (setq SNA (rtos (car oldsnap)))
    ; any others
    )

    and

    (defun set_vars ()
    (setvar "OSMODE" old_osnap)
    (command "_snap" SNA)
    ; any others
    )

    Then wrap them in the existing program..
    (defun C:NPIPEA ()
    (get_vars); get old settings
    (centerl)
    (pipecl)
    (set_vars); restore settings
    )

    Bob
     
    ECCAD, May 17, 2004
    #4
  5. Tim,

    It is best, on these sorts of simple routines that use (command), to simply
    force no osnaps each time you provide a point, e.g.:

    ....
    (setq p11 (polar p10 anga90 b))
    (setq p12 (polar sp anga90 (+ shdiam b)))

    (command "._pline" "_non" p1 "_non" p2 "_non" p3 "_non" p4 "_non" p5 "_non"
    p6 "_non" p7 "_non" p8 "_non" p9 "_non" p10 "_non" p11 "_non" p12 "_c")
    (command "._line" "_non" sp "_non" ep "")
    (setq ET (entlast))
    ....

    P.S. Get consistent on using the non-localizing and internal command
    prefixes; the posted code is rather inconsistent.


    --
    R. Robert Bell


    "Tim" <twilsonatresourceintl.com> wrote in message
    You know I hope its not simple duh......

    I cant check it out now..but I will feel so stupid.......


    Thanks


    Jason
     
    R. Robert Bell, May 17, 2004
    #5
  6. Tim

    Tim Guest

    Thanks Bob I completely forgot about setting my variables

    Tim
     
    Tim, May 17, 2004
    #6
  7. Tim

    Tim Guest

    Thats the first time I have seen osnaps turned off that way..

    Thanks for the tip Robert

    Tim
     
    Tim, May 17, 2004
    #7
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.