Jump to content

Regarding decimal places


pmadhwal7

Recommended Posts

Hi @pmadhwal7, please explain from where this mtext comes from .

It seem to be some like a surveyor dwg. 

And made  from a LISP or other api used .

The only way I see to do it,  is EDIT by LISP   all    MTEXT and change as need to be with a LISP routine . 

Please upload a new DWG with a few more mtext 

I will try to fix it by a LISP.

 

Other fact,

Quote

 

This should be your first post like: 

 

How can I change all this MTEXT from 8 decimal to 6 decimal ?

Please find dwg attached

 

 

 

 

  • Like 1
Link to comment
Share on other sites

8 hours ago, pmadhwal7 said:

Kindly check my attached

With a Northing of 17.835993 and an Easting of 79.79603567 my guess is those values are Latitude and Longitude and would be better displayed in DMS format.

Where did this text come from?

  • Like 1
Link to comment
Share on other sites

; Convert Decimal Degrees to dms.
(defun DMS (x / deg mins sec)
(setq deg (rtos (fix x) 2 0)  ;- degrees
      mins (rtos (abs (fix (* (- x (fix X1)) 60))) 2 0)         ; - minutes
      sec (rtos (abs (* (- (* x 60) (fix (* x1 60))) 60)) 2 2)  ;- seconds
  )
  (strcat deg"° " mins"m "  sec"s")
)

 

(DMS 17.835993)

"17° 50m 9.57s"

(DMS 79.79603567)

"79° 47m 45.73s"

Edited by mhupp
updated ° mark
Link to comment
Share on other sites

1 hour ago, mhupp said:


; Convert Decimal Degrees to dms.
(defun DMS (x / deg mins sec)
(setq deg (rtos (fix x) 2 0)  ;- degrees
      mins (rtos (abs (fix (* (- x (fix X1)) 60))) 2 0)         ; - minutes
      sec (rtos (abs (* (- (* x 60) (fix (* x1 60))) 60)) 2 2)  ;- seconds
  )
  (strcat deg"° " mins"m "  sec"s")
)

 

(DMS 17.835993)

"17° 50m 9.57s"

(DMS 79.79603567)

"79° 47m 45.73s"

Hi @mhupp, as far as I understood   @pmadhwal7  post  , the need is to show 6 decimal , not D mm ss

 

 

image.png.e4979470316c897d26e544e4c724d28d.png

 

 

 

 

 

 

Edited by devitg
add OP name
Link to comment
Share on other sites

Hi @pmadhwal7. please give it a test

 

;; Design by Gabo CALOS DE VIT from CORDOBA ARGENTINA
;;;    Copyleft 1995-2021 by Gabriel Calos De Vit ; DEVITG@GMAIL.COM    
;;

 ; Hecho por  Gabo CALOS DE VIT de CORDOBA ARGENTINA
;;;    Copyleft 1995-2021 por Gabriel Calos De Vit 
;; DEVITG@GMAIL.COM 
 ;
;;;Whith the following help



;******************************************************************************************
;;;(str-divset "Text mit\nZeilenumbruch" " \n")
;;;;;-*******************************************************************************************************************************
;;;;;-*******************************************************************************************************************************
;;Copyright © http://autolisp.mapcar.net/strtok.html
(DEFUN STR-DIV  (STR C / I L) ;_01
  (SETQ I 1)
  (SETQ L (STRLEN STR))
  (WHILE (AND (<= I L) (/= (SUBSTR STR I 1) C))
    (SETQ I (1+ I))
    )
  (LIST (SUBSTR STR 1 (1- I)) (SUBSTR STR (1+ I)))
  )
;;;
;;;(str-div "Schraube;M12;1,5;36;367.4;252.6;0.0" ";")
;;;("Schraube" "M12;1,5;36;367.4;252.6;0.0")
;;;(str-div "1,234,567.89" ",")

;;;("M12" "1,5;36;367.4;252.6;0.0") 
;;;;;-*******************************************************************************************************************************

;;separa por un separador 

(DEFUN STR-TOK  (STR C / TMP) ;_01
  (IF (/= STR "")
    (PROGN
      (SETQ TMP (STR-DIV STR C))
      (APPEND (LIST (CAR TMP)) (STR-TOK (CADR TMP) C))
      )
    )
  )
;;;"M12,1.5,36,367.4,252.6,0.0" )
;;;(str-tok "Schraube;M12;1,5;36;367.4;252.6;0.0" ";")
;;;
;;;("Schraube" "M12" "1,5" "36" "367.4" "252.6" "0.0") 
;;;
;;;;;-*******************************************************************************************************************************



;******************************************************************************************

(DEFUN 8-TO-6-DECIMAL  (/
                        6-DEC-EAST
                        6-DEC-NORTH
                        ADOC
                        EAST
                        EAST#$
                        MTEXT-$
                        MTEXT-OBJ-SS
                        N#$
                        NEW-6-DEC-STRING
                        NORTH
                        SPLIT-METXT
                        SS
                        )
  (VL-LOAD-COM)
  (SETQ SS (SSGET "_X" '((0 . "MTEXT") (1 . "N*E*"))))
  (SETQ MTEXT-OBJ-SS (VLA-GET-ACTIVESELECTIONSET ADOC))
  (VLAX-FOR MTEXT-OBJ  MTEXT-OBJ-SS
    (SETQ MTEXT-$ (VLA-GET-TEXTSTRING MTEXT-OBJ))

    (SETQ SPLIT-METXT (STR-TOK MTEXT-$ " "))
    (SETQ NORTH (CAR SPLIT-METXT))
    (SETQ N#$ (CADR (STR-TOK NORTH "N")))
    (SETQ 6-DEC-NORTH (RTOS (ATOF N#$) 2 6))
   
    (SETQ EAST (CADR SPLIT-METXT))
    (SETQ EAST#$ (CADR (STR-TOK EAST "E")))
    (SETQ 6-DEC-EAST (RTOS (ATOF EAST#$) 2 6))
    (SETQ NEW-6-DEC-STRING (STRCAT "N" 6-DEC-NORTH " \\PE" 6-DEC-EAST))
    (VLA-PUT-TEXTSTRING MTEXT-OBJ NEW-6-DEC-STRING)
    );end VLAX-FOR

  (PRINC)
  );end defun 8-TO-6-DECIMAL

(DEFUN C:8-6  ()
  (8-TO-6-DECIMAL)
  (PRINC)
  )

 

  Type 8-6 at command line 

 

 

 

8-to-6-decimal.LSP

Link to comment
Share on other sites

6 hours ago, mhupp said:

 

I understand was just posting what Tombu was saying

Most state plane coordinate systems in the US have values in hundreds of thousands, even when assuming coordinates for a project they're generally started in the thousands.

Even for those using Meters a Northing of 17.835993 and an Easting of 79.79603567 sounds rather odd.

 

Mostly I was hoping pmadhwal7 would clarify with a response.

Link to comment
Share on other sites

Might be that the coordinate system is specified by the client and I have a few who wouldn't be too happy if I told them that they are wrong. A few have their own base points for coordinates for their own reasons. So assuming that the OP is correct in what he is asking....

 

 

 

Link to comment
Share on other sites

1 hour ago, Steven P said:

Might be that the coordinate system is specified by the client and I have a few who wouldn't be too happy if I told them that they are wrong. A few have their own base points for coordinates for their own reasons. So assuming that the OP is correct in what he is asking....

Like I said "Mostly I was hoping pmadhwal7 would clarify with a response." Hard to tell the purpose of a drawing or what pmadhwal7 actually needs looking a one piece of text.

Don't you find it odd that the insertion point of that text coordinate values are N=1,960,481.20 & E=359,680.03?

When the insertion point isn't the coordinate value there's usually a leader pointing to that location. Tharwat wrote a nice lisp for this: https://www.cadtutor.net/forum/topic/68126-require-lisp-3-in-1-for-xyz-coordinates-with-leader/?tab=comments#comment-552696

While it may be different in other countries in the 46 years I've done survey work X over Y or Eastings over Northings is the only way I've seen coordinates labeled.

Link to comment
Share on other sites

No text location is not odd at all. As an example, In my last set of layout drawings one one side I had a table of setting out points with their coordinates remote from the actual location, might be something similar, and the text was just copied from there with no link to the actual location.

 

It might be that the OP has received the drawing like this, (we all get odd drawings) and they have to make sense of it, adjusting things to suit norms, I don't know. So no, I didn't question whether the mtext is correct or not, but there is a reason for the question.

 

Anyway, quick and cheerful and with minimal testing and checking (it is Sunday and dinner time too). Quick happy for comments and improvements of course

 

(defun c:8-6DP ( / myent mytext 6dp eastings northings 6dptext)

;; Select Text
  (setq myent (entget (car (entsel "Select Text: "))))
  (setq mytext (cdr (assoc 1 myent)))

;;Length of First line coordinate
  (setq 6dp (+ (vl-string-position (ascii ".") mytext) 7) )
;;First line coordinate
  (setq eastings (substr mytext 1 6dp))

;;Second line of text
  (setq mytext (substr mytext ( + (vl-string-search "\\P" mytext) 3)))
  (setq 6dp (+ (vl-string-position (ascii ".") mytext) 7) )

;;Second line coordinate
  (setq northings (substr mytext 1 6dp))

;;Text joined together
  (setq 6dptext (strcat eastings "\\P" northings))

;;put back into mtext
  (setq myent (subst (cons 1 6dptext) (assoc 1 myent) myent))
  (entmod myent)
  (entupd myent)

)

 

Link to comment
Share on other sites

Just to add to the general mayhem caused by second guessing the OP's intentions, the distance between the geographical coordinates (latitude and longitude) and the text insertion point is about 11 miles (assuming the coordinates were UTM zone 44Q). However it might be Indian Zone IIIA.

 

Who knows?

  • Like 1
Link to comment
Share on other sites

4 minutes ago, eldon said:

Just to add to the general mayhem caused by second guessing the OP's intentions, the distance between the geographical coordinates (latitude and longitude) and the text insertion point is about 11 miles (assuming the coordinates were UTM zone 44Q). However it might be Indian Zone IIIA.

 

Who knows?

 

Makes sense now, they are keeping the coordinates safe in the design office.....

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