Author Topic: [script] - open/closed polylines selector  (Read 5591 times)

Offline dh42

  • Administrator
  • CNC Jedi
  • *****
  • Posts: 7422
    • View Profile
    • Cambam V1.0 French Doc
[script] - open/closed polylines selector
« on: March 22, 2015, 01:22:36 am »
Hello,

A very small script I did just now for a French user. It allow to select polylines, depending if they are open or closed.

Select the drawing object, then run the script and choice an option. Other objects than polylines/polyrectangles are ignored.

Code: [Select]
' select open or closed polylines
' dh42 03/2015

sub main

'ask for open/closed

dim rep as string
dim p as polyline

rep = inputbox("1 - Select open polylines" & vbnewline & "2 - Select closed polylines",, 1)

if rep <> 1 and rep <> 2 then exit sub

dim newselection as ArrayList = new ArrayList()

if view.SelectedEntities.Length > 0 then


for each ent as Entity in view.SelectedEntities

if typeof ent is Polyline

p = ent

select case rep

case 1 'ouvertes

if p.closed = false then
newselection.add(ent)
end if

case 2 'fermées

if p.closed = true then
newselection.add(ent)
end if

end select

end if

next ent

view.Select(newselection)

view.RefreshView()

end if

end sub

++
David
« Last Edit: March 12, 2025, 17:50:24 pm by dh42 »