Jump to content

Offset Lisp


Guest balajibth84

Recommended Posts

Thats a fair point. From my earlier post theres no need to define new commands on the fly. As is VVA's post I think its best just to change the offset distance

 

(defun c:endOffset()
(if *unknownReactor* (vlr-remove *unknownReactor*))
)

(defun c:beginOffset ()
(or *unknownReactor* (setq *unknownReactor* (vlr-command-reactor nil '((:vlr-unknownCommand . createOffset)))))

(defun createOffset (<rea> <args> / acadDoc cmd offsetDist )

(setq acadDoc (vla-get-activedocument (vlax-get-acad-object ))
cmd (car <args>))
(if
(and
(not (equal (setq offsetDist (atoi cmd)) 0.0 1e-6))
(< 1 offsetDist 15000)
)

(progn
(setvar 'offsetdist offsetDist)
(vla-sendcommand acadDoc (strcat "._offset "))))
)
)

(c:beginOffset)
(princ "\nReactor started. Type endOffset to stop")
(princ)

 

Hi Jammie,

First congratulations for his work.

I work with "CAD2002" and the routine goes in a loop when I type the decimal value for example: 1.5 ... 2.6 ... 10.3...

That is, only runs with integers.

 

Thanks in advance.

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • BlackBox

    7

  • ReMark

    6

  • Cad64

    6

  • jammie

    5

Top Posters In This Topic

Hi Jammie,

First congratulations for his work.

I work with "CAD2002" and the routine goes in a loop when I type the decimal value for example: 1.5 ... 2.6 ... 10.3...

That is, only runs with integers.

 

Thanks in advance.

 

Replace createOffset sub with this one:

  (defun createOffset (<rea> <args> / off)
   (if (and (setq off (distof (car <args>))) (> off 0.))
     (vla-sendcommand
       (cond (*AcadDoc*)
             ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
       )
       (strcat "_.offset " (rtos off) " ")
     )
   )
   (princ)
 )

Link to comment
Share on other sites

Replace createOffset sub with this one:

 (defun createOffset (<rea> <args> / off)
(if (and (setq off (distof (car <args>))) (> off 0.))
(vla-sendcommand
(cond (*AcadDoc*)
((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
)
(strcat "_.offset " (rtos off) " ")
)
)
(princ)
)

 

Cool code Alan.

Thanks for your help.

Link to comment
Share on other sites

Hi Jammie,

First congratulations for his work

 

Thanks for that scamaru, glad you are getting some use of the code.

 

Replace createOffset sub with this one:

Alan thanks for the code update

 

Regards

 

Jammie

Link to comment
Share on other sites

Thanks for that scamaru, glad you are getting some use of the code.

 

 

Alan thanks for the code update

 

Regards

 

Jammie

error at lisp

error: malformed list on input

(vl-load-com)
(defun c:endOffset()
 (if *unknownReactor* (vlr-remove *unknownReactor*))
 )
(defun c:beginOffset ()
 (or *unknownReactor* (setq *unknownReactor* (vlr-command-reactor nil '((:vlr-unknownCommand . createOffset)))))

(defun createOffset (<rea> <args> / off)
   (if (and (setq off (distof (car <args>))) (> off 0.))
     (vla-sendcommand
       (cond (*AcadDoc*)
             ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
       )
       (strcat "_.offset " (rtos off) " ")
     )
   )
   (princ)
 )
(c:beginOffset)
(princ "\nReactor started. Type endOffset to stop")
(princ)

Link to comment
Share on other sites

Hi Autolisp,

 

You appear to be missing a closing bracket in the function c:beginOffset. This is what is causing the error : malformed list on input

 

Jammie

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