Message 1 of 7

Not applicable
05-26-2015
09:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am starting to learn how to work with autolisp but I'm having a really hard time. Hope you can help me because I have few questions.
1. I want to assign (don't know if this word is correct in this context) value.
For example:
In math it is
H=30; R=0.35H
But how do you write this in LISP language? (setq R (* 0.35 H) ?
I have an example by which I made my assignment but I still don't get it.
Here is my assignment and here is what came up with. maybe you could tell me the main things and tell where the mistakes are.
;------------------------------------------------ ; baseline data: p0, L, H, b, c, a, w, a1 ;------------------------------------------------ ;--baseline data---------------------------- (defun prduom () (setq p0 (getpoint "\n mark base point p0:")) (setq L (getdist "\nWidth L <30>:")) (if (null L) (setq L 30)) (setq H (getdist "\nHeight H <30>:")) (if (null H) (setq H 30)) (setq b (* [0.35] H) (setq c (* [0.15] H) (setq a (* [0.85] H) (setq r (* [0.35] H) (setq a1 (- L a) (setq W (getdist "\nPolyline width W <0.5>:")) (if (null w) (setq w 0.5)) (setq m (getdist "\nScale m <1.0>:")) (if (null m) (setq m 1.0)) ) ;--evaluating coordinates------------------------- (defun skaic () (setq p1 (polar p0 (/ pi 2.0) H)) (setq p2 (polar p1 0 a1)) (setq p3 (list (car p2) (- (cadr p2) c))) (setq p4 (polar p3 (* 1.75 pi) (* r (sqrt 2)))) (setq p5 (polar p4 0 c)) (setq p6 (polar p5 (* 1.75 pi) (* r (sqrt 2)))) (setq p7 (list (car p6) (- (cadr p6) b))) ) ;--drawing contour------------------------------ (defun braiz () (command "PLINE" p0 "w" w "" p1 p2 p3 "ARC" "ANGLE" "-90" p4 "L" p5 "ARC" "ANGLE" "90" p6 "L" p7 p0 "") (setq p2 (entlast)) (command "SCALE" p2 "" p0 m ) (setq PL2 (entlast)) (command "hatch" "ansi31" 2 0 PL2 "") ) ;--Main Program------------------------------------------- (defun C:uzdv() (prduom) (skaic) (braiz) (princ) )
Edited by
Discussion_Admin
note please use the insert code option when post to the community
Solved! Go to Solution.