Jump to content

slope lisp needed


NH3man!

Recommended Posts

  • Replies 70
  • Created
  • Last Reply

Top Posters In This Topic

  • NH3man!

    38

  • Lee Mac

    29

  • lpseifert

    1

  • Freerefill

    1

I have been trying to get your lsp to do a zero slope. The only way I can do it is the change the slope int to 1. But then it will not slope at all. Then I tried to edit out all of the slope related command and redo the definitions and temps but seem to get an error when I do that.

Link to comment
Share on other sites

I tried to edit this to make it so I didn't need to enter a slope but it keeps giving me error when I try to call it. It would be nice just to have the original be able to do a zero slope, I can make it do it but then it will not work with the slope when needed unless I edit it back.

 

 

(defun c:sh  (/ *error* vlst ovar cBlk tmp1 tmp2 tmp3 blkpt)

 ; Error Handler

 (defun *error*  (msg)
   (if ovar
     (mapcar 'setvar vlst ovar)) ; Return System Variables
   (if (not (member msg '("Function cancelled" "quit / exit abort")))
     (princ (strcat "\n<< Error: " msg " >>"))) ; Print Error Message
   (princ))

 ; Collect and Set System Variables

 (setq vlst '("CMDECHO" "OSMODE")
       ovar (mapcar 'getvar vlst))
 (mapcar 'setvar vlst '(0 0))

 ; Set Defaults

 (or hc$cop:def (setq hc$cop:def 1))
 (or hc$spc:def (setq hc$spc:def 1))
 (or hc$dir:def (setq hc$dir:def "X"))

 ; Get Block to Copy

 (if (and (setq cBlk (car (entsel "\nSelect Block: ")))
          (eq "INSERT" (cdr (assoc 0 (entget cBlk)))))
   (progn

 ; Get User Input


     (initget 6)
     (setq tmp1 (getint (strcat "\nSpecify Number of Copies <" (itoa hc$cop:def) "> : ")))
     (or (not tmp1) (setq hc$cop:def tmp1))
     (initget 6)
     (setq tmp2 (getreal (strcat "\nSpecify Spacing <" (rtos hc$spc:def) "> : ")))
     (or (not tmp2) (setq hc$spc:def tmp2))
     (initget "X Y -x -y")
     (setq tmp3 (getkword (strcat "\nSpecify Axis [X/Y/-X/-Y] <" hc$dir:def "> : ")))
     (or (not tmp3) (setq hc$dir:def tmp3))

 ; Get Block Insertion Point Information and Initiate Counter

     (setq blkpt (cdr (assoc 10 (entget cBlk)))
           i     1)

 ; Copy the Block a Number of Times
     (command "_undo" "_Begin")

     (repeat hc$cop:def

       (command "_copy" cBlk "" blkpt)
       (cond ((eq "X" hc$dir:def)
              (command
                (list (+ (* i hc$spc:def) (car blkpt))
                      (cadr blkpt)
             ((eq "Y" hc$dir:def)
              (command
                (list (car blkpt)
                      (+ (* i hc$spc:def) (cadr blkpt))
             ((eq "-x" hc$dir:def)
              (command
                (list (+ (* -1. i hc$spc:def) (car blkpt))
                      (cadr blkpt)
             ((eq "-y" hc$dir:def)
              (command
                (list (car blkpt)
                      (+ (* -1. i hc$spc:def) (cadr blkpt))
             ) ; end cond
       (command)
       (setq i (1+ i)))

     (command "_undo" "_End"))

 ; Else No Block was Selected

   (princ "\n<!> No Block Selected <!>"))

 ; Return Sys Vars Back

 (mapcar 'setvar vlst ovar)

 ; Exit Cleanly

 (princ))

 

Not sure if i did the code thing right.

Link to comment
Share on other sites

I don't seem to have those option even in the advanced reply box. I am using firefox do you think that might be the reason? Thanks

Link to comment
Share on other sites

I don't seem to have those option even in the advanced reply box. I am using firefox do you think that might be the reason? Thanks

 

I am also using Firefox and have the options.

 

Just enclose the code with

 [/ code] tags - without the space.
Link to comment
Share on other sites

  • 2 years later...

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