Tharwat Posted June 26, 2010 Share Posted June 26, 2010 Hello Something wrong with making layer current and CLAYER, (defun c:ww (/ curlay width) (prompt "This is Duct Design program . ...") (setq curlay (getvar "clayer")) (if (/= (cdr(setq ser(tblsearch "layer" "acduct")))"acduct") (progn (command "_-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") (command "_-layer" "_set" "ACDUCT" "" "")) (setvar "clayer" "ACDUCT")) (setq width (getint"\nSpecify width of Duct:")) (command "_mline" "_J" "_z" "_scale" width ) (setvar "clayer" curlay) (princ) ) Regards Tharwat Quote Link to comment Share on other sites More sharing options...
profcad Posted June 26, 2010 Share Posted June 26, 2010 I think this is what you are looking for... I removed the code (command "_-layer" "_set" "ACDUCT" "" "")) (defun c:ww2 (/ curlay width) (prompt "This is Duct Design program . ...") (setq curlay (getvar "clayer")) (if (/= (cdr(setq ser(tblsearch "layer" "acduct")))"acduct") (progn (command "_-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") (setvar "clayer" "ACDUCT") );progn );if (setq width (getint"\nSpecify width of Duct:")) (command "_mline" "_J" "_z" "_scale" width ) (setvar "clayer" curlay) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 27, 2010 Author Share Posted June 27, 2010 I think this is what you are looking for... I removed the code (command "_-layer" "_set" "ACDUCT" "" "")) (defun c:ww2 (/ curlay width) (prompt "This is Duct Design program . ...") (setq curlay (getvar "clayer")) (if (/= (cdr(setq ser(tblsearch "layer" "acduct")))"acduct") (progn (command "_-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") [color="Red"](setvar "clayer" "ACDUCT")[/color] );progn );if (setvar "layer" "ACDUCT") (setq width (getint"\nSpecify width of Duct:")) (command "_mline" "_J" "_z" "_scale" width ) (setvar "clayer" curlay) (princ) ) Thanks for your reply , But the Clayer is still not responding by putting the current layer "ACDUCT" on, and to implement the following mline works through that layer. Any other solution would be highly apprecaited. Best Regards. Tharwat Quote Link to comment Share on other sites More sharing options...
David Bethel Posted June 27, 2010 Share Posted June 27, 2010 Using (setvar "CLAYER" ) isn't the best way to create a layer It takes a bit more error trapping etc: [b][color=BLACK]([/color][/b]defun SetLayer [b][color=FUCHSIA]([/color][/b]name / ldef flag[b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]"_.LAYER"[/color][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]if [b][color=NAVY]([/color][/b]not [b][color=MAROON]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] name[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]command [color=#2f4f4f]"_Make"[/color] name[b][color=NAVY])[/color][/b] [b][color=NAVY]([/color][/b]progn [b][color=MAROON]([/color][/b]setq ldef [b][color=GREEN]([/color][/b]tblsearch [color=#2f4f4f]"LAYER"[/color] name[b][color=GREEN])[/color][/b] flag [b][color=GREEN]([/color][/b]cdr [b][color=BLUE]([/color][/b]assoc 70 ldef[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]logand flag 1[b][color=BLUE])[/color][/b] 1[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]command [color=#2f4f4f]"_Thaw"[/color] name[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]minusp [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 62 ldef[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]command [color=#2f4f4f]"_On"[/color] name[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]logand flag 4[b][color=BLUE])[/color][/b] 4[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]command [color=#2f4f4f]"_Unlock"[/color] name[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]and [b][color=GREEN]([/color][/b]= [b][color=BLUE]([/color][/b]logand flag 16[b][color=BLUE])[/color][/b] 16[b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]princ [color=#2f4f4f]"\nCannot Set To XRef Dependent Layer"[/color][b][color=GREEN])[/color][/b] [b][color=GREEN]([/color][/b]quit[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b] [b][color=MAROON]([/color][/b]command [color=#2f4f4f]"_Set"[/color] name[b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b] [b][color=FUCHSIA]([/color][/b]command [color=#2f4f4f]""[/color][b][color=FUCHSIA])[/color][/b] name[b][color=BLACK])[/color][/b] (and (/= (strcase (getvar "CLAYER")) "ACDUCT") (SetLayer "ACDUCT") (command "_.LAYER" "_LT" "Continuous" "ACDUCT" ...... "")) Checking for (snvalid) is also a good thing. -David Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 27, 2010 Author Share Posted June 27, 2010 Thanks David But SetLayer is not function definition in my system. And the way you making a layer is not familiar to me . I do not know ...... anyway thank you. Quote Link to comment Share on other sites More sharing options...
profcad Posted June 27, 2010 Share Posted June 27, 2010 tharwat313, The problem is with the mline command itself. You need a way to input multiple pauses for the ponits that you pick. The original program is running the last line (setvar "clayer" currlay) before the completes the mline command. I simplified the if statement, added a while loop to catch all the points for the mline command and a default duct width. (defun c:ww3 (/ curlay width) (prompt "This is Duct Design program . ...") (setq curlay (getvar "clayer")) (if (tblsearch "layer" "acduct") ;if layer exist, set it current, if not create it. (command "_-layer" "_set" "ACDUCT" "") (command "_-layer" "_make" "ACDUCT" "_ltype" "continuous" "" "_color" "142" "" "") );if (setq width (getint"\nSpecify width of Duct <10>: ")) (if (null width) (setq width 10)) (command "_mline" "_J" "_z" "_scale" width ) (while (= (logand (getvar "cmdactive") 1) 1) (command pause) );while (setvar "clayer" curlay) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 27, 2010 Author Share Posted June 27, 2010 Mr. Profcad Really wonderful that's what I have been looking for. So you pause the command mline by the use of (command pause) and during that period, the Layer created or set current according to the situations and reinvoked the command of Mline .... Am I right ... ? Thank you soooo much Best Regards Tharwat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.