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

check block selection

  • Thread starter Thread starter Principiante87
  • Start date Start date

Principiante87

Guest
Good morning to all,
I am carrying out a specialist thesis for which vba programming is required with autocad 2011. My current problem is to start a macro, verify that there is a selected block, extract its name and perform other operations that I have already implemented. I have a lot of difficulty on the first part.. Can any of you help me? Thank you to anyone who wants to answer, and apologize for the question, I know that for many of you it will be trivial, but I can't solve this problem.. .
 
ciao, per la selezione puoi usare:

sub seleziona_blocco()

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

filtertype(0) = 0
filterdata(0) = "insert"
'filtertype(1) = 2
'filterdata(1) = inserire il nome del blocco

if not isnull(thisdrawing.selectionsets.item("miaselezione")) then
thisdrawing.selectionsets.item("miaselezione").delete
end if

set ssetmia = thisdrawing.selectionsets.add("miaselezione")
ssetmia.selectonscreen filtertype, filterdata

if ssetmia.count > 0 then
msgbox "hai selezionato " & ssetmia.count & " blocchi.", vbinformation
else
msgbox "non hai selezionato nessun blocco.", vbexclamation
end if

set ssetmia = nothing

end sub

richiami vba con alt+ [F11]Enter the code
run the macro
(as in office)

if you already have the block name to select remove comments at

'filtertype(1) = 2
'filterdata(1) = Enter the block name

Enter the block name you want to select and put:

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

in the definitions of variables.

where there are msgboxes put the codes of what you want to do.
to you the management of errors and embellishments. . .

bye.
 

Forum statistics

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

Members online

No members online now.
Back
Top