• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

find with a selection the inner polylines to other

  • Thread starter Thread starter x11start
  • Start date Start date

x11start

Guest
I have created a lisp that I use habitually to print in succession various tables (formed a4 and a3), arranged in the model space.
basically the command asks to select the tables that I intend to print and as print coordinates use the panes (lwpolyline) that it finds on "zz_format" layers.

(setq selpol(ssget; select entities' (with filter)
(list)
(cons.<and") "and="" "lwpolyline")="" "zz_formato"="" "zz_formato")="" (cons="" -4="" ...="" 0="" 8="" ;="" entita'="" lascia="" le="" passare="" piano="" polilinea="" poste="" solo="" sul="">"
)
)

the problem arises when by mistake, there are two overlapping squares, or one is within another: e.g. the frame of the format that is also located on the "zz_formato" layer, instead of on another layer that the lisp would ignore.
In these cases my design is mistakenly printed 2 times, one taking the correct format and the other taking the frame slightly smaller.

I would therefore like to find a way to find the error, which allows me to stop my lisp and report the wrong pane... with a nice circle!

the workflow I thought of using is as follows:

- I run one by one all selected polylines and found on the "zz_formato" layer.
I create a list containing the tops of every polyline found.
- I create a second list containing the baricentro (point of intersection of the first with the 3rd summit and the 2nd with the 4th).
- I see one by one the baricentres found and I verify if these are inside, not only the list of points considered
but also another list. If so, it means that that point is internal, not only of the figure of which it is centered,
but also of another: So it's a mistake.

I don't know if this is the correct flow or if there are faster solutions: I would like to avoid writing pages and code pages, for
then discover that with 4 vl-xx commands you could do everything!</and")>
 
but the a4 and a3 formats are always on the same scale?

you could exclude polylinea that have adifferent area dai valori:
21x29.7xscala for the a4
29.7x42xscala by a3.
 
regarding the overlapping polylines... A beautiful "_-overkill" sul selection set selpol
 
in company we can not use the layouts (the boss does not know how to use them... so you do not use it!), consequently we put all drawings of the boards on model space.
These are formats to be printed in a3 or a4, but which have different dimensions depending on the element to be represented: a 30 m long whim or a
1 m panel, will be printed with different scales (on a3 or a4), depending on how size we size the format.
Obviously we will put some details, to make visible what on a whim printed on a small sheet, would be invisible.
the details (not being able to use the layouts!), we get them by making blocks and climbing them.
drawings are never scaled just for the above reason.

the perfectly overlapped polylines would be eliminated with an overkill, but more often there are 2 formats: one to print the sheet in vertical a3 containing e.g. armor and carpentry of a buffer panel, and 1 in a4 that allows to print only the carpentry.
This last format we put it in another layer... but it can happen that it goes wrongly to finish in the same layer of the a3... therefore we do not want to eliminate with overkill in the part that overlaps to the a3.

my luck is that we always treat polylines without arches and with 4 points (the format a3 to a4), so it is not difficult to find the centerpiece through a crossroads and the inters command.
So as I have previously written, I will pass one by one of the various polylines, I will extract the center of gravity and verify if this center of gravity is also within another polyline. . .

If I can do this, I'm trying to put some code down.

thank you anyway dieva: you are always kind to answer!
 
it took some time, but I found a way to solve the problem I raised in this post: now I share it with you.

we have panels (a polyline on a "zz_formato" layer), which represent as many tables on model space, which we intend to print (by means of a lisp) on many sheets a3: as I said in my company "it's forbidden" the use of layouts!

sometimes it could happen that 2 overlapping panels were drawn or that a polyline was mistakenly moved to the "zz_formato" layer: the result was that the lisp that allowed me multiple printing, printed me 2 times the same sheet or part of it.

I initially thought of a lisp that would allow me to understand whether a point was internal or external to a polyline. by turning this lisp for each point of each selected format, I would have understood if one of these points was mistakenly finished within another polyline.
it worked, but it became too long: selecting 10 formats I should have checked
(9+8+7+6+5+4+3+2)*4 = 176 points!

then I got an idea: I take the first polylinea, I extract the points (4 vertices of the format) and I make a new selection with "crossing polyline" ... and of course the filters that make me pass only the polylinea entity and the layer on which it lies.
In this way I get selnew: if selnew has 1 only element is ok, if found 2 (or more) means that it has been "captured" also an incorrect polylinea.... and puts a circle to highlight the error.

in the attached gif image I put an example:
I have made 6 boxes representing as many formats to check.
by launching the "verifsovrap" command, I'm asked to select them.
"verifsovrap" also launches a file "makelayer.lsp" of leemac, which allows you to easily create a layer: I use it to create the layer in which to put the circles that highlight the error.

- squares 1 - 2 - 4 are correct,
- the 3 has another polyline on the same layer that is partially overlapped to the format
- in 5 the extra polyline, is totally inside the box
- in 6 there are 2 formats perfectly overlapped, but it is still a mistake and is also reported
with a circle.

this lisp can also be launched by another lisp: launching (xxx:formsovrap setdiselection) where selection is the selection set you intend to pass.

substantially the lisp "lender" will have to contain:

(if (null xx:formsovrap)
(setq errsov (xx:formsovrap sel)); check overlapping panes (sel is the selection set to be checked)
(if errsov (vl-exit-with-error (alert "there are overlapping panes\n(see circle zone)\ncorreggi and relaunch")))

If errsov is different from nil, it means he found errors: He sends out a message.

I hope it was helpful.
 

Attachments

Last edited by a moderator:

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top