Jump to content

Need a fix for 2 lisps (SLOPE in percentage and creating a line at a specified slope


danielk

Recommended Posts

The first lisp SLOPE.LSP label a slope of a line in percentage and also have the ability to use different scales horizontal and vertical , something that is very useful when creating a pipeline section... Its Working great just sometimes in autocad 2013 or 2014 when im trying to repeat the command it wont let me so i need to restart autocad.

 

the second lisp SLOPEDRAW.LSP create a line at a specified slope the problems are:

1)the lisp starts only when i drag the file into autocad screen

2) the line is created in opposite direction from the points i click to create it .

 

thanks guys, i hope that someone else will also find it usefulslopedraw.lsp

slope.lsp

Link to comment
Share on other sites

...in autocad 2013 or 2014 when im trying to repeat the command it wont let me so i need to restart autocad.

maybe:

rem is a lisp function, can not be indicated as a variable.

 (setvar "osmode" rem)

 

 

 

the second lisp SLOPEDRAW.LSP create a line at a specified slope the problems are:

1)the lisp starts only when i drag the file into autocad screen

2) the line is created in opposite direction from the points i click to create it .

 

;CODE
;by Maurizio - July 2011
[b][color=red]([/color][/b]defun C:Slopedraw () ;; [color=red][b]1)[/b][/color] [color=red]missing parenthesis[/color]
   ;INPUT SLOPE
   (if (= pSlope nil)
       (setq pSlope 3.03)
   )
   (setq perc (getreal (strcat "\nSlope % <" (rtos pSlope 2 2) "> :")))
   (if (/= perc nil)
       (setq pSlope perc)
   )
   ;FIRST POINT - DISTANCE
   (setq p1 (getpoint "\nStart point: "))
   (setq dd (getdist "\nDistance: " p1))
   (setq dy (/ (* dd pSlope) 100.0))
   ;SECOND POINT AT LEFT AND DY > 0
   (setq p2 (mapcar '+ p1 (list ([b][color=red]+[/color][/b] dd) dy 0))) ;; [color=red][b]2)[/b] substitute - with +[/color]
   (command "_line" p1 p2 "")
   (princ)
)

 

or

(setq p2 (mapcar '+ p1 (list dd dy 0))) 

Link to comment
Share on other sites

Thank you soo much , SlOPEDRAW.LSP is working great.

what about the slope.lsp did you find the problem ?

do i need to delete the raw with "rem"?

Link to comment
Share on other sites

Thank you soo much , SlOPEDRAW.LSP is working great.

what about the slope.lsp did you find the problem ?

do i need to delete the raw with "rem"?

GP_ told you what one problem was. Renaming rem to rem2 everywhere would be a simple fix for this. Try it and see if that's all it needs.
Link to comment
Share on other sites

Actually, I don't see where rem was actually being used other than at the end. It looks like the intent was to save the OSMODE value then reset it, but that didn't happen. You could add the missing line near the beginning like this

 

(setq rem2 (getvar "OSMODE"))

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