Jump to content

Move any overlapped text and create a new line.


Sheep
 Share

Recommended Posts

Hi all. I hope everybody is safe during this Covid-19 pandemic.

I need some help. How do i move the text (BEFORE picture) and create a new line? The distance between the text is fix or as long as user can read it. How do i create the lines? I'm new to Autolisp, so please avoid giving example in Visual Lisp (vlx). Thanks.

0.PNG

Edited by Sheep
Link to comment
Share on other sites

1st its in built in to most Civil software.

 

The main issue and have looked at this for 40 years is its not just the 3 shown but rather when they hit the 5th 6th etc and have to move them also as the gap is not big enough. 

 

The best way is to do 1 at a time check spacing on distance then write text at correct X put in stagger and keep going rather than fix 3 to close. It about old fashioned flow charting work out a diagram of steps.

 

So take text ht and work out a X gap if not to close last draw vert line if to close draw a stagger line.

 

Note like in image stagger for design and existing taken into account.

 

image.png.edffaba97bc3b3fc8c2f51328bd94614.png

 

 

Link to comment
Share on other sites

On 6/5/2020 at 10:36 AM, Sheep said:

Hi all. I hope everybody is safe during this Covid-19 pandemic.

I need some help. How do i move the text (BEFORE picture) and create a new line? The distance between the text is fix or as long as user can read it. How do i create the lines? I'm new to Autolisp, so please avoid giving example in Visual Lisp (vlx). Thanks.

 

 

 

move text with equal spacing, perhap this -> subfoo ?

 

MOCjluj.gif

 

for line, prefer redraw as LWPOLYLINE or DIMORDINATE (note: if -ve value, you need to override measurement)

modify existing is tricky if just 'LINE'. for lwpolyline is easier if has typical number of vertices then can entmod ->  example 

 

p/s: post a sample DWG

 

 

 

 

 

 

 

Edited by hanhphuc
add GIF
  • Like 1
Link to comment
Share on other sites

Hanphuc its not just the text its the line work as well have a closer look at the image I posted you can see all the crank lines this is coded into the software to do as you draw long and cross sections etc. It has to be part of the draw objects from the start.

 

A dwg is not needed sheep is asking for after the fact it will just not work as I said earlier what happens when I overlap even more text.

 

I have seen dwg's where I stuffed up scale and it has cranked like 50 lines. Its common in Civil road works it is not new. Just needs to be thought about a bit more.

 

He needs code for check if hits last if so offset crank but draw last vertical correct, this would be part of the sequence of draw Chainage-text &  RL the vertical line work.

 

It may exist already it would be under Draw long section & Draw cross section needs a Google. Both of those do exist now. 

Edited by BIGAL
Link to comment
Share on other sites

I can relate to the whole idea about the text but making the line a liltle bit out of my hand. If i use COND, how do i calculate the top line (exact point) to joint with the lines beside the text. Again @BIGAL, made i good jump start for me. Thanks.

Link to comment
Share on other sites

On 6/7/2020 at 7:22 AM, BIGAL said:

Hanphuc its not just the text its the line work as well have a closer look at the image I posted you can see all the crank lines this is coded into the software to do as you draw long and cross sections etc. It has to be part of the draw objects from the start.

 

A dwg is not needed sheep is asking for after the fact it will just not work as I said earlier what happens when I overlap even more text.

 

I have seen dwg's where I stuffed up scale and it has cranked like 50 lines. Its common in Civil road works it is not new. Just needs to be thought about a bit more.

 

He needs code for check if hits last if so offset crank but draw last vertical correct, this would be part of the sequence of draw Chainage-text &  RL the vertical line work.

 

It may exist already it would be under Draw long section & Draw cross section needs a Google. Both of those do exist now. 

 

👌 agree, good point!

notice that upper & lower text should be aligned.

the reason asking sample OP drawing because dunno the entities are just normal AcLine? AcPolyline? AcText? crank vertices lines no problem entmake or entmod if vertices exist though it look straight. dimordinate has cranked line too, not sure if 3rd party software proxy entity?

 

many things to be considered the upper & lower text seperated or concatenated?

Text insertion point dxf 10 or 11 if justified 72 73? or Mtext?

separated layer? text size? crank line gap offset, even we can write the code but does it fit OP's template different vertical scale?  

 

according to your theory, i strcat upper & lower text

i use the same function, re-draw LWpolyline :)

 

 QEVBEWZ.gif

 

 

 

 

 

Edited by hanhphuc
comments
Link to comment
Share on other sites

17 minutes ago, hanhphuc said:

 

👌 agree. the reason sample OP drawing because dunno the entities are just normal AcLine? AcText? crank lines no problem entmake LWPolyline or dimordinate or not sure 3rd party software  proxy entity? 

many things to be considered the upper & lower text seperated or concatenated? vertical scale ? textsize ? crank line gap offset, even we can write the code but does it fit OP's template?

 

according to your theory, but i strcat upper & lower text

 

i use the same function, re-draw LWpolyline :)

 

Thank you for your reply. Below is my template. The text are seperated. The lines are not polyline except for the dashed line. As you can see the line in the box are seperated from the above line ( if this in any help).

0.PNG

Link to comment
Share on other sites

10 hours ago, Sheep said:

Thank you for your reply. Below is my template. The text are seperated. The lines are not polyline except for the dashed line. As you can see the line in the box are seperated from the above line ( if this in any help).

 

 

The tricky part is 2 layers & texts seperated. need 2 functions

post an ACAD dwg <v2019 others may help too (as already provided link for the distancing function)

:)

 

;;sub-foo renamed as
(defun ++rarify (l n / i ls) 
  ;incremental rarify - hp 14.06.2018
  (cons    (setq i (car l))
    (progn (repeat (1- (length l))
         (setq ls (cons    (setq i    (if (> (cadr l) (+ n i))
                      (cadr l)
                      (+ n i)
                      )
                      )
                ls
                )
               )
         (setq l (cdr l))
         )
           (reverse ls)
           )
    )
  )



(defun c:TTL ( / *error* ss p ls Y )

(setq *distance* (* 1.25 (getvar 'textsize))); default 

(defun *error* (msg) (vl-cmdf "_UNDO" "_END")(princ msg))
(vl-cmdf "_UNDO" "_BEGIN")

(initget 6)
(setq *distance* (cond ((getreal (strcat "\nLines X-distancing <"(rtos *distance* 2 2)"> : ")))(*distance*)))
(princ "\nSelect vertical LINES ")
(and
(setq ss (ssget '((0 . "LINE"))))
(setq p (getpoint "\nPick crank point "))
(setq p  (trans p 1 0)
      Y  (cadr p)
      ls (mapcar '(lambda (en)(cons (cdr(assoc 10 (entget en))) en)) (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))
(mapcar	'(lambda (en X / n l lst )
	   (setq en (cdr en)
	    	l  (vl-sort
	            (mapcar '(lambda (x) (cdr (assoc x (entget en)))) '(10 11))
	            '(lambda (a b) (> (cadr a) (cadr b)))
	            )
              n (cadadr l) 
	        lst (list (car l) (list (caar l) Y ) (list X (- Y (* (- Y n ) 0.1)) ) (list X n)))
	   (entdel en)
	   (entmakex
	    (vl-list*
	     '(0 . "LWPOLYLINE")
	     '(100 . "AcDbEntity")
	     '(100 . "AcDbPolyline")
	     '(70 . 0)
	     (cons 90 (length lst))
	     (mapcar '(lambda (x) (cons 10 x)) lst)
	     )
	    )
	   )
	(setq l2 (vl-sort ls '(lambda (a b) (< (caar a) (caar b)))))
	(++rarify (mapcar 'caar l2) *distance* )
	)
  )
(vl-cmdf "_UNDO" "_END")
  (princ)
)

  

 

K5STJF5.gif

 

 

Edited by hanhphuc
add GIF & code
  • Thanks 1
Link to comment
Share on other sites

  • 2 years later...
On 6/6/2020 at 9:31 AM, hanhphuc said:

 

 

move text with equal spacing, perhap this -> subfoo ?

 

MOCjluj.gif

 

for line, prefer redraw as LWPOLYLINE or DIMORDINATE (note: if -ve value, you need to override measurement)

modify existing is tricky if just 'LINE'. for lwpolyline is easier if has typical number of vertices then can entmod ->  example 

 

p/s: post a sample DWG

 

 

 

please share full code of lsp

 

 

 

 

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

 Share

×
×
  • Create New...