Jump to content

Different layer for line,ponts & text


datalife

Recommended Posts

Hello,

 

I got this lisp from Tharwat on the cadtutor forum recently.

Wow....it is wonderful and save lots of my drafting time.

 

Any problem if I ask for some changes made on the

lisp by separating the line,manhole (points) and text to different

layers.

 

Thanks a lot

mhsw.lsp

Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • Tharwat

    10

  • datalife

    6

  • pBe

    3

  • Lee Mac

    1

Top Posters In This Topic

hello, great to see your reply.

 

Say

(1) line of pipe to layer name "pipe"

(2) point(manhole) to layer name "manhole"

(3) text to layer name " textlength"

 

Thanks

Link to comment
Share on other sites

hello, great to see your reply.

 

Say

(1) line of pipe to layer name "pipe"

(2) point(manhole) to layer name "manhole"

(3) text to layer name " textlength"

 

Thanks

 

Here it goes , try it and let me know . :)

 

(defun c:MHSW (/ _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 *error* (x) (princ "\n *Cancel*"))
 (cond ((not (tblsearch "LAYER" "pipe"))
        (progn (alert "Layer < pipe > is not found in drawing !!") (exit))
       )
       ((not (tblsearch "LAYER" "manhole"))
        (progn (alert "Layer < manhole > is not found in drawing !!") (exit))
       )
       ((not (tblsearch "LAYER" "textlength"))
        (progn (alert "Layer < textlength > is not found in drawing !!") (exit))
       )
 )
 (defun _L (j k) (entmakex (list '(0 . "LINE") '(8 . "pipe") (cons 10 j) (cons 11 k))))
 (defun _P (p) (entmakex (list '(0 . "POINT") '(8 . "manhole") (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))
                   '(8 . "textlength")
                   (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 1)) 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 1)
                               )
                       )
                       ang
                   )
            )
          )
   )
   (princ)
 )
 (princ "\nWritten by Tharwat Al Shoufi")
 (princ)
)

Link to comment
Share on other sites

Hi Tharwat.......two more question.:)

 

Question 1 - After placing the points (manhole) in a specific layer. I need to hatch the points to solid square; is it possible?

 

Question 2 - Is it possible to change the points (manhole) to solid circle instead of presently square?

 

Thanks

Link to comment
Share on other sites

Hi Tharwat.......two more question.:)

 

Question 1 - After placing the points (manhole) in a specific layer. I need to hatch the points to solid square; is it possible?

 

Question 2 - Is it possible to change the points (manhole) to solid circle instead of presently square?

 

Thanks

 

Hi .

 

Solid square or solid circle ?

 

What about the circle' s diameter if circle, or the square ' s width and height if LWpolyline ?

Link to comment
Share on other sites

Hi Tharwat....thanks for the quick reply.

 

Actually I need both solid square and solid circle. Maybe Lisp can prompt

for the user to select which one would be used .:); and later it can be adopted.

 

As for the size of circle and square, is it possible to change it

directly from the pdmode ie by hatching the points selected?

 

Thanks

Link to comment
Share on other sites

You can not hatch point entities .

 

 

As for the size of circle and square, is it possible to change it

directly from the pdmode ie by hatching the points selected?

 

Thanks

 

There's your answer tharwat.

 

Depending on the variables PDSIZE/PDMODE you can convert the points to a circle/square then hatch.

Link to comment
Share on other sites

There's your answer tharwat.

 

Depending on the variables PDSIZE/PDMODE you can convert the points to a circle/square then hatch.

 

I made it another way . ;)

 

Now get to work Tharwat! :roll: :lol:

 

Here is what I come up with . :D

 

To OP , put the DCL file into your support path (named manhole) as the following path if you are working on Autocad 2011 as shown into your profile .

C:\Program Files\AutoCAD 2011\Support

Then run the Lisp routine with the name drawmanholes ( you can change the name of the routine )

 

PLEASE DO NOT REMOVE THE AUTHOR NAME OF THE TWO FILES .

 

All Opinions and Constructive Comments are welcomed . :)

manhole.DCL

manhole.LSP

Edited by Tharwat
Link to comment
Share on other sites

Wow, you sure did more than expected ! thank you. one suggestion, but it may not be possible, how to save defaults of distance between MH, text size, and MH type. This would be great even when working in the current drawing.

thanks Tharwat !!!!

Steve

Link to comment
Share on other sites

Wow, you sure did more than expected !

thanks Tharwat !!!!

Steve

 

You're welcome Steve , I am really happy that you liked the program . :)

 

one suggestion, but it may not be possible, how to save defaults of distance between MH, text size, and MH type. This would be great even when working in the current drawing.

 

Sure it is possible , but please wait until we hear the OP 's opinion and I would modify it for you to get the maximum benefit of the program .:thumbsup:

 

Regards.

 

Tharwat

Link to comment
Share on other sites

I made it another way . ;)...

 

I see, i was led to believe the points are already existing. :lol:

 

Carry on. ;)

 

EDIT: Comments

  • Why not create the layers instead of alerting the user that it doesnt exist?
  • Why not incorporate the "alerts" on the Dialog box itself, rather than accepting the wrong data on the edit box pressing "ok" then alerting the user in the middle of the routine and need to start allover again?

Edited by pBe
Link to comment
Share on other sites

pBe , for the first comment , I do agree with you but if you go back to the OP's threads recently you'll find out that it is as they wanted , although I still want to change the introduction of the routine to obtain the layers if they are not already existed .

 

For the other comment , I consider that the same issue since the next updated routine that I will post according to what Steve suggested will keep the same input values as global variables to be re-set again .

 

Thanks for trying the codes .

Link to comment
Share on other sites

Hi Tharwat,

 

Lately I search through previous forum and

found something that can do the job, maybe

you can help combine the earlier lisp (ie mhsw.lsp)

with this one ; if possible?

 

Thanks in advance for the help

aa.lsp

Link to comment
Share on other sites

Hi Tharwat,

 

Lately I search through previous forum and

found something that can do the job, maybe

you can help combine the earlier lisp (ie mhsw.lsp)

with this one ; if possible?

 

Thanks in advance for the help

 

Didn't you try the that took hours to be made for you ?

 

And why you are talking about something else with ignorance to the hard work that made just for you ?

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