Jump to content

Break line and draw symbol using point style


datalife

Recommended Posts

Hello everyone, I need a Lisp that can perform the following after

I draw a line representing the sewer pipeline:

 

(1) First divide and break the line (the line must be break to the length specify); by instruction the maximum length is say 50m (any length by user input) and leave the remaining length.

(2)Put the manhole using symbol (eg square or circle); can be using PDMODE?

(3) Place the length of the pipe L= on top orbelow of the line. The text must be editable

 

Hope I explain this well; sorry for the bad english....maybe attached drawing will explain the above well

 

Thanks guy

try.dwg

Link to comment
Share on other sites

Sure it could be done although I doubt you would save much time. It doesn't really take long to draw a line 50m long (or use the break command and place the manhole as a block.

Link to comment
Share on other sites

Search here for "break line" pretty sure it does what you want. Its not that hard manually draw circle 50m toffset say 2m trim gap grab grip pull onto end of line erase circles insert block.

 

If you want to do auto do you want all in one go or one by one or both ?

 

Heres a start for you

 

; add a circle to end of lines for import into the DRAINS software
(setq oldsnap (getvar "osmode"))
(setvar "osmode" 0)
(command "layer" "n" "PITS" "Color" 1 "PITS" "s" "PITS" "")
(setq ent (car (entsel "\nSelect drain layer: "))) 
(setq l_name (cdr (assoc 8 (entget ent))))

(setq listlines (ssget "X" (list (cons 0 "line")(cons 8 l_name))))
(setq listlinesno (sslength listlines))
(setq y 0)
(repeat listlinesno
       (setq pt1 (cdr (assoc 10 (entget (ssname listlines y)))))
       (command "circle" pt1 1.0)
       (setq y (+ y 1))
)   ;end repeat listlineno

(setvar "osmode" oldsnap)

Link to comment
Share on other sites

Thanks guy, but this don't solve my problem. As a newbie, to Lisp

I may need a complete Lisp problem instead of only code.

 

I need Lisp to prompt for the breakline of whole length of the pipe

(ie draw to max length say 50m by user prompt and left the remaining); and later

draw the rectangular/circle (represent manhole);

and also indicate the distance (L= xxx).

 

I thought this would be very faster as I need to do do this almost

every project. Thanks ahead for those can help.

Link to comment
Share on other sites

Try this routine and let me know how things went with you ... :)

 

(defun c:Test (/ _L _P _T p p1 p2 a ang l i)
;;; =============------------ Tharwat 27. Jan. 2013 -----------=========;;;
;;; Prompt to user to specify Distance between Manholes         ;;;
;;; then height of the text and finally to specify start and end points    ;;;
 (defun _L (j k) (entmakex (list '(0 . "LINE") (cons 10 j) (cons 11 k))))
 (defun _P (p) (entmakex (list '(0 . "POINT") (cons 10 p))))
 (defun _T (p h s a)
   (entmakex (list '(0 . "TEXT")
                   (cons 10 (trans p 1 0))
                   (cons 11 (trans p 1 0))
                   (cons 40 h)
                   (cons 1 s)
                   (cons 50 a)
                   '(72 . 1)
                   '(73 . 1)
             )
   )
 )
 (if (and (if (progn (initget 6)
                     (setq *d* (cond ((getdist (strcat "\n Specify distance between Manholes "
                                                       (if *d*
                                                         (strcat "< " (rtos *d* 2 2) " > :")
                                                         " :"
                                                       )
                                               )
                                      )
                                     )
                                     (t *d*)
                               )
                     )
              )
            (setq *d* *d*)
            nil
          )
          (if (progn (initget 6)
                     (setq *h* (cond ((getdist (strcat "\n Specify Text Height "
                                                       (if *h*
                                                         (strcat "< " (rtos *h* 2 2) " > :")
                                                         " :"
                                                       )
                                               )
                                      )
                                     )
                                     (t *h*)
                               )
                     )
              )
            (setq *h* *h*)
            nil
          )
          (setq p1 (getpoint "\n specify start point :"))
          (setq p2 (getpoint "\n Specify end point :" p1))
     )
   (progn (setvar 'pdmode 65)
          (setq a   (angle p1 p2)
                ang a
          )
          (if (and (< (* pi 0.5) ang) (<= ang (* pi 1.5)))
            (setq ang (+ pi ang))
            ang
          )
          (mapcar '_P (list p1 p2))
          (setq l (distance p1 p2))
          (repeat (fix (/ l *d*))
            (_L p1 (setq p (polar p1 a *d*)))
            (_P p)
            (_T (mapcar '(lambda (j k) (/ (+ j k) 2.)) p1 p) *h* (strcat "L= " (rtos *d* 2 0)) ang)
            (setq p1 p)
          )
          (if (> (setq i (rem l *d*)) 0.)
            (progn (_L p1 p2)
                   (_T (mapcar '(lambda (j k) (/ (+ j k) 2.)) p1 p2)
                       *h*
                       (strcat "L= "
                               (if (< i 0.)
                                 (rtos i 2 2)
                                 (rtos i 2 0)
                               )
                       )
                       ang
                   )
            )
          )
   )
   (princ)
 )
 (princ "\nWritten by Thrwat Al Shoufi")
 (princ)
)


Link to comment
Share on other sites

Thanks Tharwat. This is exactly what I am looking for....Wow

 

Maybe another question (that I may ask too much :)); what

about equally break the line and indicate the distance & manhole with L=xxx

(same as above)

 

Thanks again.:)

Link to comment
Share on other sites

Just a thoughts...

You can use for this task the dimensions with arrows like "closed origin"

or with other arrow head style and without extension lines,

then change dimstyle text using "ddedit" command to your suit

Link to comment
Share on other sites

(2)Put the manhole using symbol (eg square or circle); can be using PDMODE?

 

I would warn against using an AutoCAD Point to represent the manhole. The lineweight of a point is set at 0.00, so if you were to print out the drawing on paper, the manholes would be very faint. :cry:

Link to comment
Share on other sites

Try this code

 
(defun C:mhd(/ elist en p1 pn)
(setq p1 (getpoint "\nPick first point: "))
(while 
 (setq pn (getpoint p1 "\nPick next point (Enter to exit): "))
(command "._dimaligned" "_non" p1 "_non" pn "_non" pn)
(setq en (entlast))
(setq elist (entget en ))
(entmod (subst (cons 1 "L = <>")(assoc 1 elist) elist))
 (setq en (entlast))
   (setq elist (entget en '("*")))
(entmod
(list
 (assoc -1 elist)
  (list -3 
   (list "ACAD" '(1000 . "DSTYLE")
      '(1002 . "{")
      '(1070 . 77)
      '(1070 . 0)
      '(1070 . 289)
      '(1070 . 2)
      '(1070 . 279)
      '(1070 . 2)
      '(1070 . 174)
      '(1070 . 1)
      '(1070 . 76)
      '(1070 . 1)
      '(1070 . 75)
      '(1070 . 1)
      '(1070 . 343)
      '(1005 . "1A7A");;try this arrow type as well: "1B4B"
      '(1070 . 173)
      '(1070 . 1)
      '(1070 . 344)
      '(1005 . "1A7A");;try this arrow type as well: "1B4B"
      '(1002 . "}")))))
 (setq p1 pn)
 )
(princ)
)

Link to comment
Share on other sites

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...