Author Topic: (program) Line labeler  (Read 13389 times)

0 Members and 1 Guest are viewing this topic.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« on: June 10, 2004, 01:17:51 PM »
Sort of a beta version, I'm adding other functions related to labeling lines to it.
Code: [Select]

;;; FUNCTION
;;; labels lines with bearing and distance in dtext, and gives you a chance
;;; to edit the text at the end
;;; uses current text style and layer
;;;
;;; ARGUMENTS
;;;
;;; USAGE
;;;
;;; PLATFORMS
;;; 2000+
;;;
;;; AUTHOR
;;; Copyright© 2004 Mark S. Thomas
;;; mark.thomas@theswamp.org
;;;
;;; VERSION
;;; 1.0 Thu Jun 10, 2004 12:59:40

; Degree to Radian conversion
(defun MST-dtr (x)
  (/ (* x pi) 180.0)
  )

; Radian to Degree conversion
(defun MST-rtd (x)
  (/ (* x 180.0) pi)
  )
;
;   ,-----------------------------------------------,
;   |                   MID POINT                   |
;   '-----------------------------------------------'
;
(defun midpt (p1 p2)
    (mapcar
      '(lambda (x y) (/ (+ x y) 2.0)) p1 p2
      )
    )
;
;   ,-----------------------------------------------,
;   |                VARIANT TO LIST                |
;   '-----------------------------------------------'
;
(defun var2lst (var)
  (if (= (type var) 'VARIANT)
    (vlax-safearray->list
      (vlax-variant-value var)
      )
    )
  )
;
;   ,-----------------------------------------------,
;   |               MST-entsel-name                 |
;   '-----------------------------------------------'
;
;;; example: (setq CirObj (MST-entsel-name "\nSelect A Circle..." "AcDbCircle"))
;;; traps any errors in the function
(defun MST-entsel-name (msg objname / ent obj)
  (setq ent (vl-catch-all-apply 'entsel (list msg)))
  (if (and ent (not (vl-catch-all-error-p ent)))
    (progn
      (setq obj (vlax-ename->vla-object (car ent)))
      (if (/= (vla-get-ObjectName obj) objname)
        (setq obj nil)
        )
      )
    ); if
  obj
  ); defun
;
;   ,-----------------------------------------------,
;   |                 MST-release                   |
;   '-----------------------------------------------'
;
(defun MST-release (obj /)
  (if
    (= (type obj) 'VLA-OBJECT)
    (if (not (vlax-object-released-p obj))
      (vlax-release-object obj)
      )
    )
  )
(defun MST-get-txt-style ()
  (vla-get-ActiveTextStyle
    (vla-get-activedocument
      (vlax-get-acad-object)
      )
    )
  )

(defun MST-get-mspace ()
  (vla-get-modelspace
    (vla-get-activedocument
      (vlax-get-acad-object)
      )
    )
  )
;
;   ,-----------------------------------------------,
;   |                MAIN FUNCTION                  |
;   '-----------------------------------------------'
;
(defun LineLabel (/ th *error* ent lineObj lenD
                    ang bear mp txtrot p1 p2 len)

  ; error function
  (defun *error* (msg)
    (if
      (not
        (member msg '("console break" "Function cancelled" "quit / exit abort")))
      (princ (strcat "\nError: " msg))
      ); if
    (princ)
    );end error function

  (setq th (vla-get-height (MST-get-txt-style)))

  (if
    (<= th 0.0)
    (setq th (getvar' textsize))
    )

  (if
    (not
      (setq lineobj (MST-entsel-name "\nSelect line to be measured..." "AcDbLine"))
      )
    (exit)
    )

  (setq lenD (strcat (rtos (vla-get-length lineobj) 2 2)))
  (setq ang (vla-get-angle lineObj))

  ; determine text rotation
  (cond
    ((and
       (>= ang (* 0.5 pi)) ;between N-0°W
       (< ang (* 0.538889 pi))) ;& N-20°W
     (setq txtrot (- ang pi))
     )
    ((and
       (> ang (* 0.538889 pi)) ;between N-20°W
       (<= ang (* 1.5 pi))) ;& S-0°W
     (setq txtrot (+ ang pi))
     )
    ((and
       (>= ang (* 1.5 pi)) ;between S-0°E
       (< ang (* 1.538889 pi))) ;between S-20°E
     (setq txtrot (- ang pi))
     )
    (T
      (setq txtrot ang)
      )
    ); cond

  (setq bear (vl-string-subst (chr 176) "d" (angtos ang 4 4)))

  ; midpoint of line
  (setq mp (vlax-3d-point
             (midpt
               (var2lst (vla-get-startpoint lineObj))
               (var2lst (vla-get-endpoint lineObj))
               )
             )
        )

  ; offset points
  ; (setq p1
  ;       (vlax-3d-point
  ;         (polar (var2lst mp) (MST-dtr (+ (MST-rtd ang) 90)) (* th 2))
  ;         )
  ;       p2
  ;       (vlax-3d-point
  ;         (polar (var2lst mp) (MST-dtr (- (MST-rtd ang) 90)) (* th 2))
  ;         )
  ;       )

  ; text label bearing
  (if mp
    (setq txtobj
          (vla-addtext
            (MST-get-mspace)
            (strcat bear "  " lenD)
            mp
            th
            )
          )
    )

  (if txtobj
    (progn
      (vlax-put-property txtobj 'Alignment acAlignmentBottomCenter)
      (vlax-put-property txtobj 'TextAlignmentPoint mp)
      (vlax-put-property txtobj 'Rotation txtrot)
      )
    )

  (MST-release txtobj)

  (setq kwd
        (strcase
          (getstring "\nEdit bearing? (Y/N) <No>: ")
          )
        )
  (if kwd
    (if (= kwd "Y")
      (command "_.ddedit" (entlast)"")
      )
    )

  (princ)
  )

(princ "\nUse 'LA' to label LINES")
(defun c:la () (LineLabel))
(princ)

TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #1 on: June 10, 2004, 02:22:14 PM »
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
(program) Line labeler
« Reply #2 on: June 10, 2004, 02:37:34 PM »
Hey Mark -

I just tried it out, but I noticed a few things. :)

1. If you have an orthographic line, the bearing is always coming out like:
E 290 or N 290, etc.. It does not give a N 00d00'00" E 290.00. This is on with LA and LBP, however somethimes LBP will give the ortho bearding. Get what I am saying?

2. I noticed that the program doesn't add a prefix to the length...is it possible to have the program check for your DIMPOST variable, and then add that to the end of the length?

3. I also think that a multiple entity selection would be a great add-on, that way the program does not need to be run for each and every line you have :).

Hope this helps you some.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #3 on: June 10, 2004, 02:59:43 PM »
thanks for the feedback rug.
TheSwamp.org  (serving the CAD community since 2003)

Dent Cermak

  • Guest
(program) Line labeler
« Reply #4 on: June 10, 2004, 03:01:33 PM »
I HATE it when people label NORTH as N00d00'00"E!! The CARDINAL directions should ALWAYS be labeled NORTH, EAST, SOUTH, or WEST. Kindly check the National Map Accuracy Standards and most State Survey Minimum Standards. That putting the degrees , minutes and seconds things on the cardinal directions is a "lawyer" thing that just shows their ignorance. Don't copy them. Makes you look bad. The GPS bunch do it too, but they are computer geeks and not surveyors or cartographers. Last PM we had that INSISTED that was right is no longer with us.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #5 on: June 10, 2004, 03:41:02 PM »
We use N00°00'00"E also but, the signing surveyor is _always_ right. And I aim to please. :D
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
(program) Line labeler
« Reply #6 on: June 10, 2004, 04:00:37 PM »
Hey, I am not trying to step on your toes there. I only brought that up because of te fact that my client/entity in NY, and most clients/entities here in Vegas will not accept any plans that call lines out as being NORTH, rather than N00d00'00"E (or W, etc.) due to the fact that Clark County Nevada takes a paper copy of every final map/ALTA, etc. and rebuilds it, and then places it within the GIS files. That is here and there, but not every where. Nor am I trying to point at you surveyors and say that us engineers are more right or anything. Just we tend to look at things sometimes as have a million sides, while in reality, there is only one way. Anyways, I figured I would just try to help though. And for the record...Engineers don't know anything, it is always the Designer who does.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
(program) Line labeler
« Reply #7 on: June 10, 2004, 04:38:31 PM »
An Engineer is a resource for a good Designer.
I drink beer and I know things....

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #8 on: June 14, 2004, 08:08:50 AM »
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #9 on: June 15, 2004, 11:38:05 AM »
Updated:
added the dimpost variable to the end of the length.
thanks rug.

http://www.theswamp.org/swamp.files/Public/label_line.lsp
TheSwamp.org  (serving the CAD community since 2003)

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
(program) Line labeler
« Reply #10 on: June 15, 2004, 11:58:38 PM »
Dent if'n it ain't N00d00'00"E what IS the freakin' bearing? I suppose it could be just plain "Due North" .... please let me know so I don't break this rule..
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

Dent Cermak

  • Guest
(program) Line labeler
« Reply #11 on: June 16, 2004, 08:28:08 AM »
It is known as a "CARDINAL" direction. The CARDINAL directions are: NORTH, SOUTH, EAST and WEST. You've NEVER seen a map or compass with N00d00'00"E on it, have you. This is the brain child of the new GPS gurus who know NOTHING about cartography. Same IDIOTS that drew up the current Corps of Engineers drafting standards that have been in revision for 8 years now because they are so full of errors. Many state surveying minimum standards do not allow N00d00'00"E label, but call for the cardinal direction. Before all of you clowns tell me that I am full of shit, you better check your state regs. In your case I would call your attention to Chapter 16, Florida Administrative Code, Chapter 61G17-6, Minimumtechnical standards, Page 159, Page 160- 61G17-6.0031, paragraph (1)(d).  :shock:  :twisted:

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
(program) Line labeler
« Reply #12 on: June 16, 2004, 08:58:21 AM »
I know I'm gonna hate myself fer this.

Dent, this time I realy have to agree with you.
I drink beer and I know things....

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #13 on: June 16, 2004, 10:02:41 AM »
Quote from: Dent Cermak
Chapter 16, Florida Administrative Code, Chapter 61G17-6, Minimumtechnical standards, Page 159, Page 160- 61G17-6.0031, paragraph (1)(d).


which states:
Quote

61G17-6.0031 Boundary Survey, Map, and Report.
(1) BOUNDARIES OF REAL PROPERTY.
(d) All changes in direction, including curves, shall be shown on the survey map by angles, bearings or azimuths, and will be in the same form as the description or other recorded document referenced on the map.
TheSwamp.org  (serving the CAD community since 2003)

Dent Cermak

  • Guest
(program) Line labeler
« Reply #14 on: June 16, 2004, 10:44:40 AM »
And you won't find a lawyer that will use anything other than the cardinal notations, thus maintaining the original deed bearings precludes the use of N00d00'00"E for the cardinal ordinate NORTH.

PLUS, one of the bibles for cartographers and surveyors is FM 21-26, Dept. of the Army Manual, "Map Reading" which states in chapter 5, Paragraph 5 (4) "The four cardinal cardinal directions are expressed simply as North, South, East and West."

This is a reflection of the differances that you will find between Cartographers  and EIT's. Generally, this discussion deos not occur between cartographers, surveyors and lawyers. We tend to be on the same sheet of music.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
(program) Line labeler
« Reply #15 on: June 16, 2004, 12:25:51 PM »
Well I tried looking through NAC, but couldn't find much that helped me on this. Maybe you maybe able to spot it a bit easier there Dent. I don't want to sit here and tell someone they are wrong, when I truly am.

http://www.leg.state.nv.us/NAC/NAC-625.html
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Dent Cermak

  • Guest
(program) Line labeler
« Reply #16 on: June 16, 2004, 01:41:56 PM »
Appears they dance around it by saying other regulations apply as necessay without outlining them. No real guidance is provided for plat preparation. The labeling of bearings is a "back to basics' issue that they do not address. I have quoted 3 sources and haven't gotten into National Map Accuracy Standards. My approach is from a surveying/mapping viewpoint. This viewpoint is aligned with the requirements used by land title attorneys and ALTA members. The best sources are the publications put out by ALTA, ACSM and NSPS.
Today it's a matter of "do what you can get away with." Standards no longer exist. except in my office. Do it the way you want to, but if you ever come to work for me, you better know the "right" way or you won't last long.
Show me just one text book, reference manual (NOT to include GIS or Cad software, because they have been corrupted by the ill informed) or national specification or standard that uses the N00d00'00"E notation. One text or lesson plan from an accredited institution. I DO NOT want, "My PM or Engineer says that's right." I want a certified source. I do not want, "That's the way we do it here." Any document from USGS, Corps of Engineers, Rand McNally even. ANY survey trext book. NOMENCLATURE DOCUMENTATION. I have given multiple PRINTED references and sources from national mapping and survey institutions. I will not be challenged with anything of lesser stature. (see engineer slinking off muttering, 'well, he's just wrong. I know he is.")
I just don't believe that I have been wrong for 40 years. All those editors that I have slipped by!! All those state boards of registration. All those ALTA/ACSM surveys. JEEZ!! I've been lucky, huh ?!
(Another source that backs me up. The BLM Manual on Land Surveying. That's the document that 95 percent of all of the states based their minimum standards upon.)

{Now do ya'll want me to take off on "major' and "minor" contours or the practice of making the "major" contours every fourth line when you are doing metric contours? THERE'S NO SUCH THING AS MAJOR AND MINOR CONTOURS AND IF YOU DON'T KNOW THE PROPER NOMENCLATURE, YOU NEED TO GO INTO ANOTHER FIELD. OOOOOOH!! I love soap boxes!!}

Dinosaur

  • Guest
(program) Line labeler
« Reply #17 on: October 30, 2004, 12:09:10 AM »
Nice routine, Mark.  Too bad Dent scared everyone off talking about ALTA surveys - VILE things, those - the only thing worse is a HUD survey.  I had a whole collection of similar routines for r10 that provided a good share of the functions of the old DCA software.  Now that I see how you made this work for the newer versions perhaps I can rewrite some of my favorites that have not been provided with LDD 2k5.

All you guys talking about cardinal directions - When do you ever get a chance to use them?  In this area all plats and certified surveys are required to be rotated to a state plain bearing system and only the happiest of accidents return a true cardinal direction.  Most of our section lines are 3 - 10 degrees off grid after the conversion.  It makes thing real fun when abutting an older plat that wasn't rotated.

Dent Cermak

  • Guest
(program) Line labeler
« Reply #18 on: October 30, 2004, 12:23:58 AM »
I LOVE ALTA/ACSM surveys. they are really much easier to do, but because everyone thinks they are bears, you can charge more for them. No more long hours digging through musty deed books! It all comes in a Handy-Dandy report and that is all that you have to certify to. If the title company misses something, they are liable, not me. COOL!! My crew runs our normal survey, I have a little more typing to do than normal - and as ypiypu can c i's an ecxelllllant tiopist. Then I charge a bigger fee, SWEET!!
Now, I have done a ton of HUD surveys and they are nasty beasties. But then what do you expect from a government agency?

Dinosaur

  • Guest
(program) Line labeler
« Reply #19 on: October 30, 2004, 01:01:07 AM »
We have had a lucky streak of properties that we had previously surveyed.  The surveyors drive by and note anything that has changed We just make any revisions, modify the certification and nail them for a full fee.  Talk about CAKE!  The first time through, though is a headache.  Invariably the title company will list all of the exceptions they want shown but none of the actual docments we need to draw them.  By the time they give us the full package, they are already wanting the thing finished to close the sale.  THEN the lawyers get hold of it and want a completely different certification verbage.
My first HUD survey covered about 8 city blocks in downtown Denver.  It was also the only thing I ever drew in r11 and my first venture into viewports.  Every clothesline pole, sand box, swingset and play gym was located.  There were even a few shots with no descriptors that I think could have been dog piles since they had shot everything else.

Dent Cermak

  • Guest
(program) Line labeler
« Reply #20 on: October 30, 2004, 12:07:04 PM »
Many people request an ALTA/ACSM Land Title Survey when there is absolutely no need for it. What we have done, is when the client calls for an ALTA we remind them that the specs REQUIRE them to send us a FULL Title Insurance Committment report. We require this document BEFORE we start the survey.
You should NEVER accept a partial Title Insurance Committment Report. We have lucked out and have trained  our local clients without them knowing it. We have refused Bock & Clark Surveys because , even the guys that "wrote the book" tried to send us a partial report. Some people have sent us a title abstract and then tried to tell us that was all we needed. We sent them a copy of the ALTA/ACSM manual with all of the good parts high lighted and told them that until they did their part, we couldn't do our part. Over time it worked.
I have had people demand ALTA/ACSM surveys for leased property.I try to explain that someone is making a bad decision, but I'm glad to take the EXTRA money.After discussing their actual survey needs with them, many realize that a high quality survey meeting State Standards is more than adequate for their needs. Many times you will find that the only reason that an ALTA/ACSM survey is requested is that, somewhere along the line, some"New Kid" fresh out of college  has heard the term "ALTA Survey" and he really believes that they are required for any and all projects. I will reccommend an ALTA to anyone doing high dollar development, but I can't see wasting money doing one for a lease, or the average home sale. IF they insist that I take all of that money, well, I won't argue TOO hard.
OH, if you want a set of survey specs that's a real "winner", do a survey for a Family Dollar Store. Evidently EVERYONE in the office got to put an item in the spec list, including the janitor. They require that all property lines have a bearing and distance and an interior angle shown on the drawing. You must show the zoning and setbacks for your property AND ALL property within 200 feet in all directions from the subject property. When we pointed out that this would requie surveying the adjacent properties in order to show all of the setbacks, they said "Fine, and don't forget we want all the buildings and structures on those parcels too". Then they couldn't understand why that should cost extra. :shock:

Dinosaur

  • Guest
(program) Line labeler
« Reply #21 on: October 30, 2004, 10:00:14 PM »
Many of our ALTA requests come from friends of our owner.  They are used to him getting them a quick start with a promise the title company will fax us the report asap.  We do the start, but invariably have to wait for the second fax to get a full and accurate, up to date report.  We complain to him every time, but that is the way he wants to run his business.  He must be doing something right.  We are a tiny 10 man shop that has enough work backlogged to keep at least one more technician and a third survey crew busy.  If a client gets too demanding, he just "fires" them and will accecpt no more further orders from them.  It helps that he has the reputation as being the best in the area for complicated construction staking.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
(program) Line labeler
« Reply #22 on: November 02, 2004, 12:31:31 PM »
TheSwamp.org  (serving the CAD community since 2003)