Jump to content

Recommended Posts

Posted

Hi

I have many files that have elevation codes like this :

ncyk59zpnfnarpxcho3r.jpg

 

 

… and I want convert that to autocad format like this one:

uw8zbfh8dpoxr1him67j.jpg

 

 

I want a lisp or VBA routine that do this changes for me . What must I do ?

Please help me .

Thanks and have a good times …

  • Replies 25
  • Created
  • Last Reply

Top Posters In This Topic

  • cadman2009

    10

  • alanjt

    9

  • fixo

    3

  • Nima1376

    2

Top Posters In This Topic

Posted Images

Posted

Why so complicated? use find command.

First select text entities you want to change "." by ",".

Then type "find"

In "find text string" type "."

In "Replace with" type ","

Click on replace all

voilâ!

Posted
Why so complicated? use find command.

First select text entities you want to change "." by ",".

Then type "find"

In "find text string" type "."

In "Replace with" type ","

Click on replace all

voilâ!

 

I must change more than 1000 text!

Posted
I must change more than 1000 text!

And Find will do that. You can even use QSelect first to help.

Posted

Dear friend's

I dont work with a single numeric string but I work with two numeric strings that separated by a autocad dot point so I want divide right number by 100 and then add it by left number so that point symbol remain and result number changed to a float number and display above point symbol.

I test "Find command" and it do'nt solve my problem

Posted
Dear friend's

I dont work with a single numeric string but I work with two numeric strings that separated by a autocad dot point so I want divide right number by 100 and then add it by left number so that point symbol remain and result number changed to a float number and display above point symbol.

I test "Find command" and it do'nt solve my problem

 

Ohhhhh, you should have specified that from the beginning.

This is highly possible. What do you have so far in code? Post an example drawing and we can start working something out.

Posted

Here is my sample file (sample.dwg) . please check it and give me a good hint.

thanks ...

sample.dwg

Posted

This is not something easily done, there's a lot of text stacked on top of each other. I'm curious, who exploded everything?

 

I'm very confused about one thing, when the new text is created (combining the 2 pieces of text), what's the insertion point? Am I to assume the dot (block) is the actual point where the shot was taken?

 

If another office is sending these to you, call them immediately and inform them, exploding everything is NOT conducive to anything anyone is doing.

Posted
Here is my sample file (sample.dwg) . please check it and give me a good hint.

thanks ...

 

Sorry for my stupidy

Say you have a block reference "DOT-1" and

2 text at left "1809" and at right "65"

And you want to remove both text and change

them on text "1809.65" and move this text above

block reference

It's right?

 

~'J'~

Posted
Sorry for my stupidy

Say you have a block reference "DOT-1" and

2 text at left "1809" and at right "65"

And you want to remove both text and change

them on text "1809.65" and move this text above

block reference

It's right?

 

~'J'~

 

 

yes it is . we can save curent position and save new one in a diferent layer or delete old position and replace new one .

Posted
This is not something easily done, there's a lot of text stacked on top of each other. I'm curious, who exploded everything?

 

I'm very confused about one thing, when the new text is created (combining the 2 pieces of text), what's the insertion point? Am I to assume the dot (block) is the actual point where the shot was taken?

 

If another office is sending these to you, call them immediately and inform them, exploding everything is NOT conducive to anything anyone is doing.

 

I think that start point of new text can be one of the old text or be paralel with old one or be dot point ofcurse .

Posted
yes it is . we can save curent position and save new one in a diferent layer or delete old position and replace new one .

 

This is just for your interest

As you'll see its very difficult to solve

I don't know how to do it exactly :(

 

 

;;=======================================================;;
(defun _getnearest (ss pt / en)
    (while (setq en (ssname ss 0))
      (setq elist (entget en)
     ip (cdr (assoc 10 elist))
     box (textbox elist)
     up (mapcar '+ ip (cadr box))
     )
      (setq tmp (cons up en)
     data (cons tmp data)
     tmp nil)
      (ssdel en ss)
      )
   (vl-sort data (function (lambda (a b)
		      (< (distance (car a) pt)
			 (distance (car b) pt)))))
   (cdar data)
   )

;;=======================================================;;
(defun dxf (key en)
 (cdr (assoc key (entget en)))
      )
;;=======================================================;;

(defun C:ELV (/ atleft atright bref cnt ip lefttext lp righttext rp ss txt)
(command "_zoom" "e")
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "DOT-1"))))
 (setq blocks (sslength ss)
cnt 0
)
(while (setq bref (ssname ss 0))
      (setq ip (cdr (assoc 10 (entget bref)))
     lp (list (- (car ip) 7)(cadr ip))
     rp (list (+ (car ip) 3)(cadr ip))
     )
(if (and
     (setq atleft (ssget "F"
	  (list ip lp)
(list
'(0 . "TEXT")			
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1"))))
(setq atright (ssget "F"
	  (list ip rp)
(list
'(0 . "TEXT")			
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1")))))
(progn
(if (= 1 (sslength atleft))
 (setq lefttext (ssname atleft 0))
     (setq lefttext (_getnearest atleft ip))
 )

(if (= 1 (sslength atright))
   (setq righttext (ssname atright 0))
   (setq righttext (_getnearest atright ip))
   )
(if (and lefttext righttext)
  (progn
  (setq cnt (1+ cnt))
  (setq txt (strcat (dxf 1 lefttext)"."(dxf 1 righttext)))
  (princ "\n")( princ txt)
  ;; do what you need with texts here
   )
)
 )
 )
 (ssdel bref ss)
 )
 (alert (strcat  "Blocks found: " (itoa blocks) "\nTexts found: " (itoa cnt) ))
 (princ)
 )

 

~'J'~

Posted
This is just for your interest

As you'll see its very difficult to solve

I don't know how to do it exactly :(

 

 

;;=======================================================;;
(defun _getnearest (ss pt / en)
    (while (setq en (ssname ss 0))
      (setq elist (entget en)
        ip (cdr (assoc 10 elist))
        box (textbox elist)
        up (mapcar '+ ip (cadr box))
        )
      (setq tmp (cons up en)
        data (cons tmp data)
        tmp nil)
      (ssdel en ss)
      )
   (vl-sort data (function (lambda (a b)
                 (< (distance (car a) pt)
                (distance (car b) pt)))))
   (cdar data)
   )

;;=======================================================;;
(defun dxf (key en)
 (cdr (assoc key (entget en)))
      )
;;=======================================================;;

(defun C:ELV (/ atleft atright bref cnt ip lefttext lp righttext rp ss txt)
(command "_zoom" "e")
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "DOT-1"))))
 (setq blocks (sslength ss)
   cnt 0
   )
(while (setq bref (ssname ss 0))
      (setq ip (cdr (assoc 10 (entget bref)))
        lp (list (- (car ip) 7)(cadr ip))
        rp (list (+ (car ip) 3)(cadr ip))
        )
(if (and
     (setq atleft (ssget "F"
         (list ip lp)
(list
'(0 . "TEXT")            
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1"))))
(setq atright (ssget "F"
         (list ip rp)
(list
'(0 . "TEXT")            
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1")))))
(progn
(if (= 1 (sslength atleft))
 (setq lefttext (ssname atleft 0))
     (setq lefttext (_getnearest atleft ip))
 )

(if (= 1 (sslength atright))
   (setq righttext (ssname atright 0))
   (setq righttext (_getnearest atright ip))
   )
(if (and lefttext righttext)
  (progn
  (setq cnt (1+ cnt))
  (setq txt (strcat (dxf 1 lefttext)"."(dxf 1 righttext)))
  (princ "\n")( princ txt)
  ;; do what you need with texts here
   )
)
 )
 )
 (ssdel bref ss)
 )
 (alert (strcat  "Blocks found: " (itoa blocks) "\nTexts found: " (itoa cnt) ))
 (princ)
 )

~'J'~

 

thanks dear fixo I use this codes and later write to you , if there any problems

Posted
thanks dear fixo I use this codes and later write to you , if there any problems

 

No thanks,

This routine works badly

Check again edited version

As you'll see if the two blocks is very near

in this case left and right texts replaces wrong:

 

;;=======================================================;;
(defun _getnearest (ss pt / en)
    (while (setq en (ssname ss 0))
      (setq elist (entget en)
     ip (cdr (assoc 10 elist))
     box (textbox elist)
     up (mapcar '+ ip (cadr box))
     )
      (setq tmp (cons up en)
     data (cons tmp data)
     tmp nil)
      (ssdel en ss)
      )
   (vl-sort data (function (lambda (a b)
		      (< (distance (car a) pt)
			 (distance (car b) pt)))))
   (cdar data)
   )

;;=======================================================;;
(defun dxf (key en)
 (cdr (assoc key (entget en)))
      )
;;=======================================================;;

(defun C:ELV (/ atleft atright bref cnt ip lefttext lp righttext rp ss txt)
(command "_zoom" "e")
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "DOT-1"))))
 (setq blocks (sslength ss)
cnt 0
)
(while (setq bref (ssname ss 0))
      (setq ip (cdr (assoc 10 (entget bref)))
     lp (list (- (car ip) (cadr ip))
     rp (list (+ (car ip) 4)(cadr ip))
     )
(if (and
     (setq atleft (ssget "F"
	  (list ip lp)
(list
'(0 . "TEXT")			
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1"))))
(setq atright (ssget "F"
	  (list ip rp)
(list
'(0 . "TEXT")			
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1")))))
(progn
(if (= 1 (sslength atleft))
 (setq lefttext (ssname atleft 0))
     (setq lefttext (_getnearest atleft ip))
 )

(if (= 1 (sslength atright))
   (setq righttext (ssname atright 0))
   (setq righttext (_getnearest atright ip))
   )
(if (and lefttext righttext)
  (progn
  (setq cnt (1+ cnt))
  (setq txt (strcat (dxf 1 lefttext)"."(dxf 1 righttext)))
  (princ "\n")( princ txt)
  (setq apt (list (car ip)(+ (cadr ip) 2.) 0.0))
  (entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(67 . 0)
'(410 . "Model")
'(8 . "BM")
'(62 . 256)
'(100 . "AcDbText")
(cons 10 apt)
(cons 11 (list (car apt)(+ (cadr apt) 0.75)  0.0))
(cons 40  1.5)
(cons 1  txt)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "PLOTTER_1")
'(71 . 0)
'(72 . 1)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 2)))
;; change the rest to suit
   )
)
 )
 )
 (ssdel bref ss)
 )
 (alert (strcat  "Blocks found: " (itoa blocks) "\nTexts recreated: " (itoa cnt) ))
 (princ)
 )

 

I haven' have another ideas how to detect nearest texts right :(

 

~'J'~

Posted

Here's mine. It's ugly (right now), so I don't feel like posting it Open Source.

 

ElevationCombine.gif

 

As you can see from the video, I've made it so you are forced to select the correct object for the initial 3 selections. :)

 

The final MText object is placed at the insertion point of the Dot block on a new layer.

Posted
Here's mine. It's ugly (right now), so I don't feel like posting it Open Source.

 

[ATTACH]15546[/ATTACH]

 

As you can see from the video, I've made it so you are forced to select the correct object for the initial 3 selections. :)

 

The final MText object is placed at the insertion point of the Dot block on a new layer.

dear sir

Hi

I use your FAS file , come left 4digit to right 2digit side same as your slow motion show but don't come final yellow results on screen ! WHY..?

Posted
dear sir

Hi

I use your FAS file , come left 4digit to right 2digit side same as your slow motion show but don't come final yellow results on screen ! WHY..?

 

Download it again, I made an update this morning (forgot a subroutine).

Posted
No thanks,

This routine works badly

Check again edited version

As you'll see if the two blocks is very near

in this case left and right texts replaces wrong:

 

;;=======================================================;;
(defun _getnearest (ss pt / en)
    (while (setq en (ssname ss 0))
      (setq elist (entget en)
        ip (cdr (assoc 10 elist))
        box (textbox elist)
        up (mapcar '+ ip (cadr box))
        )
      (setq tmp (cons up en)
        data (cons tmp data)
        tmp nil)
      (ssdel en ss)
      )
   (vl-sort data (function (lambda (a b)
                 (< (distance (car a) pt)
                (distance (car b) pt)))))
   (cdar data)
   )

;;=======================================================;;
(defun dxf (key en)
 (cdr (assoc key (entget en)))
      )
;;=======================================================;;

(defun C:ELV (/ atleft atright bref cnt ip lefttext lp righttext rp ss txt)
(command "_zoom" "e")
(setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "DOT-1"))))
 (setq blocks (sslength ss)
   cnt 0
   )
(while (setq bref (ssname ss 0))
      (setq ip (cdr (assoc 10 (entget bref)))
        lp (list (- (car ip) (cadr ip))
        rp (list (+ (car ip) 4)(cadr ip))
        )
(if (and
     (setq atleft (ssget "F"
         (list ip lp)
(list
'(0 . "TEXT")            
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1"))))
(setq atright (ssget "F"
         (list ip rp)
(list
'(0 . "TEXT")            
'(8 . "HI")
'(62 . 14)
'(40 . 1.5)
'(41 . 1.0)
'(7 . "PLOTTER_1")))))
(progn
(if (= 1 (sslength atleft))
 (setq lefttext (ssname atleft 0))
     (setq lefttext (_getnearest atleft ip))
 )

(if (= 1 (sslength atright))
   (setq righttext (ssname atright 0))
   (setq righttext (_getnearest atright ip))
   )
(if (and lefttext righttext)
  (progn
  (setq cnt (1+ cnt))
  (setq txt (strcat (dxf 1 lefttext)"."(dxf 1 righttext)))
  (princ "\n")( princ txt)
  (setq apt (list (car ip)(+ (cadr ip) 2.) 0.0))
  (entmake
(list
'(0 . "TEXT")
'(100 . "AcDbEntity")
'(67 . 0)
'(410 . "Model")
'(8 . "BM")
'(62 . 256)
'(100 . "AcDbText")
(cons 10 apt)
(cons 11 (list (car apt)(+ (cadr apt) 0.75)  0.0))
(cons 40  1.5)
(cons 1  txt)
'(50 . 0.0)
'(41 . 1.0)
'(51 . 0.0)
'(7 . "PLOTTER_1")
'(71 . 0)
'(72 . 1)
(cons 210 (list 0.0 0.0 1.0))
'(73 . 2)))
;; change the rest to suit
   )
)
 )
 )
 (ssdel bref ss)
 )
 (alert (strcat  "Blocks found: " (itoa blocks) "\nTexts recreated: " (itoa cnt) ))
 (princ)
 )

I haven' have another ideas how to detect nearest texts right :(

 

~'J'~

 

Hi fixo

I think that you must make a selection set window around each point so that its width is equal to : ((Text.Heigt)+epsilon) and two strings lie in this window and window's base lie on dot point .

Posted
Download it again, I made an update this morning (forgot a subroutine).

 

 

ِDear alanjt

Special thanks to you for helping me through this project.Thanks for everything , You are brilliant ....

have a good time

Posted
ِDear alanjt

Special thanks to you for helping me through this project.Thanks for everything , You are brilliant ....

have a good time

:)

I take that a signal that it worked. I'll expect my check in the mail. :wink:

 

Stick around, there's plenty of people here much much smarter than I.

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