Create text in the intersection between two poly lines with different color

Create text in the intersection between two poly lines with different color

malek.elsheikh
Explorer Explorer
1,390 Views
7 Replies
Message 1 of 8

Create text in the intersection between two poly lines with different color

malek.elsheikh
Explorer
Explorer

Hi guys,

Actually i'm having an issue to place text between every pipes encase change of slope / diameter so i manged to put every slope / diameter with different color to differentiate where i should put this text without reading the value but i still placing them manually by tracking the color. so my question is if there is any lisp can understand the difference between  lines / poly lines color and place this text / text with leader between these two lines as shown in the screen shoot. 

 

note : i can also to put every poly line on unique width through the software i use encase of it can't be done by colors. 

0 Likes
Accepted solutions (1)
1,391 Views
7 Replies
Replies (7)
Message 2 of 8

hak_vz
Advisor
Advisor

@malek.elsheikh

Attach sample drawing (part of a drawing) to help us grasp how your drawing is created.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 3 of 8

malek.elsheikh
Explorer
Explorer

@hak_vz  Thank you for your reply. i attached a drawing file as an example. 

0 Likes
Message 4 of 8

hak_vz
Advisor
Advisor
Accepted solution

@malek.elsheikh 

So, to rephrase your request.

You have polylines that represent pipelines, that are drawn from intersection to intersection. At the end of each polyline that equals to start point of next poyline segment we should place marking chs/chd. Marking placed perpendicular to polyline at some distance d.

Since more poylines have mutual end point, task should be to find all endpoints, create unique list to avoid duplication, and place a marking. This should not be a problem. At the end you will have to check result and eventualy rotate marking to best position.

I'll try to write some code later today.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 5 of 8

malek.elsheikh
Explorer
Explorer

@hak_vz  Actually placing a text or even a point / block it's easy to convert it to a text. also i want to clarify that in a 3 pipes situation we have two cases : 

 

Case (1) :  No change in diameter encase of the red color is continuing.

Case(2) : There will be a change in diameter encase of the third pipe color is different than the other two pipes.

please check the attached drawing.

 

note : through the software i use i can put a value of width (start width / end width) for every color if this will help. 

 

Thank you.

0 Likes
Message 6 of 8

hak_vz
Advisor
Advisor

Here is a code to start with, and later we'll add some logic to it.

Code now works as I described in my previous post, You select text to copy at designeted points,, than select pipelines on whole drawing or part of it (window selection), and code copies text to that points. I have to add logic to it as you described above.

 

(defun c:markChangeSlope ( / unique startPoints endPoints  i ss eo p0)
(defun unique (lst)(if lst (cons (car lst) (unique (vl-remove (car lst) (cdr lst))))))
(princ "\nSelect all text entities to copy >")
(setvar 'cmdecho 0)
(setq sstxt (ssget '((0 . "TEXT"))))
(princ "\nSelect all pipelines >")
(setq ss (ssget '((0 . "LWPOLYLINE"))))
(cond 
	((and sstxt ss)
		(setq p0 (cdr (assoc 10 (entget(ssname sstxt 0)))))
				(setq i -1)
				(while (<(setq i (1+ i)) (sslength ss))
					(setq
						eo (vlax-ename->vla-object (ssname ss i))
						startPoints (cons (vlax-curve-getStartPoint eo) startPoints) 
						endPoints (cons (vlax-curve-getEndPoint eo) endPoints)
					)
				)
				(setq startPoints (unique startPoints) endPoints (unique endPoints))
				(foreach pt endPoints (if (member pt startPoints) (command "_.copy" sstxt "" p0 pt "")))
	)
)
(setvar 'cmdecho 0)
(princ "\nDone!")
(princ)
)

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 7 of 8

hak_vz
Advisor
Advisor

@malek.elsheikh 

I've written basic code for the script but have some questions for you.

a) Can you ensure that all you polylines are drawn in right direction i.e. that they are always drawn in a direction from start node to end node and not oposite? If that is not the case I have to include a test to check polyline direction and reverse its vertexes if necesary.
b) How to detect if there is a change in slope (if that is needed) or mark is always created?

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 8 of 8

hak_vz
Advisor
Advisor

We could also implement detection of correct changes to pipes diameters. You probably use standard pipe diameters and there is a relation of between sum of diameters of pipes entering the node to the diameter of exit pipe.

To do so I need to know color schema you use to represent different pipe diameters. 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes