Jump to content
Arek Adamczuk

AutoCAD - autolisp-HELP

Recommended Posts

Arek Adamczuk

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

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites
Arek Adamczuk

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

image.png.d4c3a784d345de1d33c626ef0bc747c8.png

 

Share this post


Link to post
Share on other sites
BIGAL

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×