Jump to content

Creating an AutoLISP


Elektryk

Recommended Posts

dwg file included

 

is there any way to transform the object on the right to the object on the left

by using Autolisp?

 

like when i load app it will ask me which object, which way to do the offset ( inside or outside ( in this case 1/8 and to the outside ) )

and after the selections it will redraw the object on the right so it looks like the one on the left.

i have 142 objects similar to that one , and it would take me a while to do them.

 

could anyone help creating the lsp file?

thanks

template.dwg

Link to comment
Share on other sites

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • Elektryk

    17

  • Lee Mac

    10

  • paulmcz

    2

  • alanjt

    2

is there any way to transform the object on the right to the object on the left

by using Autolisp?

 

 

and afet [sic] the selections it will redraw the object on the left so it looks like the one on the right.

 

Which is it?

Link to comment
Share on other sites

Here is the deal:

 

here you have the first half of the program (transforming selected geometry to the object on the left = "outside") and you finish it for the transformation the other way around. When you get stuck, then ask here.

 

(defun c:tio (/ aa osn)
 (initget "I O")
 (setq	aa  (getkword "\n Select option -> Inside [i], Outside [O]: ")
osn (getvar "osmode")
 )
 (cond	((= aa "I") (i))
((= aa "O") (o))
(t nil)
 )
 (princ)
)



(defun o (/ ip p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14)
 (setvar "osmode" 4)
 (setq ipt (getpoint "\n Insert new objects: "))
 (setvar "osmode" 0)
 (princ "\n Select objects to erase: ")
 (setq	ss  (ssget)
ip  (polar ipt pi 7.75)
p1  (polar ip 0 1.75)
p2  (polar p1 (* pi 0.5) 6.0)
p3  (polar p1 0 12.0)
p4  (polar ip 0 15.5)
p5  (polar p4 (* pi 0.5) 8.49331856)
p6  (polar p5 (* pi 0.5) 0.5)
p7  (polar p6 pi 0.5)
p8  (polar p6 pi 15.0)
p9  (polar p5 pi 15.5)
p10 (polar ip 0 0.5)		;
p11 (polar p10 (* pi 0.5) 2.25)
p12 (polar p11 (* pi 0.5) 4.0)
p13 (polar p11 0 14.5)
p14 (polar p12 0 14.5)
 )
 (setvar "osmode" 0)
 (command "pline" ip p1 "a" "d" p2 p3 "l" p4 p5 "a" p7	"l" p8 "a" p9
   "l" "c" "")
 (command "circle" p11 0.125)
 (setq e1 (entlast))
 (command "copy" e1 "" "m" p11 p12 p13 p14 "")
 (command "erase" ss "")

 (setvar "osmode" osn)
 (princ)
)

(defun i ()
 (alert
   "The <INSIDE> option of the program is to be written by Elektryk"
 )
)

Link to comment
Share on other sites

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