PDA

View Full Version : LISP routine to place text items with a '+'


bmonk
2006-07-12, 07:32 PM
Hello all,
I work at a coal mine, where the projected mine plan changes constantly. On these maps I have to label the crosscuts on the plan with the distances. The distances are survey stations, which look like this:

00+65
01+30
01+95
02+60
03+25
etc. etc.

I would like a routine to place these text items in the dwg with the "+" sign in there. Here is a list of questions to ask the user to get the result I need (I think)

1. Pick starting point.
2. Select direction of Belt (this is industry jargon)
3. Type center distance.
4. Type first distance to start from. (e.g. 02+60, or 25+95, or 00+00)

okay, I think thats it, I also attached a dwg to give a better idea of what I'm looking for.

Thanks

BrenBren
2006-07-12, 07:43 PM
I'm sure it can be done, but you might be better off asking for help writing the program, rather than expect someone to write it for you ~shrug~

Give a man a fish, feed him for a day..
Teach a man to fish, feed him for ever

rkmcswain
2006-07-12, 08:23 PM
Just curious, what mine are you at, and are you not using Carlson Software to assist with mine planning..?

...as described about 2/3 the way down this page: http://www.carlsonsw.com/PL_SurvCADD_Minning.html

http://www.carlsonsw.com/images/miningimages/Underground_screenshot_03.jpg

andy.manninen
2006-07-12, 08:49 PM
Just curious, what mine are you at, and are you not using Carlson Software to assist with mine planning..?

...as described about 2/3 the way down this page: http://www.carlsonsw.com/PL_SurvCADD_Minning.html

http://www.carlsonsw.com/images/miningimages/Underground_screenshot_03.jpg
Wow, that software looks pretty cool! not that i need that being in Civil Engineering topside, but cool nonetheless!

:Cheers:

bmonk
2006-07-12, 09:04 PM
[QUOTE=BrenBren]I'm sure it can be done, but you might be better off asking for help writing the program, rather than expect someone to write it for you ~shrug~

I meant the **waves ten dollar bill around** as a joke, and basically implied that I'm not even close to the level of lisp writing it would take to pull this off. Didnt mean to offend anyone or to make it look like I was saying "Do this for me now." Just thought someone might
A) actually be in the mining industry and have something like this, or
B) have the skills to be just like "pff, easy, 'tap' 'tap' 'tap' done"
/shrug

And yes, I am using Carlson, but Carlson doesnt have a routine to "just put stations in." It's routine requires you to also put in the pillars and centerlines, which if our mine plan was perfect (without angles, and odd shaped rooms) then this would be ok. And I use Carlson when I have to put in REAL long panels, but then I have to go back and erase the belt and pillars and perimeter that it automatically draws.

bmonk
2006-07-12, 09:11 PM
Wow, that software looks pretty cool! not that i need that being in Civil Engineering topside, but cool nonetheless!

:Cheers:

Andy, yeah it is pretty cool, it has a lot of cool routines and menus. I use it alot for calculating cavity volumes, stockpile volumes, contouring, drillhole data, strata info. Its real handy.

BrenBren
2006-07-12, 09:14 PM
[QUOTE=BrenBren]I'm sure it can be done, but you might be better off asking for help writing the program, rather than expect someone to write it for you ~shrug~

I meant the **waves ten dollar bill around** as a joke, and basically implied that I'm not even close to the level of lisp writing it would take to pull this off. Didnt mean to offend anyone or to make it look like I was saying "Do this for me now." Just thought someone might
A) actually be in the mining industry and have something like this, or
B) have the skills to be just like "pff, easy, 'tap' 'tap' 'tap' done"
/shrug

And yes, I am using Carlson, but Carlson doesnt have a routine to "just put stations in." It's routine requires you to also put in the pillars and centerlines, which if our mine plan was perfect (without angles, and odd shaped rooms) then this would be ok. And I use Carlson when I have to put in REAL long panels, but then I have to go back and erase the belt and pillars and perimeter that it automatically draws.
I understand - what a chance to hone your skills, though ;)

bmonk
2006-07-12, 09:33 PM
I understand - what a chance to hone your skills, though ;)

You would make a great offensive lineman...j/k. I definitely need to sharpen my skills, no doubt...

**locks door, paints windows black, yanks phone cord out of wall, and tries to learn AutoLISP by tomorrow morning**

Wanderer
2006-07-12, 09:41 PM
I'm going to move this question from the AutoCAD General forum to this one, as I believe it will be better served here. Thank you. :) Hello all,
I work at a coal mine, where the projected mine plan changes constantly. On these maps I have to label the crosscuts on the plan with the distances. The distances are survey stations, which look like this:

00+65
01+30
01+95
02+60
03+25
etc. etc.

I would like a routine to place these text items in the dwg with the "+" sign in there. Here is a list of questions to ask the user to get the result I need (I think)

1. Pick starting point.
2. Select direction of Belt (this is industry jargon)
3. Type center distance.
4. Type first distance to start from. (e.g. 02+60, or 25+95, or 00+00)

okay, I think thats it, I also attached a dwg to give a better idea of what I'm looking for.

Thanks

T.Willey
2006-07-12, 09:57 PM
See if this link (http://forums.augi.com/showthread.php?t=32338&highlight=polyline) will help you.

rkmcswain
2006-07-12, 10:16 PM
Try this as a starting point....


(defun c:labelme (/ *OBJ* A B C D DIR DIS LEN NUM OBJTEXT PT STR WH)
(defun format2sta (n / b a x)
(setq x (rtos n 2 0))
(if (eq x "0")
(setq f "0+00")
(progn
(setq b (substr x (1+ (- (strlen x) 2)) 2))
(setq a (substr x 1 (- (strlen x) 2)))
(if (eq a "")
(setq a "0")
)
(setq f (strcat a "+" b))
)
)
f
)
(vl-load-com)
(setq *obj* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(setq a (getpoint "\n Select start point: "))
(setq b (getpoint a "\n Select end point: "))
(setq dir (angle a b) len (distance a b))
(setq c (getdist "\n Center distance: "))
(setq d (getreal "\n Starting station: "))
(setq num (/ len c) dis c wh d)
(repeat (fix num)
(setq pt (vlax-3d-point (polar a dir dis)))
(setq str (format2sta wh))
(setq objText (vla-addtext *obj* str pt 15.0))
(vla-put-rotation objtext (- dir (* 0.5 pi)))
(setq dis (+ dis c) wh (+ wh c))
)
)

bmonk
2006-07-13, 03:28 PM
Try this as a starting point....


(defun c:labelme (/ *OBJ* A B C D DIR DIS LEN NUM OBJTEXT PT STR WH)
(defun format2sta (n / b a x)
(setq x (rtos n 2 0))
(if (eq x "0")
(setq f "0+00")
(progn
(setq b (substr x (1+ (- (strlen x) 2)) 2))
(setq a (substr x 1 (- (strlen x) 2)))
(if (eq a "")
(setq a "0")
)
(setq f (strcat a "+" b))
)
)
f
)
(vl-load-com)
(setq *obj* (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object))))
(setq a (getpoint "\n Select start point: "))
(setq b (getpoint a "\n Select end point: "))
(setq dir (angle a b) len (distance a b))
(setq c (getdist "\n Center distance: "))
(setq d (getreal "\n Starting station: "))
(setq num (/ len c) dis c wh d)
(repeat (fix num)
(setq pt (vlax-3d-point (polar a dir dis)))
(setq str (format2sta wh))
(setq objText (vla-addtext *obj* str pt 15.0))
(vla-put-rotation objtext (- dir (* 0.5 pi)))
(setq dis (+ dis c) wh (+ wh c))
)
)



Love it, all I need now is to get it to put it on the right layer and text style...but dont help me, Im gonna try and figure that out myself.

Thanks a ton rk

peter
2006-07-14, 02:51 PM
Here you go, another solution.


(defun C:Belt (/ entLine intCenter intStart lstPoint lstPoint2 objLine)
(princ "\nSelect start point of belt: ")
(command "line" "end" pause)
(setq lstPoint1 (getvar "lastpoint"))
(princ "\nSelect second point along belt: ")
(command pause)
(command "")
(setq lstPoint2 (getvar "lastpoint")
intStart (getint "\nType Start Station: ")
intCenter (getint "\nType Center Distance: ")
entLine (entlast)
objLine (vlax-ename->vla-object entLine)
)
(while (< intStart (vlax-curve-getdistatparam objLine (vlax-curve-getendparam objLine)))
(setq objText (vla-addtext
(vla-get-block
(vla-get-activelayout
(vla-get-activedocument
(vlax-get-acad-object))))
(station intStart)
(vlax-3d-point lstPoint1)
15.0
)
)
(vla-put-rotation objText (+ (vla-get-angle objLine)(/ pi 2.0)))
(vl-justifytext objText 4)
(vla-put-rotation objText (+ (vla-get-rotation objText) pi))
(vla-move objText (vlax-3d-point (list 0.0 0.0) )
(vlax-3d-point (polar (list 0.0 0.0) (vla-get-angle objLine) 7.5)))
(setq intStart (+ intStart intCenter)
lstPoint1 (vlax-curve-getpointatdist objLine intStart)
)
)
(entdel entLine)
)
(defun Station (intStart)
(setq strStart(itoa intStart))
(while (< (strlen strStart) 2)(setq strStart (strcat "0" strStart)))
(strcat (substr strStart 1 (- (strlen strStart) 2))
"+"
(substr strStart (- (strlen strStart) 1))
)
)

tyeelaw13
2006-07-14, 06:00 PM
I would think you would want to make the + out of lines in a block with the insertion point in the intersection of the two lines with attribute text on both sides of it. That way when you insert it, it would prompt you for the start point and distance from the start point.

See if this works- you will probably need to change the textstyle, and then make it a block