See the top rated post in this thread. Click here

Results 1 to 3 of 3

Thread: Run PLINE command with Endpoint Osmode on as I pick different parts in drawing

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Run PLINE command with Endpoint Osmode on as I pick different parts in drawing

    Hi everyone,

    I having a problem with this code that I am trying to write. I am looking to have it run the pline command with the endpoint osmode on as I pick different parts of my drawing.

    The way it is written now it will pick the first two point but after that it will not use the endpoint osmode.

    I hope somebody can help me

    Thanks,

    Kyle C.

    Code:
    (DEFUN C:PL1 (/ *Error* useros usercmd)
      ;; error function & Routine Exit
      (defun *error* (msg)
    	(if
    	  (not
     (member
       msg
       '("console break"
    	 "Function cancelled"
    	 "quit / exit abort"
    	 ""
    	)
     )
    	  )
    	   (princ (strcat "nError: " msg))
    	); endif
    	;;reset all variables here
    	(if useros
    	  (setvar "osmode" useros)
    	)
    	(if usercmd
    	  (setvar "CMDECHO" usercmd)
    	)
    	(setq useros nil
       usercmd nil
    	)
      );end error function  (defun *Error* (msg) ; embedded defun
    
      (setq useros (getvar "osmode")
     usercmd (getvar "CMDECHO")
      )
      (setvar "cmdecho" 0)
      (setq os1 (getvar "osmode"))
      (princ "MACRO: PLINE WITH ENDPOINT ON")
      (setvar "osmode" 1)
      (COMMAND "_PLINE" (getpoint "nPick First point: "))
      ;(while (> (getvar "cmdactive") 0)) ; I am not sure if I need this or not, if I use it, it locks up Autocad
      (princ "nNext Point: ");let 'em know it wants another point
      (command pause);pause for subsiquent points
      (setvar "osmode" os1)
      (SETVAR "CMDECHO" 1)
      (princ)
    )

  2. #2
    AUGI Addict madcadder's Avatar
    Join Date
    2000-11
    Location
    Too far from the beach
    Posts
    1,054
    Login to Give a bone
    1

    Default Re: Run PLINE command with Endpoint Osmode on as I pick different parts in drawing

    Code:
     (DEFUN c:pl1 (/ *error* useros usercmd)
       ;; error function & Routine Exit
       (DEFUN *error* (msg)
     	(IF
     	  (NOT
     	(MEMBER
     	  msg
     	  '("console break"
     		"Function cancelled"
     		"quit / exit abort"
     		""
     	   )
     	) ;_ end of member
     	  ) ;_ end of not
     	   (PRINC (STRCAT "nError: " msg))
     	)					; endif
     	;;reset all variables here
     	(IF	useros
     	  (SETVAR "osmode" useros)
     	) ;_ end of if
     	(IF	usercmd
     	  (SETVAR "CMDECHO" usercmd)
     	) ;_ end of if
     	(SETQ useros nil
     	  usercmd nil
     	) ;_ end of setq
       )					;end error function  (defun *Error* (msg) ; embedded defun
     
       (SETQ	useros	(GETVAR "osmode")
     	usercmd	(GETVAR "CMDECHO")
       ) ;_ end of setq
       (SETVAR "cmdecho" 0)
       (SETQ os1 (GETVAR "osmode"))
       (PRINC "MACRO: PLINE WITH ENDPOINT ON")
       (SETVAR "osmode" 1)
       (COMMAND "_PLINE" (GETPOINT "nPick First point: "))
       (WHILE (> (GETVAR "cmdactive") 0)
     	(PRINC "nNext Point: ")
     	(COMMAND pause)
       ) ;_ end of while
       (SETVAR "osmode" os1)
       (SETVAR "CMDECHO" 1)
       (PRINC)
     ) ;_ end of DEFUN
    tested and works with this mod.

    EDIT: You are setting OSMODE to two different variables.
    Last edited by madcadder; 2006-10-12 at 08:27 PM.

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Smile Re: Run PLINE command with Endpoint Osmode on as I pick different parts in drawing

    Tod,

    Thank you for your help.

    Kyle C.

Similar Threads

  1. 2013: PLINE arc segment is not visible when drawing...
    By AJ_Error 404 in forum AutoCAD General
    Replies: 3
    Last Post: 2015-03-03, 08:54 AM
  2. Drawing a PLINE (fixed width)
    By hrvoje.koncar203481 in forum AutoLISP
    Replies: 7
    Last Post: 2009-11-26, 09:04 PM
  3. Finding a text in drawing and drawing a pline
    By jitesh789 in forum AutoLISP
    Replies: 18
    Last Post: 2008-01-01, 05:19 PM
  4. feed pline command
    By kennet.sjoberg in forum AutoLISP
    Replies: 3
    Last Post: 2005-03-10, 06:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •