Author Topic: Converting polylines into room elevations program required  (Read 2910 times)

0 Members and 1 Guest are viewing this topic.

hornet

  • Guest
Converting polylines into room elevations program required
« on: December 12, 2007, 03:15:02 PM »
Hello Everyone

 I just wondered if you Civil guys and girls, could point me in the right direction for a program that works the same as your contours/tin method.  I understand that some of your civil programs produce elevations of the contours, do you think it is possible to do the similar thing for architects, i.e. all architects put a polyline around the inside of a room to get the total areas.

This boundary polyline could be used to good effect, if there was a program. The user would pick that polyline, the program would reproduce the inside elevations of each room, the user would pick or type in the vertical height and up on a clear space of the drawing, it would draw out each inside face of that room, i.e. it would take each polyline distance(s) and make a rectangle of it.

There could be 4 to 6 faces of each room that would be reproduced all at the correct sizes, all at the same time.

Can you help please

Hornet


Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Converting polylines into room elevations program required
« Reply #1 on: December 12, 2007, 03:20:34 PM »
Make sure the polyline is closed and then use the extrude command.  You could or might have to use regions too.
Wow I was off base
**I struck my post from the record since deleting is frown upon**  :evil: Sorry
« Last Edit: December 12, 2007, 04:45:02 PM by Krushert »
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

Guest

  • Guest
Re: Converting polylines into room elevations program required
« Reply #2 on: December 12, 2007, 03:29:38 PM »
I assume you're doing everything in 2D then, right?

deegeecees

  • Guest
Re: Converting polylines into room elevations program required
« Reply #3 on: December 12, 2007, 03:30:00 PM »
I've used "Thickness" on Lines, and Open Poly's before, it does what it's meant to do.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4076
Re: Converting polylines into room elevations program required
« Reply #4 on: December 12, 2007, 03:36:50 PM »
I think you guys are missing what he is asking, or maybe I am.  Anyway, I think what he wants is to draw the "section" based on the polyline segment.  To answer the question about software, I dont know of one, but maybe ADT.  As for writing your own, that is very doable.  You would just need to provide a few details up front (ceiling height, etc) and it could go from there.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Guest

  • Guest
Re: Converting polylines into room elevations program required
« Reply #5 on: December 12, 2007, 03:48:59 PM »
I think you guys are missing what he is asking, or maybe I am.  Anyway, I think what he wants is to draw the "section" based on the polyline segment.  To answer the question about software, I dont know of one, but maybe ADT.  As for writing your own, that is very doable.  You would just need to provide a few details up front (ceiling height, etc) and it could go from there.

If it's being done in ADT, then use the section/elevation commands and generate the sections "auto-magically", but I'm guessing they're not using ADT and everything is draw as 2D objects.

deegeecees

  • Guest
Re: Converting polylines into room elevations program required
« Reply #6 on: December 12, 2007, 03:54:12 PM »
This boundary polyline could be used to good effect, if there was a program. The user would pick that polyline, the program would reproduce the inside elevations of each room, the user would pick or type in the vertical height and up on a clear space of the drawing, it would draw out each inside face of that room, i.e. it would take each polyline distance(s) and make a rectangle of it.

Based on the above, this works. Although it does have it's limitations.

Before:




After:


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Converting polylines into room elevations program required
« Reply #7 on: December 12, 2007, 04:18:28 PM »
Although this is a rough draft, I thought this is what he was after.
Code: [Select]
(defun c:WallElev (/ BASE ELST ELV ENT HT LR P1 PT ST UL UR VPTS WALLS ZDIR)
  (defun plMake (pt_lst)
    (setq zdir (trans '(0 0 1) 1 0 t)
          elv  (caddr (trans (car pt_lst) 1 zdir))
    )
    (entmakex
      (append
        (list '(0 . "LWPOLYLINE")
              '(100 . "AcDbEntity")
              '(100 . "AcDbPolyline")
              (cons 90 (length pt_lst))
              '(70 . 1) ; closed
              (cons 38 elv)
              (cons 210 zdir)
        )
        (mapcar '(lambda (pt) (cons 10 (trans pt 1 zdir))) pt_lst)
      )
    )
  )

  (if (and (setq ent (car (entsel "\nSelect room outline.")))
           (setq elst (entget ent))
      )
    (if (= (cdr (assoc 0 elst)) "LWPOLYLINE")
      (progn
        (initget 7)
        (setq ht (getdist "\nEnter the ceiling height."))
        (setq
          vpts (mapcar 'cdr
                       (vl-remove-if-not '(lambda (x) (= 10 (car x))) elst)
               )
        )
        (if (eq 1 (logand 1 (cdr (assoc 70 elst))))
          (setq vpts (append vpts (list (car vpts))))
        )
        (setq st '(0 0)) ; startpoint
        (foreach pt vpts
          (if p1
            (progn
              (setq base (distance p1 pt))
              (setq lr (polar st 0 base)
                    ur (polar lr (/ pi 2) ht)
                    ul (polar st (/ pi 2) ht)
              )
              (setq walls (cons (plMake (list st lr ur ul)) walls))
              (setq st (polar st 0 (+ base 12)))
              (setq p1 pt)
            )
            (setq p1 pt)
          )
        )
      )
    )
  )
  (if walls
    (progn
      (command "._move")
      (mapcar 'command walls)
      (command "" "_non" '(0 0) pause)
    )
  )
  (princ)
)
« Last Edit: December 12, 2007, 04:42:39 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Guest

  • Guest
Re: Converting polylines into room elevations program required
« Reply #8 on: December 12, 2007, 04:28:18 PM »
Although this is a rough draft, I though this is what he was after.

I think you're right.  That's pretty cool.  I'm gonna have to "borrow" a copy of that - not sure if I'll ever use it, but, ahhhh... you never know!   :wink:

SomeCallMeDave

  • Guest
Re: Converting polylines into room elevations program required
« Reply #9 on: December 12, 2007, 04:34:37 PM »
CAB beat me to it,  but here is my version (without thickness at corners)

Needs error and type checking, etc

Code: [Select]
defun c:DrawElev( / RoomOutline WallHt BasePt BasePtX BasePtY MaxVert NewPlList count CurrX CurrDist FloorPl CeilingPL Pt1 Pt2)
    (vl-load-com)
    (setq RoomOutline (car (entsel "\Pick Room Outline Poly "))
          WallHt (getDist "\nEnter Room Height: ")
          BasePt (getpoint "\nPick Base Point for Elevation Drawing: ")
          BasePtX (car BasePt)
          BasePtY (cadr BasePt)
          MaxVert (vlax-curve-getEndParam RoomOutLine)
          NewPlList (list
            '(0 . "LWPOLYLINE")
            '(100 . "AcDbEntity")
            '(67 . 0)
            '(410 . "Model")
            '(100 . "AcDbPolyline")
            (cons 90 (fix MaxVert))
            (list 10 BasePtX BasePtY)
           );list
         count 1
         currX BasePtX
         currDist 0
    );setq
   
    (while (<= count MaxVert)
        (setq currSegmentLength (- (vlax-curve-getDistAtParam RoomOutline Count) (vlax-curve-getDistAtParam RoomOutline (- Count 1)))
              currX (+ currX currSegmentLength)
              NewPlList (append NewPlList (list (list 10 currX BasePtY)))
              count (+ count 1)
        )     
    );while
    (entmake NewPlList)
    (setq FloorPl (entlast))
    (vla-offset (vlax-ename->vla-object FloorPl) (* -1 WallHt))
    (setq CeilingPl (entlast))
 

  ;;draw the vertical lines at the breaks
  (setq count 0)
  (repeat (+ 1 (fix MaxVert))
     (setq pt1 (vlax-curve-getPointAtParam FloorPl count)
   pt2 (vlax-curve-getPointAtParam CeilingPl count)
   NewPlList (list
            '(0 . "LWPOLYLINE")
            '(100 . "AcDbEntity")
            '(67 . 0)
            '(410 . "Model")
            '(100 . "AcDbPolyline")
            (cons 90 2)
            (list 10 (car pt1) (cadr pt1))
    (list 10 (car pt2) (cadr pt2))
           );list
   count (+ count 1)
      );setq
      (entmake NewPlList)
   

  );repeat
   
  (prin1)


)


hornet

  • Guest
Re: Converting polylines into room elevations program required
« Reply #10 on: December 13, 2007, 04:22:34 AM »
Hello Everyone

Many thanks for all your input, especially CAB who has triumphed again, Yes ADT does this auto-magically, but what I have found when I last used  it 2 years ago, it did not put the room name into the elevations, to put cream on top of the cake, would it be possible to grab the plan room name and park it into the elevation somewhere.  I do this manually i.e. copy and paste but when the plan room has attributes within it and I run Autocad extattr.xls macro within Excel, it will double up the information, so what I do is "burst" the elevation room name. This looses the attributes but keeps the font exactly the same. This program will save more time the bigger the building, i.e. more rooms = more time saved.
A 45 bedroom house equated to 198 faces of elevations, even if it took me just 1 minute that adds up to 3+ hours, just drawing rectangles.

Many thanks again for all your help
It makes you wonder what else can be "pinched" out of ADT

all the best
Hornet

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Converting polylines into room elevations program required
« Reply #11 on: December 13, 2007, 08:26:07 AM »
Glad we could help.

Could you post a sample DWG with at least 2 rooms with room names so I can see the associations to the polyline?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

hornet

  • Guest
Re: Converting polylines into room elevations program required
« Reply #12 on: December 14, 2007, 08:53:19 AM »
Hello Cab

here is the dwg as requested.
many thanks for all your help

Hornet

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Converting polylines into room elevations program required
« Reply #13 on: December 14, 2007, 05:40:17 PM »
This is quick & dirty, could use some cleanup but no extra time today.
Code: [Select]
;;  CAB 12.14.07
;;  Picking a pline this routine will create a rectangle with a bas equal
;;  to each side of the picked pline & with a height chosen by the user
;;  This represent each wall elevation within the room.

(defun c:WallElev (/ BASE ELST ELV ENT LR P1 PT ST UL UR VPTS new tmp
                   ZDIR pnlspc txtht ss pickpt)
  (setq txtht 100.0        ; text height for label
        pnlspc (* 2 txtht) ; panel spacing
        )
  (or cht (setq cht 1000.)) ; default ceiling height
  (defun plMake (pt_lst)
    (setq zdir (trans '(0 0 1) 1 0 t)
          elv  (caddr (trans (car pt_lst) 1 zdir))
    )
    (entmakex
      (append
        (list '(0 . "LWPOLYLINE")
              '(100 . "AcDbEntity")
              '(100 . "AcDbPolyline")
              '(8 . "area") ; layer
              (cons 90 (length pt_lst))
              '(70 . 1) ; closed
              (cons 38 elv)
              (cons 210 zdir)
        )
        (mapcar '(lambda (pt) (cons 10 (trans pt 1 zdir))) pt_lst)
      )
    )
  )

  (if (and (print "\nSelect room outline.")
           (setq ss (ssget "_+.:E:S" '((0 . "LWPOLYLINE")(-4 . "&")(70 . 1)(8 . "AREA"))))
           (setq  pickpt (last (last (car (ssnamex ss 0))))
                  elst (entget (cadar(ssnamex ss 0))))
      )
    (if (= (cdr (assoc 0 elst)) "LWPOLYLINE")
      (progn
        (initget 6)
        (if (setq tmp (getdist (strcat "\nEnter the ceiling height. <" (rtos cht)"> ")))
          (setq cht tmp))
        (setq vpts (mapcar 'cdr (vl-remove-if-not
                                  '(lambda (x) (= 10 (car x))) elst)))
        (if (eq 1 (logand 1 (cdr (assoc 70 elst))))
          (setq vpts (append vpts (list (car vpts))))
        )
        (setq st pickpt) ; startpoint
        (foreach pt vpts
          (if p1
            (progn
              (setq base (distance p1 pt))
              (setq lr (polar st 0 base)
                    ur (polar lr (/ pi 2) cht)
                    ul (polar st (/ pi 2) cht)
              )
              (setq new (cons (plMake (list st lr ur ul)) new))
              (setq st (polar st 0 (+ base pnlspc)))
              (setq p1 pt)
            )
            (setq p1 pt)
          )
        )
        (vl-cmdf "._zoom" "_E")
        (if (setq ss (ssget "_CP" vpts '((0 . "INSERT")(2 . "ROOM"))))
          (progn
            (setq ent (ssname ss 0))
            (setq atts
                   (mapcar '(lambda (att)
                             (cons (vla-get-tagstring att) (vla-get-textstring att)))
                             (vlax-invoke (vlax-ename->vla-object ent) 'getattributes)))
            (mapcar '(lambda(x)
                       (if (wcmatch (car x) "ROOMNAME*") (setq rname (cdr x))))atts)
            (setq new (cons (entmakex (list '(0 . "TEXT")
                                            (cons 10 (polar pickpt (* pi 1.5) (* txtht 1.25)))
                                            '(8 . "area") ; layer
                                            (cons 40 txtht)
                                            (cons 7 "NOTES")
                                            (cons 1 rname))) new))
          )
        )
        (vl-cmdf "._zoom" "_P")
      )
    )
  )
  (if new
    (progn
      (command "._move")
      (mapcar 'command new)
      (command "" "_non" pickpt pause)
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.