Jump to content

Recommended Posts

Posted

i know there is a lisp for total up the figure , is that any one could help on lisp that can do example attach.

which shown the (Invert level minus invert level) divide by Length and the result getting is 1:______

 

Because when i had a lot of manhole , it take me lots of time to calculate one by one.

 

thanks in advance

MH Gradient.dwg

Posted

just write a lisp the answers is say pick line = 2D length pick Il1 pick il22 pull Il's out grade = l/(il1-il2) strcat "1:" to grade and you have answer.

 

Heres a start it will work but you need a bit more it will not recognise the "= 26.2" but will work with 26.2 Lee mac did a pull the number from a text string so do a bit of searching here I can not at the moment.

 

      (setq en1 (car (entsel "\nSelect text number1:" )))
       (setq el1 (entget en1))
       (setq v1 (atof (cdr (assoc 1 el1))))
    (setq en2 (car (entsel "\nSelect text number2:" )))
       (setq el2 (entget en2))
       (setq v2 (atof (cdr (assoc 1 el2))))
       (setq diff  (- v1 v2))
    (setq en3 (car (entsel "\nSelect line:" )))
       (setq el3 (entget en3))
       (setq Pt1  (cdr (assoc 10 el3)))
(setq Pt2 (cdr (assoc 11 el3)))
(setq dist (distance Pt1 Pt2))
(setq grade (/ dist diff))
(setq ansgrd (strcat "1:" (rtos grade 2 3)))
(princ ansgrd)

Posted

BIGAL thanks , it's ok even it did not pull the number from the string, but how to output the result into the position we want ?

thanks again

Posted

i try to input

(princ "\n \nansgrd = ")(princ ansgrd)

(setq pt(getpoint "\nInsertion Point: "))

but because i really not good in lisp then dont know how :oops:

Posted
but how to output the result into the position we want ?

 

Put the following at the end of the supported codes .

 

(entmake (list (cons 0 "TEXT")(cons 10 (getpoint "\n Text Location:"))(cons 40 (getvar 'textsize))(cons 1 ansgrd)))

Posted

Thanks to Bigal and Tharwat, this really help me alot :D

Posted

A litter bit more , how to make the command repeat / continuous ? which i no need to reload every time:unsure:

Thanks

Posted

Your pipe length you have drawn there is 24.17 m, not 25 m also.

 

I personally would just manually calculate the pipe grades as it doesn't take that long, as as you are manually doing it I assume you did not design the system (if you did, look into civil design packages as they will do this for you) and I personally wouldn't trust any drawing I got to be accurate (unless I had done it myself) enough to pull the values out using lisp.

 

Out of interest what does the "T = E - 5" represent, I have not seen that notation before/can't work it out.

Posted

Dink87522, im doing as built survey, so the pipe length is based on site , by manually will be some time human error on calculating when its a lot of manhole . :lol: by the way the "T = E - 5" actually mean Type - E-5 (this is the label(indication) i follow the design drawing)

Posted

Yes, but if it is an as built survey, the pipe length used in the slope calc. (assuming you are adding the as built slope, not the design slope that it should have been built at) should be the actual length (24.17) not 25 as you showed in the calculation though.

Posted

I wonder how to start the lisp with a command and can make it repeat?

Posted (edited)

This one would help you but it is not perfect

 

(defun c:TesT (/ *error* acdoc ss1 ss2 l n str e)
; TharwaT 20. 04. 2011
 (vl-load-com)
 (defun *error* (msg)
      (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
       (princ (strcat "\n** Error: " msg " **"))
   )
   (princ)
 )
 (setq acdoc (vla-get-ActiveDocument (vlax-get-acad-object)))

 (vla-StartUndoMark acdoc)
 (if
   (and
     (setq ss1 (entsel "\n First numerical Text :"))
     (setq ss2 (entsel "\n Second numerical Text :"))
     (setq l (entsel "\n Select Line :"))
   )
    (progn
      (setq n (- (atof (cdr (assoc 1 (entget (car ss1)))))
                 (atof (cdr (assoc 1 (entget (car ss2)))))
              )
      )
      (setq
        str (/ (distance (cdr (assoc 10 (setq e (entget (car l)))))
                         (cdr (assoc 11 e))
               )
               n
            )
      )
      (entmakex (list (cons 0 "TEXT")
                      (cons 10 (getpoint "\n Text Location:"))
                      (cons 40 (getvar 'textsize))
                      (cons 1 (strcat "1:" (rtos str 2 3)))
                )
      )
    )
    (princ)
 )
 (vla-EndUndoMark acdoc)
 (c:TesT)
 (princ)
)

TharwaT

Edited by Tharwat
Extra name of variables
Posted

Dear Tharwat , thank you very much :D your are so 8)

is already good enough for me.

Million Thanks to you ~:thumbsup:

Posted

This is what I use to label as-built surveys:

Command: sl

Initializing...
Pipe size & type: 8" PVC

Specify 1st point:
Specify 1st elevation: 25.25

Specify 2nd point:
Specify 2nd elevation: 26

177 LF 8" PVC @ 0.42%

 

and at the midpoint of my two picked points, it places a piece of MText, as follows:

SLOPE.png

From there, I can strike a line through the proposed pipe data (another handy routine I put together) and place my as-built data above it.

Posted

alanjt how the code running? but the concept if combine with Tharwat lisp will be great:shock: your one is come out with percent % but in malaysia the engineer want us to shown 1:_____

Posted
Dear Tharwat , thank you very much :D your are so 8)

is already good enough for me.

Million Thanks to you ~:thumbsup:

 

You're welcome .

 

Enjoy it .:)

 

TharwaT

  • 2 years later...
Posted

how to use this code please tell about it ..........

Posted
how to use this code please tell about it ..........

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...