Jump to content

Recommended Posts

Posted

Hello. I am a student and I need your help😉. My task is to write a program in AutoLISP that draws parts but I have no idea how to do it. The program in the simplest version which is only possible - I know that for some of you it's a bit of a job, so if it was possible, I would ask for help. I will try to repay somehow 😉. Greetings. 👊 Sorry for my English.

autolisp.png

Posted

You need to start with the basics then use simple command method as a start. Keep using polar to work out new points and drawing objects like a circle then trim to clean up. look up the help for explanation of the commands below. There is some missing distances in the sketch you will have to make some choices.

 

Getpoint

Getreal or Getdist

Polar to work out new points

 


(setq pt1 (getpoint "Pick lower left point"))

(setq a (getreal "Enter length A"))

(setq b (/ a 0.6))

(setq h (getreal "Enter offset H"))

(setq h1 (- (/ b 3.0) 5.0))

 

(setq pt2 (polar pt1 0.0 b))

(setq pt3 (polar pt2 (/ pi 2.0) a))

(setq pt4 (polar pt3 pi  b))

 

(command "line" pt1 pt2 pt3 pt4 pt1 "")

  • Thanks 1
Posted

Thanks ;). What is this mistake? The compiler shows that it is good.

image.png.d4c3a784d345de1d33c626ef0bc747c8.png

 

Posted

The new version of Cadtutor double lines when I paste if you just copy and paste it will not work as it will skip over the getpoint and getreal. Paste it to vlide and run from there. If you paste a line at a time it will work just a quirk with copy and pasting to command line you have to know how many lines you can paste takes experience. I tested this version and it works.

 


(setq pt1 (getpoint "Pick lower left point"))
(setq a (getreal "Enter length A"))
(setq h (getreal "Enter offset H"))
(setq b (/ a 0.6))
(setq h1 (- (/ b 3.0) 5.0))
(setq pt2 (polar pt1 0.0 b))
(setq pt3 (polar pt2 (/ pi 2.0) a))
(setq pt4 (polar pt3 pi  b))

(setvar "osmode" 0)
(command "line" pt1 pt2 pt3 pt4 pt1 "")

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