Help modify lisp - align text
Hello all;I have download a lisp which can calculate the slope
between two manhole invert level ie the upstream and
downstream level. Then , the slope was indicate on the
pipe line ie slope 1:xxx
But something missing (I think); the text is not align to
the pipeline and no flow direction indicate (ie arrow line
indicate flow from upstream to downstream)
Any help to modify this Lisp is appreciated.
Thanks in advance
mh.lsp Here ... try this:
(defun c:mh (/ *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 Upstream numerical Text :")) (setq ss2 (entsel "\n Downstream numerical Text :")) (setq l (entsel "\n Select Pipe 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 ) ang (angle (cdr (assoc 10 e)) (cdr (assoc 11 e)) ) ) (if (> n 0) (setq dir (strcat "1:" (rtos str 2 3) " --->")) (setq dir (strcat " Hello, thanks for the reply.
The arrow seems NOT quite correct in some cases; as the flow should
be flowing from the upstream (higher height) to
downstream (lower height). See drawing example.
Thanks.
mh1.dwg easiest way is to use the existing texts angle
(Defun c:mh2 (/ ss1 ss2 l n str ang sp ep) (while (and (setq ss1 (entsel "\n Upstream numerical Text :")) (setq ss2 (entsel "\n Downstream numerical Text :")) (setq l (entsel "\n Select Pipe Line :")) ) (setq n (- (atof (cdr (assoc 1 (setq ss1 (entget (car ss1)))))) (atof (cdr (assoc 1 (entget (car ss2))))))) (setqstr (abs (/ (distance (setq sp (cdr (assoc 10 (setq e (entget (car l)))))) (setq ep (cdr (assoc 11 e))) )n))) (setq ang (if (> (distance (cdr (assoc 10 ss1)) ep) (distance (cdr (assoc 10 ss1)) sp)) (angle ep sp)(angle sp ep))) (entmakex (list (cons 0 "TEXT") (cons 10 (getpoint "\n Text Location:") ) (cons 40 (getvar 'textsize)) (cons 50 ang) (cons 1 (strcat "1:" (rtos str 2 0) "--->")) ) ) ) (princ))
HTH Hello pBE,
Not quite right, the "arrow" showing the flow is not parallel
to the pipeline; make it the annotation confusing. See the
example of drawings i attached.
Further help is very much grateful.
Thanks
mhdirn.dwg i didn't actually see your drawing sample, i based my suggestionsolely on the code you posted. If the attached file is 2010 version or higher i wont be able to view it.
Anyhow....
Somebody will come along and "fix" it for you.
Cheers Quick fix for you
I had one of my buddies to convert the file to a lower version
HTH
It is OK for me at a lower version;
so pBe........... can you help?
I updated the code on my previous post [#4] Oh......... I still can't get the flow
direction right?????
页:
[1]