lisp prog required

lisp prog required

Anonymous
Not applicable
1,055 Views
4 Replies
Message 1 of 5

lisp prog required

Anonymous
Not applicable

Hi guys,

I have an issue. I need to create a boundary as i have shown in the dwg. I require it for a layout. I have shown a model of it in the attached dwg. I am not able to use the boundary command as the lines are not closed. and if i close it manually it creates a seperate boundary for the box which ever is not in line with the outer line. shown in green.the yellow is my requirement. Pls suggest coding for this.

0 Likes
1,056 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant

Welcome to these Forums!

I don't want to sound discouraging, but that seems like an almost impossibly complicated thing to get a routine to do.  I suspect that, in the time it would take someone to come up with the code to do it automatically, you could do very many such outlines manually.  Even if you are able to write the code yourself, it would not be a time-saver overall unless you do a lot of these.

 

One of the main difficulties is that such a routine would be required to compare virtually every point on every object with every other other object in the selection [or perhaps in the entire drawing?].  If those white rectangles might ever be made up of Lines rather than as single Polylines, it gets even more complex -- for example, how is it to decide which Lines it can ignore, and which are relevant to the result?  Other complications:  Might the outlying pieces ever not be closed?  Would there ever be curves involved?

 

Getting it to recognize the correct conditions requiring closure would be very difficult.  Here's a slightly altered approximation of your image [I moved the gap along the bottom over in relation to what's above it, assuming that kind of relationship is possible].  It's hard to imagine how to get it to not "find" the magenta/pink elements as closure opportunities, instead of the closures in your image.  Also, I suspect the red ones at the top left would be hugely simpler [though not "simple"] for it to recognize and calculate than the vertical ones in your image.

 

Closure.png

 

I suggest you Search for threads [in the "Community," not just "this Board;" there was one somewhere pretty recently] involving "Boundary," that talk about drawing a Circle or closed Polyline or something around the entire thing, and using Hatch as a start, because [in new-enough versions] it can find and identify certain kinds of gaps.  It won't do the whole thing for you, but it may give you a quicker start than manually closing all the gaps, etc.

Kent Cooper, AIA
Message 3 of 5

Anonymous
Not applicable

HI Kent. Thx for your time and effort for suggesting a solution.I have actually presented only a model for easy understanding. I require to do it for a whole plant. and the commodities available in it is vast. So i do a single plant for almost 2 months. I have tried using the boundary lisp codes, but the issue is the white box(control panels are outside the main lines shown in green. So i cant use the boundary option. and as u said the lines need to be closed for the boundary command, which wont be closed obviously in a layout. SO i am not able to proceed with the boundary command.Presently i am doing it manually. 

 

I got few ideas, but i am not sure how to make the coding for that.

1) Extract only the outer points from the layout after exploding the whole layout as it will contain blocks.After extracting the outer points alone,i can join it using polyline codes. but the issue in this is the script should know which code to be joined 1st and from where. and extraction of the outer points alone is not possible as far as i know.

 

2) this idea is the weirdest idea that crossed my mind. Using snap tools (midpoints and endpoints) instead of clicking with mouse, just move the mouse over the end points of the object and the script recognize the endpoints/midpoints and automatically draw line, instead of we clicking it on the points. This will reduce the time for drawing.But how to develop a script for this is also a big question mark.

 

 

 

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant

Perhaps approach shown on following screencast and with little routine will help.

 

See screencast!

 

(vl-load-com)

(defun c:ExtendEndsToPolyline ( / ss pl i p1 p2)

  (if (and (setq ss (ssget '((0 . "LWPOLYLINE"))))
	   (setq pl (car (entsel "\nSelect polyline")))
	   )
    (repeat (setq i (sslength ss))
      (setq en (ssname ss (setq i (1- i)))
	    p1 (trans (vlax-curve-getStartPoint en) 0 1)
	    p2 (trans (vlax-curve-getEndPoint en) 0 1)
	    )
      (command "_.EXTEND" pl ""
	       (list en p1) (list en p2) "")))
  (princ)
)
0 Likes
Message 5 of 5

Anonymous
Not applicable

good day mate,

Thanks for your suggestion, but my requirement is not simple. The method which you have provided is what i am doing it at present manually. The number of control panels is more and i am talking about a whole plant layout.So practically i cant trim and extend all the control panels with the bigger area.

If you see my requirement in my post you might understand in better.

 

My idea is to extract all the points from the layout (Lisp required) and then join only the outer points at its extreme. (lisp required)

0 Likes