Jump to content

Recommended Posts

Posted

Ive found many lisps for these on various sites but not that fit our offices standards and the way they like it to look(yes they are picky) Now that im trying to learn lisp i figured id take a stab at getting one that they will use.

 

(defun c:dflex (/ A B C)
(setq A(getint "\n Duct Length?: "))
(setq B(ssget "\n Select duct: "))
(setq C(); want it to allow user to pick start point dont know if i need a variable or not
(command "_.circle" C (/ A 2.0)")

 

That is what i have so far. I have var. C for the endpoint of the polyline/line that will be the start point for the flex duct. after creating the first circle on the endpoint I want to copy the circle from the center a distance of A+1 along the polyline/line selected I have no idea how to do this. any help in the right direction would be great (again im trying to write this not wanting someone to write it for me) also open to suggestions on another way to go about it attached is an image of what i want the final to look like

flex.JPG

Posted

You got a really tough one there.

 

You can use MEASURE to copy circles. Trimming by offsetting the path PLINE might be a solution but it would be tricky. -David

Posted

yea, after your responses i might hold off on this one a bit until i get a little farther into it

Posted

One answer is in polylines you can create a polyline with multiple arcs along it. I cut this out of another program so not tested but it is set to draw 90mm arcs.

 

(setq insul_ht (getint "\nEnter Insulation ht mm :<90> "))
(if (= insul_ht nil) 
 (setq insul_ht 90)
)

(setq p1 (getpoint "\n1st point: "))
(setq p9 (getpoint P1 "\nend point : "))
(setq ang1 (angle p1 p9))
(setq p1 (polar p1 ang1 45))    
; routine to set N as number of pline segments as a factor of 90 mm.
; 90 mm 25 arc's with straights

(setq N (fix (/ (distance p1 p9) 90.0)))
(setq d1 (- insul_ht 25.0))
(setq d2 25.0)
(setq d3 (- d1 25))
(setq d4 40.0)

(setq p2 (polar p1 (+ 1.5708 ang1)  d1))
(command "pLINE"  p2 "w" 0.0 0.0)
(setq m 0)
(while (< m N)
 (setq p3 (polar p2 ang1 d2))
 (setq p4 (polar p3 ang1 d2))
 (setq p5 (polar (polar p3 ang1 20)(+ ang1 4.71239) d3))
 (setq p6 (polar p5 ang1 d2 ))
 (setq p7 (polar p6 ang1 d2))
 (setq p8 (polar p4  ang1 d4))
; now put pts 3,4,5,6
 (command "a" "ce" p3 "a" "-180" "l" p5 "a" "ce" p6 p7 "l" p8)
; parallel lines now drawn
 (setq m (+ 1 m))
 (setq p2 p8)
) 

(command "")   
; ends pline
          


Posted

Ok second go the lisp code cut from has 5 different patterns

 

(setq N (fix (/ (distance p1 p9) (* 90.0 (/ insul_ht 90.0)) )))
(setq d1 (/ insul_ht 2.0))
(setq p2 (polar p1 (+ 1.5708 ang1)  d1))
(command "pLINE" p2 "w" 0.0 0.0 "a")
(setq m 1)
(while (<= m N)
 (setq p3 (polar p2 ang1 d1))
 (setq p5 (polar p3 ang1 insul_ht))
 (setq p6 (polar p5 ang1 d1 ))
; now put pts 3,4,5,6
;  (command "ce" p3 "a" "-180" "ce" p5 "a" "180") draws up& down
 (command "ce" p3 "a" "180" "ce" p5 "a" "180")
; parallel lines now drawn
 (setq m (+ 2 m))
 (setq p2 p6)
) 

(command "")   
)              
)

Posted

Thanks Big Al ill take a look at these and see if i can figure out whats going on and how to modify to my needs

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