Civ Posted May 10, 2013 Posted May 10, 2013 I am still a novice. I have a lot to learn about autolisp. I need help completing this picture frame. I would greatly appreciate any help. Here is my code. (defun c:picf () (setvar "cmdecho" 0) ;askimg the user three questions (setq osmode (getvar "osmode" )) (setq height (getint "\nEnter the height: ")) (setq width (getint "\nEnter the width: ")) (setq thick (getint "\nEnter the thickness: ")) ;setting the start point and top right point (setq stpt (list 0.0 0.0)) (setq trp (polar (polar stpt 0 width) (* pi 0.5) height)) (command "rectangle" stpt trp "") (setvar "osmode" 0) (setvar "osmode" osmode) (princ) ) Quote
BIGAL Posted May 10, 2013 Posted May 10, 2013 Put your setvar osmode after the getvar osmode you have it too far down now. You can also do plines but it requires you work out 3 extra pts, the reason for this way is you can use an autoloaded defun pline routine their are lots of examples here about a VLa-Addlwpolyline. Then you can do 2+ pts Its probably a good idea to start moving away from "Command" and using vla-add's There was a recent post about rectangs on an angle I suggested use "snapang" Quote
pBe Posted May 10, 2013 Posted May 10, 2013 I am still a novice. I have a lot to learn about autolisp. I need help completing this picture frame. I would greatly appreciate any help. After "rectangle" whats next? I did not see any question on your post at all beside the obvious placement of "osmode" settings mentioned by Bigal Quote
BIGAL Posted May 10, 2013 Posted May 10, 2013 (edited) The suggestion was to move to Vla-addpolyline this has the advantage of setting all its properties in one go rather than rectang then another command PE last width etc anyway ps use code brackets (defun c:picf () (setvar "cmdecho" 0) ;askimg the user three questions (setq osmode (getvar "osmode" )) (setq height (getint "\nEnter the height: ")) (setq width (getint "\nEnter the width: ")) (setq thick (getint "\nEnter the thickness: ")) ;setting the start point and top right point (setq stpt (list 0.0 0.0)) (setq trp (polar (polar stpt 0 width) (* pi 0.5) height)) (command "rectangle" stpt trp "") (command "pedit" "L" "w" thick) (setvar "osmode" 0) (setvar "osmode" osmode) (princ) ) Edited May 10, 2013 by BIGAL Quote
welldriller Posted May 10, 2013 Posted May 10, 2013 i thought that this may show you the formula and give you some ideas about how to set up your lisp program. i could be wrong but i think that you have missed a step or 2 in your lisp posted but as i do not know how to program in lisp i am probably wrong. anyway hope this may be of some help to you Quote
SLW210 Posted May 10, 2013 Posted May 10, 2013 Civ, Please edit your post to include CODE TAGS. Quote
neophoible Posted May 10, 2013 Posted May 10, 2013 How about posting a pic of what an end result should look like? Quote
Tharwat Posted May 12, 2013 Posted May 12, 2013 Try this ... and let me know if this would meet your requirements . (defun c:Test (/ hgt wid thk pt l p1 p2 p3 p4 p5 p6 p7 ct) (if (and (setq hgt (getdist "\nEnter the height: ")) (setq wid (getdist "\nEnter the width: ")) (setq thk (getdist "\nEnter the thickness: ")) (if (> wid (* 2. thk)) t (progn (alert "Width of outter border must be bigger two times at least than the Thickness !" ) nil ) ) (setq pt (getpoint "\n Specify point :")) ) (progn (setq l (- wid (* thk 2.)) p1 (polar pt 0. wid) p2 (polar p1 (* pi 1.5) hgt) p3 (polar p2 pi wid) p4 (polar (polar pt 0. thk) (* pi 1.5) thk) p5 (polar p4 0. l) p6 (polar p5 (* pi 1.5) l) p7 (polar p6 pi l) ct (inters p4 p6 p5 p7) ) (command "_.rectang" "_none" pt "_none" p2) (command "_.rectang" "_none" p4 "_none" p6) (entmake (list '(0 . "CIRCLE") (cons 10 ct) (cons 40 (/ l 2.))) ) ) ) (princ) ) Quote
welldriller Posted May 12, 2013 Posted May 12, 2013 Here is a program that i made to help me with frame sizes i hope that it will help you with your lisp program. Quote
Recommended Posts
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.