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

use selectionset create selection and removal group

  • Thread starter Thread starter tiziano69
  • Start date Start date

tiziano69

Guest
Good morning, I have the following problem, I am developing a program in vba, this track of lines from a common point in direction of every text that satisfies certain conditions. There is no problem here.
Now I have to remove the drawn lines, I must be able to select and delete them, having all a common point I thought to create a selection group, using two diametrally opposite points i.e. a rectangle that intercepts the lines.

acadselectionset

explain how to make the selection.... you have some code examples

Thank you.
 
disegna le linee nel layer tmpline, le puoi selezionare e cancellare:

sub rptestselect()

dim i as integer
dim txt as string
dim acad as object
dim document as acaddocument

dim sset as acadselectionset
dim element as acadline

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

set acad = fngetacadapplication()
if isnull(acad) = false then
acad.visible = true
set document = acad.activedocument

autocadsetfocus document

on error resume next
' delete the selection set if it exists
if not isnull(document.selectionsets.item("element")) then
set sset = document.selectionsets.item("element")
sset.delete
end if
set sset = document.selectionsets.add("element")
'on error goto 0

filtertype(0) = 0
filterdata(0) = "line"
filtertype(1) = 8
filterdata(1) = "tmpline"

sset.select acselectionsetall, , , filtertype, filterdata

sset.erase

end if

set document = nothing
set acad = nothing

end sub
 
ok works, but I had to change two lines:
set acad = acadapplication() - removed fngetif isnull (acad) = false then
acad. visible = true
document set = acad.activedocument

'autocadsetfocus document - added apex to eliminate educationWhy?
 
I forgot, I also removed the brackets - the correct line is set acad = acadapplication
 
Damn customizations, that's why.
I use a function that loads the right libraries depending on the version of autocad in use.

bye
 

Forum statistics

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

Members online

No members online now.
Back
Top