Author Topic: [request] Radiant Pipe Layout  (Read 1015 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
Re: [request] Radiant Pipe Layout
« Reply #15 on: April 26, 2024, 03:01:07 AM »
I just evaluated LoopCAD and put in a purchase request. It was denied because apparently, they would not even discuss "security" and other things with Legal and IT. My request was denied.
None of my business, but… what did they say? Like no answer or ..Go away or I shall taunt you a second time! 

JohnK

  • Administrator
  • Seagull
  • Posts: 10653
Re: [request] Radiant Pipe Layout
« Reply #16 on: April 26, 2024, 07:56:11 AM »
I just evaluated LoopCAD and put in a purchase request. It was denied because apparently, they would not even discuss "security" and other things with Legal and IT. My request was denied.
None of my business, but… what did they say? Like no answer or ..Go away or I shall taunt you a second time! 

I don't know either really, But I got the impression that they basically hung up the phone (so to speak). I got a lot of "They refuse", "I highly doubt", and "Do you have any other software ideas". 
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
Re: [request] Radiant Pipe Layout
« Reply #17 on: April 26, 2024, 09:21:07 AM »
I’m interested in what types of questions your organization would ask with regards to ‘security’ and ‘Legal’ things. 
I know I'm not setup for enterprise clients, I always thought, 500 seats and you get the source under NDA,
5 and I’d just say, sorry, I’m not setup for that.  :crazy2:
I guess the bigger companies are doomed to stall productivity with bureaucracies   
Could be a topic for another thread…

JohnK

  • Administrator
  • Seagull
  • Posts: 10653
Re: [request] Radiant Pipe Layout
« Reply #18 on: April 26, 2024, 09:45:48 AM »
I know legal was on the meeting (didn't say much), but they did say something about "indemnity". But I wonder if our legal wanted a section of their EULA updated.
https://www.avenir-online.com/AvenirWeb/LoopCAD/LoopCADEULA.aspx

But I'm not sure how that even applies because it's just an application that produces output. We assume liability when we "send the final product out" (-i.e. it is up to us to verify the information is correct before we sign the drawings).

I got the impression that IT couldn't get answers about "security". I imagine questions like: "does it talk to the internet", "where/what/who", etc. and they wouldn't give an answer (or gave the wrong one).

The meeting was short and basically was telling me I may want to find an alternative.

TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
Re: [request] Radiant Pipe Layout
« Reply #19 on: April 26, 2024, 10:19:53 AM »
"Does it talk to the internet"
Oh, I had to make one of those for my app on the store. “This application may attempt to access other devices on your network..”  :lmao:

JohnK

  • Administrator
  • Seagull
  • Posts: 10653
Re: [request] Radiant Pipe Layout
« Reply #20 on: April 26, 2024, 10:35:48 AM »
I just remembered a comment one of them made. They blindly asked if we could find something on github and if IT could help if we did. Now I wonder how all that's handled (most of the stuff on github doesn't even have a license or is GPL3 or BSD2). How/who takes liability in those cases? ...and what happens if the code is in python or delphi, or whatever and they'd need to install a 3rd party lib; does the process start over at that point?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Zeftax

  • Mosquito
  • Posts: 4
  • Measure once, cut thrice, glue, and cut again.
Re: [request] Radiant Pipe Layout
« Reply #21 on: April 26, 2024, 04:11:09 PM »
My impression from what you wrote is more that they are concerned about it being malware than the guarantee of correct data output, thus an open source license would be good. But maybe I am misreading it.
I use Central European Time, dunno why my profile says otherwise.
Pastafarian minister, dungeon master, concertina player, and sometimes I do a bit of CADing as well :tongue2:

ymg

  • Mosquito
  • Posts: 3
Re: [request] Radiant Pipe Layout
« Reply #22 on: April 26, 2024, 05:31:46 PM »
@johnK,

Found this document from Radiantec https://www.radiantec.com/installation-manuals/instructions-for-doing-your-own-tubing-layout/

I'm quite sure you know most of what's in there, but if somebody wants to chip in with some code it will
probably help.

It shows 4 different layout pattern if we don't count the in-joist layout.

Thinking aloud now, It has some resemblance to ceiling tile layout.  If we enter from the bottom off the room, the width minus 2 feet has to be a mutiple of 2 otherwise we need to add one side branch and decrease the spacing.

Lot'sa gotcha in there though.

ymg



« Last Edit: April 26, 2024, 05:51:32 PM by ymg »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8746
  • AKA Daniel
Re: [request] Radiant Pipe Layout
« Reply #23 on: April 26, 2024, 09:13:49 PM »
"who takes liability in those cases?"
IMHO, Liability isn’t really a thing unless you can prove negligence.  Even then, it would have to be a big dollar amount and the most likely outcome is the other party filing bankruptcy.

Interesting point regarding Python. Generally, that’s going to be open source all the way to the OS, or like in my case *CAD. An investigative IT guy can work though the chain. 
I list off all the libraries I link with. Closed source usually does the same.

Pretty sure no one went thought this list interrogating each library owner
https://prd.autocad.com/attributions/autocad2025/index.html



JohnK

  • Administrator
  • Seagull
  • Posts: 10653
Re: [request] Radiant Pipe Layout
« Reply #24 on: April 27, 2024, 02:53:05 PM »
I am posting my concept code in case anyone wanted to help. The code below isn't perfect but I think it could be a start. I have added a few XXXs and TODOs (I'm sure there will be more). The code is still a bit monolithic but that can be optomized later.

This will draw a centerline (the cyan line in my first post) in a serpentine pattern. Pick two points (left -> right) and enter a spacing (9,12,16, etc) and it should calculate the number of loops needed and then draw the center line.
Code - Auto/Visual Lisp: [Select]
  1. (defun c:radpipe ( / roundit add-distance drawpolyline oddp
  2.                      x-point y-point z-point
  3.  
  4.                      size spacing loops totallength
  5.                      runoffsetdist runlengthdist
  6.                      runstartpoint runendpoint
  7.                      cntr lst)
  8.    (defun roundit (a)
  9.      (atof (rtos a 2 0)))
  10.  
  11.    ;; Adds a distance to a point unless a point equals zero.
  12.    ;; This is to keep from altering the z-value. If either of the x or
  13.    ;; y coords were actually zero, the routine will not work properly.
  14.    (defun add-distance (pt1 direction dist)
  15.      (mapcar
  16.        '(lambda (x1)
  17.           (if (zerop x1) x1
  18.             (+ dist (list direction x1)))
  19.           )
  20.        pt1))
  21.  
  22.  
  23.    ;; Draws a polyline for a given list of points.
  24.    (defun drawpolyline (lst)
  25.      (entmakex (list (cons 0 "POLYLINE")
  26.                      (cons 10 '(0 0 0))))
  27.      (mapcar
  28.        (function (lambda (p)
  29.                    (entmake (list (cons 0 "VERTEX") (cons 10 p))))) lst)
  30.  
  31.      (entmakex (list (cons 0 "SEQEND"))) )
  32.  
  33.    ;; Determine if a number is odd.
  34.    (defun oddp (int)
  35.      (eq 1 (logand int 1)))
  36.  
  37.    ;; Name for x point.
  38.    (set 'x-point car)
  39.    ;; Name for y point.
  40.    (set 'y-point cadr)
  41.    ;; Name for z point.
  42.    (set 'z-point caddr)
  43.  
  44.    ;; Get some points
  45.    (princ "\nPick points left to right.")
  46.    (setq pt1 (getpoint "\nPoint 1: ")
  47.          pt2 (getpoint pt1 "\rPoint 2: "))
  48.  
  49.    ;; Calculate the rectangular size.
  50.    (setq size (mapcar '- pt1 pt2)                       ; -Determine the size of the rectangle.
  51.          size (mapcar 'abs size)                        ; -make numbers positive
  52.                                                         ; (in case user picked from right to left).
  53.          )
  54.  
  55.    ;; Determine the number of spacing and loops
  56.    (setq spacing (getint "\rEnter loop spacing: ")
  57.  
  58.          loops (/
  59.                  (- (y-point size) (* spacing 1.5))
  60.                  (* spacing 2))                         ; -Calculate the number of loops to draw.
  61.  
  62.          loops (roundit loops)                          ; -round the loop count up/down
  63.  
  64.          totallength                                    ; -Used for reporting.
  65.          (/ (* (* loops 2) (x-point size)) 12)
  66.          )
  67.  
  68.    ;; Print some numbers for the user's information.
  69.    (princ "\nSize: ") (princ size)
  70.    (princ "\nLoops: ") (princ loops)
  71.    (princ "\nLenght (ft): ") (princ totallength)
  72.  
  73.    ;; Calculate some initial points and distances.
  74.    ;;
  75.    ;; XXX:
  76.    ;; 1.  Center the loops vertically.
  77.    ;; 1a. Center the loops horizontally.
  78.    ;;     ~ Blindly adding a distance to to the `runstartpoint`
  79.    ;;       will "center" vertically but cause inaccurate
  80.    ;;       `runlengthdist` and thus cause the loops to be
  81.    ;;        not centered horizontally.
  82.    ;; TODO:
  83.    ;; 1.  Handle vertical and horizontal drawing.
  84.    ;;     ~ This may require building an association list--for each
  85.    ;;       orientation--to store the values. The list(s) can then
  86.    ;;       be referenced later when/if user is offered a choice
  87.    ;;       between the two orientations.
  88.    ;;       Something like:
  89.    ;;           (list
  90.    ;;             ;; 1 - size
  91.    ;;             ;; 2 - number of loops
  92.    ;;             ;; 3 - total length
  93.    ;;             ;; 4 - spacing
  94.    ;;             ;; 5 - point list
  95.    ;;             (cons 0 (list pt1 pt2))
  96.    ;;             (cons 1 (list size))
  97.    ;;             (cons 2 loops)
  98.    ;;             (cons 3 totallength)
  99.    ;;             (cons 4 spacing)
  100.    ;;             (cons 5 lst) )
  101.    ;;           (drawpolyline (cadr (assoc 5 <looplist>)))
  102.    (setq
  103.      runstartpoint (list
  104.                      (+ (x-point pt1) spacing)
  105.                      (+ (y-point pt1)
  106.                         (/
  107.                           (* loops
  108.                              (* spacing 2))
  109.                           loops))                       ; -Find distance we need (from the bottom)
  110.                      (z-point pt1))                     ;  to center the layout.
  111.  
  112.      runoffsetdist (* spacing 1.5)
  113.      runlengthdist (- (x-point size) runoffsetdist runoffsetdist)
  114.      runendpoint (polar runstartpoint 0 runlengthdist)
  115.      cntr 1
  116.      lst (list runendpoint runstartpoint)               ; -This will be the first loop
  117.                                                         ;  (the bottom most) to draw.
  118.      )
  119.  
  120.    ;; Calculate the points working from the bottom upwards to the top.
  121.    ;; This is where we generate the remaining points of the center
  122.    ;; line.
  123.    ;;
  124.    ;; TODO:
  125.    ;; 1. See TODO note #1 above.
  126.    (while (< cntr loops)
  127.           (mapcar
  128.             '(lambda(x)
  129.                (setq lst
  130.                      (cons
  131.                        (polar x 1.5708 (* (* spacing 2) cntr))
  132.                        lst)))
  133.             (if (oddp cntr)
  134.               (list runendpoint runstartpoint)
  135.               (list runstartpoint runendpoint)
  136.               )
  137.             )
  138.           (setq cntr (1+ cntr))
  139.           )
  140.  
  141.    (drawpolyline lst)
  142.  
  143.  (princ)
  144. )
  145.  
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3293
  • Marko Ribar, architect
Re: [request] Radiant Pipe Layout
« Reply #25 on: May 03, 2024, 07:00:13 PM »
Here is another pattern...
With this code - CAD will construct double heating pipes with required distance from left edge so that pipes can return to base heating instalation... But this pattern is only single row, so you should copy rows by 4 x distance upward... Then you could use stretching, exploding last row and make bigger fillets so that you can pass through leaving pipes into instalation...

Here is the code :
Code - Auto/Visual Lisp: [Select]
  1. (defun c:heating-pipes-double ( / *error* chiv inside-p uf cmd osm s lw pt d1 d2 mf dd vl vx bl pl )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if uf
  6.       (if command-s
  7.         (command-s "_.ucs" "_p")
  8.         (vl-cmdf "_.ucs" "_p")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if osm
  15.       (setvar (quote osmode) osm)
  16.     )
  17.     (if m
  18.       (prompt m)
  19.     )
  20.     (princ)
  21.   )
  22.  
  23.   (defun chiv ( pl pt / pp ptt bulge )
  24.  
  25.     (defun pp ( pl p / par )
  26.       (if
  27.         (and
  28.           (setq par (float (+ (fix (vlax-curve-getparamatpoint pl (trans p 1 0))) 0.5)))
  29.           (not (equal (float (fix par)) (vlax-curve-getendparam pl) 1e-6))
  30.         )
  31.         (list
  32.           (trans (vlax-curve-getpointatparam pl (rem (- par 0.1) (vlax-curve-getendparam pl))) 0 1)
  33.           (trans (vlax-curve-getpointatparam pl (rem (+ par 0.1) (vlax-curve-getendparam pl))) 0 1)
  34.         )
  35.       )
  36.     )
  37.  
  38.     (if
  39.       (and
  40.         (vlax-curve-isclosed pl)
  41.         (not (equal pt (trans (vlax-curve-getendpoint pl) 0 1) 1e-6))
  42.       )
  43.       (progn
  44.         (setq pt
  45.           (trans
  46.             (vlax-curve-getpointatparam pl
  47.               (float (fix (- (vlax-curve-getparamatpoint pl (vlax-curve-getclosestpointto pl (trans pt 1 0))) 0.5)))
  48.             )
  49.             0 1
  50.           )
  51.         )
  52.         (if (setq p (pp pl pt))
  53.           (progn
  54.             (if (vlax-method-applicable-p (vlax-ename->vla-object pl) 'getbulge)
  55.               (setq bulge (vla-getbulge (vlax-ename->vla-object pl) (fix (vlax-curve-getparamatpoint pl (trans (car p) 1 0)))))
  56.             )
  57.             (if command-s
  58.               (command-s "_.BREAK" pl "_non" (car p) "_non" (cadr p))
  59.               (vl-cmdf "_.BREAK" pl "_non" (car p) "_non" (cadr p))
  60.             )
  61.             (if command-s
  62.               (command-s "_.TRIM" pl "" "_non" (trans (vlax-curve-getpointatparam pl 0.1) 0 1) "_non" (trans (vlax-curve-getpointatparam pl (- (vlax-curve-getendparam pl) 0.1)) 0 1) "")
  63.               (vl-cmdf "_.TRIM" pl "" "_non" (trans (vlax-curve-getpointatparam pl 0.1) 0 1) "_non" (trans (vlax-curve-getpointatparam pl (- (vlax-curve-getendparam pl) 0.1)) 0 1) "")
  64.             )
  65.             (if (not (equal pt (trans (vlax-curve-getstartpoint pl) 0 1) 1e-6))
  66.               (progn
  67.                 (if command-s
  68.                   (command-s "_.PEDIT" pl "" "_R")
  69.                   (vl-cmdf "_.PEDIT" pl "" "_R")
  70.                 )
  71.                 (while (< 0 (getvar (quote cmdactive)))
  72.                   (vl-cmdf "")
  73.                 )
  74.                 (setq rf t)
  75.               )
  76.             )
  77.             (vla-put-closed (vlax-ename->vla-object pl) :vlax-true)
  78.             (if (vlax-method-applicable-p (vlax-ename->vla-object pl) 'getbulge)
  79.               (vla-setbulge (vlax-ename->vla-object pl) (1- (vlax-curve-getendparam pl)) bulge)
  80.             )
  81.             (if rf
  82.               (progn
  83.                 (if command-s
  84.                   (command-s "_.PEDIT" pl "" "_R")
  85.                   (vl-cmdf "_.PEDIT" pl "" "_R")
  86.                 )
  87.                 (while (< 0 (getvar (quote cmdactive)))
  88.                   (vl-cmdf "")
  89.                 )
  90.               )
  91.             )
  92.           )
  93.         )
  94.       )
  95.       (prompt "\n(chiv) sub function works only on closed POLYLINE entity... Either you picked starting point of closed polyline, or you picked open polyline...")
  96.     )
  97.   )
  98.  
  99.   (defun inside-p ( lw p / lwi r )
  100.     (vla-offset (vlax-ename->vla-object lw) -1e-3)
  101.       (setq lwi (entlast))
  102.       (progn
  103.         (entdel (entlast))
  104.         (vla-offset (vlax-ename->vla-object lw) 1e-3)
  105.         (setq lwi (entlast))
  106.       )
  107.     )
  108.       (setq r t)
  109.     )
  110.     (entdel lwi)
  111.     r
  112.   )
  113.  
  114.   (setq cmd (getvar (quote cmdecho)))
  115.   (setvar (quote cmdecho) 0)
  116.   (setq osm (getvar (quote osmode)))
  117.   (setvar (quote osmode) 0)
  118.   (if (= 0 (getvar (quote worlducs)))
  119.     (progn
  120.       (if command-s
  121.         (command-s "_.ucs" "_w")
  122.         (vl-cmdf "_.ucs" "_w")
  123.       )
  124.       (setq uf t)
  125.     )
  126.   )
  127.   (prompt "\nPick closed polygonal LWPOLYLINE that lies in WCS on unlocked Layer...")
  128.   (if (setq s (ssget "_+.:E:S:L" (list (cons 0 "LWPOLYLINE") (cons -4 "&") (cons 70 1) (cons 38 0.0) (cons 410 (if (= 1 (getvar (quote cvport))) "Model" (getvar (quote ctab)))) (cons 210 (list 0.0 0.0 1.0)))))
  129.     (progn
  130.       (setq lw (ssname s 0))
  131.       (setvar (quote osmode) 1)
  132.       (initget 1)
  133.       (setq pt (getpoint "\nPick or specify lower-left starting/ending vertex of picked LWPOLYLINE : "))
  134.       (setvar (quote osmode) 0)
  135.       (if (not (equal pt (trans (vlax-curve-getstartpoint lw) 0 1) 1e-6))
  136.         (chiv lw pt)
  137.       )
  138.       (setq d1 (distance pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)))
  139.       (setq d2 (distance pt (trans (vlax-curve-getpointatparam lw (float (fix (1- (+ (vlax-curve-getendparam lw) 0.1))))) 0 1)))
  140.       (if (< d1 d2)
  141.         (progn
  142.           (if command-s
  143.             (command-s "_.PEDIT" lw "" "_R")
  144.             (vl-cmdf "_.PEDIT" lw "" "_R")
  145.           )
  146.           (while (< 0 (getvar (quote cmdactive)))
  147.             (vl-cmdf "")
  148.           )
  149.         )
  150.       )
  151.       (initget 7)
  152.       (setq dd (getdist "\nPick or specify offset distance from shorter side of polygon edge : "))
  153.       (setq vl (cons (polar pt (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 4.0 dd)) vl))
  154.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 0.5 dd)) vl))
  155.       (setq vx (inters (car vl) (polar (car vl) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) 1.0) (trans (vlax-curve-getpointatparam lw 1.0) 0 1) (trans (vlax-curve-getpointatparam lw 2.0) 0 1) nil))
  156.       (setq vl (cons (polar vx (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 2.5 dd))) vl))
  157.       (setq vl (cons (polar (polar (car vl) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 1.5 dd)) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 1.5 dd)) vl))
  158.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 1.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 1.5 dd))) vl))
  159.       (setq vl (cons (polar vx (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 4.5 dd)) vl))
  160.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 0.5 dd))) vl))
  161.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  162.       (setq bl (cons 0.0 bl))
  163.       (setq bl (cons (1- (sqrt 2.0)) bl))
  164.       (setq bl (cons (1- (sqrt 2.0)) bl))
  165.       (setq bl (cons 0.0 bl))
  166.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  167.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  168.       (setq vl (reverse vl))
  169.       (setq bl (reverse bl))
  170.       (setq pl
  171.         (entmakex
  172.           (append
  173.             (list
  174.               (cons 0 "LWPOLYLINE")
  175.               (cons 100 "AcDbEntity")
  176.               (cons 100 "AcDbPolyline")
  177.               (cons 90 (length vl))
  178.               (cons 70 (* 128 (getvar (quote plinegen))))
  179.               (cons 38 0.0)
  180.             )
  181.             (apply (function append) (mapcar (function (lambda ( p b ) (list (cons 10 p) (cons 42 b)))) vl bl))
  182.             (list (list 210 0.0 0.0 1.0))
  183.           )
  184.         )
  185.       )
  186.       (vla-offset (vlax-ename->vla-object pl) (- dd))
  187.       (if (not (inside-p lw (last vl)))
  188.         (if command-s
  189.           (command-s "_.MIRROR" (ssadd pl (ssadd (entlast))) "" pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1) "_Y")
  190.           (vl-cmdf "_.MIRROR" (ssadd pl (ssadd (entlast))) "" pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1) "_Y")
  191.         )
  192.       )
  193.     )
  194.   )
  195.   (*error* nil)
  196. )
  197.  
« Last Edit: May 05, 2024, 09:32:46 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

ribarm

  • Gator
  • Posts: 3293
  • Marko Ribar, architect
Re: [request] Radiant Pipe Layout
« Reply #26 on: May 04, 2024, 10:21:09 AM »
And here is single pattern... When one segment is drawn, you just have to copy it - 2 times input distance - upward...
For me it's totally not important which one is better... Maybe the best is to choose in real life situation and then decide...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:heating-pipes-single ( / *error* chiv inside-p uf cmd osm s lw pt d1 d2 mf dd vl vx bl pl )
  2.  
  3.  
  4.   (defun *error* ( m )
  5.     (if uf
  6.       (if command-s
  7.         (command-s "_.ucs" "_p")
  8.         (vl-cmdf "_.ucs" "_p")
  9.       )
  10.     )
  11.     (if cmd
  12.       (setvar (quote cmdecho) cmd)
  13.     )
  14.     (if osm
  15.       (setvar (quote osmode) osm)
  16.     )
  17.     (if m
  18.       (prompt m)
  19.     )
  20.     (princ)
  21.   )
  22.  
  23.   (defun chiv ( pl pt / pp ptt bulge )
  24.  
  25.     (defun pp ( pl p / par )
  26.       (if
  27.         (and
  28.           (setq par (float (+ (fix (vlax-curve-getparamatpoint pl (trans p 1 0))) 0.5)))
  29.           (not (equal (float (fix par)) (vlax-curve-getendparam pl) 1e-6))
  30.         )
  31.         (list
  32.           (trans (vlax-curve-getpointatparam pl (rem (- par 0.1) (vlax-curve-getendparam pl))) 0 1)
  33.           (trans (vlax-curve-getpointatparam pl (rem (+ par 0.1) (vlax-curve-getendparam pl))) 0 1)
  34.         )
  35.       )
  36.     )
  37.  
  38.     (if
  39.       (and
  40.         (vlax-curve-isclosed pl)
  41.         (not (equal pt (trans (vlax-curve-getendpoint pl) 0 1) 1e-6))
  42.       )
  43.       (progn
  44.         (setq pt
  45.           (trans
  46.             (vlax-curve-getpointatparam pl
  47.               (float (fix (- (vlax-curve-getparamatpoint pl (vlax-curve-getclosestpointto pl (trans pt 1 0))) 0.5)))
  48.             )
  49.             0 1
  50.           )
  51.         )
  52.         (if (setq p (pp pl pt))
  53.           (progn
  54.             (if (vlax-method-applicable-p (vlax-ename->vla-object pl) 'getbulge)
  55.               (setq bulge (vla-getbulge (vlax-ename->vla-object pl) (fix (vlax-curve-getparamatpoint pl (trans (car p) 1 0)))))
  56.             )
  57.             (if command-s
  58.               (command-s "_.BREAK" pl "_non" (car p) "_non" (cadr p))
  59.               (vl-cmdf "_.BREAK" pl "_non" (car p) "_non" (cadr p))
  60.             )
  61.             (if command-s
  62.               (command-s "_.TRIM" pl "" "_non" (trans (vlax-curve-getpointatparam pl 0.1) 0 1) "_non" (trans (vlax-curve-getpointatparam pl (- (vlax-curve-getendparam pl) 0.1)) 0 1) "")
  63.               (vl-cmdf "_.TRIM" pl "" "_non" (trans (vlax-curve-getpointatparam pl 0.1) 0 1) "_non" (trans (vlax-curve-getpointatparam pl (- (vlax-curve-getendparam pl) 0.1)) 0 1) "")
  64.             )
  65.             (if (not (equal pt (trans (vlax-curve-getstartpoint pl) 0 1) 1e-6))
  66.               (progn
  67.                 (if command-s
  68.                   (command-s "_.PEDIT" pl "" "_R")
  69.                   (vl-cmdf "_.PEDIT" pl "" "_R")
  70.                 )
  71.                 (while (< 0 (getvar (quote cmdactive)))
  72.                   (vl-cmdf "")
  73.                 )
  74.                 (setq rf t)
  75.               )
  76.             )
  77.             (vla-put-closed (vlax-ename->vla-object pl) :vlax-true)
  78.             (if (vlax-method-applicable-p (vlax-ename->vla-object pl) 'getbulge)
  79.               (vla-setbulge (vlax-ename->vla-object pl) (1- (vlax-curve-getendparam pl)) bulge)
  80.             )
  81.             (if rf
  82.               (progn
  83.                 (if command-s
  84.                   (command-s "_.PEDIT" pl "" "_R")
  85.                   (vl-cmdf "_.PEDIT" pl "" "_R")
  86.                 )
  87.                 (while (< 0 (getvar (quote cmdactive)))
  88.                   (vl-cmdf "")
  89.                 )
  90.               )
  91.             )
  92.           )
  93.         )
  94.       )
  95.       (prompt "\n(chiv) sub function works only on closed POLYLINE entity... Either you picked starting point of closed polyline, or you picked open polyline...")
  96.     )
  97.   )
  98.  
  99.   (defun inside-p ( lw p / lwi r )
  100.     (vla-offset (vlax-ename->vla-object lw) -1e-3)
  101.       (setq lwi (entlast))
  102.       (progn
  103.         (entdel (entlast))
  104.         (vla-offset (vlax-ename->vla-object lw) 1e-3)
  105.         (setq lwi (entlast))
  106.       )
  107.     )
  108.       (setq r t)
  109.     )
  110.     (entdel lwi)
  111.     r
  112.   )
  113.  
  114.   (setq cmd (getvar (quote cmdecho)))
  115.   (setvar (quote cmdecho) 0)
  116.   (setq osm (getvar (quote osmode)))
  117.   (setvar (quote osmode) 0)
  118.   (if (= 0 (getvar (quote worlducs)))
  119.     (progn
  120.       (if command-s
  121.         (command-s "_.ucs" "_w")
  122.         (vl-cmdf "_.ucs" "_w")
  123.       )
  124.       (setq uf t)
  125.     )
  126.   )
  127.   (prompt "\nPick closed polygonal LWPOLYLINE that lies in WCS on unlocked Layer...")
  128.   (if (setq s (ssget "_+.:E:S:L" (list (cons 0 "LWPOLYLINE") (cons -4 "&") (cons 70 1) (cons 38 0.0) (cons 410 (if (= 1 (getvar (quote cvport))) "Model" (getvar (quote ctab)))) (cons 210 (list 0.0 0.0 1.0)))))
  129.     (progn
  130.       (setq lw (ssname s 0))
  131.       (setvar (quote osmode) 1)
  132.       (initget 1)
  133.       (setq pt (getpoint "\nPick or specify lower-left starting/ending vertex of picked LWPOLYLINE : "))
  134.       (setvar (quote osmode) 0)
  135.       (if (not (equal pt (trans (vlax-curve-getstartpoint lw) 0 1) 1e-6))
  136.         (chiv lw pt)
  137.       )
  138.       (setq d1 (distance pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)))
  139.       (setq d2 (distance pt (trans (vlax-curve-getpointatparam lw (float (fix (1- (+ (vlax-curve-getendparam lw) 0.1))))) 0 1)))
  140.       (if (< d1 d2)
  141.         (progn
  142.           (if command-s
  143.             (command-s "_.PEDIT" lw "" "_R")
  144.             (vl-cmdf "_.PEDIT" lw "" "_R")
  145.           )
  146.           (while (< 0 (getvar (quote cmdactive)))
  147.             (vl-cmdf "")
  148.           )
  149.         )
  150.       )
  151.       (initget 7)
  152.       (setq dd (getdist "\nPick or specify offset distance from shorter side of polygon edge : "))
  153.       (setq vl (cons (polar pt (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 2.0 dd)) vl))
  154.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 0.5 dd)) vl))
  155.       (setq vx (inters (car vl) (polar (car vl) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) 1.0) (trans (vlax-curve-getpointatparam lw 1.0) 0 1) (trans (vlax-curve-getpointatparam lw 2.0) 0 1) nil))
  156.       (setq vl (cons (polar vx (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 1.5 dd))) vl))
  157.       (setq vl (cons (polar (polar (car vl) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 0.5 dd)) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) vl))
  158.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 0.5 dd))) vl))
  159.       (setq vl (cons (polar vx (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (* 2.5 dd)) vl))
  160.       (setq vl (cons (polar (polar (car vl) (+ (* 0.5 pi) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1))) (* 0.5 dd)) (angle pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1)) (- (* 0.5 dd))) vl))
  161.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  162.       (setq bl (cons 0.0 bl))
  163.       (setq bl (cons (1- (sqrt 2.0)) bl))
  164.       (setq bl (cons (1- (sqrt 2.0)) bl))
  165.       (setq bl (cons 0.0 bl))
  166.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  167.       (setq bl (cons (- (1- (sqrt 2.0))) bl))
  168.       (setq vl (reverse vl))
  169.       (setq bl (reverse bl))
  170.       (setq pl
  171.         (entmakex
  172.           (append
  173.             (list
  174.               (cons 0 "LWPOLYLINE")
  175.               (cons 100 "AcDbEntity")
  176.               (cons 100 "AcDbPolyline")
  177.               (cons 90 (length vl))
  178.               (cons 70 (* 128 (getvar (quote plinegen))))
  179.               (cons 38 0.0)
  180.             )
  181.             (apply (function append) (mapcar (function (lambda ( p b ) (list (cons 10 p) (cons 42 b)))) vl bl))
  182.             (list (list 210 0.0 0.0 1.0))
  183.           )
  184.         )
  185.       )
  186.       (if (not (inside-p lw (last vl)))
  187.         (if command-s
  188.           (command-s "_.MIRROR" (ssadd pl (ssadd (entlast))) "" pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1) "_Y")
  189.           (vl-cmdf "_.MIRROR" (ssadd pl (ssadd (entlast))) "" pt (trans (vlax-curve-getpointatparam lw 1.0) 0 1) "_Y")
  190.         )
  191.       )
  192.     )
  193.   )
  194.   (*error* nil)
  195. )
  196.  
« Last Edit: May 05, 2024, 09:32:03 AM by ribarm »
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

JohnK

  • Administrator
  • Seagull
  • Posts: 10653
Re: [request] Radiant Pipe Layout
« Reply #27 on: Today at 10:15:42 AM »
Thank you.
The picture looks promising but when I ran a quick test I didn't get good results.

I entered 9 as my "offset distance".
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ribarm

  • Gator
  • Posts: 3293
  • Marko Ribar, architect
Re: [request] Radiant Pipe Layout
« Reply #28 on: Today at 10:34:10 AM »
John, I coded for sample which is going to be copied like in my shown example... If you want 9.0 from bottom of room, just move sample for 4.5 upward and add small line for entering which connects sample and entering point... Sample is calculated the way that allows exiting pipe to be distanced from wall for 9.0 units from left wall side... So exiting and entering pipes are distanced at 9.0 units between each other... My picture explains everything, only you wanted to move sample for 4.5 upward; you must add small pipe line if you want or keep like you want and not like it is with my picture...
That's all, I hope it helps...
Regards...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube