sayhi_sanjay1 Posted July 18, 2012 Share Posted July 18, 2012 (edited) I am trying to preparedmy 1st lisp in my life in command and draw Equal Tee I wrote Like this for 4" Equal Tee without Wall Thickness (defun c:DET4()(asave)(command "PLINE" PAUSE "@114.30<270" "@210<0" "@114.30<90" "@47.85<180" "@47.85<90" "@114.30<180" "@47.85<270" "C")) But Whenever i try this lisp i have to zoom small area and insert than it will come proper other wise it come in one pline. I know you are the king of experts. please help me. & give some gide line to make Lisp for Single line/Double Line Pipe (without Wall thickness), Single line/Double Line Elbow (90°LR, 90°SR, 45°LR) (with center line), Single line/Double Line Tee/Reducing Tee (with center line), Reducer (Concentric, Eccentric [Flat Side-up or Flat side Down)(with center line), Weldneck Flange, Socket weld Flange, Blind Flange (Ansi B16.5 & B16.47A, B)(75#, 125#, 150#, 300#, 400#, 600#, 900# 1500#, 2500#), Valves with small to big size& all Ratings (Gate, Globe, Ball, Plug, Butterfly, Diapharm), Steel section plan & elevations, Civil works 2d door/windows And Electrical symbols. I need your help& guidline to complete my all lisp. After Completing my lisp i will post also. Edited July 18, 2012 by sayhi_sanjay1 Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 18, 2012 Share Posted July 18, 2012 The problem seems to be from interference with auto Osnap feature - you should temporarily disable it while calling the COMMAND function: (defun c:ET4( / [color=#ff0000]oldOsMode [/color]) [color=red](setq oldOsMode (getvar "OSMODE"))[/color] [color=red](setvar "OSMODE" 0)[/color] (asave) (command "PLINE" PAUSE "@114.30<270" "@210<0" "@114.30<90" "@47.85<180" "@47.85<90" "@114.30<180" "@47.85<270" "C") [color=red](setvar "OSMODE" oldOsMode)[/color] ) You didn't included the definition of ASAVE function, so cannot comment how this is influencing your code. Also, please edit you post and add code tags. Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 18, 2012 Share Posted July 18, 2012 For a more flexible approach, I suggest you to look to POLAR function instead of hard-coding the relative coordinates (see below example). An even better solution is to directly add the entities by their associated lists using ENTMAKE - but this will require some level of experience, so may let if for later. (defun c:ET4( / oldOsMode pointTemp DtoR ) (defun DtoR( angle / ) (* (/ angle 180.0) pi)) (setq oldOsMode (getvar "OSMODE")) (setvar "OSMODE" 0) ;(asave) (setq pointTemp (getpoint "Start point: ")) (command "PLINE" pointTemp (setq pointTemp (polar pointTemp (DtoR 270) 114.30)) (setq pointTemp (polar pointTemp (DtoR 0) 210.00)) (setq pointTemp (polar pointTemp (DtoR 90) 114.30)) (setq pointTemp (polar pointTemp (DtoR 180) 47.85)) (setq pointTemp (polar pointTemp (DtoR 90) 47.85)) (setq pointTemp (polar pointTemp (DtoR 180) 114.30)) (setq pointTemp (polar pointTemp (DtoR 270) 47.85)) "C") (setvar "OSMODE" oldOsMode) ) Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 Thanks Mircea Both Options works. Any guide line for make Single line/Double Line Pipe (without Wall thickness), Single line/Double Line Elbow (90°LR, 90°SR, 45°LR) (with center line), Single line/Double Line Tee/Reducing Tee (with center line), Reducer (Concentric, Eccentric [Flat Side-up or Flat side Down)(with center line), Weldneck Flange, Socket weld Flange, Blind Flange (Ansi B16.5 & B16.47A, B)(75#, 125#, 150#, 300#, 400#, 600#, 900# 1500#, 2500#), Valves with small to big size& all Ratings (Gate, Globe, Ball, Plug, Butterfly, Diapharm), Steel section plan & elevations, Civil works 2d door/windows And Electrical symbols. Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 (edited) The problem seems to be from interference with auto Osnap feature - you should temporarily disable it while calling the COMMAND function: (defun c:ET4( / [color=#ff0000]oldOsMode [/color]) [color=red](setq oldOsMode (getvar "OSMODE"))[/color] [color=red](setvar "OSMODE" 0)[/color] (asave) (command "PLINE" PAUSE "@114.30<270" "@210<0" "@114.30<90" "@47.85<180" "@47.85<90" "@114.30<180" "@47.85<270" "C") [color=red](setvar "OSMODE" oldOsMode)[/color] ) You didn't included the definition of ASAVE function, so cannot comment how this is influencing your code. Also, please edit you post and add code tags. if i want to add more lines and one lisp than..? Like this (defun c:DET4()(asave)(command "PLINE" PAUSE "@114.30<270" "@210<0" "@114.30<90" "@47.85<180" "@47.85<90" "@114.30<180" "@47.85<270" "C")(setvar "OSMODE" oldOsMode)) (defun c:DET5()(asave)(command "PLINE" PAUSE "@141.30<270" "@248<0" "@141.30<90" "@53.35<180" "@53.35<90" "@141.30<180" "@53.35<270" "C")(setvar "OSMODE" oldOsMode)) (defun c:DET6()(asave)(command "PLINE" PAUSE "@168.28<270" "@286<0" "@168.28<90" "@58.86<180" "@58.86<90" "@168.28<180" "@58.86<270" "C")(setvar "OSMODE" oldOsMode)) (defun c:DET8()(asave)(command "PLINE" PAUSE "@219.08<270" "@356<0" "@219.08<90" "@68.46<180" "@68.46<90" "@219.08<180" "@68.46<270" "C")(setvar "OSMODE" oldOsMode)) (defun c:DET10()(asave)(command "PLINE" PAUSE "@273.05<270" "@432<0" "@273.05<90" "@79.48<180" "@79.48<90" "@273.05<180" "@79.48<270" "C")(setvar "OSMODE" oldOsMode)) than also i have to use same function for all or i can give one comman function and than end with same. Edited July 18, 2012 by sayhi_sanjay1 Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 18, 2012 Share Posted July 18, 2012 To create the components of your library you should divide each sketch in simple components (lines, arcs, polylines, texts or so) and add them by AutoLISP code. Alternatively, may check a solution based on dynamic blocks and add them on a dedicated palette. Depending on what are you/your employer willing to invest, I think that there are vertical products of AutoCAD for those fields. Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 18, 2012 Share Posted July 18, 2012 First, please edit your both posts to follow Forum rules. if i want to add more lines and one lisp than..? Second, please pay attention that I have added more lines to your original code! To answer your question, you can define a function for each case or a general one with options: (defun c:ET( / oldOsMode modelET ) (setq oldOsMode (getvar "OSMODE")) (setvar "OSMODE" 0) (asave) (initget "4 5 6 8 10") (setq modelET (getkword "\Input ET's model [4/5/6/8/10]: ")) (cond ((= modelET "4") (command "PLINE" PAUSE "@114.30<270" "@210<0" "@114.30<90" "@47.85<180" "@47.85<90" "@114.30<180" "@47.85<270" "C")) ((= modelET "5") (command "PLINE" PAUSE "@141.30<270" "@248<0" "@141.30<90" "@53.35<180" "@53.35<90" "@141.30<180" "@53.35<270" "C")) ((= modelET "6") (command "PLINE" PAUSE "@168.28<270" "@286<0" "@168.28<90" "@58.86<180" "@58.86<90" "@168.28<180" "@58.86<270" "C")) ((= modelET "8") (command "PLINE" PAUSE "@219.08<270" "@356<0" "@219.08<90" "@68.46<180" "@68.46<90" "@219.08<180" "@68.46<270" "C")) ((= modelET "10") (command "PLINE" PAUSE "@273.05<270" "@432<0" "@273.05<90" "@79.48<180" "@79.48<90" "@273.05<180" "@79.48<270" "C")) ) (setvar "OSMODE" oldOsMode) (princ) ) Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 Thanks alot i have tried and complete for all and its work perfact. Thanks once again Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 To draw pipe in double line i have wrote like this (defun c:DPH()(asave)(command "-layer" "m" "center" "lt" "center" "" "c" "8" "" "m" "pipe" "lt" "continuous" "" "c" "4" "" "")(command "MLINE" "S" "21.34" PAUSE PAUSE "")(command "explode" "l")(command "offset" "10.67" pause pause "" )(command "change" "l" "" "p" "la" "center" "c" "bylayer" "lt" "bylayer" "" "")) (defun c:DP3F()(asave)(command "-layer" "m" "center" "lt" "center" "" "c" "8" "" "m" "pipe" "lt" "continuous" "" "c" "4" "" "")(command "MLINE" "S" "26.67" PAUSE PAUSE "")(command "explode" "l")(command "offset" "13.34" pause pause "" )(command "change" "l" "" "p" "la" "center" "c" "bylayer" "lt" "bylayer" "" "")) check and tel mee if any modification is requred Quote Link to comment Share on other sites More sharing options...
MSasu Posted July 18, 2012 Share Posted July 18, 2012 Glad I could help you. You're entirely welcome! Also, thank you for fixing your posts. Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 could you help me for pipe route lisp Quote Link to comment Share on other sites More sharing options...
sayhi_sanjay1 Posted July 18, 2012 Author Share Posted July 18, 2012 (defun c:DPH()(asave)(command "-layer" "m" "center" "lt" "center" "" "c" "8" "" "m" "pipe" "lt" "continuous" "" "c" "4" "" "")(command "MLINE" "S" "21.34" PAUSE PAUSE "")(command "explode" "l")(command "offset" "10.67" pause pause "" )(command "change" "l" "" "p" "la" "center" "c" "bylayer" "lt" "bylayer" "" "")) (defun c:DP3F()(asave)(command "-layer" "m" "center" "lt" "center" "" "c" "8" "" "m" "pipe" "lt" "continuous" "" "c" "4" "" "")(command "MLINE" "S" "26.67" PAUSE PAUSE "")(command "explode" "l")(command "offset" "13.34" pause pause "" )(command "change" "l" "" "p" "la" "center" "c" "bylayer" "lt" "bylayer" "" "")) any comments i am trying with mline but if u have some thing which is easy than this please tell me. 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.