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

detect blocks within a limited area

  • Thread starter Thread starter piratabobo
  • Start date Start date

piratabobo

Guest
hello to all
and for some time I have been missing from forums for work problems but I have returned with a new problem "I hope not difficult for experts" and certainly here there are several.
I have the problem of identifying in a limited area i.e. within a polylinea how many blocks there are, I better explain if I create for example a rectangle-shaped polyline and inside I insert 2 blocks, selecting the polylinea I can know within the same how many blocks there are and possibly being blocks with attributes the characteristics of these blocks?
I hope I have been quite clear in my exposition of the problem and thanking you in advance of your help remain available for any explanations on this.
 
hello to all
and for some time I have been missing from forums for work problems but I have returned with a new problem "I hope not difficult for experts" and certainly here there are several.
I have the problem of identifying in a limited area i.e. within a polylinea how many blocks there are, I better explain if I create for example a rectangle-shaped polyline and inside I insert 2 blocks, selecting the polylinea I can know within the same how many blocks there are and possibly being blocks with attributes the characteristics of these blocks?
I hope I have been quite clear in my exposition of the problem and thanking you in advance of your help remain available for any explanations on this.
what do you mean to know the characteristics? a list of attributes values, or change values according to what you want?

I just need to know what I asked about.
 
what do you mean to know the characteristics? a list of attributes values, or change values according to what you want?
First I have to say that the news that what I ask is feasible I rejoice and then thank you for having responded.

by blocks with attributes I mean to know for each block:
1) how many blocks there are within a polyline
2) the names of individual blocks
3) the coordinates of inserting the individual blocks (x, y and angle)
 
First I have to say that the news that what I ask is feasible I rejoice and then thank you for having responded.

by blocks with attributes I mean to know for each block:
1) how many blocks there are within a polyline
2) the names of individual blocks
3) the coordinates of inserting the individual blocks (x, y and angle)
do you want information on video and save it in a text file?

Try what I sent you

save the annex
by autocad tools->macro-> project loading and selecting the file I sent you

then from macro->macro->selections the macro line and from the executed

select polylinea and appear information for each block found inside.

It's a draft, but it's to see if that's what you need.
 

Attachments

I always told you that you are great, regarding the information, that is not a problem then I will charge them in a matrix, the only thing that we are not there and that if the block inserted inside the polyline has the point of insertion with one of the sides of the polylinea is not read while even if the block is inserted on the edge of the polylinea it is necessary to read equally, in fact I thought that
 
I always told you that you are great, regarding the information, that is not a problem then I will charge them in a matrix, the only thing that we are not there and that if the block inserted inside the polyline has the point of insertion with one of the sides of the polylinea is not read while even if the block is inserted on the edge of the polylinea it is necessary to read equally, in fact I thought that
.....it seems to me to understand that you are a little satisfied.... .

then, the selection was purposely set that only the entirely contained objects were analyzed, as for the autocad crossing and window function to understand us, you said that the blocks were within a rectangle, and already I stopped to let you read any polyline of any form now I change the type of selection.. and then I pass the ball.. .

and voilà, les jeux sont faits
public sub analizza_blocchi_pl()

dim filtertype(0) as integer
dim filterdata(0) as variant

dim sset as acadselectionset
dim element as acadentity
dim coord as variant
dim sset1 as acadselectionset
dim element1 as acadblockreference
dim punti3d as variant

dim pigreco as double
pigreco = 4 * atn(1)


on error resume next
if not isnull(thisdrawing.selectionsets.item("element")) then
set sset = thisdrawing.selectionsets.item("element")
sset.delete
end if

set sset = thisdrawing.selectionsets.add("element")

sset.selectonscreen

coord = sset.item(0).coordinates

x = ((ubound(coord) - 1) / 2) + ubound(coord)

redim punti3d(0 to x + 1) as double

for i = 0 to ubound(coord) step 2
punti3d(u) = coord(i)
punti3d(u + 1) = coord(i + 1)
u = u + 2
punti3d(u) = 0
u = u + 1
next i


if not isnull(thisdrawing.selectionsets.item("element1")) then
set sset1 = thisdrawing.selectionsets.item("element1")
sset1.delete
end if

set sset1 = thisdrawing.selectionsets.add("element1")

filtertype(0) = 0
filterdata(0) = "insert"

sset1.selectbypolygon acselectionsetcrossingpolygon, punti3d, filtertype, filterdata

msgbox ("elementi selezionati:" & sset1.count)

z = 1

thisdrawing.regen acallviewports

for each element1 in sset1
element1.highlight true
msgbox ("oggetto" & z & ":" & element1.name & vblf & "punto inserimento" & vblf & "x: " & element1.insertionpoint(0) & vblf & "y: " & element1.insertionpoint(1) & vblf & "rotazione: " & (element1.rotation) / pigreco * 180)
z = z + 1
element1.highlight false
next

end sub
two notes, as you will see there is an array that I then had to resize, this because the two-dimensional objects return it with vector 2d (0)x (1)y 2(x) 3(y) etc while the window/crossing selection wants an array 3d (0)x (1)y 3(z) etc.

for rotation the lazy serves only to transform radiants into degrees. . .

you will forgive any form vices, I threw it down of barrel and I did not care much about the form but to verify the feasibility, otherwise if it was perfect I had to send you the invoice then neeee!
 
and just what I needed, as I said at the beginning in this forum there are really good people, you es tres magnifiques
hello and again thanks
 

Forum statistics

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

Members online

No members online now.
Back
Top