Osmode Problem

Discussion in 'AutoCAD' started by Aaron Cunningham, Jul 15, 2004.

  1. I'm trying to create this simple routine that will set Pline Width according to the Dimscale. This part of the lisp routine works but what I would like to add is to set my osnaps to "endpoint, midpoint,nearest,quadrant,center" draw my pline and then turn them off the snaps.

    I'm new to writing these routines so this is probally something very easy to fix but I've been unable to get this routine to work correctly. Any Suggestions?

    (defun c:pl (/ OS)
    (setvar "plinewid" (* 0.015625 (if (= (getvar "dimscale") 0) 1 (getvar "dimscale"))))
    (setq os (getvar "osmode"))
    (setvar "osmode" 535)
    (command "pline")
    (setvar "osmode" os)
    (princ)
    )
     
    Aaron Cunningham, Jul 15, 2004
    #1
  2. Aaron Cunningham

    ECCAD Guest

    Do the osnap command, getting the dialog.
    Set your osnap modes the way you want them.
    At the command line type: (getvar "OSMODE")
    and watch the prompt line. A number should appear.
    Place that number in the line: (setvar "osmode" nnn)
    where you replace the 'nnn' with the number you got.

    Bob
     
    ECCAD, Jul 15, 2004
    #2
  3. Aaron Cunningham

    Chip Harper Guest

    Just a guess ...

    (defun c:pl (/ OS)
    (setvar "plinewid" (* 0.015625 (if (= (getvar "dimscale") 0) 1 (getvar
    "dimscale"))))
    (setq os (getvar "osmode"))
    (setvar "osmode" 535)
    (command "pline")

    (while (> (getvar "cmdactive") 0) (command pause))

    (setvar "osmode" os)
    (princ)
    )
     
    Chip Harper, Jul 15, 2004
    #3
  4. Aaron Cunningham

    MP Guest

    according to the Dimscale. This part of the lisp routine works but what I
    would like to add is to set my osnaps to "endpoint,
    midpoint,nearest,quadrant,center" draw my pline and then turn them off the
    snaps.
    to fix but I've been unable to get this routine to work correctly. Any
    Suggestions?
    ;add this here
    (while (= (logand (getvar "cmdactive") 1) 1)
    (command pause))
     
    MP, Jul 15, 2004
    #4
  5. O.K. I've changed my value to 567 but still when I run this routine no snaps are set?

    (defun c:pl (/ OS)
    (setvar "plinewid" (* 0.015625 (if (= (getvar "dimscale") 0) 1 (getvar "dimscale"))))
    (setq os (getvar "osmode"))
    (setvar "osmode" 567)
    (command "pline")
    (setvar "osmode" os)
    (princ)
    )
     
    Aaron Cunningham, Jul 15, 2004
    #5
  6. That's it. Thank you. If you don't mind could you explain what

    (while (> (getvar "cmdactive") 0) (command pause))

    is actually doing?
     
    Aaron Cunningham, Jul 15, 2004
    #6
  7. Aaron Cunningham

    ECCAD Guest

    (command "pline")
    Add:
    (while (> (getvar "cmdactive") 0) (command pause))

    Bob
     
    ECCAD, Jul 15, 2004
    #7
  8. Aaron Cunningham

    Chip Harper Guest

    (setvar "osmode" 535)
    (command "pline")
    (setvar "osmode" os)

    Set your osmode to 535
    starts the command "pline"
    resets your osmode

    all before you get started on the screen, in a flash, so you don't get the
    benefit of the resets...

    adding (while (> (getvar "cmdactive") 0) (command pause))

    tells the lisp to PAUSE after starting the pline command until your done
    with the pline command ... THEN it reset's osmode
     
    Chip Harper, Jul 15, 2004
    #8
  9. Aaron Cunningham

    Chip Harper Guest

    Yep, slid one under the wire :)
     
    Chip Harper, Jul 15, 2004
    #9
  10. Adding the while statement fixed the problem of the Osnaps but now when the pline command is active I can't see the pline command options. Is there a way to be able to see these because sometimes I need to draw pline "arc" and sometimes regular "straight" plines?
     
    Aaron Cunningham, Jul 16, 2004
    #10
  11. Adding "._pline" Does the trick
     
    Aaron Cunningham, Jul 16, 2004
    #11
  12. Well it did on my test try of the routine but now I can't get it to display the command line interface. What's going on? Any help please.
     
    Aaron Cunningham, Jul 16, 2004
    #12
  13. Aaron Cunningham

    Chip Harper Guest

    Normally I collect the info up front and feed the values into the pline
    command from saved variables ... not sure why the pline prompts aren't
    displayed ... this isn't same behavior you get with the qleader command for
    example...
     
    Chip Harper, Jul 16, 2004
    #13
  14. There isn't any command line options with the qleader command either?
     
    Aaron Cunningham, Jul 16, 2004
    #14
  15. Aaron Cunningham

    Chip Harper Guest

    No I said "this isn't same behavior you get with the qleader command" ...
    you do see the command line prompts using a similar routine for qleader...
     
    Chip Harper, Jul 16, 2004
    #15
  16. Right I replaced "._pline" with "._qleader" and it still has the same results.
     
    Aaron Cunningham, Jul 16, 2004
    #16
  17. Aaron Cunningham

    Chip Harper Guest

    You do?? Humm I use a similiar routine wiithout issue with qleaders .... let
    me look
     
    Chip Harper, Jul 16, 2004
    #17
  18. Aaron Cunningham

    Chip Harper Guest

    Ok, i diced and spliced .... try this ...

    (defun c:QPL ( / os)
    (setq ce (getvar "cmdecho"))
    (setvar "cmdecho" 0) ; Turn cmdecho off
    (setvar "plinewid" (* 0.015625 (if (= (getvar "dimscale") 0) 1
    (getvar"dimscale"))))

    (setq os (getvar "osmode"))
    (setvar "osmode" 535)

    (setvar "texteval" 1) ; Force ACAD to accept input
    (setvar "cmdecho" 1) ; Turn cmdecho back on
    (command "_.PLINE") ; Start PLINE command
    ;;
    (while (= (logand (getvar "cmdactive") 1) 1)
    (command pause))

    (setvar "texteval"0)
    (setvar "osmode" os) ;
    (setvar "cmdecho" ce) ;
    (prompt "\n. ") ; Clear the command
    Line
    (prompt "\n. ") ; Clear the command
    Line
    (princ) ; Nil supression
    ) ; End defun
     
    Chip Harper, Jul 16, 2004
    #18
  19. Thanks Chip that seems to have done it!! Very busy right now but when I get some time today or next week I want to dig into what you did. I might post back with some questions.
     
    Aaron Cunningham, Jul 16, 2004
    #19
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.