Jump to content

Recommended Posts

Posted

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)

)

Posted

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"

Posted
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

Posted (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 by BIGAL
Posted

frame sizes.jpg

 

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

Posted

How about posting a pic of what an end result should look like?

Posted

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

Posted

Here is a program that i made to help me with frame sizes i hope that it will help you with your lisp program.

 

frame size prg.jpg

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