Heredias2020 Posted February 27, 2020 Posted February 27, 2020 Can Anyone help me create a lisp routine that calculates the invert of a plumbing run by selecting a pline and inputting that distance information into a formula shown below? length in feet (selected Pline) X slope (.125) + 30" (footing) = total in feet / 12 maybe output the answer with a leader if posible Thank you much appreciated Quote
BIGAL Posted March 1, 2020 Posted March 1, 2020 Here is a very rough say 1st version. You need to makeup your mind how you want it labelled, same with slope is it drop per foot, slope or a %. (setq slope (getreal "\nEnter slope")) (setq obj (vlax-ename->vla-object (car (entsel "Pick object ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (/ (+ (* len slope) 2.5) 12.0)) Quote
Heredias2020 Posted March 2, 2020 Author Posted March 2, 2020 Hello Bigal, its slope of 1/8 most of my slopes are 1/8 (.125) id love to just select my pipe run and out-put a description with the invert calculation mentioned above i can see it on the 1st version, how do i make it to prompt for a selection of the pline? thank you so much for the reply by the way i really appreciate it, this will make my production super fast Quote
BIGAL Posted March 2, 2020 Posted March 2, 2020 try this Note no error checking etc. (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (/ (+ (* len slope) 2.5) 12.0)) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 (strcat (rtos drop 4 2) " Drop") "") ) (c:lslope) Quote
dlanorh Posted March 3, 2020 Posted March 3, 2020 On 27/02/2020 at 21:20, Heredias2020 said: Can Anyone help me create a lisp routine that calculates the invert of a plumbing run by selecting a pline and inputting that distance information into a formula shown below? length in feet (selected Pline) X slope (.125) + 30" (footing) = total in feet / 12 maybe output the answer with a leader if posible Thank you much appreciated Are your drawing units in inches or feet? I ask as you specify length in feet and the footing in inches Quote
Heredias2020 Posted March 3, 2020 Author Posted March 3, 2020 Awesome!!! Bigal you are a genious.. i did a couple of changes to make it work like i need it to but nothing major just moving things around this is how it changed (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 " X SANITARY SEWER INVERT @"(strcat (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") ) (c:lslope) my next step is to ask me for a dfu count and based on that it would automatically output a pipe size at the beginning of the text this would be an example 8" SANITARY SEWER INVERT @ 6'-4" BELOW FINISHED FLOOR 1/8 SLOPE 1,292 DFUS here are the dfu/pipe size ranges: 0-180 = 4" 181-700 = 6" 701-1,600 = 8" can this be done? thank you Quote
BIGAL Posted March 3, 2020 Posted March 3, 2020 Not sure what the plumbing terms are maybe this (cond ((< len 180.0000001)(setq dia "4")) ((< len 700.0000001)(setq dia "6")) ((< len 1600.0000001)(setq dia "8")) ((> len 1600.0000001) ((alert "Length is greater than 1600\nwill now exit")(exit)) ) Quote
Heredias2020 Posted March 4, 2020 Author Posted March 4, 2020 Im super excited for this lisp and what it could become for me as a tool this would be the ideal sequence, i am trying to play with it but i get lost some times being new to lisp routines. can this be done? at the very beginning of the lisp it would ask the amount of dfu's (drain fixture units) it would then leave that number below the text out put (example below on red next to the dfus) based on this amount it would then place a number where 8" is below. (example below on red next to the sanitary sewer invert) the sizes are based on this ranges 0-180 = 4" 181-700 = 6" 701-1,600 = 8" 8" SANITARY SEWER INVERT @ 6'-4" BELOW FINISHED FLOOR 1/8 SLOPE 1,292 DFUS Quote
BIGAL Posted March 5, 2020 Posted March 5, 2020 Just change len to dfus in the cond and you need a (strcat dia (chr 34) " SANITARY SEWER INVERT") Quote
Heredias2020 Posted May 6, 2020 Author Posted May 6, 2020 (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) ((< len 180.0000001)(setq dia "4")) ((< len 700.0000001)(setq dia "6")) ((< len 1600.0000001)(setq dia "8")) ((> len 1600.0000001) ((alert "Length is greater than 1600\nwill now exit")(exit)) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 " (strcat dia (chr 34) " SANITARY SEWER INVERT") @"(strcat (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") ) (c:lslope) im not sure what is wrong here i cant get it to work, please help Quote
dlanorh Posted May 6, 2020 Posted May 6, 2020 (edited) 41 minutes ago, Heredias2020 said: (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) ((< len 180.0000001)(setq dia "4")) ((< len 700.0000001)(setq dia "6")) ((< len 1600.0000001)(setq dia "8")) ((> len 1600.0000001) ((alert "Length is greater than 1600\nwill now exit")(exit)) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 " (strcat dia (chr 34) " SANITARY SEWER INVERT") @"(strcat (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") ) (c:lslope) im not sure what is wrong here i cant get it to work, please help You messed up the leader text strcat. Try this (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") If you were trying to make a multiline MText, this will now work. If you only want one line remove the "\\P" between "SANITARY SEWER INVERT" and " @ " Edited May 6, 2020 by dlanorh 1 Quote
Heredias2020 Posted May 6, 2020 Author Posted May 6, 2020 This is how im putting it together, however when i try to run it. it gives me a malformed list on input error my goal with this is to; 1) Pick a Pline 2) prompt for a dfu value where i can manually input (based on the dfu list below) which would automatically place the pipe size at the beginning of the sentence my final product would look like this 8" SANITARY SEWER INVERT @ 6'-4" BELOW FINISHED FLOOR 1/8 SLOPE 1,292 DFUS Please help.. this is what i have so far.. (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (setq dfus) (cond ((< dfus 180.0000001)(setq dia "4")) ((< dfus 700.0000001)(setq dia "6")) ((< dfus 1600.0000001)(setq dia "8")) ((> dfus 1600.0000001) ((alert "dfus is greater than 1600\nwill now exit")(exit)) ) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") ) (c:lslope) Quote
dlanorh Posted May 6, 2020 Posted May 6, 2020 (edited) 1 hour ago, Heredias2020 said: This is how im putting it together, however when i try to run it. it gives me a malformed list on input error my goal with this is to; 1) Pick a Pline 2) prompt for a dfu value where i can manually input (based on the dfu list below) which would automatically place the pipe size at the beginning of the sentence my final product would look like this 8" SANITARY SEWER INVERT @ 6'-4" BELOW FINISHED FLOOR 1/8 SLOPE 1,292 DFUS Please help.. this is what i have so far.. (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (setq dfus) (cond ((< dfus 180.0000001)(setq dia "4")) ((< dfus 700.0000001)(setq dia "6")) ((< dfus 1600.0000001)(setq dia "8")) ((> dfus 1600.0000001) ((alert "dfus is greater than 1600\nwill now exit")(exit)) ) (command "qleader" (getpoint "\nPick 1st leader point")(getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE DFUS") "") ) (c:lslope) What should variable dfus be? It isn't being set to anything (setq dfus). If it is the length of the pline then use the top lisp below. If you want to set it use the bottom lisp. (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (cond ( (<= len 180.0) (setq dia "4")) ( (<= len 700.0)(setq dia "6")) ( (<= len 1600.0)(setq dia "8")) ( (> len 1600.0) (alert "dfus is greater than 1600\nwill now exit") (vl-exit-with-error "")) ) (command "qleader" (getpoint "\nPick 1st leader point") (getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE " (rtos len 4) " DFUS") "" ) ) (defun c:lslope ( / slope obj len drop dfus dfust) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (setq dfus (getreal "\nEnter DFUS Value : ")) (cond ( (<= dfus 180.0) (setq dia "4")) ( (<= dfus 700.0)(setq dia "6")) ( (<= dfus 1600.0)(setq dia "8")) ( (> dfus 1600.0) (alert "dfus is greater than 1600\nwill now exit") (vl-exit-with-error "")) ) (if (zerop (rem dfus 1.0)) (setq dfust (itoa (fix dfus))) (setq dfust (rtos dfus 4))) (command "qleader" (getpoint "\nPick 1st leader point") (getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE " dfust " DFUS") "" ) ) I am off to bed as I need plenty of beauty sleep. Will try to answer any further questions in the morning. Edited May 6, 2020 by dlanorh 1 Quote
Heredias2020 Posted May 7, 2020 Author Posted May 7, 2020 14 hours ago, dlanorh said: What should variable dfus be? It isn't being set to anything (setq dfus). If it is the length of the pline then use the top lisp below. If you want to set it use the bottom lisp. (defun c:lslope ( / slope obj len drop) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (cond ( (<= len 180.0) (setq dia "4")) ( (<= len 700.0)(setq dia "6")) ( (<= len 1600.0)(setq dia "8")) ( (> len 1600.0) (alert "dfus is greater than 1600\nwill now exit") (vl-exit-with-error "")) ) (command "qleader" (getpoint "\nPick 1st leader point") (getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE " (rtos len 4) " DFUS") "" ) ) (defun c:lslope ( / slope obj len drop dfus dfust) ;(setq slope (getreal "\nEnter slope")) (setq slope 0.125) (setq obj (vlax-ename->vla-object (car (entsel "\nPick Pline ")))) (setq Len (vlax-get Obj 'Length)) (setq drop (+ (/ (* len slope) 12.0) 30)) (setq dfus (getreal "\nEnter DFUS Value : ")) (cond ( (<= dfus 180.0) (setq dia "4")) ( (<= dfus 700.0)(setq dia "6")) ( (<= dfus 1600.0)(setq dia "8")) ( (> dfus 1600.0) (alert "dfus is greater than 1600\nwill now exit") (vl-exit-with-error "")) ) (if (zerop (rem dfus 1.0)) (setq dfust (itoa (fix dfus))) (setq dfust (rtos dfus 4))) (command "qleader" (getpoint "\nPick 1st leader point") (getpoint "\nPick end point") "" 0 (strcat dia (chr 34) " SANITARY SEWER INVERT" "\\P" " @ " (rtos drop 4) " BELOW FINISHED FLOOR 1/8 SLOPE " dfust " DFUS") "" ) ) I am off to bed as I need plenty of beauty sleep. Will try to answer any further questions in the morning. Thank you dlanorh this worked great!!! Quote
dlanorh Posted May 7, 2020 Posted May 7, 2020 1 hour ago, Heredias2020 said: Thank you dlanorh this worked great!!! Glad I could help. Quote
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.