Jump to content

Filling up one area with a "oriented" polyline.


CafeJr

Recommended Posts

Attached lisp file replaced due to the lack of (command) function vs (entmake) function... Now posted lisp should correctly work and on versions

 

Also, no matter that it's called snakefill-2linesboundaries-arc, it can be applied and on 2 curve boundaries as long as reference arc (half circle) would make intersections while copy-moving along horizontal/vertical curve boundaries...

 

Regards, M.R.

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • CafeJr

    13

  • marko_ribar

    6

  • BIGAL

    4

  • Lee Mac

    1

Top Posters In This Topic

Posted Images

Attached lisp file replaced due to the lack of (command) function vs (entmake) function... Now posted lisp should correctly work and on versions

 

Also, no matter that it's called snakefill-2linesboundaries-arc, it can be applied and on 2 curve boundaries as long as reference arc (half circle) would make intersections while copy-moving along horizontal/vertical curve boundaries...

 

Regards, M.R.

 

Marko_ribar It's working!... I did some tests and I'm showing to you the result on the picture... I don't know, but, because the arc is so big to try to follow the boundary line, it could cause the situation 1. Also, following a arc as a reference line I miss a little distance of boundary line the situation 2... The boundary lines aren't a perfect lines as a arc, because it, I asked if it's possible to choose a pline to follow instead of a arc...

 

Grateful...

 

Snake line2.jpg

Link to comment
Share on other sites

Marko_ribar,

 

As I told you, I'm trying to do it in the worst way!... :( But, is a good beginning to someone that is newbie in this kind of code!... I guess!...

 

Thanks again...

 

Filling up simple code.jpg

 


(defun C:RS3 (/ l1 l2 l3 p1 p2 p3 p4 pa c1 c2 r ptd1 ptd2 ss)
 (prompt "\nSelect reference line:")
 (setq l1 (ssget)
p1 (getpoint "\nEnter with center 1:")
p2 (getpoint "\nEnter with center 2:")
p4 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) 0.0 0.0)
r  (getreal "\nEnter with radius: ")
n  (getint "\nEnter with number of lines: ")
i  1
c1 (ssadd)
l2 (ssname l1 1)
l3 (ssname l1 2)
l1 (ssname l1 0)
 )
 (while (= nil n)
   (setq n (getint "\nEnter with number of lines, must be > 0: "))
 )
 (command "_CIRCLE" p1 r)
 (ssadd (entlast) c1)
 (command "_CIRCLE" p2 r)
 (ssadd (entlast) c1)

 (while (<= i n)
   (setq p2   (- (cadr p1) (* r 4 i))
  p3   (- (cadr p1) (* r 2 i))
  ptd1 (list (car p1) p2 (caddr p1))
  ptd2 (list (car p1) p3 (caddr p1))
   )
   (if (<= i (/ n 2))
     (command ".copy" c1 "" p1 ptd1)
   )     ; Drawing circles
   (command ".copy" l1 "" p1 ptd2) ; Drawing lines

   (setq i (1+ i)
   )
 )

 (load "extrim")
 (etrim l2 p4)
 (etrim l3 p4)
 (setq pa (getvar "peditaccept"))
 (setvar "peditaccept" 1)
 (setq ss (ssget))
 (command "pedit" "m" ss "" "j" "0.01" "")
 (setvar "peditaccept" pa)
)

Edited by CafeJr
Edit: A little bit better than last one!...
Link to comment
Share on other sites

  • 3 weeks later...

Another code, a little bit more simple than the latest!... It's necessary select the entity to copy, the begin of the first arc, the opposite side of reference line, fill up the radius of arc and number of lines...

 

Before to execute the code, you need to prepare the filled area, drawing lines 1, 2 and 3. Line 1 is the line to be copied; line 2 and 3 the side limits.

 

Edit: translated to english...

 

(defun C:RS1 (/ l1 l2 l3 p1 p2 p3 p4 p5 pa c1 c2 r ptd1 ptd2 ss os)
 (prompt
   "\nSelect the lines reference, as: (1 - Line to be copied; 2 and 3 side limits): "
 )
 (setq l1 (ssget)
p1 (getpoint "\nEnter with begin of first arc, point 1:")
p2 (getpoint "\nEnter with end of line (opposite side of arc), point 2:")
p5 p2
p4 (list (+ (car p1) (/ (- (car p2) (car p1)) 2)) 0.0 0.0)
r  (getreal "\nEnter with radius: ")
n  (getint "\nEnter with number of lines: ")
i  1
c1 (ssadd)
l2 (ssname l1 1)
l3 (ssname l1 2)
l1 (ssname l1 0)

 )
 
 (setq os (getvar "osmode"))
 (setvar "osmode" 0)
 
 (while (= nil n)
   (setq n (getint "\nEnter with number of lines, must be > 0: "))
 )
 (setq p2   (- (cadr p1) r)
p3   (- (cadr p5) (* r 3))
ptd1 (list (car p1) p2 (caddr p1))
ptd2 (list (car p5) p3 (caddr p5))
 )
 (command "_CIRCLE" ptd1 r)
 (ssadd (entlast) c1)
 (command "_CIRCLE" ptd2 r)
 (ssadd (entlast) c1)
 (while (<= i n)
   (setq p2   (- (cadr p1) (* r 4 i))
  p3   (- (cadr p1) (* r 2 i))
  ptd1 (list (car p1) p2 (caddr p1))
  ptd2 (list (car p1) p3 (caddr p1))
   )
   (if (<= i (/ n 2))
     (command ".copy" c1 "" p1 ptd1)
   )     ; Drawing circles
   (command ".copy" l1 "" p1 ptd2) ; Drawing lines
   (setq i (1+ i)
   )
 )
 (load "extrim")
 (etrim l2 p4)
 (etrim l3 p4)
 (command "_.erase" l2 "")
 (command "_.erase" l3 "")
 (setq pa (getvar "peditaccept"))
 (setvar "peditaccept" 1)
 (setq ss (ssget))
 (command "pedit" "m" ss "" "j" "0.01" "")
 (setvar "peditaccept" pa)
 (setvar "osmode" os)
)

Edited by CafeJr
Link to comment
Share on other sites

  • 4 years later...

Hey!

Is a new member and saw a Lisp that makes it easier to draw underfloor heating.

Do not know, but can you point to a starting point where the heater starts and an end point where the heating pipe will stop? These two tubes are almost always short-lived each other. Thus the optimum would be a starting point an end point and then you draw with the mouse what surface you want under floor heating. As I said, I am a beginner.

Thanks in advance.

Per-Anders

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