Author Topic: Xline help  (Read 2732 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Xline help
« on: November 01, 2006, 12:19:26 PM »
My company has a little program to draw xline for construction lines.  It works ok but there is a little problem.

If you want to draw more than 2 line it resets the layer.

Code: [Select]
;;; ------------------------------------------------------------------------
(defun c:XLH (/)

;;; Begin Error Handler -------------------------------------------------
(defun *error* (MSG)

(if (not (member MSG '("Function cancelled" "quit / exit abort")))
(princ (strcat "\n*** Program Error: " (strcase MSG) " ***"))
(princ "\n... Program Cancelled ...")
)
(while (< 0 (getvar "cmdactive"))
(command)
)
(setvar "CLAYER" OldClayer)
(setvar "CMDECHO" OldCmdEcho)
(princ)
)
;;; End Error Handler ---------------------------------------------------

(setq OldClayer (getvar "CLAYER"))
(setq OldCmdEcho (getvar "CMDECHO"))

(setvar "CMDECHO" 0)

(if (tblsearch "Layer" "51")
(setvar "CLAYER" "51")
)
(command "xline" "hor" pause)

(setvar "CLAYER" OldClayer)
(setvar "CMDECHO" OldCmdEcho)
(princ)
)

Here is the code.  What I need is for the program to continue with the correct layer until the user ends the program. This doesn't seem to be working.

Thanks all
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Guest

  • Guest
Re: Xline help
« Reply #1 on: November 01, 2006, 12:24:50 PM »
Give this a shot.... Note the 3 lines after (command "xline" "hor" pause)

Code: [Select]
;;; ------------------------------------------------------------------------
(defun c:XLH (/)

;;; Begin Error Handler -------------------------------------------------
(defun *error* (MSG)

(if (not (member MSG '("Function cancelled" "quit / exit abort")))
(princ (strcat "\n*** Program Error: " (strcase MSG) " ***"))
(princ "\n... Program Cancelled ...")
)
(while (< 0 (getvar "cmdactive"))
(command)
)
(setvar "CLAYER" OldClayer)
(setvar "CMDECHO" OldCmdEcho)
(princ)
)
;;; End Error Handler ---------------------------------------------------

(setq OldClayer (getvar "CLAYER"))
(setq OldCmdEcho (getvar "CMDECHO"))

(setvar "CMDECHO" 0)

(if (tblsearch "Layer" "51")
(setvar "CLAYER" "51")
)
(command "xline" "hor" pause)
        (while (> (getvar "cmdactive") 0)
           (command pause)
        )
(setvar "CLAYER" OldClayer)
(setvar "CMDECHO" OldCmdEcho)
(princ)
)

Guest

  • Guest
Re: Xline help
« Reply #2 on: November 01, 2006, 12:26:38 PM »
Actually, the PAUSE in (command "xline" "hor" pause) is not necessary.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Xline help
« Reply #3 on: November 01, 2006, 12:31:27 PM »
That works but not  exactly what I was looking for.

( actually used that first only slightly differant)
Code: [Select]
(while (< 0 (getvar "cmdactive"))
(command)
)

But what I would like is to stay in the xline command until the user wants to exit,while still maintaining the correct layer.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016

Crank

  • Water Moccasin
  • Posts: 1503
Re: Xline help
« Reply #4 on: November 02, 2006, 03:15:37 PM »
I use this (no error check):
Code: [Select]
(defun C:Gb_CV ()(Gb_CL "v"))
(defun C:Gb_CH ()(Gb_CL "h"))
(defun Gb_CL (richting / oudlaag)
(setq oudlaag (getvar "CLAYER"))
(c:Gb_HULPL); Make and set layer
(command "_.xline" richting (while (= (logand (getvar "CMDACTIVE") 1) 1)(command PAUSE)))
(setvar "CLAYER" oudlaag)
                (princ)
)
Vault Professional 2023     +     AEC Collection

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Xline help
« Reply #5 on: November 03, 2006, 07:41:28 AM »
Crank that did the trick.

Thanks man.

(I'll have to add that to my bag'o tricks)
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright © 2016