Author Topic: Create a Lisp help for Grading site plans  (Read 7149 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« on: June 22, 2004, 10:36:58 AM »
I need to know how hard it is to create a lisp which will do the following:

1 - Pick a place on the drawing which places a leader or spot X.

2 - Then Prompts for an Elevation XXX.XX with a rectangle around it.

3 - Then takes the XXX.XX value and adds .50 to it and places it above the value which was entered in a block

4 - finally, user pics a place for the block to be placed with the leader or line which connects the block to the spot X.


Yes you are right... it is used for survey to sight work for plans... you choose a place to for your spot elevation... Then you place where you want your elevation # XXX.XX to apear. Then after that, it adds a # .50 to that XXX.XX, and places it in a rectangle with the line in the middle of it where the higher grade XXX.50 is up top, and XXX.XX is on the bottom of the rectangle...

 _______
| XXX.50 |
----------
| XXX.XX |
----------
Civil3D 2020

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Create a Lisp help for Grading site plans
« Reply #1 on: June 22, 2004, 10:43:33 AM »
Are you using LDT ??
TheSwamp.org  (serving the CAD community since 2003)

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
Create a Lisp help for Grading site plans
« Reply #2 on: June 22, 2004, 10:43:49 AM »
Check out this discription of some lisp I have. We might be able to modify it to your needs. It is the Grading.doc
I drink beer and I know things....

JohnK

  • Administrator
  • Seagull
  • Posts: 10664
Re: Create a Lisp help for Grading site plans
« Reply #3 on: June 22, 2004, 10:45:39 AM »
Quote from: MSTG007
I need to know how hard it is to create a lisp which will do the following...


Not hard.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #4 on: June 22, 2004, 11:03:00 AM »
lol Well I found this... I am new to lisp and writing... sorry to bother you withi this!

thank you for the help

CarlAK (TechnicalUser) Jun 16, 2004
Not likely possible with a macro due to imbedded math.  Could be a fairly simple lisp if you can live with a fixed size & length rectagle (relative to text size). I would say make a block (of a rectangle) with your text being attributes. Probably have 2 blocks, one with leader from right side and one from left. A routine could be fairly simple.  A little code, off the cuff:
Code: [Select]

(defun c:Spot ()
;; assumes 2 blocks available named "SpotLeft" and
;; "SpotRight" with different base points, a rectangle and
;; 2 attributes, text drawn at 1 unit high.
(setq TxtHt (getreal "\nText height for label: ")
      Pt1 (getpoint"\nPick point for elevation: ")
      Pt2 (getpoint Pt1 "nPick elevation label point: ")
)
(setq BkName (if (> (car Pt2) (car Pt1))  "SpotRight" "SpotLeft"))
(setq SpotElev (getreal "\nEnter elevation: ")
      SpotHigh (+ 0.5 SpotElev)
      SpotElevTxt (rtos SpotElev 2 2)
      SpotHighTxt (rtos SpotHigh 2 2)
)
(command "line" pt1 pt2 "")
(command "-insert" BkName Pt2 TxtHt TxtHt 0 SpotElevTxt SpotHighTxt)
(princ)
)

 and then:
Civil3D 2020

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Create a Lisp help for Grading site plans
« Reply #5 on: June 22, 2004, 11:06:29 AM »
Well if you want to get started writing your own here is some of it. The rest you can work on. :D
Code: [Select]

(defun c:spot-elev (/ pt elev elev2)

  (setq pt (getpoint "\nPlace 'X' where? : "))

  (command "_.point" pt)

  (setq elev (getreal "\nElevation: "))
  (setq elev2 (+ elev 0.50))
  (command "_.text" pt 0.0 (rtos elev2))
  (command "_.text" "" (rtos elev))
  )
TheSwamp.org  (serving the CAD community since 2003)

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #6 on: June 22, 2004, 11:10:31 AM »
Thanks! ill see what i can do... I might have questions!
Civil3D 2020

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Create a Lisp help for Grading site plans
« Reply #7 on: June 22, 2004, 11:14:48 AM »
Quote from: MSTG007
Thanks! ill see what i can do... I might have questions!

No problem, we like questions. :D
TheSwamp.org  (serving the CAD community since 2003)

JohnK

  • Administrator
  • Seagull
  • Posts: 10664
Create a Lisp help for Grading site plans
« Reply #8 on: June 22, 2004, 11:30:20 AM »
yes we do!
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #9 on: June 27, 2004, 09:29:34 PM »
From the below lisp... i am having probs figuring out where to place a X on where the first line starts... i dont know if it needs to be a block or what....

http://theswamp.org/lilly.pond/mstg007/spot%20grade.zip

the above is the drawing with the blocks!


(defun c:S2 ()
;; assumes 2 blocks available named "SpotLeft" and
;; "SpotRight" with different base points, a rectangle and
;; 2 attributes, text drawn at 1 unit high.
(setq TxtHt (getreal "\nText height for label: ")
Pt1 (getpoint"\nPick point for elevation: ")
Pt2 (getpoint Pt1 "nPick elevation label point: ")
)
(setq BkName (if (> (car Pt2) (car Pt1)) "SpotRight" "SpotLeft"))
(setq SpotElev (getreal "\nEnter elevation: ")
SpotHigh (+ 0.5 SpotElev)
SpotElevTxt (rtos SpotElev 2 2)
SpotHighTxt (rtos SpotHigh 2 2)
)
(command "line" pt1 pt2 "")
(command "-insert" BkName Pt2 TxtHt TxtHt 0 SpotElevTxt SpotHighTxt)
(princ)
)



(defun c:S1 ()
;; assumes 2 blocks available named "SpotLeft1" and
;; "SpotRight1" with different base points, a rectangle and
;; 1 attributes, text drawn at 1 unit high.
(setq TxtHt (getreal "\nText height for label: ")
      Pt1 (getpoint"\nPick point for elevation: ")
      Pt2 (getpoint Pt1 "nPick elevation label point: ")
)
(setq BkName (if (> (car Pt2) (car Pt1))  "SpotRight1" "SpotLeft1"))
(setq SpotElev (getreal "\nEnter elevation: ")
            SpotElevTxt (rtos SpotElev 2 2)      
)
(command "line" pt1 pt2 "")
(command "-insert" BkName Pt2 TxtHt TxtHt 0 SpotElevTxt SpotHighTxt)
(princ)
)http://http://
Civil3D 2020

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Create a Lisp help for Grading site plans
« Reply #10 on: June 27, 2004, 09:46:10 PM »
Quote from: MSTG007
lol Well I found this... I am new to lisp and writing... sorry to bother you withi this!

thank you for the help

CarlAK (TechnicalUser) Jun 16, 2004
Not likely possible with a macro due to imbedded math.  Could be a fairly simple lisp if you can live with a fixed size & length rectagle (relative to text size). I would say make a block (of a rectangle) with your text being attributes. Probably have 2 blocks, one with leader from right side and one from left. A routine could be fairly simple.  A little code, off the cuff:
Code: [Select]

(defun c:Spot ()
;; assumes 2 blocks available named "SpotLeft" and
;; "SpotRight" with different base points, a rectangle and
;; 2 attributes, text drawn at 1 unit high.
(setq TxtHt (getreal "\nText height for label: ")
      Pt1 (getpoint"\nPick point for elevation: ")
      Pt2 (getpoint Pt1 "nPick elevation label point: ")
)
(setq BkName (if (> (car Pt2) (car Pt1))  "SpotRight" "SpotLeft"))
(setq SpotElev (getreal "\nEnter elevation: ")
      SpotHigh (+ 0.5 SpotElev)
      SpotElevTxt (rtos SpotElev 2 2)
      SpotHighTxt (rtos SpotHigh 2 2)
)
(command "line" pt1 pt2 "")
(command "-insert" BkName Pt2 TxtHt TxtHt 0 SpotElevTxt SpotHighTxt)
(princ)
)

 and then:


Well, it actually could be a little simpler than you imagine. If you do not need to access the data in the block programmatically, then a simple anonymous block with the text in a textbox will do the trick.....
I have both a textbox outlining proggie and an anonymous block proggie, I am sure the two could be combined to make a single program to insert a block dynamically based on a passed numerical argument
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #11 on: June 27, 2004, 10:57:23 PM »
wow... that would be cool.   see that seems simple, but when i go to do it... its like i am looking at something i have little knowledge on... it stinks...
I am trying to learn as much as i can from this...
grh... just frusterating sometimes.

Thanks for the help keith.
Civil3D 2020

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Create a Lisp help for Grading site plans
« Reply #12 on: June 28, 2004, 01:09:25 PM »
I'll look it up and post when I can...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #13 on: June 28, 2004, 01:23:41 PM »
thanks keith
Civil3D 2020

MSTG007

  • Gator
  • Posts: 2606
  • I can't remeber what I already asked! I need help!
Create a Lisp help for Grading site plans
« Reply #14 on: July 20, 2004, 11:39:31 PM »
can i ask about this? lol :)
Civil3D 2020

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Create a Lisp help for Grading site plans
« Reply #15 on: July 21, 2004, 09:36:16 AM »
you know what... I had completely forgotten about it...

Here is the anonymous part...

Code: [Select]

;|----------------------------------------------------------------------------

     ANON.LSP   Version 1.0

     Copyright (C) 2001-2004 by Keith Blackie

     THIS PROGRAM IS PROVIDED "AS IS" AND WITH ALL FAULTS.
     ANY AND ALL IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
     A PARTICULAR PURPOSE ARE HEREBY DISCLAIMED. THIS CODE IS NOT
     WARRANTED THAT THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED
     OR ERROR FREE. YOU UTILIZE THIS CODE AT YOUR OWN RISK.

     Please visit us at http://www.resourcecad.com

|;

(defun C:ANON()
 (SETQ SSST (SSGET))
 (SETQ ST (GETPOINT "\nInsertion point: "))
 (ENTMAKE
   (LIST
     (CONS 0 "BLOCK")
     (CONS 2 "*U")
     (CONS 10 ST)
     (CONS 70 67)
   )
 )
 (SETQ NDX 0)
 (REPEAT (SSLENGTH SSST)
  (ENTMAKE
    (CDR (ENTGET (SSNAME SSST NDX)))
  )
  (SETQ NDX (+ 1 NDX))
 )
 (SETQ BKN(entmake (list (cons 0 "ENDBLK"))))
 (SETQ EEE
   (LIST
     (CONS 0 "INSERT")
     (CONS 2 BKN)
     (CONS 6 (GETVAR "CELTYPE"))
     (CONS 8 (GETVAR "CLAYER"))
     (CONS 66 0)
     (CONS 10 ST)
     (CONS 41 1)
     (CONS 42 1)
     (CONS 43 1)
     (CONS 50 (GETANGLE ST "\nRotation angle: "))
     (CONS 71 0)
     (CONS 44 0)
     (CONS 45 0)
   )
  )
 (ENTMAKE EEE
 )
 (COMMAND "_.ERASE" SSST "")
)
(PRINC)


I'll have to look and see if I can find the textbox portion.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie