TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Zahex on May 12, 2005, 07:23:47 PM
-
I'm working on a 3D routine and need some help
Thanks
-
Wow, really !!
-
sorry, da debil made me do it
-
can you help???
-
with what ?? What's your difficulty ?
-
it's hard to explain but basicly i want to draw a spiral through a solid.
i have a routine that defines the solid,it asks for:
1.base radius
2.top radius
3.height
4.number of polygon sides
5.insertion point
and i have a spiral routine also,that draws spirals.
but now i first want to draw the solid and then the spiral but according to the spiral,kinda like the spiral is revolving arround the solid.
Do u understand?
should i post the routines?
Thanks
-
Posting would be most excellent.
I have a bit to do today, so may be able to look at it tonight, If no-one else raises their hand. Chances are you will have a response before I get to look at it.
Good luck
kwb
-
solid:
(defun c:1 ()
(defun Radians->Degrees (rads)
(* rads (/ 180.0 pi))
)
(setq radius (getdist "\n top radius: "))
(setq baseradius (getdist "\n base radius: "))
(setq height (getdist "\n height: "))
(setq angRad (atan (- radius baseradius) height))
(setq angDeg (Radians->Degrees angRad))
(setq sides (getint "\n number of polygon sides: "))
(setq centerpt (getpoint "\n insertion point: "))
(setq osnaps (getvar "osmode"))
(setvar "osmode" 0)
(command "polygon"
sides
centerpt
"C"
(polar centerpt 0 radius)
)
(command "extrude" (entlast) "" height angDeg)
(setvar "osmode" osnaps)
)
spiral:
(defun C:2()
(setq
segs (getreal "Number of segments: ")
spin -1
ri (getreal "Base radius: ")
rf (getreal "Top radius: ")
rt (getreal "Extrusion radius: "));setq ;for the extrusion path
(setq h (getreal "Elevation: "))
(setq ns (getint "Number of spirals: "))
(setq
tu (getreal "Turns: ")
old (getvar "osmode")
fi1 (/ (* 2 PI) segs)
i 0
points (fix (* tu segs))
h1 (/ h points)
r1 (/ (- rf ri) points)
s (getpoint "Center of base: ")
end (list (car s) (cadr s) (+ h (caddr s))));setq
(setvar "osmode" 0 )
(command "line" s end "")
(command "chprop" "l" "" "c" 1 "")
(command "3dpoly")
(setq i 0)
(repeat (1+ points)
(setq
fi (* i fi1)
h (* i h1)
r (+ ri (* i r1))
x (* r (cos fi))
y (* spin r (sin fi)));setq
(command (list (+ (car s) x) (+ (cadr s) y) (+ (caddr s) h)))
(setq i (1+ i)));repeat
(command "")
(setvar "osmode" old)
(setq spiral (entlast))
(command "ucs" "n" "za" (polar s 0 ri)
(list
(+(car s) (* ri (cos fi1)))
(+(cadr s) (* spin ri (sin fi1)))h1))
;(command "circle" "0,0,0" rt)
;(command "extrude" (entlast) "" "p" spiral) ;for the extrusion path
(setvar "osmode" old)
(command "ucs" "p")
(command "array" (entlast) "" "p" s ns 360 "y")
(command "view" "swiso")
(command "_zoom" "e")
(command "shademode" "g")
); defun
even so,it would be great if you could help.
Thanks
-
You may have to explain a little better what you are trying to do.
The prompts don't mean a lot to me.
One-element array, nothing to do.
; error: Function cancelled
-
This is what I get :
(http://www.theswamp.org/screens/kerry/spiral.png)
-
Kerry,
Check this out, i combined the lisp but have no idea about the 3d stuff.
http://www.theswamp.org/phpBB2/viewtopic.php?p=62392#62392
this is what it produces:
Command: zahex
._undo Enter the number of operations to undo or
[Auto/Control/BEgin/End/Mark/Back] <1>: _begin
Command:
larger radius: 120
smaller radius: 60
height: 200
number of polygon sides: 6
insertion point: Number of spirals: 4
Extrusion radius: 25
Turns: 6
._undo Enter the number of operations to undo or
[Auto/Control/BEgin/End/Mark/Back] <1>: _end
(http://www.theswamp.org/screens/cab/Zahex.png)
-
mmmm, jello.
-
:shock: :) :)
It's past your bed time young man. 8)
-
But DaaAD!
-
Hey CAB are you in here??
i've one question about the code you posted...
Thanks
-
Just passing through, headed out to early dinner.
I'll catch up tonight.
-
Hey CAB:
Nice dinner?
Well,i saw you're picture and that was exactly what i wanted to do but the code you posted in another subject of mine doesn't do what appeared in the picture.In your code(c:zahex)the spiral appears in tne solid interior other thanface to face with the solid faces.
Why does that happen?
Other than that it's perfect...
Thank you
PS-i wrote this post in case i don't meet you here later
-
forgot this...
example:
command prompt:"keep the (s)olid or create s(t)ructure?:" if the user choses (t) how do i define that the solid is erased so that the structure is drawn?(knowing that i have 2 defuns one for each:(defun solid) and (defun structure))
Thanks
-
Hey CAB:
Nice dinner?
Well,i saw you're picture and that was exactly what i wanted to do but the code you posted in another subject of mine doesn't do what appeared in the picture.In your code(c:zahex)the spiral appears in tne solid interior other thanface to face with the solid faces.
Why does that happen?
Other than that it's perfect...
Thank you
PS-i wrote this post in case i don't meet you here later
Yes, thanks.
I suspect that if the picture is what you are after and you entered the responses as I did in the code above.
That is like this:
larger radius: 120
smaller radius: 60
height: 200
number of polygon sides: 6
insertion point: Number of spirals: 4
Extrusion radius: 25
Turns: 6
The problem is most likely a system variable in your environment that is not the same as in my environment.
Upload your drawing with the attempted results using the entries above to the link at the top of this page.
In other words click on 'Lilly Pond' above using your user name & password to upload your drawing.
-
forgot this...
example:
command prompt:"keep the (s)olid or create s(t)ructure?:" if the user choses (t) how do i define that the solid is erased so that the structure is drawn?(knowing that i have 2 defuns one for each:(defun solid) and (defun structure))
Thanks
Sorry the question is unclear to me.
If you want to delete an entity you already have the name of use (entdel <entName>)
-
The program you did only works with the values you defined in your previous code?
What i mean is,it only works with these values?:
That is like this:
larger radius: 120
smaller radius: 60
height: 200
number of polygon sides: 6
insertion point: Number of spirals: 4
Extrusion radius: 25
Turns: 6
i would want it to work for all values..
thanks