Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Draw circle, extrim inside circle, erase circle

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Daniel_Cadcon
2032 Views, 3 Replies

Draw circle, extrim inside circle, erase circle

So i am completely in over my head with this LISP stuff. I wanted to try and write a simple routine to try and automate a few processes i do manually within a drawing. Basically i wanted to draw 2 seperate circles with a set radius at a selected point(circle 1 with a radius of 0.75, circle 2 with a radius of 1.1), trim all lines inside circle 2, and then delete circle 2.

 

After lots of time on different websites/forums and trying to copy parts of this code and parts of that code, i got some of my routine to work. I can succesfully draw the 2 circles at the set radius, but when i got to the EXTRIM command thats when it all started to go flying over my head. I couldn't even get my routine to erase the second cirlce. Any help would be greatly appreciated, even being pointed in the right direction. Here is my attampt at the routine, keeping in mind that i am very much only just starting to understand the basics of LISP.

(defun c:station ()
  (setq pt1(getpoint))
      (command "circle" pt1 0.75)
      (setq circle_2 (command "circle" pt1 1.1))
    )

 

Thanks

Daniel

 

3 REPLIES 3
Message 2 of 4
hmsilva
in reply to: Daniel_Cadcon

 

Hello Daniel,

something like this perhaps...

 

(defun c:station ( / circle_2 pt1)

(if (setq pt1 (getpoint "\nEnter the center point: ")) (progn (command "circle" pt1 0.75) (command "circle" pt1 1.1) (setq circle_2 (entlast)) (load "extrim") (etrim circle_2 pt1) (entdel circle_2) ) ) (princ) )

 

Henrique

EESignature

Message 3 of 4
Daniel_Cadcon
in reply to: hmsilva

Thank you Henrique!

It seemed to work until it it got to one part of the extrim code and then would return a error, so i replaced that section of the code with marko_ribar's code for extrim from CADtutor that i fond online and it works! Code looks like this.

 

(defun c:station (/ circle_2 pt1)
  (if (setq pt1 (getpoint "\nSelect Station Point: "))
    (progn (command "circle" pt1 0.75)
      (command "circle" pt1 1.1)
      (setq circle_2 (entlast))
      (load "extrim")
(acet-error-init (list
                   (list   "cmdecho" 0
                         "highlight" 0
                         "regenmode" 1
                            "osmode" 0
                           "ucsicon" 0
                        "offsetdist" 0
                            "attreq" 0
                          "plinewid" 0
                         "plinetype" 1
                          "gridmode" 0
                           "celtype" "CONTINUOUS"
                         "ucsfollow" 0
                          "limcheck" 0
                   )
                   T     ;flag. True means use undo for error clean up.
                   '(if redraw_it (redraw na 4))
                  );list
);acet-error-init
 
(etrim circle_2 pt1)

(acet-error-restore)

       (entdel circle_2)))
  (princ)
  )

 

Thank you again for your help!

Message 4 of 4
hmsilva
in reply to: Daniel_Cadcon

You're welcome, Daniel
Glad you got it sorted.

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost