PDA

View Full Version : calculate manhole invert level

drafting_man
23rd Apr 2011, 12:25 am
if someone can help me i will be thanks

i need lisp can calculate manhole invert level for sewer line
i will give the lisp invert level 1 and slope and distance (distance is
aligned dimension ) then lisp calculate invert level 2
invert level 2 = invert leverl 1 - distance * slope
invert level 3 = invert leverl 2 - distance * slope
invert level 4 = invert leverl 3 - distance * slope until i finished
slope don't changed only distance changed
example attached thanks

Tharwat
23rd Apr 2011, 04:58 am

TharwaT

drafting_man
23rd Apr 2011, 09:12 am

TharwaT

thank's but that was not help for me

Tharwat
23rd Apr 2011, 09:52 am
thank's but that was not help for me

No problem , I guess the routine that you asking for is not that hard to make , so if I had time today I would make it for you .:)

Or may be one of the great friends in here would do it .

Regards,

TharwaT

Organic
23rd Apr 2011, 02:59 pm
I would just manually calculate the invert levels. If something goes wrong and the inverts are calculated incorrectly, then that will have flow on effects for other parts of the design.

Civil3D and most other civil design packages can do this for you. Although a calcualtor, pen and paper still remains one of the best ways.

fixo
23rd Apr 2011, 03:09 pm
try this

(defun c:demo(/ decs diff elist level osm p1 p2 slope strlevel txtelev txthgt txtpt)
(setq osm (getvar 'osmode))
(while (and
(or (not
(setq txtelev (entsel "\nSelect starting level text : ")))
(not
(eq "TEXT"
(cdr (assoc 0 (setq elist (entget (car txtelev)))))))))
(princ
"\n Nothing selected or wrong object type selected, try again")
)
(setq strlevel (cdr (assoc 1 elist))
decs (- (strlen strlevel) (1+ (vl-string-position 46 strlevel)))
level (atof strlevel)
txthgt (cdr (assoc 40 elist))
)

(initget 6)
(setq slope (getreal "\n Enter slope in decimals <0.03> : "))
(if (not slope)
(setq slope 0.03))
(setvar 'osmode 516)
(setq p1 (getpoint "\nPick first point: "))
(setq diff (mapcar '- (cdr (assoc 10 elist)) p1))

(while (setq p2 (getpoint "\nPick next point (or press Enter to Exit): "))
(setq level (- level (* (distance p1 p2) slope))
strlevel (rtos level decs)
txtpt (mapcar '+ p2 diff)
)
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 10 txtpt)
(cons 11 (list 0.0 0.0 0.0))
(cons 40 txthgt)
(cons 1 strlevel)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 0))
)
(setq p1 p2)
)

(setvar 'osmode osm)
(princ)
)

drafting_man
23rd Apr 2011, 11:33 pm
try this

(defun c:demo(/ decs diff elist level osm p1 p2 slope strlevel txtelev txthgt txtpt)
(setq osm (getvar 'osmode))
(while (and
(or (not
(setq txtelev (entsel "\nSelect starting level text : ")))
(not
(eq "TEXT"
(cdr (assoc 0 (setq elist (entget (car txtelev)))))))))
(princ
"\n Nothing selected or wrong object type selected, try again")
)
(setq strlevel (cdr (assoc 1 elist))
decs (- (strlen strlevel) (1+ (vl-string-position 46 strlevel)))
level (atof strlevel)
txthgt (cdr (assoc 40 elist))
)

(initget 6)
(setq slope (getreal "\n Enter slope in decimals <0.03> : "))
(if (not slope)
(setq slope 0.03))
(setvar 'osmode 516)
(setq p1 (getpoint "\nPick first point: "))
(setq diff (mapcar '- (cdr (assoc 10 elist)) p1))

(while (setq p2 (getpoint "\nPick next point (or press Enter to Exit): "))
(setq level (- level (* (distance p1 p2) slope))
strlevel (rtos level decs)
txtpt (mapcar '+ p2 diff)
)
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 10 txtpt)
(cons 11 (list 0.0 0.0 0.0))
(cons 40 txthgt)
(cons 1 strlevel)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 0))
)
(setq p1 p2)
)

(setvar 'osmode osm)
(princ)
)

that was great fixo thank's man
you make me happy but excuse me small editing
if there is small opition to place text manually

fixo
24th Apr 2011, 11:20 am
You might be want to try this one insted

(defun c:demo2 (/ decs ;|diff|; elist level osm p1 p2 slope strlevel txtelev txthgt txtpt)
(setq osm (getvar 'osmode))
(while (and
(or (not
(setq txtelev (entsel "\nSelect starting level text : ")))
(not
(eq "TEXT"
(cdr (assoc 0 (setq elist (entget (car txtelev)))))))))
(princ
"\n Nothing selected or wrong object type selected, try again")
)
(setq strlevel (cdr (assoc 1 elist))
decs (- (strlen strlevel) (1+ (vl-string-position 46 strlevel)))
level (atof strlevel)
txthgt (cdr (assoc 40 elist))
)

(initget 6)
(setq slope (getreal "\n Enter slope in decimals <0.004> : "))
(if (not slope)
(setq slope 0.004))
(setvar 'osmode 516)
(setq p1 (getpoint "\nPick first point: "))
;;; (setq diff (mapcar '- (cdr (assoc 10 elist)) p1))

(while (setq p2 (getpoint "\nPick next point (or press Enter to Exit): "))
(setq level (- level (* (distance p1 p2) slope))
strlevel (rtos level decs)
txtpt (getpoint "\nPick a text point: "); (mapcar '+ p2 diff)
)
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 10 txtpt)
(cons 11 (list 0.0 0.0 0.0))
(cons 40 txthgt)
(cons 1 strlevel)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 0))
)
(setq p1 p2)
)

(setvar 'osmode osm)
(princ)
)

jason tay
25th Apr 2011, 02:32 am
fixo , it's really great :D !

jason tay
25th Apr 2011, 02:37 am
is that possible the slope not in decimal ?

fixo
25th Apr 2011, 07:10 am
I'm metric.. so maybe you need to use :

(rtos level 3 3)
or

(rtos level 4 3)

(rtos level decs)
inside the code

jason tay
25th Apr 2011, 07:29 am
fixo , sorry to make the confuse, i mean the slope shown by the example is 1:250
then we can enter 250 instead of enter 0.004

Organic
25th Apr 2011, 09:58 am
Try

(defun c:demo3 (/ decs ;|diff|; elist level osm p1 p2 slope strlevel txtelev txthgt txtpt)
(setq osm (getvar 'osmode))
(while (and
(or (not
(setq txtelev (entsel "\nSelect starting level text : ")))
(not
(eq "TEXT"
(cdr (assoc 0 (setq elist (entget (car txtelev)))))))))
(princ
"\n Nothing selected or wrong object type selected, try again")
)
(setq strlevel (cdr (assoc 1 elist))
decs (- (strlen strlevel) (1+ (vl-string-position 46 strlevel)))
level (atof strlevel)
txthgt (cdr (assoc 40 elist))
)

(initget 6)
(setq slope (getreal "\n Enter slope ratio (1:X) <250> : "))
(if (not slope)
(setq slope 250))
(setq slope (/ 1 slope))
(setvar 'osmode 516)
(setq p1 (getpoint "\nPick first point: "))
;;; (setq diff (mapcar '- (cdr (assoc 10 elist)) p1))

(while (setq p2 (getpoint "\nPick next point (or press Enter to Exit): "))
(setq level (- level (* (distance p1 p2) slope))
strlevel (rtos level decs)
txtpt (getpoint "\nPick a text point: "); (mapcar '+ p2 diff)
)
(entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 10 txtpt)
(cons 11 (list 0.0 0.0 0.0))
(cons 40 txthgt)
(cons 1 strlevel)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 0))
)
(setq p1 p2)
)

(setvar 'osmode osm)
(princ)
)

jason tay
25th Apr 2011, 10:04 am
8) cool~man, Thanks Fixo and Dink ! those lisp is such express for doing invert calculation ! :lol:

drafting_man
25th Apr 2011, 11:38 am
fixo , it's really great :D !

fixo thank's man that was wat i want
u make all engineer in my office happy with this lisp

fixo
25th Apr 2011, 04:07 pm
Happy to help
Cheers :)

Afsarghori
25th Aug 2014, 10:51 am
That's a great job, must be followed by appreciation.

could you guide how to use this lsp in steps.......as im electrical, first time time doing plumbing.........and when I started using this lisp didn't understand what to select when LSP is asking to select.........pl. guide step by step