+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Full Member sachindkini's Avatar
    Computer Details
    sachindkini's Computer Details
    Operating System:
    xp
    Using
    AutoCAD 2008
    Join Date
    Nov 2007
    Location
    india (mumbai)
    Posts
    96

    Question floor & height lsp

    floor height & floor Numbering in 2d section & elevation lsp
    Attached Images

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Hello, and welcome to CADTutor sachindkini.

    I am assuming you would like someone to create such a LISP for you - but just stating the name of a LISP in your thread is not a very polite way of requesting such a LISP in my opinion.

    As you're new, I'll have a look.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  3. #3
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Are the floors, polylines or lines?
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Ok, ignore my last post - I have accounted for both polylines and lines:

    Code:
    ; Multiple Floor Height by Lee McDonnell 14th January 2009
    
    ; Places Height and Floor Text above Midpoint on Floor Level Line.
    
    ; [If Polyline, Assumes only two Vertices.]
    
    ; [Assumes Lines are Parallel]
    
    (defun c:fht (/ varlist oldvars cCurve cVlist cAng cMpt cStpt cEnpt dCurve fStr dVlist dStpt dEnpt dAng)
        
        (vl-load-com)
        (setq varlist (list "CMDECHO" "CLAYER")
          oldvars (mapcar 'getvar varlist))
        (setvar "CMDECHO" 0)
       (if (and (setq cCurve (car (entsel "\nSelect Ground Floor >   ")))
             (member (cdr (assoc 0 (entget cCurve)))
                '("LINE" "LWPOLYLINE")))
           (progn
           (if (not (tblsearch "LAYER" "TEXT"))
               (vl-cmdf "-layer" "M" "TEXT" "C" "2" "TEXT" ""))
           (cond ((= "LWPOLYLINE" (cdr (assoc 0 (entget cCurve))))
              (setq cVlist (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget cCurve)))
                cAng (angle (nth 0 cVlist)(nth 1 cVlist))
                cMpt (polar (nth 0 cVlist) cAng (/ (distance (nth 0 cVlist)(nth 1 cVlist)) 2)))
              (if (>= cAng pi) (setq cAng (- cAng pi)))
              (Make_Text (polar cMpt (+ cAng (/ pi 2)) 2.0) "%%P0.00 Mt.  Gr. Level" cAng))
             ((= "LINE" (cdr (assoc 0 (entget cCurve))))
              (setq cStpt (cdr (assoc 10 (entget cCurve)))
                cEnpt (cdr (assoc 11 (entget cCurve)))
                 cAng (angle cStpt cEnpt)
                cMpt (polar cStpt cAng (/ (distance cStpt cEnpt) 2)))
              (if (> cAng pi) (setq cAng (- cAng pi)))
              (if (= cAng pi) (setq cAng 0.0))
              (Make_Text (polar cMpt (+ cAng (/ pi 2)) 2.0) "%%P0.00 Mt.   Gr. Level" cAng)))
           (while (and (setq dCurve (car (entsel "\nSelect a Floor >   ")))
                    (member (cdr (assoc 0 (entget dCurve)))
                        '("LINE" "LWPOLYLINE"))
                   (/= (setq fStr (getstring t "\nSpecify Name of Floor >   ")) ""))
               (cond ((= "LWPOLYLINE" (cdr (assoc 0 (entget dCurve))))
                  (setq dVlist (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget dCurve)))
                    dAng (angle (nth 0 dVlist)(nth 1 dVlist))
                    cdDist (distance (vlax-curve-getClosestPointto dCurve cMpt T) cMpt))
                  (Make_Text (polar cMpt (+ cAng (/ pi 2)) (+ cdDist 2))
                    (strcat "+" (rtos cdDist 2 2) " Mt.   " fStr) cAng))
                 ((= "LINE" (cdr (assoc 0 (entget dCurve))))
                  (setq dStpt (cdr (assoc 10 (entget dCurve)))
                    dEnpt (cdr (assoc 11 (entget dCurve)))
                     dAng (angle dStpt dEnpt)
                    cdDist (distance (vlax-curve-getClosestPointto dCurve cMpt T) cMpt))
                  (Make_Text (polar cMpt (+ cAng (/ pi 2)) (+ cdDist 2))
                      (strcat "+" (rtos cdDist 2 2) " Mt.   " fStr) cAng)))))
           (princ "\n<!> No Floor Selected <!> "))
        (mapcar 'setvar varlist oldvars)
        (princ))
    
    (defun Make_Text (txt_pt txt_val txt_ang)
        (entmake (list '(0 . "TEXT") '(8 . "TEXT") (cons 10 txt_pt) (cons 40 (max 2.5 (getvar "TEXTSIZE")))
        (cons 1 txt_val) (cons 50 txt_ang) '(7 . "STANDARD") '(71 . 0) '(72 . 1) '(73 . 2) (cons 11 txt_pt))))
    The above will prompt for the selection of a Ground Floor line (either 2D polyline or Line) and then continue to prompt for subsequent floor level selections and names. The Levels can be at any angle, and, if not parallel, the distance will be to the closest point.

    See example attached.

    Cheers

    Lee
    Attached Files
    Last edited by Lee Mac; 14th Jan 2009 at 03:59 pm.
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  5. #5
    Full Member sachindkini's Avatar
    Computer Details
    sachindkini's Computer Details
    Operating System:
    xp
    Using
    AutoCAD 2008
    Join Date
    Nov 2007
    Location
    india (mumbai)
    Posts
    96

    Love thanks sir

    thanks sir

    u done very good job

    thnx lot

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    No probs, hope it saves you some time
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Edit to my original post:

    The point is measured from the midpoint of the ground floor line - thus, if the lines are not parallel, the distance measured will be the closest to the midpoint, not to the line.

    Also, if the lines are not parallel, the text will be set at the angle of the base line, not that of the top line - I shall endeavor to fix these bugs.
    Attached Images
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Ok, So I have accounted for the subsequent floors not being level. - takes quite a bit of playing around with the angles and conditional statements depending on the angle of the floor level, but I got there in the end..

    The hard part is that the floor lines can be drawn from either side, and so the angle measured is either say, "x" when drawn from left to right or (x + pi) when drawn from right to left.

    See example for how I have overcome this. - again though, distances are measured from the midpoint of the ground floor line - to the closest point on the floor level (i.e. the perpendicular).

    Code:
    ; Multiple Floor Height by Lee McDonnell 14th January 2009
    
    ; Places Height and Floor Text above Midpoint on Floor Level Line.
    
    ; [If Polyline, Assumes only two Vertices.]
    
    ; [Assumes Lines are Parallel]
    
    (defun c:fht (/ varlist oldvars cCurve cVlist cAng cMpt cStpt cEnpt dCurve fStr dVlist dStpt dEnpt dAng)
        
        (vl-load-com)
        (setq varlist (list "CMDECHO" "CLAYER")
          oldvars (mapcar 'getvar varlist))
        (setvar "CMDECHO" 0)
       (if (and (setq cCurve (car (entsel "\nSelect Ground Floor >   ")))
             (member (cdr (assoc 0 (entget cCurve)))
                '("LINE" "LWPOLYLINE")))
           (progn
           (if (not (tblsearch "LAYER" "TEXT"))
               (vl-cmdf "-layer" "M" "TEXT" "C" "2" "TEXT" ""))
           (cond ((= "LWPOLYLINE" (cdr (assoc 0 (entget cCurve))))
              (setq cVlist (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget cCurve)))
                cAng (angle (nth 0 cVlist)(nth 1 cVlist))
                cMpt (polar (nth 0 cVlist) cAng (/ (distance (nth 0 cVlist)(nth 1 cVlist)) 2)))
              (if (>= cAng pi) (setq cAng (- cAng pi)))
              (Make_Text (polar cMpt (+ cAng (/ pi 2)) 2.0) "%%P0.00 Mt.  Gr. Level" cAng))
             ((= "LINE" (cdr (assoc 0 (entget cCurve))))
              (setq cStpt (cdr (assoc 10 (entget cCurve)))
                cEnpt (cdr (assoc 11 (entget cCurve)))
                 cAng (angle cStpt cEnpt)
                cMpt (polar cStpt cAng (/ (distance cStpt cEnpt) 2)))
              (if (> cAng pi) (setq cAng (- cAng pi)))
              (if (= cAng pi) (setq cAng 0.0))
              (Make_Text (polar cMpt (+ cAng (/ pi 2)) 2.0) "%%P0.00 Mt.   Gr. Level" cAng)))
           (while (and (setq dCurve (car (entsel "\nSelect a Floor >   ")))
                    (member (cdr (assoc 0 (entget dCurve)))
                        '("LINE" "LWPOLYLINE"))
                   (/= (setq fStr (getstring t "\nSpecify Name of Floor >   ")) ""))
               (cond ((= "LWPOLYLINE" (cdr (assoc 0 (entget dCurve))))
                  (setq dVlist (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget dCurve)))
                    dAng (angle (nth 0 dVlist)(nth 1 dVlist))
            cdDist (distance (vlax-curve-getClosestPointto dCurve cMpt T) cMpt))
            (cond ((> (/ (* 3 pi) 2) dAng (/ pi 2)) (setq dAng (- dAng pi)))
                  ((= dAng pi) (setq dAng 0.0)))
                  (Make_Text (polar cMpt (+ dAng (/ pi 2)) (+ cdDist 2))
                    (strcat "+" (rtos cdDist 2 2) " Mt.   " fStr) dAng))
                 ((= "LINE" (cdr (assoc 0 (entget dCurve))))
                  (setq dStpt (cdr (assoc 10 (entget dCurve)))
                    dEnpt (cdr (assoc 11 (entget dCurve)))
                     dAng (angle dStpt dEnpt)
            cdDist (distance (vlax-curve-getClosestPointto dCurve cMpt T) cMpt))
               (cond ((> (/ (* 3 pi) 2) dAng (/ pi 2)) (setq dAng (- dAng pi)))
                  ((= dAng pi) (setq dAng 0.0)))
                  (Make_Text (polar cMpt (+ dAng (/ pi 2)) (+ cdDist 2))
                      (strcat "+" (rtos cdDist 2 2) " Mt.   " fStr) dAng)))))
           (princ "\n<!> No Floor Selected <!> "))
        (mapcar 'setvar varlist oldvars)
        (princ))
    
    (defun Make_Text (txt_pt txt_val txt_ang)
        (entmake (list '(0 . "TEXT") '(8 . "TEXT") (cons 10 txt_pt) (cons 40 (max 2.5 (getvar "TEXTSIZE")))
        (cons 1 txt_val) (cons 50 txt_ang) '(7 . "STANDARD") '(71 . 0) '(72 . 1) '(73 . 2) (cons 11 txt_pt))))
    Attached Images
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

  9. #9
    Full Member sachindkini's Avatar
    Computer Details
    sachindkini's Computer Details
    Operating System:
    xp
    Using
    AutoCAD 2008
    Join Date
    Nov 2007
    Location
    india (mumbai)
    Posts
    96

    Smile fhl

    i load the lisp file but problem is text insert is middle of line
    & some file text rotate in 180 dgree

    and onter help
    chage floor height manual change the every floor height
    define text layer, text height & text style
    im using autocad 2008 & 2009
    sorry for bad english

    thnx
    Last edited by sachindkini; 16th Jan 2009 at 12:05 pm.

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    16,737

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by sachindkini View Post
    i load the lisp file but problem is text insert is middle of line
    & some file text rotate in 180 dgree

    and onter help
    chage floor height manual change the every floor height
    define text layer, text height & text style
    im using autocad 2008 & 2009
    sorry for bad english

    thnx

    Did you load the newly posted LISP? ~ as shown in the example, all works fine on my machine.

    As for changing one floor height and needing to change every floor height, this shouldn't be the case as all the height are measured from the ground floor +/- 0.00 and are not relative, - you should only need to re-do one floor.

    As for the layers and text heights and styles, these can all be changed very easily - what do you require?
    Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

Similar Threads

  1. Remove Extruded Height in 3d
    By cldryden in forum AutoCAD 3D Modelling & Rendering
    Replies: 2
    Last Post: 9th Feb 2008, 04:26 am
  2. Attach top floor to bottom floor.
    By K-Ro0 in forum AutoCAD General
    Replies: 2
    Last Post: 2nd Dec 2007, 03:08 am
  3. Spline Height
    By Simple153 in forum AutoCAD Drawing Management & Output
    Replies: 1
    Last Post: 9th Feb 2007, 01:48 pm
  4. Text height
    By Siberian in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 23rd Aug 2005, 05:05 pm
  5. Text Height
    By hyposmurf in forum AutoCAD General
    Replies: 7
    Last Post: 2nd Jul 2003, 02:54 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts