Jump to content

Recommended Posts

Posted (edited)

Hi All Experts,

 

Need advice, i need to calculate the total standard wall panels needed for a room.

 

Note: each standard wall panel is 1.2meter width.

 

for eg: a room with 10 x 10 meters width and length. total standard wall panel needed is 8.33 nos, round up to 9 panels for each wall, total up 4 walls are 9x4walls= 36 total standard panels needed, and then put the result as text in drawing.

 

for below attached LISP only able to produce result on total length of walls divide by 1.2meter, which result is 34 nos of panels (10+10+10+10 / 1.2)= 33.33, round up to 34 nos.

 

Eventually, i need to calculate quantity / total standard wall panels for multiple rooms, and for those rooms that share same wall, need to deduct the quantity for shared wall (only the touched area of shared wall).

 

Thanks

YS

 

 

 

(defun c:TotalWallPanels (/ ss panel-length total-panels total-length insertion-point)
  (setq panel-length 1200) ; Change this value to the length of each wall panel in millimeters
  (setq ss (ssget '((0 . "LWPOLYLINE"))))
  (if ss
    (progn
      (setq cnt 0
            total-panels 0)
      (repeat (sslength ss)
        (setq ent (ssname ss cnt))
        (setq total-length (vlax-curve-getdistatparam (vlax-ename->vla-object ent) (vlax-curve-getendparam (vlax-ename->vla-object ent))))
        (if (> total-length panel-length)
          (setq panels-needed (+ 1 (fix (/ total-length panel-length))))
          (setq panels-needed (fix (/ total-length panel-length)))
        )
        (setq total-panels (+ total-panels panels-needed))
        (setq cnt (1+ cnt))
      )
      (setq endpt (cdr (assoc 10 (entget (entlast)))))
      (setq insertion-point (getpoint "\nSpecify insertion point for text: "))
      (command "_TEXT" insertion-point insertion-point (strcat "Total wall panels needed: " (itoa total-panels)))
    )
    (princ "\nNo polylines found.")
  )
  (princ)
)

TotalWallPanels d.lsp

Edited by SLW210
Added Code Tags!
Posted

Please use Code Tags in the future. (<> in the editor toolbar)

Posted (edited)

A couple of suggestions. yes have done something similar years ago. For walls made from 100mm thick panels.

 

(repeat (setq x (sslength ss))
(setq total-length (vlax-get (vlax-ename->vla-object (ssname ss (setq x (- x 1))))))

 

"deduct the quantity for shared wall" Checking for touching plines may be way harder than draw Lines or plines to represent all the walls. Have a "U" pline with a single line end, use "*LINE" in the ssget filter, the length will still be returned. I would have the panels on say 1 layer, if rooms need a closed pline then have a second layer that is closed for each room. It is feasible for say straight section plines to find duplicate points but a lot of coding work, runs into problems with line direction. One up one down.

Edited by BIGAL

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