Author Topic: Lisp help  (Read 5851 times)

0 Members and 1 Guest are viewing this topic.

BIGAL

  • Swamp Rat
  • Posts: 1396
  • 40 + years of using Autocad
Re: Lisp help
« Reply #15 on: November 12, 2018, 09:17:09 PM »
My $0.05 I wrote a lisp that just asks for the offsets includes left and right by using a -ve the input is a simple string either space or a comma input.

eg 12.3,45,-12.3,56 or 123.3 46 52 -12.56 -52.68

It is split into a list of multiple offsets and just do it. The feet part could be added fairly simply by adding a defun that looks for the - and returns the correct string for the offset command.

This is an old one will try to find the newere version its at home.
Code: [Select]
(defun C:MULOFF ( / obj s off)
(vl-load-com)
(setq obj (entsel "\nSelectObject"))
(setq s (getpoint "\nPick Offset side"))
(while (/= (setq off (getreal "\nEnter offset or Enter to exit")) nil)
(vl-cmdf "_.offset" off obj s "")
(setq obj (entlast))
)
)
(c:muloff)
A man who never made a mistake never made anything

cadd4la

  • Newt
  • Posts: 27
Re: Lisp help
« Reply #16 on: November 21, 2018, 03:47:24 PM »
Dlanor,

Thank you so much for the code. I have a problem using the OD option for inches, for example when I type in 9 I get "An Error : bad argument type: numberp: nil occured." but if I type in 0-9 the code will work.

Regards,
Windows 10 x64 - AutoCAD 2023

cadd4la

  • Newt
  • Posts: 27
Re: Lisp help
« Reply #17 on: November 21, 2018, 04:10:46 PM »
CAB,

Thank you so much. Your code is great with just one thing that I don't care for, I have to enter the ' and " so 2'-3" and not just 2-3.

Regards,

Cadd4la
Windows 10 x64 - AutoCAD 2023

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Lisp help
« Reply #18 on: November 22, 2018, 09:44:14 AM »
Well you could omit the "
(setq dist (getdist "\nEnter distance: "))
Enter distance: 3'-2

I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

cadd4la

  • Newt
  • Posts: 27
Re: Lisp help
« Reply #19 on: November 29, 2018, 10:23:41 AM »
Cab,

Thank you for your reply

Cadd4la
Windows 10 x64 - AutoCAD 2023

cadd4la

  • Newt
  • Posts: 27
Re: Lisp help
« Reply #20 on: November 29, 2018, 10:24:57 AM »
BIGAL,

Thank you for your $0.05.

Regards,

Cadd4la
Windows 10 x64 - AutoCAD 2023