Jump to content

Recommended Posts

Posted

Hello everyone in the forum, thank you in advance for the help you can give me.

Ok  this is the situation:

 

I've a LISP, that calculates the slopes in a plan view or in the model, and works very well, but i need some changes adapted to this task. I'll try to explain my best.

1. Here is the code

(defun c:plevel (/ decs ;|diff|; elist level osm p1 p2 slope strlevel txtelev txthgt txtpt)
 (setq osm (getvar 'osmode))
 (while (and
   (or (not
  (setq txtelev (entsel "\nSelect Starting Level Text : ")))
       (not
  (eq "TEXT"
      (cdr (assoc 0 (setq elist (entget (car txtelev)))))))))
   (princ
     "\n Nothing selected or wrong object type selected, try again")
   )
 (setq strlevel (cdr (assoc 1 elist))
decs  (- (strlen strlevel) (1+ (vl-string-position 46 strlevel)))
level  (atof strlevel)
txthgt  (cdr (assoc 40 elist))
)

 (initget 6)
 (setq slope (getreal "\n Enter Slope Like ==> 0.005 : "))
 (if (not slope)
   (setq slope 0.005))
 (setvar 'osmode 39)
 (setq p1 (getpoint "\nPick 1st Point: "))
;;;  (setq diff (mapcar '- (cdr (assoc 10 elist)) p1))

 (while (setq p2 (getpoint "\nPick Next Point (Or Press Enter To Exit): "))
   (setq level    (- level (* (distance p1 p2) slope))
  strlevel (rtos level decs)
  txtpt   (getpoint "\nPick Text Place For Point Level: "); (mapcar '+ p2 diff)
  )
   (entmake
     (list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(100 . "AcDbText")
(cons 10 txtpt)
(cons 11 (list 0.0 0.0 0.0))
(cons 40 txthgt)
(cons 1 strlevel)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "Standard")
'(71 . 0)
'(72 . 0)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 0))
     )
   (setq p1 p2)
   )

 (setvar 'osmode osm)
 (princ)
 )

2. Basically, what the LISP does is obtain through the slope introduced the levels at the points that the user subsequently enters. To this point, well.

 

Ok, this is what i need

 

1. It does not calculate the negative slope, if the user enters a negative slope this sends an error message. calculation is not possible in that situation. I need change that to work with negative slopes.

2. that allows me, by selecting objects either line, polyline to calculate the distance first and then with the previous selection of levels, calculate the slope automatically.

 

post the original LISP,

 

Regards.

 

plevel.lsp

Posted

Not sure what this breaks but comment out: (initget 6)

Posted
18 hours ago, ronjonp said:

Not sure what this breaks but comment out: (initget 6)

 

Hi, ronjonp

 

neither do I, thank you for watching my post, I tell you I don't know much about programming in this of the LISP, post that because I work and it works well, but if you can modify it it would be useful in my work.

 

Regards.

Posted (edited)
21 minutes ago, Jaru said:

 

Hi, ronjonp

 

neither do I, thank you for watching my post, I tell you I don't know much about programming in this of the LISP, post that because I work and it works well, but if you can modify it it would be useful in my work.

 

Regards.

A comment in lisp is preceded with a semicolon so find (initget 6) in the code and replace it with ;(initget 6) or delete it.

Edited by ronjonp
Posted
On 2/21/2020 at 10:19 AM, ronjonp said:

A comment in lisp is preceded with a semicolon so find (initget 6) in the code and replace it with ;(initget 6) or delete it.

thanks for the comment

I tried to delete (initget 6), but I still don't change, nothing remains in the same conditions I am using it.

 

Regards

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